Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

87 wiersze
3.0 KiB

  1. import 'package:demo001/generated/l10n.dart';
  2. import 'package:demo001/scenes/translate/TranslateScene.dart';
  3. import 'package:demo001/tools/color_utils.dart';
  4. import 'package:flutter/material.dart';
  5. import 'package:flutter_localizations/flutter_localizations.dart';
  6. import 'package:get/get.dart';
  7. import 'package:flutter_easyloading/flutter_easyloading.dart';
  8. void main() {
  9. WidgetsFlutterBinding.ensureInitialized();
  10. EasyLoading.instance
  11. ..indicatorType = EasyLoadingIndicatorType.threeBounce
  12. ..maskType = EasyLoadingMaskType.black
  13. ..progressColor = Colors.white
  14. ..backgroundColor = const Color.fromRGBO(38, 38, 38, 1)
  15. ..indicatorColor = Colors.white
  16. ..textColor = Colors.white
  17. ..userInteractions = false
  18. ..displayDuration = 1.5.seconds
  19. ..dismissOnTap = false;
  20. runApp(const MyApp());
  21. }
  22. class MyApp extends StatelessWidget {
  23. const MyApp({super.key});
  24. // This widget is the root of your application.
  25. @override
  26. Widget build(BuildContext context) {
  27. return GetMaterialApp(
  28. locale: Get.deviceLocale,
  29. fallbackLocale: Get.deviceLocale,
  30. title: '智能耳机',
  31. debugShowCheckedModeBanner: false,
  32. defaultTransition: Transition.rightToLeft,
  33. theme: ThemeData(
  34. colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
  35. useMaterial3: true,
  36. appBarTheme: const AppBarTheme(
  37. centerTitle: true,
  38. iconTheme: IconThemeData(color: whiteGrey),
  39. surfaceTintColor: white,
  40. shape: Border(bottom: BorderSide(color: lightBlue, width: 1)),
  41. backgroundColor: bgColor,
  42. ),
  43. scaffoldBackgroundColor: bgColor,
  44. splashColor: clean,
  45. highlightColor: clean,
  46. switchTheme: SwitchThemeData(
  47. trackOutlineColor: const WidgetStatePropertyAll(blue),
  48. trackColor: WidgetStateProperty.resolveWith((states) {
  49. if (states.contains(WidgetState.selected)) {
  50. return blue;
  51. } else {
  52. return silver.withOpacity(0.5);
  53. }
  54. }),
  55. thumbColor: WidgetStateProperty.resolveWith((states) {
  56. if (states.contains(WidgetState.selected)) {
  57. return white;
  58. } else {
  59. return silver;
  60. }
  61. }),
  62. trackOutlineWidth: const WidgetStatePropertyAll(0)),
  63. navigationBarTheme: NavigationBarThemeData()),
  64. localizationsDelegates: {
  65. S.delegate,
  66. GlobalMaterialLocalizations.delegate,
  67. GlobalCupertinoLocalizations.delegate,
  68. GlobalWidgetsLocalizations.delegate,
  69. },
  70. // supportedLocales: S.delegate.supportedLocales,
  71. home: TranslateScene(),
  72. builder: (context, widget) {
  73. final easyload = EasyLoading.init();
  74. var child = easyload(context, widget);
  75. return MediaQuery(
  76. data:
  77. MediaQuery.of(context).copyWith(textScaler: TextScaler.noScaling),
  78. child: child,
  79. );
  80. },
  81. );
  82. }
  83. }