main.dart 1.6KB

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