0

Hello guys i am working in this Platform specific flutter application and wanted have sliver like the gif listed bellow i was able to achieve part of it but the search bar is not moving with scrolling.Please help.

enter image description here

Widget _buildContent(context, productBloc, isIOS) {
        return CustomScrollView(slivers: <Widget>\[
          CupertinoSliverNavigationBar(
            border: null,
            backgroundColor: Colors.grey\[50\],
            leading: Padding(
              padding: const EdgeInsets.only(bottom: 16, left: 10),
              child: Transform.scale(
                scale: 4.5,
                child: Image.asset('assets/images/whitelogo.png'),
              ),
            ),
            largeTitle: Column(
              crossAxisAlignment: CrossAxisAlignment.stretch,
              mainAxisSize: MainAxisSize.min,
              children: \[
                SizedBox(
                  width: MediaQuery.of(context).size.width * 0.75,
                  child: Padding(
                    padding: const EdgeInsets.only(left: 20.0, right: 20),
                    child: CupertinoTextField(
                      placeholderStyle: TextStyle(color: Colors.grey\[300\]),
                      placeholder: 'Enter Product Name',
                      prefix: Padding(
                        padding: const EdgeInsets.all(8.0),
                        child: Icon(
                          FrinoIcons.f_search_2,
                          size: 20,
                        ),
                      ),
                      decoration: BoxDecoration(
                        border: Border.all(color: Colors.grey\[300\]),
                        borderRadius: BorderRadius.circular(5),
                        color: Colors.white,
                      ),
                    ),
                  ),
                ),
              \],
            ),
            trailing: GestureDetector(
              child: const Icon(
                FrinoIcons.f_cart,
                color: const Color(0xFFf79B34),
                size: 28,
              ),
              onTap: () => Navigator.of(context).pushNamed('/cart'),
            ),
          )]
e.T55
  • 443
  • 1
  • 4
  • 21

1 Answers1

-1

Try replacing CustomScrollView with NestedScrollView:

Widget _buildContent(context, productBloc, isIOS) {
        return NestedScrollView(slivers: <Widget>\[
          CupertinoSliverNavigationBar(
            border: null,
            backgroundColor: Colors.grey\[50\],
            leading: Padding(
              padding: const EdgeInsets.only(bottom: 16, left: 10),
              child: Transform.scale(
                scale: 4.5,
                child: Image.asset('assets/images/whitelogo.png'),
              ),
            ),
        }
}
AlexH
  • 828
  • 7
  • 26
Pulkit Prajapat
  • 190
  • 2
  • 11