0

大家好,我在这个平台特定的颤振应用程序中工作,并且想要像下面列出的 gif 一样的条子,我能够实现其中的一部分,但搜索栏没有滚动移动。请帮助。

在此处输入图像描述

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'),
            ),
          )]
4

1 回答 1

0

尝试替换CustomScrollViewNestedScrollView

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'),
              ),
            ),
        }
}
于 2020-11-24T13:50:48.777 回答