final
This commit is contained in:
@@ -1,9 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:catcher/catcher.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:flutter_redux/flutter_redux.dart';
|
||||
import 'package:flutter_wisetronic/pages/buy_service.dart';
|
||||
@@ -14,12 +9,8 @@ import 'pages/create_online_store_1.dart';
|
||||
import 'pages/download.dart';
|
||||
import 'pages/me.dart';
|
||||
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||
import 'package:splashscreen/splashscreen.dart';
|
||||
// import 'package:uni_links/uni_links.dart';
|
||||
|
||||
import 'constants.dart';
|
||||
import 'events/eventbus.dart';
|
||||
import 'events/events.dart';
|
||||
import 'generated/l10n.dart';
|
||||
import 'pages/home.dart';
|
||||
import 'pages/plain_page.dart';
|
||||
@@ -34,20 +25,14 @@ import 'utils/utils.dart';
|
||||
|
||||
void main() {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
// Enable configureApp will cause route problem.
|
||||
// configureApp();
|
||||
setPathUrlStrategy();
|
||||
runApp(MyApp());
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
String _to = '/';
|
||||
|
||||
MyApp() {
|
||||
Routes.configure();
|
||||
Utils().init();
|
||||
Util().init();
|
||||
// getCurrentPosition();
|
||||
}
|
||||
|
||||
static getCurrentPosition() async {
|
||||
@@ -95,27 +80,8 @@ class MyApp extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
Widget _buildBody() {
|
||||
return SplashScreen(
|
||||
seconds: 5,
|
||||
routeName: _to,
|
||||
navigateAfterSeconds: Home(title: Constants.APP_TITLE,),
|
||||
styleTextUnderTheLoader: new TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 20.0,
|
||||
),
|
||||
imageBackground: (Image.network(Constants.BASE_API_URL + 'gallery/get-minimanager-splash/')).image,
|
||||
backgroundColor: Colors.white,
|
||||
onClick: () {
|
||||
|
||||
},
|
||||
loaderColor: Colors.blue,
|
||||
);
|
||||
}
|
||||
|
||||
return MaterialApp(
|
||||
debugShowCheckedModeBanner: Constants.DEBUG,
|
||||
navigatorKey: kIsWeb ? null : Catcher.navigatorKey,
|
||||
localizationsDelegates: [
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
@@ -124,20 +90,26 @@ class MyApp extends StatelessWidget {
|
||||
S.delegate,
|
||||
],
|
||||
supportedLocales: S.delegate.supportedLocales,
|
||||
localeResolutionCallback: (Locale locale, Iterable<Locale> supportedLocales) {
|
||||
print('Language code: ${locale.languageCode}, Country code: ${locale.countryCode}');
|
||||
for (final supportedLocale in supportedLocales) {
|
||||
if (supportedLocale.languageCode == locale.languageCode) {
|
||||
store.dispatch(UpdateLocale(locale));
|
||||
return supportedLocale;
|
||||
localeResolutionCallback: (Locale? locale, Iterable<Locale>? supportedLocales) {
|
||||
print('Language code: ${locale?.languageCode}, Country code: ${locale?.countryCode}');
|
||||
if (locale != null && supportedLocales != null) {
|
||||
for (final supportedLocale in supportedLocales) {
|
||||
if (supportedLocale.languageCode == locale.languageCode) {
|
||||
store.dispatch(UpdateLocale(locale));
|
||||
return supportedLocale;
|
||||
}
|
||||
}
|
||||
}
|
||||
store.dispatch(UpdateLocale(supportedLocales.first));
|
||||
store.dispatch(UpdateLocale(supportedLocales.first));
|
||||
return supportedLocales.first;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
onGenerateRoute: (RouteSettings settings) {
|
||||
final List<String> pathElements = settings.name.split('/');
|
||||
print('path elements: $pathElements');
|
||||
final uri = Uri.parse(settings.name!);
|
||||
final path = uri.path;
|
||||
print('path: $path');
|
||||
final List<String> pathElements = path.split('/');
|
||||
print('path elements --> $pathElements');
|
||||
if (pathElements[0] != '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user