1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| class HomeGetWidget extends GetView<HomeController>{ @override Widget build(BuildContext context) { return _buildMixState(); } Widget _buildMixState(){ return controller.obx( (data) => ListView.separated( itemCount: data!.data!.datas.length, separatorBuilder: (context, index) {return Divider(height: 10, color: Colors.grey,);}, itemBuilder: (BuildContext context, int index) { return Column( children: [ Text(data.data!.datas[index].author), Text(data.data!.datas[index].title), Text(data.data!.datas[index].niceShareDate) ], ); }, ), //onLoading: const CupertinoActivityIndicator(radius: 10), //加载中,默认是个Center(child:CircularProgressIndicator()) onEmpty: const Text('No data found'), //空数据显示 onError: (error) => Text(error!), //出错界面显示 ); } }
|