import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_alibc/flutter_alibc.dart'; import 'package:provider/provider.dart'; import 'package:zhiying_base_widget/pages/home_page/home_page.dart'; import 'package:zhiying_base_widget/pages/launch_page/launch_page.dart'; import 'package:zhiying_base_widget/register.dart'; import 'package:zhiying_comm/zhiying_comm.dart'; void main() { FlutterError.onError = (FlutterErrorDetails details) { FlutterError.dumpErrorToConsole(details); print(details.exceptionAsString()); // if (kReleaseMode) exit(1); }; runApp(MyApp()); } class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State { Widget getErrorWidget(BuildContext context, FlutterErrorDetails error) { return Center( child: Text( "走神了~\n${error.exceptionAsString()}", style: Theme.of(context).textTheme.title.copyWith(color: Colors.redAccent), ), ); } @override void initState() { super.initState(); print('初始化~~~~'); BaseWidgetRegister.init(); FlutterAlibc.initAlibc(version: "", appName: "").then((result) { Logger.debug('${result.errorCode} ${result.errorMessage}'); }); } @override Widget build(BuildContext context) { ErrorWidget.builder = (FlutterErrorDetails errorDetails) { return getErrorWidget(context, errorDetails); }; return MultiProvider( providers: [ ChangeNotifierProvider.value(value: UserInfoNotifier()), ], child: MaterialApp( home: LaunchPage( builder: (context) => HomePage(), ), ), ); } }