基础组件库
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.
 
 
 
 
 

122 lines
3.3 KiB

  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. Center(
  66. child: FlatButton(
  67. child: Text(
  68. 'aaaaaa',
  69. style: TextStyle(color: Colors.black),
  70. ),
  71. onPressed: () {
  72. Provider.of<MainPageBgNotifier>(context, listen: false)
  73. .switchBg(Container(
  74. width: double.infinity,
  75. height: 200,
  76. color: Colors.purpleAccent,
  77. ));
  78. },
  79. ),
  80. )
  81. ],
  82. ),
  83. ),
  84. );
  85. }
  86. List<Widget> _createContent(BuildContext context) {
  87. List<Widget> list = List();
  88. list.addAll(WidgetFactory.create(
  89. 'normal_nav',
  90. isSliver: true,
  91. model: Map(),
  92. ));
  93. list.addAll(WidgetFactory.create(
  94. 'wallet_data',
  95. isSliver: true,
  96. model: Map(),
  97. ));
  98. list.addAll(WidgetFactory.create(
  99. 'wallet_detail',
  100. isSliver: true,
  101. model: Map(),
  102. ));
  103. list.addAll(WidgetFactory.create(
  104. 'wallet_income',
  105. isSliver: true,
  106. model: Map(),
  107. ));
  108. return list;
  109. }
  110. }