写一个Flutter彩票客户端

编程入门 行业动态 更新时间:2024-10-09 18:24:38

写一个Flutter彩票<a href=https://www.elefans.com/category/jswz/34/1771403.html style=客户端"/>

写一个Flutter彩票客户端

数据来源 聚合数据

项目用到的库 rxdart + dio + bloc

主要技术点:
  • 请求完数据的组合显示(由于聚合数据是每一个彩种都是单个请求发);

  • 号码的动态添加布局(遍历数据动态添加布局数据,就像Android中动态addview一样);

  • rxdart + dio 的网络请求;

  • rxdart + bloc 的状态管理;

  • Stack + Positoned + Offstage(隐藏显示)Widget的使用


数据的组合: Future.wait([各个彩种的请求接口])
Future<Response> lottery(String lotteryId) {return _dio.get(Api.LOTTERY_QUERY, queryParameters: {"lottery_id": lotteryId,"lottery_no": "","key": Api.KEY});}Future queryLotteryList_() {Future<List<Response>> resp = Future.wait([lottery(Const.SSQ),lottery(Const.DLT),lottery(Const.QLC),lottery(Const.QXC),lottery(Const.PLS),lottery(Const.PLW),lottery(Const.FCSD),]);return resp;}
复制代码
号码布局的实现(动态添加):
 Container(padding: EdgeInsets.only(top: 9),child: Row(children: info.lotteryRes.split(',').map((number) {++numberIndex;return Container(margin: EdgeInsets.only(right: 4),child: ClipOval(child: Container(width: 30,height: 30,color: Utils.getLotteryItemColor(numberIndex, info.lotteryId),child: Center(child: Text(number,style: TextStyle(color: Colors.white, fontSize: 14),),),),),);}).toList(),),
),
复制代码

转载于:

更多推荐

写一个Flutter彩票客户端

本文发布于:2024-02-13 09:19:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1757512.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:客户端   彩票   Flutter

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!