当前位置: 首页 > news >正文

自适应网站制作费用企业宣传网站

自适应网站制作费用,企业宣传网站,湖南旅游十大必去景区,jsp动态网站开发参考文献flutter开发实战-下拉刷新与上拉加载更多实现 在开发中经常遇到列表需要下拉刷新与上拉加载更多,这里使用EasyRefresh,版本是3.3.21 一、什么是EasyRefresh EasyRefresh可以在Flutter应用程序上轻松实现下拉刷新和上拉加载。它几乎支持所有Flutter Sc…

flutter开发实战-下拉刷新与上拉加载更多实现

在开发中经常遇到列表需要下拉刷新与上拉加载更多,这里使用EasyRefresh,版本是3.3.2+1

一、什么是EasyRefresh

EasyRefresh可以在Flutter应用程序上轻松实现下拉刷新和上拉加载。它几乎支持所有Flutter Scrollable小部件。它的功能与安卓的SmartRefreshLayout非常相似,也吸收了许多第三方库的优势。EasyRefresh集成了各种风格的页眉和页脚,但它没有任何限制,您可以轻松自定义。使用Flutter强大的动画,即使只是一个简单的控制也可以完成。EasyRefresh的目标是为Flutter创建一个强大、稳定、成熟的pull-to-refresh框架。

二、实现下拉刷新与上拉加载更多

在pubspec.yaml中引入EasyRefresh

 # 下拉刷新、上拉更多easy_refresh: ^3.3.2+1

在使用EasyRefresh过程中,需要用到EasyRefreshController来控制刷新结束。

/// Finish the refresh task and return the result./// [result] Result of task completion./// [force] Enforced, used to modify the result.void finishRefresh([IndicatorResult result = IndicatorResult.success, bool force = false]) {assert(controlFinishRefresh || force,'Please set controlFinishRefresh to true, then use. If you want to modify the result, you can set force to true.');_state?._headerNotifier._finishTask(result);}/// Finish the load task and return the result./// [result] Result of task completion./// [force] Enforced, used to modify the result.void finishLoad([IndicatorResult result = IndicatorResult.success, bool force = false]) {assert(controlFinishLoad || force,'Please set controlFinishLoad to true, then use. If you want to modify the result, you can set force to true.');_state?._footerNotifier._finishTask(result);}

整体实现下拉刷新与上拉加载更多完整代码如下

import 'package:easy_refresh/easy_refresh.dart';
import 'package:flutter/material.dart';class RefreshPage extends StatefulWidget {const RefreshPage({super.key});State<RefreshPage> createState() => _RefreshPageState();
}class _RefreshPageState extends State<RefreshPage> {int _count = 10;late EasyRefreshController _controller;void initState() {super.initState();_controller = EasyRefreshController(controlFinishRefresh: true,controlFinishLoad: true,);}void dispose() {_controller.dispose();super.dispose();}Widget build(BuildContext context) {return Scaffold(appBar: AppBar(title: const Text('EasyRefresh'),),body: EasyRefresh(controller: _controller,header: const BezierCircleHeader(),footer: const ClassicFooter(),onRefresh: () async {await Future.delayed(const Duration(seconds: 4));if (!mounted) {return;}setState(() {_count = 10;});_controller.finishRefresh();_controller.resetFooter();},onLoad: () async {await Future.delayed(const Duration(seconds: 4));if (!mounted) {return;}setState(() {_count += 5;});_controller.finishLoad(_count >= 20 ? IndicatorResult.noMore : IndicatorResult.success);},child: ListView.builder(itemBuilder: (context, index) {return Card(child: Container(alignment: Alignment.center,height: 80,child: Text('${index + 1}'),),);},itemCount: _count,),),);}
}

整体效果图如下

在这里插入图片描述

三、实现下拉刷新与上拉加载更多

flutter开发实战-下拉刷新与上拉加载更多实现。

https://blog.csdn.net/gloryFlow/article/details/133869961

学习记录,每天不停进步。

http://www.khdw.cn/news/34029.html

相关文章:

  • 男女做暖暖的视频试看网站本周时事新闻概要10条
  • wordpress 菜单 表郑州seo
  • wap网站开发协议百度推广开户代理
  • 模板网站的建设方式与方法千锋教育官方网
  • 云南网站建设哪家好百度统计登录
  • 给企业做网站的公司西安seo排名培训学校
  • 唐山市住房房和城乡建设厅网站360seo排名优化服务
  • 南京专业做网站的公司哪家好网站关键词优化公司
  • 网站开发培训班 上地汕头网站关键词推广
  • 二手房装修seo是什么级别
  • 免费网站建站软件南宁seo多少钱报价
  • 平台搭建不常州seo博客
  • 如何自制网站代理怎么引流推广
  • 烟台网络公司有哪些磐石网站seo
  • 做网站现在什么最赚钱吗最近最新的新闻
  • 淘宝网站是用什么开发的seo为什么要进行外部优化
  • app网站建站系统下载短视频优化
  • 做代购去那些网站发帖怎么免费给自己建网站
  • 宣威市住房与城乡建设局网站广州seo推广服务
  • 用WordPress做网站入门课百度搜索引擎首页
  • 做网站需要的公司杭州网站推广优化
  • 酒店要做关于网站ppt怎么做app注册拉新平台
  • 在线做海报的网站湖南好搜公司seo
  • 关于网站建设项目收取费用品牌网络推广外包
  • 企业网站的功能模块上海网站排名seo公司
  • 电梯行业网站怎么做平面设计培训费用一般是多少
  • 做网站软件frontpage友链交易
  • 广州外贸营销型网站建设公司如何建造一个网站
  • 网站设置了自动登录怎么显示密码电商怎么做如何从零开始
  • .net做的网站怎么样成都专门做网络推广的公司