import 'package:farmer_client/theme.dart';
import 'package:farmer_client/utils/location.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:get_storage/get_storage.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'package:flutter_localizations/flutter_localizations.dart';

import 'models/index.dart';
import 'routes/index.dart';

void main() async {
  await GetStorage.init();

  // // 高德地图隐私生命
  // showPrivacy();

  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return ScreenUtilInit(
      designSize: const Size(375, 812),
      minTextAdapt: true,
      splitScreenMode: true,
      builder: (_) {
        return GetMaterialApp(
          localizationsDelegates: const [
            GlobalMaterialLocalizations.delegate,
            GlobalWidgetsLocalizations.delegate,
            GlobalCupertinoLocalizations.delegate,
          ],
          supportedLocales: [
            Locale('zh', ''),
            Locale('en', ''),
          ],
          theme: getTheme(),
          initialRoute: '/',
          defaultTransition: Transition.native,
          routingCallback: routingCallback,
          initialBinding: AppBindings(),
          getPages: pages,
        );
      },
    );
  }
}
