Home > database >  Tried to change the background color and text color in Flutter toast. But its not working properly
Tried to change the background color and text color in Flutter toast. But its not working properly

Time:11-18

While trying to change the background color and text color of toast message in flutter, the changes are not reflecting.

Help me with the solution.

      Fluttertoast.showToast(
              msg: text,
              toastLength: Toast.LENGTH_SHORT,
              gravity: ToastGravity.CENTER,
              timeInSecForIosWeb: 1,
              backgroundColor: Colors.red,
              textColor: Colors.white,
              fontSize: 16.0
          );

enter image description here

CodePudding user response:

Fluttertoast.showToast(
    msg: "This is Center Short Toast",
    toastLength: Toast.LENGTH_SHORT,
    gravity: ToastGravity.CENTER,
    timeInSecForIosWeb: 1,
    backgroundColor: Colors.red,
    textColor: Colors.white,
    fontSize: 16.0
);

If this didn't work run flutter clean and restart the app

CodePudding user response:

Try below code hope its helpful to you. Using Image 1

Your result green color Screen->enter image description here

  • Related