基础组件库
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.
 
 
 
 
 

72 satır
2.1 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. print('初始化百川');
  37. FlutterAlibc.initAlibc(version: "", appName: "").then((result) {
  38. print("白川" + '${result.errorCode} ${result.errorMessage}');
  39. });
  40. }
  41. @override
  42. Widget build(BuildContext context) {
  43. ErrorWidget.builder = (FlutterErrorDetails errorDetails) {
  44. return getErrorWidget(context, errorDetails);
  45. };
  46. return MultiProvider(
  47. providers: [
  48. ChangeNotifierProvider.value(value: UserInfoNotifier()),
  49. ],
  50. child: MaterialApp(
  51. home: GestureDetector(
  52. onTap: () {
  53. FocusScopeNode currentFocus = FocusScope.of(context);
  54. if (!currentFocus.hasPrimaryFocus &&
  55. currentFocus.focusedChild != null) {
  56. FocusManager.instance.primaryFocus.unfocus();
  57. }
  58. },
  59. child: LaunchPage(
  60. builder: (context) => HomePage(),
  61. ),
  62. ),
  63. ),
  64. );
  65. }
  66. }