基础组件库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.dart 2.1 KiB

4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. }