A constructor
const SnackBar({ Key key, @required this.content, BackgroundColor,// backgroundColor this.elevation,// shadow length this.shape,// background shape this.behavior,// fixed at the bottom, popup will put the page on the top; Floating suspended over the page. This action, / / this. Add operation duration = _snackBarDisplayDuration, / / duration, then automatically hide this. Animation,})Copy the code
The sample

code
class _MyHomePageState extends State<MyHomePage> { @override Widget build(BuildContext context) { return Scaffold( body:  new Builder(builder: (BuildContext context) { return Center( child: GestureDetector( onTap: (){scaffold.of (context).showsnackbar (SnackBar(content: Text(" network error "), backgroundColor: Color. Orange [200],// Background color elevation: 10, duration: duration (seconds: 4),// Rectangleborder (borderRadius: borderRadius. Circular (10)),// Background shape // behavior: SnackBarBehavior floating, / / suspended behaviors: SnackBarBehavior. Fixed, fixed action at the bottom: / / SnackBarAction (label: {scaffold.of (context).hidecurrentsnackbar (); // hide},),)); }, child: Text("show snackbar",style: TextStyle(fontSize: 29),), ), ); }), floatingActionButton: FloatingActionButton( onPressed: // Scaffold.of(context).showsnackbar (new SnackBar(// content: New Text (" Snackbar "), / / action: new SnackBarAction (/ / label: "withdraw", / / onPressed: {} (), / /, / /)); }, child: Icon(Icons.airline_seat_recline_extra), ), ); }}Copy the code