64 lines
2.0 KiB
Dart
64 lines
2.0 KiB
Dart
|
|
import 'package:flutter/material.dart';
|
||
|
|
import 'package:flutter/services.dart';
|
||
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||
|
|
import 'package:get/get.dart';
|
||
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
||
|
|
|
||
|
|
import 'app/app.dart';
|
||
|
|
|
||
|
|
DBHelper dbHelper = DBHelper();
|
||
|
|
|
||
|
|
Future<void> main() async {
|
||
|
|
WidgetsFlutterBinding.ensureInitialized();
|
||
|
|
|
||
|
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||
|
|
|
||
|
|
final String? lang = prefs.getString(Constants.LOCALE);
|
||
|
|
|
||
|
|
await initLoginStatus();
|
||
|
|
|
||
|
|
runApp(ElektronikaShopApp(lang: lang));
|
||
|
|
}
|
||
|
|
|
||
|
|
class ElektronikaShopApp extends StatelessWidget {
|
||
|
|
final String? lang;
|
||
|
|
|
||
|
|
ElektronikaShopApp({required this.lang});
|
||
|
|
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
// SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
|
||
|
|
// systemNavigationBarColor: Colors.blue, // navigation bar color
|
||
|
|
// statusBarColor: Colors.transparent, // status bar color
|
||
|
|
// ));
|
||
|
|
// SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
|
||
|
|
// statusBarColor: ThemeColor.mainColor,
|
||
|
|
// ));
|
||
|
|
SystemChrome.setPreferredOrientations([
|
||
|
|
DeviceOrientation.portraitUp,
|
||
|
|
DeviceOrientation.portraitDown,
|
||
|
|
]);
|
||
|
|
return LayoutBuilder(
|
||
|
|
builder: (BuildContext context, BoxConstraints constraints) {
|
||
|
|
return ScreenUtilInit(
|
||
|
|
designSize: Size(constraints.maxWidth, constraints.maxHeight),
|
||
|
|
builder: (_, child) => GetMaterialApp(
|
||
|
|
initialRoute: lang == null ? AppRoutes.SPLASH : AppRoutes.DASHBOARD,
|
||
|
|
getPages: AppPages.list,
|
||
|
|
debugShowCheckedModeBanner: false,
|
||
|
|
locale: lang == null ? Locale('tm', 'TM') : Locale(lang!, lang!.toUpperCase()),
|
||
|
|
fallbackLocale: LocalizationService.fallbackLocale,
|
||
|
|
translations: LocalizationService(),
|
||
|
|
theme: AppTheme.light,
|
||
|
|
darkTheme: AppTheme.dark,
|
||
|
|
themeMode: ThemeMode.light, // ThemeMode.system
|
||
|
|
),
|
||
|
|
);
|
||
|
|
},
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// cd ios
|
||
|
|
//arch -x86_64 pod install
|
||
|
|
//arch -x86_64 pod install --repo-update
|