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.

88 lines
3.6 KiB

2 years ago
import 'package:bot_toast/bot_toast.dart';
import 'package:cloud_car_internal/constants/app_theme.dart';
2 years ago
import 'package:cloud_car_internal/providers/user_provider.dart';
import 'package:cloud_car_internal/ui/splash/splash.dart';
2 years ago
import 'package:cloud_car_internal/utils/api_client.dart';
import 'package:flutter/foundation.dart';
2 years ago
import 'package:flutter/material.dart';
2 years ago
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_ume/flutter_ume.dart'; // UME 框架
import 'package:flutter_ume_kit_ui/flutter_ume_kit_ui.dart'; // UI 插件包
import 'package:flutter_ume_kit_perf/flutter_ume_kit_perf.dart'; // 性能插件包
import 'package:flutter_ume_kit_show_code/flutter_ume_kit_show_code.dart'; // 代码查看插件包
import 'package:flutter_ume_kit_device/flutter_ume_kit_device.dart'; // 设备信息插件包
import 'package:flutter_ume_kit_console/flutter_ume_kit_console.dart'; // debugPrint 插件包
import 'package:flutter_ume_kit_dio/flutter_ume_kit_dio.dart'; // Dio 网络请求调试工具
2 years ago
import 'package:get/get_navigation/src/root/get_material_app.dart';
import 'package:provider/provider.dart';
2 years ago
void main() {
2 years ago
if (kDebugMode) {
PluginManager.instance // 注册插件
..register(const WidgetInfoInspector())
..register(const WidgetDetailInspector())
..register(const ColorSucker())
2 years ago
..register(AlignRuler())
..register(const ColorPicker()) // 新插件
..register(const TouchIndicator()) // 新插件
2 years ago
..register(Performance())
..register(const ShowCode())
..register(const MemoryInfoPage())
2 years ago
..register(CpuInfoPage())
..register(const DeviceInfoPanel())
2 years ago
..register(Console())
..register(DioInspector(dio: apiClient.dio));
runApp(const UMEWidget(enable: true, child: MyApp())); // 初始
2 years ago
} else {
runApp(const MyApp());
2 years ago
}
2 years ago
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
2 years ago
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
2 years ago
return MultiProvider(
providers: [
ChangeNotifierProvider(create: (context) => UserProvider()),
],
child: ScreenUtilInit(
designSize: const Size(750, 1334),
builder: (context) => GestureDetector(
onTap: () {
//点击输入框外部隐藏键盘⌨️
//只能响应点击非手势识别的组件
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus &&
currentFocus.focusedChild != null) {
FocusManager.instance.primaryFocus!.unfocus();
}
},
child: GetMaterialApp(
onGenerateTitle: (context) => '云云问车',
debugShowCheckedModeBanner: false,
theme: AppTheme.defaultTheme,
home: const SplashPage(),
2 years ago
supportedLocales: const [Locale('zh')],
locale: const Locale('zh'),
localizationsDelegates: GlobalMaterialLocalizations.delegates,
//builder: BotToastInit(),
builder: (context, child) {
ScreenUtil.setContext(context);
return MediaQuery(
//设置文字大小不随系统设置改变
data: MediaQueryData.fromWindow(WidgetsBinding.instance.window).copyWith(textScaleFactor: 1.0),
child: BotToastInit().call(context, child),
);
},
navigatorObservers: [BotToastNavigatorObserver()],
),
),
2 years ago
),
);
}
}