flutter 嵌套滑动实现

 

 

flutter 嵌套滑动实现

class HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(

        //Image.asset("images/u.png")
        body: NestedScrollView(
      headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
        return <Widget>[
          SliverAppBar(
            expandedHeight: 260,
            pinned: true,
            flexibleSpace: FlexibleSpaceBar(
                collapseMode: CollapseMode.parallax,
                titlePadding: EdgeInsets.only(left: 0),
                title: buildTitle(),
                background: Stack(
                  children: <Widget>[

                    Positioned.fill(
                        child: Image.asset(
                          "images/u.png",
                          fit: BoxFit.cover,
                        )),
                    Positioned.fill(child: BlurUtils(singl: 20,)),
                    //Positioned(bottom:200,left: 0,right: 0,top: 20,child:Ziliao()),
                    Align(
                      alignment: Alignment.bottomCenter,
                      child: Ziliao(),
                    )
                    //bioa

                  ],
                )),
          )
        ];
      },
      body: ListView.builder(
          itemCount: 20,
          itemBuilder: (Context, index) {
            return ListTile(
              title: Text("${index}"),
            );
          }),
    ));
  }

  Widget buildTitle() {
    return Container(
      child: Container(
        margin: EdgeInsets.fromLTRB(20, 0, 0, 50),
        child: Row(
          children: <Widget>[
            ClipRRect(
              borderRadius: BorderRadius.circular(23),
              child: Image.asset(
                "images/u.png",
                width: 50,
                height: 50,
              ),
            ),
            Text("张三")
          ],
        ),
      ),
    );
  }

 Widget Ziliao() {
    return Container(
      height: 60,
      alignment: Alignment.center,
      color: Colors.white,
      child: Row(

        children: <Widget>[
          titles(),
          titles(),
          titles(),
          titles()

        ],
      ),
    );
 }
 Widget titles(){
    return  Expanded(child:
    Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        Text("3"),
        Text("收藏")
      ],
    ));
 }
}

 

上一篇:浅谈MySQL中的游标


下一篇:20-案例篇:为什么系统的Swap变高了?(下)