AnswerBun.com

Flutter: SilverAppBar Background Image with Text

Stack Overflow Asked by gsk on December 2, 2020

I am trying to make an app bar looks like this:

enter image description here

I hope to collapse the big image using SilverAppBar, but I am having hard time to insert AssetImage (or Image.asset'). I almost exactly followed the code from the [official Flutter website][2], and unfortunately, both AssetImageandImage.asset` cannot be used as shown below:

enter image description here

Is there any way to do this?

2 Answers

maybe you can use background like this:

SliverAppBar(
...
...
   background: Image(
      image: NetworkImage(recipeDetails.coverPhoto),
      fit: BoxFit.cover,
      ),
   ),

Answered by xion on December 2, 2020

Wrap Image.asset with Container widget

          Stack(
                  fit: StackFit.expand,
                  children: <Widget>[
                    Container(
                      child: Image.asset('name'),
                    )
                    ],
                ),

Answered by Titas Černiauskas on December 2, 2020

Add your own answers!

Related Questions

NGINX gives 502 error from browsers but not from Postman

1  Asked on October 13, 2020 by knguyen

   

Python Pandas cumsum with shift of n

1  Asked on October 10, 2020 by gonzalo-polo

     

How to read only half a byte from a binary file at a time in C?

2  Asked on October 9, 2020 by nguyenvivian

         

Failed to install laravel/jetstream on laravel 8

2  Asked on October 8, 2020 by vldcndn

     

liquibase roll back with spring boot

1  Asked on October 7, 2020 by user1999453

       

How to change the order of jquery events?

0  Asked on October 2, 2020 by turqay-umudzade

   

How to == async axios value

0  Asked on September 30, 2020 by jessica-bulldog

   

Is there a way to set variable methods in Python?

1  Asked on September 30, 2020 by defarm

     

How to pull data from an array using SQL

1  Asked on September 29, 2020 by sarah

     

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir