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

网站没有备案怎么申请广告北京百度seo服务

网站没有备案怎么申请广告,北京百度seo服务,网站制作精品案例欣赏,外贸一般在哪个网站做的GetBuilder模板使用方式参考上一节 本篇主要代码记录如何使用上拉加载下拉刷新, 接口请求和商品组件的代码不包括在内 pubspec.yaml装包 cupertino_icons: ^1.0.8# 分页 上拉加载,下拉刷新pull_to_refresh_flutter3: 2.0.2商品列表:controlle…

GetBuilder模板使用方式参考上一节
本篇主要代码记录如何使用上拉加载下拉刷新,
接口请求和商品组件的代码不包括在内

pubspec.yaml装包

  cupertino_icons: ^1.0.8# 分页 上拉加载,下拉刷新pull_to_refresh_flutter3: 2.0.2

商品列表:controller

import 'package:flutter_aidishi/api/index.dart';
import 'package:flutter_aidishi/models/home/product_model/product_model.dart';
import 'package:flutter_aidishi/models/index.dart';
import 'package:get/get.dart';
import 'package:pull_to_refresh_flutter3/pull_to_refresh_flutter3.dart';class GoodsListController extends GetxController {GoodsListController();final isHot = Get.arguments['hot'];List<ProductModel> items = [];/** 分页* refreshController:分页控制器* _page:分页* _limit:每页条数* _loadNewsSell:拉取数据(是否刷新)* onLoading:上拉加载新商品* onRefresh:下拉刷新* */final RefreshController refreshController = RefreshController(initialRefresh: true,);int _page = 1;int _limit = 20;Future<bool> _loadNewsSell(bool isRefresh) async {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(["goods_list"]);}// 下拉刷新void onRefresh() async{try{await _loadNewsSell(true);refreshController.refreshCompleted();}catch(e){refreshController.refreshFailed();}update(["goods_list"]);}_initData() async{update(["goods_list"]);}void onTap() {}@overridevoid onInit() {super.onInit();}@overridevoid onReady() {super.onReady();_initData();}@overridevoid onClose() {super.onClose();// 控制器释放refreshController.dispose();}
}

商品列表:view

import 'package:flutter/material.dart';
import 'package:flutter_aidishi/components/product_item.dart';
import 'package:flutter_aidishi/components/refresher.dart';
import 'package:get/get.dart';
import 'package:pull_to_refresh_flutter3/pull_to_refresh_flutter3.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'index.dart';class GoodsListPage extends GetView<GoodsListController> {const GoodsListPage({super.key});// AppBarAppBar _buildAppBar(){return AppBar(title: const Text("goods_list"));}// 主视图Widget _buildView() {return GridView.builder(itemCount: controller.items.length,itemBuilder: (context,index){var product = controller.items[index];// 自行封装商品item组件return ProductItemWidget(product,imgHeight: 117.w, // 图片高度);},gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, // 每行3个mainAxisSpacing: 10.w, // 主轴间距crossAxisSpacing: 10.w, // 交叉轴间距childAspectRatio: 0.7, // 宽高比),);}@overrideWidget build(BuildContext context) {return GetBuilder<GoodsListController>(init: GoodsListController(),id: "goods_list",builder: (_) {return Scaffold(appBar: _buildAppBar(),body: SmartRefresher(controller: controller.refreshController,enablePullUp: true, // 启用上拉加载onRefresh: controller.onRefresh, // 下拉刷新回调onLoading: controller.onLoading, // 上拉加载回调footer: const SmartRefresherFooterWidget(), // 底部加载更多组件child: _buildView(),),);},);}
}

底部加载更多组件:SmartRefresherFooterWidget

import 'package:flutter/cupertino.dart';
import 'package:flutter_aidishi/extension/index.dart';
import 'package:pull_to_refresh_flutter3/pull_to_refresh_flutter3.dart';/// 底部加载更多组件
class SmartRefresherFooterWidget extends StatelessWidget {/// 底部高度final double? height;/// 图标大小final double? iconSize;const SmartRefresherFooterWidget({Key? key,this.iconSize,this.height,}) : super(key: key);@overrideWidget build(BuildContext context) {return ClassicFooter(height: height ?? 60 + MediaQuery.of(context).padding.bottom + 30, // 底部高度loadingIcon: const CupertinoActivityIndicator().tight(width: iconSize ?? 25,height: iconSize ?? 25,), // 加载中outerBuilder: (child) => child.center().height(height ?? 60), // 内容);}
}

main也需要启用上拉加载下拉刷新

class MyApp extends StatelessWidget {const MyApp({Key? key}) :super(key: key);@overrideWidget build(BuildContext context) {return ScreenUtilInit(designSize: const Size(375, 812), // 设计稿中设备的尺寸(单位随意,建议dp,但在使用过程中必须保持一致)builder: (context,child){return RefreshConfiguration(headerBuilder: () => const ClassicHeader(), // 自定义刷新头部footerBuilder: () => const ClassicFooter(), // 自定义刷新尾部hideFooterWhenNotFull: true, // 当列表不满一页时,是否隐藏刷新尾部headerTriggerDistance: 80, // 触发刷新的距离maxOverScrollExtent: 100, // 最大的拖动距离footerTriggerDistance: 150, // 触发加载的距离child:GetMaterialApp(......));});}
}

完成!

http://www.dinnco.com/news/62244.html

相关文章:

  • 专门做地图的网站惠州百度seo
  • 手机网站建设需要多少钱网络营销软件商城
  • 网站编辑难做吗企业培训课程有哪些
  • 谈谈对网站建设的认识手游免费0加盟代理
  • 怎样做电商网站好视频教学咖啡的营销推广软文
  • 重庆璧山网站制作报价小说榜单首页百度搜索风云榜
  • java做的网站如何知道网址太原优化排名推广
  • 个人免费网站申请如何在百度发布文章
  • 澳门网站建设公司微信视频号小店
  • 苏州网站制作设计湖南专业seo优化
  • 武汉阳网站建设平台淘宝推广运营
  • 高唐网站建设潍坊新闻头条最新消息
  • 个人工商户做网站要上税吗百度指数查询官网大数据
  • 月嫂网站建设打广告推广怎么做
  • 长春火车站在哪个区今日重大国际新闻
  • 网站编辑制作大连网络推广公司哪家好
  • 极简wordpress主题、郑州优化网站关键词
  • 软文推广是什么意思?旺道优化软件
  • 手机网站建设服务器网络营销模式有哪些类型
  • 做电影网站要多少钱国内专业seo公司
  • 手机网站设计欣赏网站宁德seo优化
  • 企业做网站需要什么软件杭州优化seo
  • dede网站搬家更换空间重新安装我的百度网盘登录入口
  • 北京优酷首页培训机构seo信息优化
  • 棋牌类网站怎么做谷歌优化的最佳方案
  • 页面设计站在学员的角度网站如何快速推广
  • 360网络推广5000元网站seo推广
  • server2003网站建设佛山网站设计实力乐云seo
  • 美国做化工的b2b网站如何推广小程序
  • 网易邮箱企业版关键词优化推广公司