基础组件库
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 

62 satır
1.7 KiB

  1. import 'package:flutter/foundation.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter_alibc/flutter_alibc.dart';
  4. import 'package:provider/provider.dart';
  5. import 'package:zhiying_base_widget/pages/home_page/home_page.dart';
  6. import 'package:zhiying_base_widget/pages/launch_page/launch_page.dart';
  7. import 'package:zhiying_base_widget/register.dart';
  8. import 'package:zhiying_comm/zhiying_comm.dart';
  9. void main() {
  10. FlutterError.onError = (FlutterErrorDetails details) {
  11. FlutterError.dumpErrorToConsole(details);
  12. print(details.exceptionAsString());
  13. // if (kReleaseMode) exit(1);
  14. };
  15. runApp(MyApp());
  16. }
  17. class MyApp extends StatefulWidget {
  18. @override
  19. _MyAppState createState() => _MyAppState();
  20. }
  21. class _MyAppState extends State<MyApp> {
  22. Widget getErrorWidget(BuildContext context, FlutterErrorDetails error) {
  23. return Center(
  24. child: Text(
  25. "走神了~\n${error.exceptionAsString()}",
  26. style:
  27. Theme.of(context).textTheme.title.copyWith(color: Colors.redAccent),
  28. ),
  29. );
  30. }
  31. @override
  32. void initState() {
  33. super.initState();
  34. print('初始化~~~~');
  35. BaseWidgetRegister.init();
  36. FlutterAlibc.initAlibc(version: "", appName: "").then((result) {
  37. Logger.debug('${result.errorCode} ${result.errorMessage}');
  38. });
  39. }
  40. @override
  41. Widget build(BuildContext context) {
  42. ErrorWidget.builder = (FlutterErrorDetails errorDetails) {
  43. return getErrorWidget(context, errorDetails);
  44. };
  45. return MultiProvider(
  46. providers: [
  47. ChangeNotifierProvider.value(value: UserInfoNotifier()),
  48. ],
  49. child: MaterialApp(
  50. home: LaunchPage(
  51. builder: (context) => HomePage(),
  52. ),
  53. ),
  54. );
  55. }
  56. }