main.dart 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import 'package:farmer_client/theme.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:get/get.dart';
  4. import 'package:get_storage/get_storage.dart';
  5. import 'package:flutter_screenutil/flutter_screenutil.dart';
  6. import 'package:flutter_localizations/flutter_localizations.dart';
  7. import 'models/index.dart';
  8. import 'routes/index.dart';
  9. void main() async {
  10. await GetStorage.init();
  11. runApp(const MyApp());
  12. }
  13. class MyApp extends StatelessWidget {
  14. const MyApp({Key? key}) : super(key: key);
  15. // This widget is the root of your application.
  16. @override
  17. Widget build(BuildContext context) {
  18. return ScreenUtilInit(
  19. designSize: const Size(375, 812),
  20. minTextAdapt: true,
  21. splitScreenMode: true,
  22. builder: (_) {
  23. return GetMaterialApp(
  24. localizationsDelegates: const [
  25. GlobalMaterialLocalizations.delegate,
  26. GlobalWidgetsLocalizations.delegate,
  27. GlobalCupertinoLocalizations.delegate,
  28. ],
  29. supportedLocales: [
  30. Locale('zh', ''),
  31. Locale('en', ''),
  32. ],
  33. theme: getTheme(),
  34. initialRoute: '/',
  35. defaultTransition: Transition.native,
  36. routingCallback: routingCallback,
  37. initialBinding: AppBindings(),
  38. getPages: pages,
  39. );
  40. },
  41. );
  42. }
  43. }