main.dart 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import 'package:electronic_assistant/resource/string_source.dart';
  2. import 'package:electronic_assistant/router/app_pages.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:flutter_screenutil/flutter_screenutil.dart';
  5. import 'package:get/get.dart';
  6. import 'package:get/get_navigation/src/root/get_material_app.dart';
  7. void main() {
  8. runApp(const MyApp());
  9. }
  10. class MyApp extends StatelessWidget {
  11. const MyApp({super.key});
  12. // This widget is the root of your application.
  13. @override
  14. Widget build(BuildContext context) {
  15. return ScreenUtilInit(
  16. designSize: const Size(360, 800),
  17. builder: (_, child) {
  18. return _buildMaterialApp();
  19. },
  20. );
  21. }
  22. _buildMaterialApp() {
  23. return GetMaterialApp(
  24. title: 'Flutter Demo',
  25. getPages: AppPage.pages,
  26. initialRoute: RoutePath.splash,
  27. initialBinding: AppBinding(),
  28. theme: ThemeData(
  29. colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
  30. useMaterial3: true,
  31. ),
  32. translations: StringResource(),
  33. // 你的翻译
  34. locale: const Locale('zh', 'CN'),
  35. // 将会按照此处指定的语言翻译
  36. fallbackLocale: const Locale('zh', 'CN'), // 添加一个回调语言选项,以备上面指定的语言翻译不存在
  37. );
  38. }
  39. }