基础组件库
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

pirms 3 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 3 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 3 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 3 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 3 gadiem
pirms 4 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 4 gadiem
pirms 3 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. import 'dart:convert';
  2. import 'dart:io';
  3. import 'package:flutter/foundation.dart';
  4. import 'package:flutter/material.dart';
  5. import 'package:flutter_alibc/flutter_alibc.dart';
  6. import 'package:flutter_localizations/flutter_localizations.dart';
  7. import 'package:provider/provider.dart';
  8. import 'package:pull_to_refresh/pull_to_refresh.dart';
  9. import 'package:zhiying_base_widget/pages/home_page/home_page.dart';
  10. import 'package:zhiying_base_widget/pages/launch_page/launch_page.dart';
  11. import 'package:zhiying_base_widget/register.dart';
  12. import 'package:zhiying_comm/util/update/app_update_util.dart';
  13. import 'package:zhiying_comm/zhiying_comm.dart';
  14. import 'util/localizations_delegate.dart';
  15. import 'package:zhiying_base_widget/utils/mob_push_util.dart';
  16. void main() {
  17. FlutterError.onError = (FlutterErrorDetails details) {
  18. FlutterError.dumpErrorToConsole(details);
  19. print(details.exceptionAsString());
  20. // if (kReleaseMode) exit(1);
  21. };
  22. runApp(MyApp());
  23. }
  24. class MyApp extends StatefulWidget {
  25. @override
  26. _MyAppState createState() => _MyAppState();
  27. }
  28. class _MyAppState extends State<MyApp> {
  29. Widget getErrorWidget(BuildContext context, FlutterErrorDetails error) {
  30. return Center(
  31. child: Text(
  32. "走神了~\n${error.exceptionAsString()}",
  33. style: Theme
  34. .of(context)
  35. .textTheme
  36. .title
  37. .copyWith(color: Colors.redAccent),
  38. ),
  39. );
  40. }
  41. @override
  42. void initState() {
  43. super.initState();
  44. print('初始化~~~~');
  45. BaseWidgetRegister.init();
  46. print('初始化百川');
  47. FlutterAlibc.initAlibc(version: "", appName: "").then((result) {
  48. print("白川" + '${result.errorCode} ${result.errorMessage}');
  49. });
  50. MobPushUtil.setCanPush();
  51. // app更新插件
  52. AppUpdateUtil.initXUpdate();
  53. }
  54. @override
  55. Widget build(BuildContext context) {
  56. ErrorWidget.builder = (FlutterErrorDetails errorDetails) {
  57. return getErrorWidget(context, errorDetails);
  58. };
  59. return MultiProvider(
  60. providers: [
  61. ChangeNotifierProvider.value(value: UserInfoNotifier()),
  62. ],
  63. child: MaterialApp(
  64. builder: (context,child){
  65. return MediaQuery(
  66. //设置文字大小不随系统设置改变
  67. data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
  68. child: child,
  69. );
  70. },
  71. theme: ThemeData(
  72. fontFamily: 'PingFang',
  73. primaryColor: HexColor.fromHex('#FF4242'),
  74. accentColor: HexColor.fromHex('#FF4242'),
  75. ),
  76. routes: <String, WidgetBuilder>{
  77. '/homePage': (BuildContext context) => HomePage(),
  78. },
  79. navigatorKey: navigatorKey,
  80. localizationsDelegates: [
  81. RefreshLocalizations.delegate,
  82. GlobalMaterialLocalizations.delegate,
  83. GlobalWidgetsLocalizations.delegate,
  84. CommonLocalizationsDelegate(),
  85. ],
  86. supportedLocales: [
  87. const Locale('en'),
  88. const Locale('zh'),
  89. ],
  90. localeResolutionCallback: (Locale locale, Iterable<Locale> supportedLocales) {
  91. print("change language ${locale.toString()}");
  92. return locale;
  93. },
  94. home: GestureDetector(
  95. onTap: () {
  96. FocusScopeNode currentFocus = FocusScope.of(context);
  97. if (!currentFocus.hasPrimaryFocus && currentFocus.focusedChild != null) {
  98. FocusManager.instance.primaryFocus.unfocus();
  99. }
  100. },
  101. child: LaunchPage(
  102. // builder: (context) => HomePage(),
  103. ),
  104. ),
  105. ),
  106. );
  107. }
  108. }