Flutter开发Feed流笔记二

这篇博客详细记录了使用Flutter仿照贝壳找房app的看点页开发Feed流的过程,涉及UI组件如tabbar、tabbarview和ListView的使用,以及Dio进行http通信、json_serializable处理JSON数据、flutter_refresh实现刷新加载功能。在开发中遇到了tabbarview状态丢失和标签间距设置的问题,并给出了相应的解决方案。完整代码可在GitHub找到。
摘要由CSDN通过智能技术生成

在这里插入图片描述在这里插入图片描述

仿照贝壳找房app看点页实现feed流功能。

UI使用了:tabbar+tabbarview+ListView
http通讯:Dio
json:json_serializable
下载刷新/加载更多:flutter_refresh

遇到问题:
1、 tabbarview在切换标签页后, 前一个标签页的状态会丢失。 其实TabbarView也是用的PageView,只需要继承mixin类AutomaticKeepAliveClientMixin并设置wantKeepAlive为true。 原理类似于安卓的ViewPager的pagelimit。

class ContentWidget extends StatefulWidget {
  List dataItems;

  ContentWidget({Key key, this.title, this.dataItems}) : super(key: key);

  // This widget is the home page of your application. It is stateful, meaning
  // that it has a State object (defined below) that contains fields that affect
  // how it looks.

  // This class is the configuration for the state. It holds the values
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值