12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. GetStorage box = GetStorage();
  19. return ScreenUtilInit(
  20. designSize: const Size(375, 812),
  21. minTextAdapt: true,
  22. splitScreenMode: true,
  23. builder: (_) {
  24. return GetMaterialApp(
  25. localizationsDelegates: const [
  26. GlobalMaterialLocalizations.delegate,
  27. GlobalWidgetsLocalizations.delegate,
  28. GlobalCupertinoLocalizations.delegate,
  29. ],
  30. supportedLocales: [
  31. Locale('zh', ''),
  32. Locale('en', ''),
  33. ],
  34. theme: getTheme(),
  35. initialRoute: '/splash',
  36. defaultTransition: Transition.native,
  37. routingCallback: routingCallback,
  38. initialBinding: AppBindings(),
  39. getPages: pages,
  40. );
  41. },
  42. );
  43. }
  44. }