Home > front end >  How to Display a Widget Over the Screen in flutter?
How to Display a Widget Over the Screen in flutter?

Time:10-06

I want to Display a Widget like this over the Image/Screen: enter image description here

I try to do this with snackbar with following code:

SnackBar(
  elevation: 5,
  padding: const EdgeInsets.all(0),
  backgroundColor: Colors.transparent,
  behavior: SnackBarBehavior.floating,
  content: Children()

But it is displaying with a little black color in background...

Is there any other widget for achieving this???

If you know the answer of the question then answer this question...

CodePudding user response:

You can also use Toast in this case. A toast generally appears for 2 seconds or you can set a custom duration for the same.

Flutter Toast is a good library to achieve the same.

https://pub.dev/packages/fluttertoast

CodePudding user response:

Stack(children: [
    ImageWidget(...),
    Align(
        alignment: Alignment.bottomCenter
        child: SnackBar(
            elevation: 5,
            padding: const EdgeInsets.all(0),
            backgroundColor: Colors.transparent,
            behavior: SnackBarBehavior.floating,
            content: Children()
)])

CodePudding user response:

set elevation to 0 and make backgroundcolor to transparent. This may help you buddy.

  • Related