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

微网站制作速成法免费云虚拟主机

微网站制作速成法,免费云虚拟主机,wordpress 缓存在那,免费手机网站申请在分页中#xff0c;实现tab吸顶。 TDNavBar的screenAdaptation: true, 开启屏幕适配。 该属性已自动对不同手机状态栏高度进行适配。我们只需关注如何实现吸顶。 view import package:ducafe_ui_core/ducafe_ui_core.dart; import package:flutter/material.dart; import p…在分页中实现tab吸顶。 TDNavBar的screenAdaptation: true, 开启屏幕适配。 该属性已自动对不同手机状态栏高度进行适配。我们只需关注如何实现吸顶。 view import package:ducafe_ui_core/ducafe_ui_core.dart; import package:flutter/material.dart; import package:get/get.dart; import package:pull_to_refresh_flutter3/pull_to_refresh_flutter3.dart; import package:tdesign_flutter/tdesign_flutter.dart; import package:xiaoshukeji/common/index.dart;import index.dart;// 1. SliverPersistentHeaderDelegate必须实现的抽象类 class _StickyTabBarDelegate extends SliverPersistentHeaderDelegate {final Widget child;_StickyTabBarDelegate({required this.child});overrideWidget build(BuildContext context, double shrinkOffset, bool overlapsContent) {// shrinkOffset: 滚动距离// overlapsContent: 是否与其他内容重叠return Container(color: AppTheme.pageBgColor,child: child,);}overridedouble get maxExtent 92.w; // 最大高度已知tab高度72上下padding10overridedouble get minExtent 92.w; // 最小高度overridebool shouldRebuild(covariant SliverPersistentHeaderDelegate oldDelegate) true; }class RankingPage extends GetViewRankingController {const RankingPage({super.key});// 头部皇冠位置Widget _buildHeader() {return Widget[].toRow().card(color: AppTheme.pageBgColor).tight(width: 750.w,height: 300.w,);}// tab可吸顶Widget _buildTab() {return Widget[Widget[TextWidget.body(日榜, size: 28.sp, weight: FontWeight.w600, color: AppTheme.textColorfff),].toRow(mainAxisAlignment: MainAxisAlignment.center).card(color: AppTheme.primaryYellow).tight(width: 336.w,height: 72.w,),Widget[TextWidget.body(总榜, size: 28.sp, weight: FontWeight.w600, color: AppTheme.textColor6a7),].toRow(mainAxisAlignment: MainAxisAlignment.center).card(color: AppTheme.navBarBgColor).tight(width: 336.w,height: 72.w,),].toRow(mainAxisAlignment: MainAxisAlignment.spaceBetween);}// 数据列表Widget _buildDataList() {return SliverList(delegate: SliverChildBuilderDelegate((context, index) {return Widget[].toRow().paddingHorizontal(30.w).card(color: AppTheme.blockBgColor).tight(width: 690.w,height: 120.w,).marginOnly(bottom: 20.w);},childCount: 20,),);}// 主视图Widget _buildView() {return SmartRefresher(controller: controller.refreshController,enablePullUp: true,onRefresh: controller.onRefresh,onLoading: controller.onLoading,footer: const SmartRefresherFooterWidget(),header: const SmartRefresherHeaderWidget(),child: CustomScrollView(slivers: [// 头部_buildHeader().sliverToBoxAdapter().sliverPaddingHorizontal(30.w),// 2. SliverPersistentHeader实现吸顶的核心组件SliverPersistentHeader(pinned: true, // 设置为 true 实现吸顶delegate: _StickyTabBarDelegate(child: Container(padding: EdgeInsets.symmetric(horizontal: 30.w, vertical: 10.w),child: _buildTab(),),),),// 列表内容_buildDataList().sliverPaddingHorizontal(30.w),],),);}overrideWidget build(BuildContext context) {return GetBuilderRankingController(init: RankingController(),id: ranking,builder: (_) {return Scaffold(backgroundColor: AppTheme.pageBgColor, // 自定义颜色appBar: const TDNavBar(height: 0,titleColor: AppTheme.textColorfff,titleFontWeight: FontWeight.w600,backgroundColor: AppTheme.pageBgColor,screenAdaptation: true, // 是否进行屏幕适配默认trueuseDefaultBack: false,),body: _buildView(),);},);} } controller import package:get/get.dart; import package:pull_to_refresh_flutter3/pull_to_refresh_flutter3.dart;class RankingController extends GetxController {RankingController();List items [];/** 分页* refreshController分页控制器* _page分页* _limit每页条数* _loadNewsSell:拉取数据是否刷新* onLoading上拉加载新商品* onRefresh下拉刷新* */final RefreshController refreshController RefreshController(initialRefresh: true,);// int _page 1;// int _limit 20;Futurebool _loadNewsSell(bool isRefresh) async {return false;// var result await ProductApi.products(ProductsReq(// page:isRefresh ? 1:_page,// prePage:_limit// ));// if(isRefresh){// _page 1;// items.clear();// }// if(result.isNotEmpty){// _page;// items.addAll(result);// }// // 是否是空// return result.isEmpty;}// 上拉载入新商品void onLoading() async {if (items.isNotEmpty) {try {// 拉取数据是否为空 ? 设置暂无数据 加载完成var isEmpty await _loadNewsSell(false);isEmpty? refreshController.loadNoData(): refreshController.loadComplete();} catch (e) {refreshController.loadFailed(); // 加载失败}} else {refreshController.loadNoData(); // 设置无数据}update([ranking]);}// 下拉刷新void onRefresh() async {try {await _loadNewsSell(true);refreshController.refreshCompleted();} catch (e) {refreshController.refreshFailed();}update([ranking]);}_initData() {update([ranking]);}void onTap() {}// override// void onInit() {// super.onInit();// }overridevoid onReady() {super.onReady();_initData();}// override// void onClose() {// super.onClose();// } } 记录tab切换 int currentTab 0; // 当前选中的tab索引 // tab切换方法 void switchTab(int index) {if (currentTab index) return;currentTab index;items.clear();// 切换tab时重置列表数据refreshController.requestRefresh();update([ranking]); }// tab切换 Widget _buildTab() {return Widget[Widget[TextWidget.body(日榜, size: 28.sp, weight: FontWeight.w600, color: controller.currentTab 0 ? AppTheme.textColorfff : AppTheme.textColor646),].toRow(mainAxisAlignment: MainAxisAlignment.center).card(color: controller.currentTab 0 ? AppTheme.primaryYellow : AppTheme.navBarBgColor).tight(width: 336.w,height: 72.w,).onTap(() {controller.switchTab(0);}),Widget[TextWidget.body(总榜, size: 28.sp, weight: FontWeight.w600, color: controller.currentTab 1 ? AppTheme.textColorfff : AppTheme.textColor646),].toRow(mainAxisAlignment: MainAxisAlignment.center).card(color: controller.currentTab 1 ? AppTheme.primaryYellow : AppTheme.navBarBgColor ).tight(width: 336.w,height: 72.w,).onTap(() {controller.switchTab(1);}),].toRow(mainAxisAlignment: MainAxisAlignment.spaceBetween); }
http://www.w-s-a.com/news/873646/

