Files
Neo_wallet/neowallet_mobile/lib/main.dart
nutchayut 5f810de336 bug fixed
2024-12-25 17:44:05 +07:00

101 lines
3.5 KiB
Dart

import 'dart:io';
import 'package:camera/camera.dart';
import 'package:cathaypay_mobile/Home/HomePage.dart';
import 'package:cathaypay_mobile/Login/Login.dart';
import 'package:cathaypay_mobile/Login/LoginValidate.dart';
import 'package:cathaypay_mobile/Register/policy.dart';
import 'package:cathaypay_mobile/Register/register.dart';
import 'package:cathaypay_mobile/Register/register_data.dart';
import 'package:cathaypay_mobile/Register/register_picture.dart';
import 'package:cathaypay_mobile/Register/register_signature.dart';
import 'package:cathaypay_mobile/custompaint.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:intl/date_symbol_data_local.dart';
import 'package:intl/intl.dart';
import 'Register/camera_card_id.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await EasyLocalization.ensureInitialized();
Intl.defaultLocale = "th";
initializeDateFormatting();
CameraApp = await availableCameras();
HttpOverrides.global = MyHttpOverrides();
runApp(
EasyLocalization(
supportedLocales: [Locale('en'), Locale('th')],
path: 'assets/translations', // <-- change the path of the translation files
fallbackLocale: Locale('th'),
child: MyApp()),
);
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async {
// Returning false prevents the back button action globally
return false;
},
child: MaterialApp(
// localizationsDelegates: const [
// GlobalMaterialLocalizations.delegate,
// GlobalWidgetsLocalizations.delegate,
// GlobalCupertinoLocalizations.delegate,
// ],
// supportedLocales: const [
// Locale('en', ''),
// Locale('th', ''),
// ],
localizationsDelegates: context.localizationDelegates,
supportedLocales: context.supportedLocales,
locale: context.locale,
debugShowCheckedModeBanner: false,
title: 'NEO TRAVEL',
theme: ThemeData(
primaryColor: Colors.blue,
textTheme: GoogleFonts.kanitTextTheme(
Theme.of(context).textTheme,
),
),
initialRoute: '/',
routes: {
// Login
'/': (context) => const LoginPage(),
'/LoginValidate': (context) => const LoginValidate(),
//Register
// '/RegisterPage': (context) => const RegisterPage(),
'/RegisterData': (context) => const RegisterData(),
// '/OtpPage': (context) => const OtpPage(),
'/PolicyPage': (context) => const PolicyPage(),
//'/PinCodePage': (context) => const PinCodePage(login: false,),
'/RegisterPicturePage': (context) => const RegisterPicturePage(),
'/RegisterSignaturePage': (context) => const RegisterSignaturePage(),
'/DrawScreen': (context) => DrawScreen(),
//Home
'/HomePage': (context) => const HomePage(),
}));
}
}
extension E on String {
String lastChars(int n) => substring(length - n);
}
class MyHttpOverrides extends HttpOverrides{
@override
HttpClient createHttpClient(SecurityContext? context){
return super.createHttpClient(context)
..badCertificateCallback = (X509Certificate cert, String host, int port)=> true;
}
}