Init home feature add presentation layer
This commit is contained in:
@@ -0,0 +1,22 @@
|
|||||||
|
import 'package:core/core.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
import 'package:tmail_ui_user/features/home/presentation/home_controller.dart';
|
||||||
|
import 'package:tmail_ui_user/features/login/data/repository/credential_repository_impl.dart';
|
||||||
|
import 'package:tmail_ui_user/features/login/domain/repository/credential_repository.dart';
|
||||||
|
import 'package:tmail_ui_user/features/login/domain/usecases/get_credential_interactor.dart';
|
||||||
|
|
||||||
|
class HomeBindings extends Bindings {
|
||||||
|
@override
|
||||||
|
void dependencies() {
|
||||||
|
Get.lazyPut(() => CredentialRepositoryImpl(Get.find<SharedPreferences>()));
|
||||||
|
Get.lazyPut<CredentialRepository>(() => Get.find<CredentialRepositoryImpl>());
|
||||||
|
|
||||||
|
Get.lazyPut(() => GetCredentialInteractor(Get.find<CredentialRepository>()));
|
||||||
|
|
||||||
|
Get.lazyPut(() => HomeController(
|
||||||
|
Get.find<GetCredentialInteractor>(),
|
||||||
|
Get.find<DynamicUrlInterceptors>(),
|
||||||
|
Get.find<AuthorizationInterceptors>()));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
import 'package:core/core.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:tmail_ui_user/features/login/domain/state/get_credential_state.dart';
|
||||||
|
import 'package:tmail_ui_user/features/login/domain/usecases/get_credential_interactor.dart';
|
||||||
|
import 'package:tmail_ui_user/main/routes/app_routes.dart';
|
||||||
|
|
||||||
|
class HomeController extends GetxController {
|
||||||
|
final GetCredentialInteractor _getCredentialInteractor;
|
||||||
|
final DynamicUrlInterceptors _dynamicUrlInterceptors;
|
||||||
|
final AuthorizationInterceptors _authorizationInterceptors;
|
||||||
|
|
||||||
|
HomeController(this._getCredentialInteractor, this._dynamicUrlInterceptors, this._authorizationInterceptors);
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onReady() {
|
||||||
|
super.onReady();
|
||||||
|
_getCredentialAction();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _getCredentialAction() async {
|
||||||
|
await _getCredentialInteractor.execute()
|
||||||
|
.then((response) => response.fold(
|
||||||
|
(failure) => _goToLogin(),
|
||||||
|
(success) => success is GetCredentialViewState ? _goToMailbox(success) : _goToLogin()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void _goToLogin() {
|
||||||
|
Get.offNamed(AppRoutes.LOGIN);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _goToMailbox(GetCredentialViewState credentialViewState) {
|
||||||
|
_dynamicUrlInterceptors.changeBaseUrl(credentialViewState.baseUrl.origin);
|
||||||
|
_authorizationInterceptors.changeAuthorization(
|
||||||
|
credentialViewState.userName.userName,
|
||||||
|
credentialViewState.password.value,
|
||||||
|
);
|
||||||
|
Get.offNamed(AppRoutes.MAILBOX);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import 'package:core/core.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:tmail_ui_user/features/home/presentation/home_controller.dart';
|
||||||
|
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||||
|
|
||||||
|
class HomeView extends GetWidget<HomeController> {
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: AppColor.primaryColor,
|
||||||
|
body: SafeArea(
|
||||||
|
child: Center(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(AppLocalizations.of(context).initializing_data, style: TextStyle(color: Colors.white, fontSize: 17)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
{
|
||||||
|
"@@last_modified": "2021-07-01T16:29:46.979874",
|
||||||
|
"initializing_data": "Initializing data...",
|
||||||
|
"@initializing_data": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"login_text_slogan": "TMail",
|
||||||
|
"@login_text_slogan": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"prefix_https": "https://",
|
||||||
|
"@prefix_https": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"username": "username",
|
||||||
|
"@username": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"password": "password",
|
||||||
|
"@password": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"login": "Login",
|
||||||
|
"@login": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"login_text_login_to_continue": "Please login to continue",
|
||||||
|
"@login_text_login_to_continue": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"unknown_error_login_message": "Unknown error occurred, please try again",
|
||||||
|
"@unknown_error_login_message": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"search_folder": "Search folder",
|
||||||
|
"@search_folder": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"storage": "STORAGE",
|
||||||
|
"@storage": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"my_folders": "MY FOLDERS",
|
||||||
|
"@my_folders": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"new_folder": "New folder",
|
||||||
|
"@new_folder": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
{
|
||||||
|
"@@last_modified": "2021-07-01T16:29:46.979874",
|
||||||
|
"initializing_data": "Initializing data...",
|
||||||
|
"@initializing_data": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"login_text_slogan": "TMail",
|
||||||
|
"@login_text_slogan": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"prefix_https": "https://",
|
||||||
|
"@prefix_https": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"username": "username",
|
||||||
|
"@username": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"password": "password",
|
||||||
|
"@password": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"login": "Login",
|
||||||
|
"@login": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"login_text_login_to_continue": "Please login to continue",
|
||||||
|
"@login_text_login_to_continue": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"unknown_error_login_message": "Unknown error occurred, please try again",
|
||||||
|
"@unknown_error_login_message": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"search_folder": "Search folder",
|
||||||
|
"@search_folder": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"storage": "STORAGE",
|
||||||
|
"@storage": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"my_folders": "MY FOLDERS",
|
||||||
|
"@my_folders": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"new_folder": "New folder",
|
||||||
|
"@new_folder": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
{
|
||||||
|
"@@last_modified": "2021-07-23T09:09:13.997889",
|
||||||
|
"initializing_data": "Initializing data...",
|
||||||
|
"@initializing_data": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"login_text_slogan": "TMail",
|
||||||
|
"@login_text_slogan": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"prefix_https": "https://",
|
||||||
|
"@prefix_https": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"username": "username",
|
||||||
|
"@username": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"password": "password",
|
||||||
|
"@password": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"login": "Login",
|
||||||
|
"@login": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"login_text_login_to_continue": "Please login to continue",
|
||||||
|
"@login_text_login_to_continue": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"unknown_error_login_message": "Unknown error occurred, please try again",
|
||||||
|
"@unknown_error_login_message": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"search_folder": "Search folder",
|
||||||
|
"@search_folder": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"storage": "STORAGE",
|
||||||
|
"@storage": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"my_folders": "MY FOLDERS",
|
||||||
|
"@my_folders": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"new_folder": "New folder",
|
||||||
|
"@new_folder": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
{
|
||||||
|
"@@last_modified": "2021-07-01T16:29:46.979874",
|
||||||
|
"initializing_data": "Initializing data...",
|
||||||
|
"@initializing_data": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"login_text_slogan": "TMail",
|
||||||
|
"@login_text_slogan": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"prefix_https": "https://",
|
||||||
|
"@prefix_https": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"username": "username",
|
||||||
|
"@username": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"password": "password",
|
||||||
|
"@password": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"login": "Login",
|
||||||
|
"@login": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"login_text_login_to_continue": "Please login to continue",
|
||||||
|
"@login_text_login_to_continue": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"unknown_error_login_message": "Unknown error occurred, please try again",
|
||||||
|
"@unknown_error_login_message": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"search_folder": "Search folder",
|
||||||
|
"@search_folder": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"storage": "STORAGE",
|
||||||
|
"@storage": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"my_folders": "MY FOLDERS",
|
||||||
|
"@my_folders": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"new_folder": "New folder",
|
||||||
|
"@new_folder": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
{
|
||||||
|
"@@last_modified": "2021-07-01T16:29:46.979874",
|
||||||
|
"initializing_data": "Initializing data...",
|
||||||
|
"@initializing_data": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"login_text_slogan": "TMail",
|
||||||
|
"@login_text_slogan": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"prefix_https": "https://",
|
||||||
|
"@prefix_https": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"username": "username",
|
||||||
|
"@username": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"password": "password",
|
||||||
|
"@password": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"login": "Login",
|
||||||
|
"@login": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"login_text_login_to_continue": "Please login to continue",
|
||||||
|
"@login_text_login_to_continue": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"unknown_error_login_message": "Unknown error occurred, please try again",
|
||||||
|
"@unknown_error_login_message": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"search_folder": "Search folder",
|
||||||
|
"@search_folder": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"storage": "STORAGE",
|
||||||
|
"@storage": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"my_folders": "MY FOLDERS",
|
||||||
|
"@my_folders": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"new_folder": "New folder",
|
||||||
|
"@new_folder": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
import 'package:core/core.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
|
class CoreBindings extends Bindings {
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future dependencies() async {
|
||||||
|
await _bindingSharePreference();
|
||||||
|
_bindingAppImagePaths();
|
||||||
|
_bindingResponsiveManager();
|
||||||
|
_bindingKeyboardManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _bindingAppImagePaths() {
|
||||||
|
Get.put(ImagePaths());
|
||||||
|
}
|
||||||
|
|
||||||
|
void _bindingResponsiveManager() {
|
||||||
|
Get.put(ResponsiveUtils());
|
||||||
|
}
|
||||||
|
|
||||||
|
Future _bindingSharePreference() async {
|
||||||
|
await Get.putAsync(() async => await SharedPreferences.getInstance(), permanent: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _bindingKeyboardManager() {
|
||||||
|
Get.put(KeyboardUtils());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:tmail_ui_user/main/bindings/core/core_bindings.dart';
|
||||||
|
import 'package:tmail_ui_user/main/bindings/network/network_bindings.dart';
|
||||||
|
|
||||||
|
class MainBindings extends Bindings {
|
||||||
|
@override
|
||||||
|
Future dependencies() async {
|
||||||
|
await CoreBindings().dependencies();
|
||||||
|
NetworkBindings().dependencies();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:core/core.dart';
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:jmap_dart_client/http/http_client.dart' as JmapHttpClient;
|
||||||
|
import 'package:tmail_ui_user/features/login/data/network/login_api.dart';
|
||||||
|
import 'package:tmail_ui_user/features/mailbox/data/network/mailbox_api.dart';
|
||||||
|
|
||||||
|
class NetworkBindings extends Bindings {
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dependencies() {
|
||||||
|
_bindingDio();
|
||||||
|
_bindingApi();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _bindingBaseOption() {
|
||||||
|
final headers = <String, dynamic>{
|
||||||
|
HttpHeaders.acceptHeader: Constant.acceptHeaderDefault,
|
||||||
|
HttpHeaders.contentTypeHeader: Constant.contentTypeHeaderDefault
|
||||||
|
};
|
||||||
|
Get.put(BaseOptions(headers: headers));
|
||||||
|
}
|
||||||
|
|
||||||
|
void _bindingDio() {
|
||||||
|
_bindingBaseOption();
|
||||||
|
Get.put(Dio(Get.find<BaseOptions>()));
|
||||||
|
_bindingInterceptors();
|
||||||
|
Get.find<Dio>().interceptors.add(Get.find<DynamicUrlInterceptors>());
|
||||||
|
Get.find<Dio>().interceptors.add(Get.find<AuthorizationInterceptors>());
|
||||||
|
if (kDebugMode) {
|
||||||
|
Get.find<Dio>().interceptors.add(LogInterceptor(requestBody: true));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _bindingInterceptors() {
|
||||||
|
Get.put(DynamicUrlInterceptors());
|
||||||
|
Get.put(AuthorizationInterceptors());
|
||||||
|
}
|
||||||
|
|
||||||
|
void _bindingApi() {
|
||||||
|
Get.put(DioClient(Get.find<Dio>()));
|
||||||
|
Get.put(JmapHttpClient.HttpClient(Get.find<Dio>()));
|
||||||
|
Get.put(LoginAPI(Get.find<DioClient>()));
|
||||||
|
Get.put(MailboxAPI(Get.find<JmapHttpClient.HttpClient>()));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:tmail_ui_user/l10n/messages_all.dart';
|
||||||
|
|
||||||
|
class AppLocalizations {
|
||||||
|
|
||||||
|
static AppLocalizations of(BuildContext context) {
|
||||||
|
return Localizations.of<AppLocalizations>(context, AppLocalizations)!;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<AppLocalizations> load(Locale locale) async {
|
||||||
|
final name = locale.countryCode == null ? locale.languageCode : locale.toString();
|
||||||
|
|
||||||
|
final localeName = Intl.canonicalizedLocale(name);
|
||||||
|
|
||||||
|
return initializeMessages(localeName).then((_) {
|
||||||
|
Intl.defaultLocale = localeName;
|
||||||
|
return AppLocalizations();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
String get initializing_data {
|
||||||
|
return Intl.message('Initializing data...',
|
||||||
|
name: 'initializing_data');
|
||||||
|
}
|
||||||
|
|
||||||
|
String get login_text_slogan {
|
||||||
|
return Intl.message('TMail',
|
||||||
|
name: 'login_text_slogan');
|
||||||
|
}
|
||||||
|
|
||||||
|
String get prefix_https {
|
||||||
|
return Intl.message('https://',
|
||||||
|
name: 'prefix_https');
|
||||||
|
}
|
||||||
|
|
||||||
|
String get username {
|
||||||
|
return Intl.message('username',
|
||||||
|
name: 'username');
|
||||||
|
}
|
||||||
|
|
||||||
|
String get password {
|
||||||
|
return Intl.message('password',
|
||||||
|
name: 'password');
|
||||||
|
}
|
||||||
|
|
||||||
|
String get login {
|
||||||
|
return Intl.message('Login',
|
||||||
|
name: 'login');
|
||||||
|
}
|
||||||
|
|
||||||
|
String get login_text_login_to_continue {
|
||||||
|
return Intl.message('Please login to continue',
|
||||||
|
name: 'login_text_login_to_continue');
|
||||||
|
}
|
||||||
|
|
||||||
|
String get unknown_error_login_message {
|
||||||
|
return Intl.message('Unknown error occurred, please try again',
|
||||||
|
name: 'unknown_error_login_message');
|
||||||
|
}
|
||||||
|
|
||||||
|
String get search_folder {
|
||||||
|
return Intl.message(
|
||||||
|
'Search folder',
|
||||||
|
name: 'search_folder',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
String get storage {
|
||||||
|
return Intl.message(
|
||||||
|
'STORAGE',
|
||||||
|
name: 'storage',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
String get my_folders {
|
||||||
|
return Intl.message(
|
||||||
|
'MY FOLDERS',
|
||||||
|
name: 'my_folders',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
String get new_folder {
|
||||||
|
return Intl.message(
|
||||||
|
'New folder',
|
||||||
|
name: 'new_folder',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||||
|
|
||||||
|
class AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> {
|
||||||
|
const AppLocalizationsDelegate();
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool isSupported(Locale locale) {
|
||||||
|
return ['en', 'vi', 'fr', 'ru'].contains(locale.languageCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<AppLocalizations> load(Locale locale) async {
|
||||||
|
return AppLocalizations.load(locale);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool shouldReload(covariant LocalizationsDelegate<AppLocalizations> old) => false;
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
import 'package:core/core.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:tmail_ui_user/main/bindings/main_bindings.dart';
|
||||||
|
import 'package:tmail_ui_user/main/localizations/app_localizations_delegate.dart';
|
||||||
|
import 'package:tmail_ui_user/main/pages/app_pages.dart';
|
||||||
|
import 'package:tmail_ui_user/main/routes/app_routes.dart';
|
||||||
|
|
||||||
|
void main() async {
|
||||||
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
await MainBindings().dependencies();
|
||||||
|
runApp(TMailApp());
|
||||||
|
}
|
||||||
|
|
||||||
|
class TMailApp extends StatelessWidget {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return GetMaterialApp(
|
||||||
|
debugShowCheckedModeBanner: false,
|
||||||
|
theme: appTheme(),
|
||||||
|
supportedLocales: [
|
||||||
|
Locale('en'),
|
||||||
|
Locale('vi'),
|
||||||
|
Locale('ru'),
|
||||||
|
Locale('fr')
|
||||||
|
],
|
||||||
|
localizationsDelegates: [
|
||||||
|
AppLocalizationsDelegate(),
|
||||||
|
GlobalMaterialLocalizations.delegate,
|
||||||
|
GlobalWidgetsLocalizations.delegate,
|
||||||
|
GlobalCupertinoLocalizations.delegate,
|
||||||
|
],
|
||||||
|
localeResolutionCallback: (deviceLocale, supportedLocales) {
|
||||||
|
for (var locale in supportedLocales) {
|
||||||
|
if (locale.languageCode == deviceLocale?.languageCode) {
|
||||||
|
return deviceLocale;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return supportedLocales.first;
|
||||||
|
},
|
||||||
|
defaultTransition: Transition.fade,
|
||||||
|
initialRoute: AppRoutes.HOME,
|
||||||
|
getPages: AppPages.pages);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import 'package:get/get_navigation/src/routes/get_route.dart';
|
||||||
|
import 'package:tmail_ui_user/features/home/presentation/home_bindings.dart';
|
||||||
|
import 'package:tmail_ui_user/features/home/presentation/home_view.dart';
|
||||||
|
import 'package:tmail_ui_user/features/login/presentation/login_bindings.dart';
|
||||||
|
import 'package:tmail_ui_user/features/login/presentation/login_view.dart';
|
||||||
|
import 'package:tmail_ui_user/features/mailbox/presentation/mailbox_bindings.dart';
|
||||||
|
import 'package:tmail_ui_user/features/mailbox/presentation/mailbox_view.dart';
|
||||||
|
import 'package:tmail_ui_user/main/routes/app_routes.dart';
|
||||||
|
|
||||||
|
class AppPages {
|
||||||
|
static final pages = [
|
||||||
|
GetPage(
|
||||||
|
name: AppRoutes.HOME,
|
||||||
|
page: () => HomeView(),
|
||||||
|
binding: HomeBindings()),
|
||||||
|
GetPage(
|
||||||
|
name: AppRoutes.LOGIN,
|
||||||
|
page: () => LoginView(),
|
||||||
|
binding: LoginBindings()),
|
||||||
|
GetPage(
|
||||||
|
name: AppRoutes.MAILBOX,
|
||||||
|
page: () => MailboxView(),
|
||||||
|
binding: MailboxBindings()),
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
abstract class AppRoutes {
|
||||||
|
static const HOME = '/';
|
||||||
|
static const LOGIN = '/login';
|
||||||
|
static const MAILBOX = '/mailbox';
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user