import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:zhiying_base_widget/pages/main_page/notifier/main_page_bg_notifier.dart'; import 'package:zhiying_base_widget/pages/main_page/notifier/main_page_notifier.dart'; import 'package:zhiying_base_widget/widgets/others/mine_header_bg_widget.dart'; import 'package:zhiying_comm/zhiying_comm.dart'; class WalletPage extends StatefulWidget { @override _WalletPageState createState() => _WalletPageState(); } class _WalletPageState extends State { @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Color(0xfff9f9f9), body: MultiProvider( providers: [ ChangeNotifierProvider.value(value: MainPageNotifier()), ChangeNotifierProvider.value(value: MainPageBgNotifier()), ], child: _WalletPageContainer(), ), ); } } class _WalletPageContainer extends StatefulWidget { _WalletPageContainer({Key key}) : super(key: key); @override _WalletPageContainerState createState() => _WalletPageContainerState(); } class _WalletPageContainerState extends State<_WalletPageContainer> { final ScrollController _controller = ScrollController(); final RefreshController _refreshController = RefreshController(initialRefresh: false); @override void initState() { super.initState(); } void _onLoading() async { // await Future.delayed(Duration(milliseconds: 1000)); // if (mounted) setState(() {}); // _refreshController.loadComplete(); } @override Widget build(BuildContext context) { return SmartRefresher( controller: _refreshController, enablePullDown: false, enablePullUp: false, header: WaterDropHeader(), onLoading: _onLoading, child: Container( width: double.infinity, child: Stack( fit: StackFit.passthrough, children: [ MineHeaderBgWidget( controller: _controller, ), CustomScrollView( slivers: _createContent(context), ), ], ), ), ); } List _createContent(BuildContext context) { List list = List(); list.addAll(WidgetFactory.create( 'normal_nav', isSliver: true, model: Map(), )); list.addAll(WidgetFactory.create( 'wallet_data', isSliver: true, model: Map(), )); list.addAll(WidgetFactory.create( 'wallet_detail', isSliver: true, model: Map(), )); list.addAll(WidgetFactory.create( 'wallet_income', isSliver: true, model: Map(), )); return list; } }