Collapsing title bar flutter with animation

Issue

I am trying to recreate this in Flutter -> https://blog.uptech.team/how-to-build-resizing-image-in-navigation-bar-with-large-title-8ba2e8bcb840

I.e., An app bar that resizes and aligns the title when you drag (Just the title, I don’t want the Captain America shield). I have looked into Sliver App Bar as below:

 NestedScrollView(
        controller: _scrollController,
        physics: NeverScrollableScrollPhysics(),
        headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
          return <Widget>[
            SliverAppBar(
              automaticallyImplyLeading: false,
              backgroundColor: backgroundColor,
              expandedHeight:
                  MediaQuery.of(context).size.height * 0.25,
              floating: false,
              pinned: true,
              centerTitle: true,
              flexibleSpace: FlexibleSpaceBar(
                title: Text("Testing",
                    style: TextStyle(
                      color: Colors.white,
                    )),
              ),
            ),
          ];
        },

However I am not sure where to go next from here.

Solution

I believe you are looking for the CupertinoSliverNavigationBar which is apart of the Cupertino Widget collection.

Answered By – Adrian Murray

Answer Checked By – Gilberto Lyons (FlutterFixes Admin)

Leave a Reply

Your email address will not be published.