Home > Software design >  How to add borders for SnackBar in Flutter?
How to add borders for SnackBar in Flutter?

Time:05-26

I'm doing system messages, I decided to use SnackBar, but I ran into a problem - I can't add a border around the SnackBar, I need to make a colored border. Please tell me, is it possible to add a border to the SnackBar and how? Perhaps there are packages that allow you to do this?

CodePudding user response:

Try this

final snackBar = SnackBar(
      content: Text('test'),
      action: SnackBarAction(
        label: 'test label',
        textColor: Colors.white,
        onPressed: () {},
      ),
      behavior: SnackBarBehavior.floating,
      shape: RoundedRectangleBorder(
        side: BorderSide(color: Colors.red, width: 1),
        borderRadius: BorderRadius.circular(24),
      ),
      backgroundColor: Colors.blue,

Point is behavior, shape

  • Related