|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- 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<WalletPage> {
- @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: <Widget>[
- MineHeaderBgWidget(
- controller: _controller,
- ),
- CustomScrollView(
- slivers: _createContent(context),
- ),
- Center(
- child: FlatButton(
- child: Text(
- 'aaaaaa',
- style: TextStyle(color: Colors.black),
- ),
- onPressed: () {
- Provider.of<MainPageBgNotifier>(context, listen: false)
- .switchBg(Container(
- width: double.infinity,
- height: 200,
- color: Colors.purpleAccent,
- ));
- },
- ),
- )
- ],
- ),
- ),
- );
- }
-
- List<Widget> _createContent(BuildContext context) {
- List<Widget> 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;
- }
- }
|