0

i am new to dart So i am frustrated by the snackBar is appears just in the footer of the body. and above of persistentFooterButtons and bottomNavigationBar plz someone help me to fixed the snackbar on the end of screen .

this my code:

    Widget build(BuildContext context) {
       return Scaffold(

  key: scaffoldKey,

  backgroundColor: Colors.white,

  appBar: AppBar(),

  body:  SafeArea(

          Material(

             color: Color(0xFF43bdd2), 

             borderRadius: BorderRadius.circular(25.0),

             child: MaterialButton(

                       onPressed:(){ _showSnack; },

                        child: Text('إرسال'),

                                  ),



                         ),  ),

  persistentFooterButtons: <Widget>[

               Text('hello everyone'),

           ],

  bottomNavigationBar: BottomAppBar(

    child: Container(

      padding: EdgeInsets.only(bottom: 3),

          child: Text("©Copyright flutter 2020",style:   TextStyle(color:Colors.black,fontWeight:     FontWeight.bold),textAlign: TextAlign.center,),



    ),  

  ),);}



         _showSnack(){scaffoldKey.currentState.showSnackBar(SnackBar(content:   Text('hi, here i am a snackBar'),)) ;}
user41vall
  • 11
  • 1
  • 3

1 Answers1

0

You can use a Flushbar to show a similar widget at the bottom.

FlatButton(
  child: Text('Show Snackbar'),
  onPressed: () {
    Flushbar(
      flushbarPosition: FlushbarPosition.BOTTOM, //Make sure at the bottom
    )
      ..title = 'hi, here i am a snackBar'
      ..show(context);
  },
),

Installing the package (https://pub.dartlang.org/packages/flushbar)

Add this in pubspec.ymal

dependencies:
  flushbar: ^1.10.4

Then import the flushber in the file you are on

import 'package:flushbar/flushbar.dart';
Nehal
  • 1,261
  • 12
  • 18