/*
 * @Author       : WuWei
 * @LastEditors  : WuWei
 * @Date         : 2021-03-04 16:06:21
 * @LastEditTime : 2023-05-25 15:38:32
 * @FilePath     : /wisdom-huiguanjia-app/oa_package/lib/src/pages/index/index.dart
 * @Description  : Do not edit
 */
import 'package:flutter/material.dart';
import 'package:wisdom_cli/wisdom_cli.dart';
import 'package:oa_package/src/view_models/index_store.dart';
// ignore: implementation_imports
import 'package:app_package/src/route_observer_util.dart';
import 'view.dart';
part 'index.g.dart';

///路由传递的参数
class IndexPageArguments {
  final String? id;
  IndexPageArguments({this.id});

  ///
  ///
  ///
  ///
  ///
  ///
  ///
//***以下为模板代码谨慎修改***
  factory IndexPageArguments.fromJson(Map<String, dynamic> json) {
    return _$IndexPageArgumentsFromJson(json);
  }
  factory IndexPageArguments.fromRouteArguments(BuildContext context) {
    return _$IndexPageArgumentsFromJson(
        (ModalRoute.of(context)?.settings.arguments ??
            new Map<String, dynamic>()) as Map<String, dynamic>);
  }
  Map<String, dynamic> toJson() => _$IndexPageArgumentsToJson(this);
}

///
///
///
///
///
//***以下为模板代码谨慎修改***

class IndexPage extends StatefulWidget {
  IndexPage({Key? key}) : super(key: key);

  @override
  _IndexPageState createState() => _IndexPageState();
}

class _IndexPageState extends State<IndexPage> with RouteAware {
  final RouteObserver<PageRoute> routeObserver =
      GetIt.I.get<RouteObserverUtil>().routeObserver;

  @override
  void didChangeDependencies() {
    super.didChangeDependencies();
    routeObserver.subscribe(this, ModalRoute.of(context) as PageRoute<dynamic>);
  }

  @override
  void dispose() {
    routeObserver.unsubscribe(this); //取消订阅
    super.dispose();
  }

  @override
  void didPopNext() {
    // final store = IndexStore(context);
    // store.getData();
  }

  @override
  Widget build(BuildContext context) {
    return MultiProvider(
      providers: [
        ChangeNotifierProvider(create: (_) => IndexStore(context)),
      ],
      child: IndexPageView(),
    );
  }
}
