feat: lang
This commit is contained in:
+4
-3
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../../../../application/user/change_password_form/change_password_form_bloc.dart';
|
||||
import '../../../../../common/extension/extension.dart';
|
||||
import '../../../../../common/theme/theme.dart';
|
||||
import '../../../../../injection.dart';
|
||||
import '../../../../components/appbar/appbar.dart';
|
||||
@@ -39,7 +40,7 @@ class _ProfileChangePasswordPageState extends State<ProfileChangePasswordPage> {
|
||||
(f) => AppFlushbar.showUserFailureToast(context, f),
|
||||
(user) {
|
||||
if (context.mounted) {
|
||||
AppFlushbar.showSuccess(context, 'Password changed');
|
||||
AppFlushbar.showSuccess(context, context.lang.password_changed);
|
||||
Future.delayed(const Duration(seconds: 2), () {
|
||||
context.router.back();
|
||||
});
|
||||
@@ -59,7 +60,7 @@ class _ProfileChangePasswordPageState extends State<ProfileChangePasswordPage> {
|
||||
pinned: true,
|
||||
elevation: 0,
|
||||
backgroundColor: AppColor.primary,
|
||||
flexibleSpace: CustomAppBar(title: 'Change Password'),
|
||||
flexibleSpace: CustomAppBar(title: context.lang.change_password),
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child:
|
||||
@@ -83,7 +84,7 @@ class _ProfileChangePasswordPageState extends State<ProfileChangePasswordPage> {
|
||||
ChangePasswordNewPassword(),
|
||||
SpaceHeight(24),
|
||||
AppElevatedButton(
|
||||
text: 'Save',
|
||||
text: context.lang.save,
|
||||
isLoading: state.isSubmitting,
|
||||
onPressed: () {
|
||||
context.read<ChangePasswordFormBloc>().add(
|
||||
|
||||
+4
-3
@@ -3,6 +3,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:line_icons/line_icons.dart';
|
||||
|
||||
import '../../../../../../application/user/change_password_form/change_password_form_bloc.dart';
|
||||
import '../../../../../../common/extension/extension.dart';
|
||||
import '../../../../../components/field/field.dart';
|
||||
|
||||
class ChangePasswordCurrentPassword extends StatelessWidget {
|
||||
@@ -11,9 +12,9 @@ class ChangePasswordCurrentPassword extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppPasswordTextFormField(
|
||||
title: 'Current Password',
|
||||
title: context.lang.current_password,
|
||||
prefixIcon: LineIcons.lock,
|
||||
hintText: 'Please enter your current password',
|
||||
hintText: context.lang.current_password_placeholder,
|
||||
onChanged: (value) => context.read<ChangePasswordFormBloc>().add(
|
||||
ChangePasswordFormEvent.currentPasswordChanged(value),
|
||||
),
|
||||
@@ -23,7 +24,7 @@ class ChangePasswordCurrentPassword extends StatelessWidget {
|
||||
.state
|
||||
.currentPassword
|
||||
.isEmpty) {
|
||||
return 'Please enter your current password';
|
||||
return context.lang.current_password_placeholder;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
+5
-4
@@ -3,6 +3,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:line_icons/line_icons.dart';
|
||||
|
||||
import '../../../../../../application/user/change_password_form/change_password_form_bloc.dart';
|
||||
import '../../../../../../common/extension/extension.dart';
|
||||
import '../../../../../components/field/field.dart';
|
||||
|
||||
class ChangePasswordNewPassword extends StatelessWidget {
|
||||
@@ -11,20 +12,20 @@ class ChangePasswordNewPassword extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppPasswordTextFormField(
|
||||
title: 'New Password',
|
||||
title: context.lang.new_password,
|
||||
prefixIcon: LineIcons.lock,
|
||||
hintText: 'Please enter your new password',
|
||||
hintText: context.lang.new_password_placeholder,
|
||||
onChanged: (value) => context.read<ChangePasswordFormBloc>().add(
|
||||
ChangePasswordFormEvent.newPasswordChanged(value),
|
||||
),
|
||||
validator: (value) {
|
||||
if (context.read<ChangePasswordFormBloc>().state.newPassword.isEmpty) {
|
||||
return 'Please enter your new password';
|
||||
return context.lang.new_password_placeholder;
|
||||
}
|
||||
|
||||
if (context.read<ChangePasswordFormBloc>().state.newPassword ==
|
||||
context.read<ChangePasswordFormBloc>().state.currentPassword) {
|
||||
return 'New password cannot be same as current password';
|
||||
return context.lang.new_password_not_same;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../../../../application/auth/auth_bloc.dart';
|
||||
import '../../../../../application/user/user_edit_form/user_edit_form_bloc.dart';
|
||||
import '../../../../../common/extension/extension.dart';
|
||||
import '../../../../../common/theme/theme.dart';
|
||||
import '../../../../../domain/user/user.dart';
|
||||
import '../../../../../injection.dart';
|
||||
@@ -64,7 +65,7 @@ class _ProfileEditPageState extends State<ProfileEditPage> {
|
||||
pinned: true,
|
||||
elevation: 0,
|
||||
backgroundColor: AppColor.primary,
|
||||
flexibleSpace: CustomAppBar(title: 'Profile Edit'),
|
||||
flexibleSpace: CustomAppBar(title: context.lang.edit_profile),
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: BlocBuilder<UserEditFormBloc, UserEditFormState>(
|
||||
@@ -85,7 +86,7 @@ class _ProfileEditPageState extends State<ProfileEditPage> {
|
||||
ProfileEditNameField(controller: nameController),
|
||||
SpaceHeight(24),
|
||||
AppElevatedButton(
|
||||
text: 'Save',
|
||||
text: context.lang.save,
|
||||
isLoading: state.isSubmitting,
|
||||
onPressed: () {
|
||||
context.read<UserEditFormBloc>().add(
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:line_icons/line_icons.dart';
|
||||
|
||||
import '../../../../../../application/user/user_edit_form/user_edit_form_bloc.dart';
|
||||
import '../../../../../../common/extension/extension.dart';
|
||||
import '../../../../../components/field/field.dart';
|
||||
|
||||
class ProfileEditNameField extends StatelessWidget {
|
||||
@@ -12,9 +13,9 @@ class ProfileEditNameField extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppTextFormField(
|
||||
title: 'Name',
|
||||
title: context.lang.name,
|
||||
prefixIcon: LineIcons.user,
|
||||
hintText: 'Please enter your name',
|
||||
hintText: context.lang.name_placeholder,
|
||||
controller: controller,
|
||||
onChanged: (value) {
|
||||
context.read<UserEditFormBloc>().add(
|
||||
@@ -23,7 +24,7 @@ class ProfileEditNameField extends StatelessWidget {
|
||||
},
|
||||
validator: (value) {
|
||||
if (context.read<UserEditFormBloc>().state.name.isEmpty) {
|
||||
return 'Please enter your name';
|
||||
return context.lang.name_placeholder;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:loader_overlay/loader_overlay.dart';
|
||||
|
||||
import '../../../application/auth/auth_bloc.dart';
|
||||
import '../../../application/auth/logout_form/logout_form_bloc.dart';
|
||||
import '../../../common/extension/extension.dart';
|
||||
import '../../../common/theme/theme.dart';
|
||||
import '../../../injection.dart';
|
||||
import '../../components/button/button.dart';
|
||||
@@ -89,7 +90,7 @@ class ProfilePage extends StatelessWidget implements AutoRouteWrapper {
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Profile',
|
||||
context.lang.profile,
|
||||
style: AppStyle.xl.copyWith(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 18,
|
||||
|
||||
@@ -34,7 +34,7 @@ class ProfileAccountInfo extends StatelessWidget {
|
||||
Padding(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Text(
|
||||
'Account Information',
|
||||
context.lang.account_information,
|
||||
style: AppStyle.xl.copyWith(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -45,7 +45,7 @@ class ProfileAccountInfo extends StatelessWidget {
|
||||
|
||||
ProfileTile(
|
||||
icon: LineIcons.envelope,
|
||||
title: 'Email',
|
||||
title: context.lang.email,
|
||||
subtitle: user.email,
|
||||
showArrow: false,
|
||||
),
|
||||
@@ -54,7 +54,7 @@ class ProfileAccountInfo extends StatelessWidget {
|
||||
|
||||
ProfileTile(
|
||||
icon: LineIcons.calendarAlt,
|
||||
title: 'Member Since',
|
||||
title: context.lang.member_since,
|
||||
subtitle: user.createdAt.toDate,
|
||||
showArrow: false,
|
||||
),
|
||||
@@ -62,15 +62,15 @@ class ProfileAccountInfo extends StatelessWidget {
|
||||
|
||||
ProfileTile(
|
||||
icon: LineIcons.userEdit,
|
||||
title: 'Ubah Profil',
|
||||
subtitle: 'Ubah profil kamu',
|
||||
title: context.lang.edit_profile,
|
||||
subtitle: context.lang.edit_profile_desc,
|
||||
onTap: () => context.router.push(ProfileEditRoute(user: user)),
|
||||
),
|
||||
ProfileDivider(),
|
||||
ProfileTile(
|
||||
icon: LineIcons.lock,
|
||||
title: 'Change Password',
|
||||
subtitle: 'Change your password',
|
||||
title: context.lang.change_password,
|
||||
subtitle: context.lang.change_password_desc,
|
||||
onTap: () => context.router.push(ProfileChangePasswordRoute()),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../common/extension/extension.dart';
|
||||
import '../../../../common/theme/theme.dart';
|
||||
import '../../../router/app_router.gr.dart';
|
||||
import 'profile_tile.dart';
|
||||
@@ -37,7 +38,7 @@ class _ProfileAppSettingState extends State<ProfileAppSetting> {
|
||||
Padding(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Text(
|
||||
'App Settings',
|
||||
context.lang.app_settings,
|
||||
style: AppStyle.xl.copyWith(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -74,8 +75,8 @@ class _ProfileAppSettingState extends State<ProfileAppSetting> {
|
||||
// ProfileDivider(),
|
||||
ProfileTile(
|
||||
icon: Icons.language_outlined,
|
||||
title: 'Language',
|
||||
subtitle: 'English (US)',
|
||||
title: context.lang.language,
|
||||
subtitle: context.lang.language_desc,
|
||||
onTap: () => context.router.push(LanguageRoute()),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../common/extension/extension.dart';
|
||||
import '../../../../common/theme/theme.dart';
|
||||
import '../../../router/app_router.gr.dart';
|
||||
import 'divider.dart';
|
||||
@@ -30,7 +31,7 @@ class ProfileBusinessSetting extends StatelessWidget {
|
||||
Padding(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Text(
|
||||
'Business Settings',
|
||||
context.lang.business_settings,
|
||||
style: AppStyle.xl.copyWith(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -41,8 +42,8 @@ class ProfileBusinessSetting extends StatelessWidget {
|
||||
|
||||
ProfileTile(
|
||||
icon: Icons.business_outlined,
|
||||
title: 'Outlet Information',
|
||||
subtitle: 'Manage your Outlet details',
|
||||
title: context.lang.outlet_information,
|
||||
subtitle: context.lang.outlet_informatio_desc,
|
||||
onTap: () => context.router.push(OutletInformationRoute()),
|
||||
),
|
||||
|
||||
@@ -50,8 +51,8 @@ class ProfileBusinessSetting extends StatelessWidget {
|
||||
|
||||
ProfileTile(
|
||||
icon: Icons.people_outline,
|
||||
title: 'Staff Management',
|
||||
subtitle: 'Manage employees and permissions',
|
||||
title: context.lang.staff_management,
|
||||
subtitle: context.lang.staff_management_desc,
|
||||
onTap: () => context.router.push(ComingSoonRoute()),
|
||||
),
|
||||
|
||||
@@ -59,16 +60,16 @@ class ProfileBusinessSetting extends StatelessWidget {
|
||||
|
||||
ProfileTile(
|
||||
icon: Icons.inventory_2_outlined,
|
||||
title: 'Product',
|
||||
subtitle: 'Manage your products',
|
||||
title: context.lang.products,
|
||||
subtitle: context.lang.manage_your_products,
|
||||
onTap: () => context.router.push(ProductRoute()),
|
||||
),
|
||||
ProfileDivider(),
|
||||
|
||||
ProfileTile(
|
||||
icon: Icons.download_outlined,
|
||||
title: 'Download Report',
|
||||
subtitle: 'Download your sales or inventory report',
|
||||
title: context.lang.download_report,
|
||||
subtitle: context.lang.download_report_desc,
|
||||
onTap: () => context.router.push(DownloadReportRoute()),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -2,8 +2,8 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../../../application/auth/logout_form/logout_form_bloc.dart';
|
||||
import '../../../../common/extension/extension.dart';
|
||||
import '../../../../common/theme/theme.dart';
|
||||
import '../../../components/spacer/spacer.dart';
|
||||
import 'profile_tile.dart';
|
||||
|
||||
class ProfileDangerZone extends StatelessWidget {
|
||||
@@ -28,27 +28,10 @@ class ProfileDangerZone extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.warning_outlined, color: AppColor.error, size: 20),
|
||||
const SpaceWidth(8),
|
||||
Text(
|
||||
'Danger Zone',
|
||||
style: AppStyle.xl.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColor.error,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
ProfileTile(
|
||||
icon: Icons.logout,
|
||||
title: 'Logout',
|
||||
subtitle: 'Sign out from your account',
|
||||
title: context.lang.logout,
|
||||
subtitle: context.lang.logout_desc,
|
||||
iconColor: AppColor.error,
|
||||
textColor: AppColor.error,
|
||||
onTap: () {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../common/extension/extension.dart';
|
||||
import '../../../../common/theme/theme.dart';
|
||||
import '../../../router/app_router.gr.dart';
|
||||
import 'divider.dart';
|
||||
@@ -30,7 +31,7 @@ class ProfileSupport extends StatelessWidget {
|
||||
Padding(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Text(
|
||||
'Support',
|
||||
context.lang.support,
|
||||
style: AppStyle.xl.copyWith(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -41,8 +42,8 @@ class ProfileSupport extends StatelessWidget {
|
||||
|
||||
ProfileTile(
|
||||
icon: Icons.help_outline,
|
||||
title: 'Help Center',
|
||||
subtitle: 'Get help and support',
|
||||
title: context.lang.help_center,
|
||||
subtitle: context.lang.help_center_desc,
|
||||
onTap: () => context.router.push(ComingSoonRoute()),
|
||||
),
|
||||
|
||||
@@ -60,8 +61,8 @@ class ProfileSupport extends StatelessWidget {
|
||||
|
||||
ProfileTile(
|
||||
icon: Icons.info_outline,
|
||||
title: 'About',
|
||||
subtitle: 'App version and information',
|
||||
title: context.lang.about,
|
||||
subtitle: context.lang.about_desc,
|
||||
onTap: () => context.router.push(AboutAppRoute()),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user