相关文章:

  • 公司怎么注册官方网站wordpress花园网站
  • 一般网站的建设步骤有哪些企业网站建设应该注意什么事项问题
  • 枣庄市建设局网站建设工程合同交底的内容包括
  • 全国十大跨境电商排名seo优化入门教程
  • 福安网站开发网站内容建设要求age06
  • 网站开发制作公司罗湖在线
  • 做网站银川潍坊网络科技有限公司
  • 南宁企业网站建站模板盐田高端网站建设
  • 深圳市建设局网站张局北京档案馆网站建设
  • 运动健身型网站开发网站备案掉了什么原因
  • 网站开发的前后端是什么注册网站多少钱一年
  • 彩票网站建设需要什么网站未备案被阻断怎么做
  • wordpress 版权声明网站优化排名哪家性价比高
  • dedecms网站关键词外包做网站平台 一分钟
  • 酒网站建设游戏分类网站怎么做
  • 仿牌网站安全北京大良网站建设
  • ps中怎样做网站轮播图片吉林省网站建设公司
  • 广西网站建设-好发信息网温江做网站哪家好
  • 网站建设属于什么职位类别南京哪个网站建设比较好
  • wdcp 网站备份东莞网站建设五金建材
  • 天津制作网站的公司电话wordpress架设进出销
  • tomcat做静态网站prestashop和wordpress
  • 上海响应式建站wap网站微信分享代码
  • 四川建筑人才招聘网南昌网站优化
  • 南充网站建设制作重庆有的设计网站大全
  • 深圳沙井做网站公司网站搭建谷歌seo
  • 学校资源网站的建设方案山西省住房城乡建设厅网站
  • 医疗行业网站建设深圳网络科技公司排名
  • 企业形象型网站建设wordpress chess
  • 网站的域名起什么好处罗湖网站建设公司乐云seo