adding i18n base project
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../../Utils/color_constants.dart';
|
||||
import '../../l10n/app_localizations.dart';
|
||||
import '../../providers/token_manager.dart';
|
||||
import '../../utilities/make_api_request.dart';
|
||||
import '../main_app_screen/tabbed_layout_component.dart';
|
||||
@@ -60,8 +61,9 @@ class LoginFormComponentState extends State<LoginFormComponent> {
|
||||
}
|
||||
// ignore: use_build_context_synchronously
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(const SnackBar(
|
||||
content: Text("Login Successful"),
|
||||
.showSnackBar(SnackBar(
|
||||
content:
|
||||
Text(AppLocalizations.of(context)!.loginSuccessful),
|
||||
backgroundColor: Colors.green,
|
||||
))
|
||||
.closed
|
||||
@@ -135,8 +137,8 @@ class LoginFormComponentState extends State<LoginFormComponent> {
|
||||
textInputAction: TextInputAction.next,
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
errorMessageSetter(
|
||||
1, 'You must provide an email or username');
|
||||
errorMessageSetter(1,
|
||||
AppLocalizations.of(context)!.provideEmailOrUsername);
|
||||
} else {
|
||||
errorMessageSetter(1, "");
|
||||
|
||||
@@ -148,7 +150,7 @@ class LoginFormComponentState extends State<LoginFormComponent> {
|
||||
return null;
|
||||
},
|
||||
autocorrect: false,
|
||||
decoration: const InputDecoration(
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
border: InputBorder.none,
|
||||
focusedBorder: InputBorder.none,
|
||||
@@ -157,7 +159,8 @@ class LoginFormComponentState extends State<LoginFormComponent> {
|
||||
disabledBorder: InputBorder.none,
|
||||
contentPadding:
|
||||
EdgeInsets.only(left: 15, bottom: 11, top: 11, right: 15),
|
||||
hintText: "Username or email address",
|
||||
hintText:
|
||||
AppLocalizations.of(context)!.usernameOrEmailHint,
|
||||
hintStyle: TextStyle(fontSize: 16, color: Color(0xFF929BAB)),
|
||||
),
|
||||
style: const TextStyle(fontSize: 16, color: Color(0xFF929BAB)),
|
||||
@@ -199,7 +202,8 @@ class LoginFormComponentState extends State<LoginFormComponent> {
|
||||
onFieldSubmitted: (value) => _validateLoginDetails(),
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
errorMessageSetter(2, 'Password cannot be empty');
|
||||
errorMessageSetter(
|
||||
2, AppLocalizations.of(context)!.passwordEmpty);
|
||||
} else {
|
||||
errorMessageSetter(2, "");
|
||||
setState(() {
|
||||
@@ -219,7 +223,7 @@ class LoginFormComponentState extends State<LoginFormComponent> {
|
||||
disabledBorder: InputBorder.none,
|
||||
contentPadding: const EdgeInsets.only(
|
||||
left: 15, bottom: 11, top: 11, right: 15),
|
||||
hintText: "Password",
|
||||
hintText: AppLocalizations.of(context)!.password,
|
||||
hintStyle:
|
||||
const TextStyle(fontSize: 16, color: Color(0xFF929BAB)),
|
||||
suffixIcon: IconButton(
|
||||
@@ -246,7 +250,7 @@ class LoginFormComponentState extends State<LoginFormComponent> {
|
||||
),
|
||||
CheckboxListTile(
|
||||
activeColor: ColorConstant.blue700,
|
||||
title: const Text('Stay Logged In'),
|
||||
title: Text(AppLocalizations.of(context)!.stayLoggedIn),
|
||||
value: stayLoggedIn,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
@@ -266,8 +270,8 @@ class LoginFormComponentState extends State<LoginFormComponent> {
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
),
|
||||
child: const Text(
|
||||
'Log in',
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.logIn,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.white,
|
||||
@@ -323,8 +327,9 @@ class LoginFormComponentState extends State<LoginFormComponent> {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
if (errorMessage1 != "" || errorMessage2 != "") {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Please provide all required details'),
|
||||
SnackBar(
|
||||
content: Text(
|
||||
AppLocalizations.of(context)!.provideRequiredDetails),
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
);
|
||||
@@ -332,7 +337,7 @@ class LoginFormComponentState extends State<LoginFormComponent> {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
onVisible: tryLoggingIn,
|
||||
content: const Text('Processing...'),
|
||||
content: Text(AppLocalizations.of(context)!.processing),
|
||||
backgroundColor: Colors.blue,
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user