/*
 * @Author: XianKaiQun
 * @LastEditors: XianKaiQun
 * @Date: 2020-11-09 12:00:35
 * @LastEditTime: 2020-11-09 14:53:07
 */
import 'package:flutter/material.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:wisdom_cli/wisdom_cli.dart';
import 'store.dart';
import 'view.dart';
part 'index.g.dart';

///路由传递的参数
@JsonSerializable()
class SuccessPageArguments {
  final String? id;
  final bool? isRepair;
  SuccessPageArguments({this.id, this.isRepair});
  factory SuccessPageArguments.fromJson(Map<String, dynamic> json) {
    return _$SuccessPageArgumentsFromJson(json);
  }
  factory SuccessPageArguments.fromRouteArguments(BuildContext context) {
    return _$SuccessPageArgumentsFromJson(
      (ModalRoute.of(context)?.settings.arguments ??
            new Map<String, dynamic>()) as Map<String, dynamic>,
    );
  }
  Map<String, dynamic> toJson() => _$SuccessPageArgumentsToJson(this);
}

class SuccessPage extends StatelessWidget {
  const SuccessPage({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return MultiProvider(
      providers: [
        ChangeNotifierProvider(create: (_) => SuccessPageStore(context)),
      ],
      child: SuccessPageView(),
    );
  }
}
