| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- import 'package:flutter/material.dart';
- import 'package:flutter_localizations/flutter_localizations.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
- import 'package:get/get_navigation/src/root/get_material_app.dart';
- import 'package:location/resource/colors.gen.dart';
- import 'package:location/resource/string.gen.dart';
- import 'package:location/resource/string_source.dart';
- import 'package:location/router/app_pages.dart';
- import 'package:pull_to_refresh/pull_to_refresh.dart';
- import 'base/get_it.dart';
- void main() async {
- WidgetsFlutterBinding.ensureInitialized();
- configureDependencies();
- runApp(const MyApp());
- }
- class MyApp extends StatelessWidget {
- const MyApp({super.key});
- @override
- Widget build(BuildContext context) {
- return ScreenUtilInit(
- designSize: const Size(360, 640),
- builder: (_, child) {
- return _buildMaterialApp();
- },
- );
- }
- _buildMaterialApp() {
- return RefreshConfiguration(
- headerBuilder:
- () => const MaterialClassicHeader(color: ColorName.colorPrimary),
- footerBuilder:
- () => ClassicFooter(
- canLoadingText: StringName.loadingMore,
- idleText: StringName.loadPullUp,
- loadingText: StringName.loadingTxt,
- noDataText: StringName.loadNoData,
- failedText: StringName.loadFailed,
- ),
- child: GetMaterialApp(
- onGenerateTitle: (_) => StringName.appName,
- getPages: AppPage.pages,
- initialRoute: RoutePath.splash,
- initialBinding: AppBinding(),
- theme: ThemeData(
- useMaterial3: true,
- textSelectionTheme: const TextSelectionThemeData(
- cursorColor: ColorName.colorPrimary, // 设置默认光标颜色
- selectionHandleColor: ColorName.colorPrimary, // 设置光标下面水滴的颜色
- ),
- ),
- navigatorObservers: [FlutterSmartDialog.observer],
- builder: FlutterSmartDialog.init(),
- translations: StringResource(),
- localizationsDelegates: const [
- GlobalMaterialLocalizations.delegate,
- //是Flutter的一个本地化委托,用于提供Material组件库的本地化支持
- GlobalWidgetsLocalizations.delegate,
- //用于提供通用部件(Widgets)的本地化支持
- GlobalCupertinoLocalizations.delegate,
- //用于提供Cupertino风格的组件的本地化支持
- ],
- supportedLocales: const [
- Locale('zh', 'CN'), // 支持的语言和地区
- ],
- // 你的翻译
- locale: const Locale('zh', 'CN'),
- // 将会按照此处指定的语言翻译 添加一个回调语言选项,以备上面指定的语言翻译不存在
- fallbackLocale: const Locale('zh', 'CN'),
- ),
- );
- }
- }
|