We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import 'dart:math'; import 'package:easy_refresh/easy_refresh.dart'; import 'package:flutter/material.dart'; const int itemCount = 20; class ProductPage extends StatefulWidget { const ProductPage({Key? key}) : super(key: key); @override State<ProductPage> createState() => _ProductPageState(); } class _ProductPageState extends State<ProductPage> { final _products = ['电脑', '手机', '家电']; _tabBarItemBuilder() { return SizedBox( height: 34, child: TabBar( tabs: _products.map((e) => Text(e)).toList(), ), ); } _tabBarPageBuilder() { return Expanded( child: TabBarView( children: _products .map((e) => ProductSubPage( title: e, )) .toList()), ); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Easy_refresh测试'), backgroundColor: Colors.yellowAccent, ), body: DefaultTabController( length: _products.length, child: Container( color: Colors.blueAccent, child: Column( children: [ _tabBarItemBuilder(), _tabBarPageBuilder(), ], ), )), ); } } class ProductSubPage extends StatefulWidget { final String title; const ProductSubPage({Key? key, required this.title}) : super(key: key); @override State<ProductSubPage> createState() => _ProductSubPageState(); } class _ProductSubPageState extends State<ProductSubPage> { final _dataArr = <String>[]; _loadData(refresh) async { await Future.delayed(Duration(seconds: 1)); if (_dataArr.length >= itemCount) { return; } var data = <String>[]; int randInt = Random().nextInt(10) + 1; int j = Random().nextInt(200); int k = Random().nextInt(100); for (var i = 0; i < 7; ++i) { data.add('${j}=${k}-${i}内容'); } if (refresh) { _dataArr.clear(); } else {} setState(() { _dataArr.addAll(data); }); } Widget _itemBuilder(text) { return Container( margin: EdgeInsets.all(12), padding: EdgeInsets.symmetric(vertical: 12, horizontal: 4), color: Colors.white, child: Text(text), ); } @override void initState() { // TODO: implement initState super.initState(); _loadData(true); } @override Widget build(BuildContext context) { return EasyRefresh( onRefresh: () => _loadData(true), onLoad: () => _loadData(false), child: ListView.builder( itemCount: _dataArr.length, itemBuilder: (BuildContext context, int index) { return _itemBuilder(_dataArr[index]); })); } }
The text was updated successfully, but these errors were encountered:
你使用IndicatorPosition.locator即可。Flutter中的鼠标滚轮事件响应原理有点不一样
Sorry, something went wrong.
你使用IndicatorPosition.locator即可。Flutter中的鼠标滚轮事件响应原理有点不一样 你好! 设置footer.position: IndicatorPosition.locator还是一样不回弹,而且Footer里面的文本等内容都没显示
position: IndicatorPosition.locator
Widget build(BuildContext context) { return EasyRefresh( onRefresh: () => _loadData(true), onLoad: () => _loadData(false), footer: ClassicFooter( position: IndicatorPosition.locator, dragText: 'Pull to load', armedText: 'Release ready', readyText: '准备Loading...', processingText: '加载Loading...', processedText: '成功Succeeded', noMoreText: '无更多No more', failedText: '失败了Failed', ), child: ListView.builder( itemCount: _dataArr.length, itemBuilder: (BuildContext context, int index) { return _itemBuilder(_dataArr[index]); })); }
No branches or pull requests
2024-05-15.14.26.36.mov
The text was updated successfully, but these errors were encountered: