Search code examples
flutterdartflutter-layoutandroid-appbarlayoutflutter-appbar

How to Place a Text Below the Image file in the App-Bar?


I have an App-Bar , where i need to place an Text below the Image in the App-Bar. The text should align directly below the below. I have tried many ways but i cannot find a way to do it. [Image of the Output i am getting now][1]

      appBar:
      new PreferredSize(
       preferredSize: const Size.fromHeight(240.0), 
        child: new AppBar(
        centerTitle: true,
        title: Row(),
            flexibleSpace: Container(
              decoration: BoxDecoration(
                gradient: LinearGradient(
                  colors: [reddish, blushish],
                ),
              ),
            ),

      bottom: new PreferredSize(
          child: new Container(
            child: new Image.asset('assets/rewahub_icon.png'),
            padding: const EdgeInsets.all(80.0),
           ),
          preferredSize: const Size.fromHeight(100.0)),
      ),
      ),

I am not able to place a text below the Png file that is image file. I would like to place a text below the Image file. Please do help me with this.

[1]: https://i.sstatic.net/P45ya.jpg



Solution

  • You can wrap your image in a column and add a text widget in this column.

                        child: Column(
                      children: <Widget>[
                        new Image.asset('assets/rewahub_icon.png'),
                        Text('I got my text here'),
                      ],
                    )