繁体   English   中英

当向下滚动 ListviewItmes 时,强制屏幕小部件的顶部继续显示,颤动

[英]Force The Top Part Of The Screen's Widget to keep showing when Scrolling the ListviewItmes down, Flutter

请问当我向下滚动列表视图时,如何强制屏幕的顶部不消失? 正如你在这张照片中看到的

屏幕 1

当我向下滚动 ListView 时,包含播放器小部件的顶部将消失

屏幕 2

那么当我向下滚动列表视图时,我该如何强制顶部小部件继续显示

Scaffold(
        body: Container(
          child: ListView(
            shrinkWrap: true,
            children: <Widget>[
              Center(
                child: Container(
                  width: 200.0,
                  height: 150.0,
                  child: Stack(
                    children: <Widget>[
                      Container(
                        decoration: BoxDecoration(
                            color:Color(0xff193451).withOpacity(.5),
                            shape: BoxShape.circle),
                        child: Padding(
                          padding: const EdgeInsets.all(.0),
                          child: _buildRadialSeekBar(),
                        ),
                      ),
                      Center(
                        child: Container(
                          width: 150.0,
                          height: 150.0,
                          child: Padding(
                            padding: const EdgeInsets.all(5.0),
                            child: ClipOval(
                              clipper: MClipper(),
                              child: Image.asset(
                                "assets/justine.jpg",
                                fit: BoxFit.cover,
                              ),
                            ),
                          ),
                        ),
                      )
                    ],
                  ),
                ),
              ),
              Container(
                // color: Colors.blue,
                width: 350.0,
                height: 100.0,
                child: Stack(
                  children: <Widget>[
                    Center(
                      child: Container(
                        height: 65.0,
                        width: 290.0,
                        decoration: BoxDecoration(
                            border: Border.all(
                                color: Color(0xff193451), width: 3.0),
                            borderRadius: BorderRadius.circular(40.0)),
                        child: Padding(
                          padding: const EdgeInsets.symmetric(horizontal: 25.0),
                          child: Row(
                            children: <Widget>[
                              Icon(Icons.fast_rewind,
                                  size: 55.0, color: Color(0xff193451)),
                              Expanded(
                                child: Container(),
                              ),
                              Icon(Icons.fast_forward,
                                  size: 55.0, color: Color(0xff193451))
                            ],
                          ),
                        ),
                      ),
                    ),
                    Align(
                      alignment: Alignment.center,
                      child: Container(
                        width: 92.0,
                        height: 92.0,
                        decoration: BoxDecoration(
                            color: Color(0xff193451), shape: BoxShape.circle),
                        child: IconButton(
                          icon: Icon(
                            Icons.play_arrow,
                            size: 45.0,
                            color: Colors.white,
                          ),
                          onPressed: () {},
                        ),
                      ),
                    )
                  ],
                ),
              ),
          ListView(
            shrinkWrap: true,
            physics: ClampingScrollPhysics(),
            children: [
              if(LocalUrl == "http://local") Container(child: ParseLocall(),),
              if(LocalUrl == "http://music") Container(child: ParseMusicc(),),
              if(LocalUrl == "http://talk") Container(child: ParseTalkk(),),
              if(LocalUrl == "http://sports") Container(child: ParseSportss(),),
              if(LocalUrl == "http://id=r0") Container(child: ParseByLocationn(),),
              if(LocalUrl == "http://lang") Container(child: ParseLanguagess(),),
              if(LocalUrl == "http://podcast") Container(child: ParseProdcastss(),),
            ],
          ),
            ],
          ),
        ));

提前致谢

您可以将Justin部分与您的ListView分开并用Column包裹它们。 代码仍然需要一些修复,但会像这样:

 body: Container(
          // Here is the Column!
          child: Column(
            children: [
              // And here is the top part!
              Center(
                child: Container(
                  width: 200.0,
                  height: 150.0,
                  child: Stack(
                    children: <Widget>[
                      Container(
                        decoration: BoxDecoration(
                            color:Color(0xff193451).withOpacity(.5),
                            shape: BoxShape.circle),
                        child: Padding(
                          padding: const EdgeInsets.all(.0),
                          child: _buildRadialSeekBar(),
                        ),
                      ),
                      Center(
                        child: Container(
                          width: 150.0,
                          height: 150.0,
                          child: Padding(
                            padding: const EdgeInsets.all(5.0),
                            child: ClipOval(
                              clipper: MClipper(),
                              child: Image.asset(
                                "assets/justine.jpg",
                                fit: BoxFit.cover,
                              ),
                            ),
                          ),
                        ),
                      )
                    ],
                  ),
                ),
              ),
              
              ListView(
                shrinkWrap: true,
                children: <Widget>[
                  Container(
                    // color: Colors.blue,
                    width: 350.0,
                    height: 100.0,
                    child: Stack(
                      children: <Widget>[
                        Center(
                          child: Container(
                            height: 65.0,
                            width: 290.0,
                            decoration: BoxDecoration(
                                border: Border.all(
                                    color: Color(0xff193451), width: 3.0),
                                borderRadius: BorderRadius.circular(40.0)),
                            child: Padding(
                              padding: const EdgeInsets.symmetric(horizontal: 25.0),
                              child: Row(
                                children: <Widget>[
                                  Icon(Icons.fast_rewind,
                                      size: 55.0, color: Color(0xff193451)),
                                  Expanded(
                                    child: Container(),
                                  ),
                                  Icon(Icons.fast_forward,
                                      size: 55.0, color: Color(0xff193451))
                                ],
                              ),
                            ),
                          ),
                        ),
                        Align(
                          alignment: Alignment.center,
                          child: Container(
                            width: 92.0,
                            height: 92.0,
                            decoration: BoxDecoration(
                                color: Color(0xff193451), shape: BoxShape.circle),
                            child: IconButton(
                              icon: Icon(
                                Icons.play_arrow,
                                size: 45.0,
                                color: Colors.white,
                              ),
                              onPressed: () {},
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
              ListView(
                shrinkWrap: true,
                physics: ClampingScrollPhysics(),
                children: [
                  if(LocalUrl == "http://local") Container(child: ParseLocall(),),
                  if(LocalUrl == "http://music") Container(child: ParseMusicc(),),
                  if(LocalUrl == "http://talk") Container(child: ParseTalkk(),),
                  if(LocalUrl == "http://sports") Container(child: ParseSportss(),),
                  if(LocalUrl == "http://id=r0") Container(child: ParseByLocationn(),),
                  if(LocalUrl == "http://lang") Container(child: ParseLanguagess(),),
                  if(LocalUrl == "http://podcast") Container(child: ParseProdcastss(),),
                ],
              ),
                ],
              ),
            ],
          ),
        ));

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM