基础组件库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

wallet_page.dart 2.8 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:provider/provider.dart';
  4. import 'package:pull_to_refresh/pull_to_refresh.dart';
  5. import 'package:zhiying_base_widget/pages/main_page/notifier/main_page_bg_notifier.dart';
  6. import 'package:zhiying_base_widget/pages/main_page/notifier/main_page_notifier.dart';
  7. import 'package:zhiying_base_widget/widgets/others/mine_header_bg_widget.dart';
  8. import 'package:zhiying_comm/zhiying_comm.dart';
  9. class WalletPage extends StatefulWidget {
  10. @override
  11. _WalletPageState createState() => _WalletPageState();
  12. }
  13. class _WalletPageState extends State<WalletPage> {
  14. @override
  15. Widget build(BuildContext context) {
  16. return Scaffold(
  17. backgroundColor: Color(0xfff9f9f9),
  18. body: MultiProvider(
  19. providers: [
  20. ChangeNotifierProvider.value(value: MainPageNotifier()),
  21. ChangeNotifierProvider.value(value: MainPageBgNotifier()),
  22. ],
  23. child: _WalletPageContainer(),
  24. ),
  25. );
  26. }
  27. }
  28. class _WalletPageContainer extends StatefulWidget {
  29. _WalletPageContainer({Key key}) : super(key: key);
  30. @override
  31. _WalletPageContainerState createState() => _WalletPageContainerState();
  32. }
  33. class _WalletPageContainerState extends State<_WalletPageContainer> {
  34. final ScrollController _controller = ScrollController();
  35. final RefreshController _refreshController =
  36. RefreshController(initialRefresh: false);
  37. @override
  38. void initState() {
  39. super.initState();
  40. }
  41. void _onLoading() async {
  42. // await Future.delayed(Duration(milliseconds: 1000));
  43. // if (mounted) setState(() {});
  44. // _refreshController.loadComplete();
  45. }
  46. @override
  47. Widget build(BuildContext context) {
  48. return SmartRefresher(
  49. controller: _refreshController,
  50. enablePullDown: false,
  51. enablePullUp: false,
  52. header: WaterDropHeader(),
  53. onLoading: _onLoading,
  54. child: Container(
  55. width: double.infinity,
  56. child: Stack(
  57. fit: StackFit.passthrough,
  58. children: <Widget>[
  59. MineHeaderBgWidget(
  60. controller: _controller,
  61. ),
  62. CustomScrollView(
  63. slivers: _createContent(context),
  64. ),
  65. ],
  66. ),
  67. ),
  68. );
  69. }
  70. List<Widget> _createContent(BuildContext context) {
  71. List<Widget> list = List();
  72. list.addAll(WidgetFactory.create(
  73. 'normal_nav',
  74. isSliver: true,
  75. model: Map(),
  76. ));
  77. list.addAll(WidgetFactory.create(
  78. 'wallet_data',
  79. isSliver: true,
  80. model: Map(),
  81. ));
  82. list.addAll(WidgetFactory.create(
  83. 'wallet_detail',
  84. isSliver: true,
  85. model: Map(),
  86. ));
  87. list.addAll(WidgetFactory.create(
  88. 'wallet_income',
  89. isSliver: true,
  90. model: Map(),
  91. ));
  92. return list;
  93. }
  94. }