fix languages in settings
This commit is contained in:
parent
6424e82d54
commit
023db31270
4 changed files with 159 additions and 41 deletions
|
|
@ -19,6 +19,7 @@ class CustomerSettingsPage extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _CustomerSettingsPageState extends State<CustomerSettingsPage> {
|
||||
static const List<String> languageList = ['English', 'Tagalog', 'Hilogaynon (Ilonggo)', 'Cebuano (Bisaya)'];
|
||||
final _authService = AuthService();
|
||||
|
||||
late String currentName = '';
|
||||
|
|
@ -41,10 +42,10 @@ class _CustomerSettingsPageState extends State<CustomerSettingsPage> {
|
|||
}
|
||||
|
||||
void gotoSettings() async {
|
||||
final changed = await context.push<bool>('/languagesetting');
|
||||
if (changed == true) {
|
||||
setState(() {});
|
||||
}
|
||||
await context.push('/languagesetting');
|
||||
// ignore: use_build_context_synchronously
|
||||
currentLanguage = await getLanguage(context);
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
void autoRun() async {
|
||||
|
|
@ -71,25 +72,86 @@ class _CustomerSettingsPageState extends State<CustomerSettingsPage> {
|
|||
body: CustomerPagebackgroundWidget(
|
||||
child: Column(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
const Gap(68),
|
||||
const CustomerTitleWidget(),
|
||||
const Gap(32),
|
||||
const TextWidget(text: 'Settings'),
|
||||
const Gap(16),
|
||||
SettingWidget(
|
||||
icon: Icons.language, title: 'Language', value: currentLanguage, onPressed: () => gotoSettings()),
|
||||
const Gap(8),
|
||||
SettingWidget(
|
||||
icon: Icons.person,
|
||||
title: 'Display Name',
|
||||
value: _isGuest ? 'Guest' : currentName,
|
||||
),
|
||||
const Gap(32),
|
||||
ButtonWidget(text: 'Log Out', onPressed: _signOut)
|
||||
],
|
||||
)
|
||||
if (currentLanguage == languageList[0])
|
||||
Column(
|
||||
children: [
|
||||
const Gap(68),
|
||||
const CustomerTitleWidget(),
|
||||
const Gap(32),
|
||||
const TextWidget(text: 'Settings'),
|
||||
const Gap(16),
|
||||
SettingWidget(
|
||||
icon: Icons.language, title: 'Language', value: currentLanguage, onPressed: () => gotoSettings()),
|
||||
const Gap(8),
|
||||
SettingWidget(
|
||||
icon: Icons.person,
|
||||
title: 'Name',
|
||||
value: _isGuest ? 'Guest' : currentName,
|
||||
),
|
||||
const Gap(32),
|
||||
ButtonWidget(text: 'Log Out', onPressed: _signOut)
|
||||
],
|
||||
)
|
||||
else if (currentLanguage == languageList[1])
|
||||
Column(
|
||||
children: [
|
||||
const Gap(68),
|
||||
const CustomerTitleWidget(),
|
||||
const Gap(32),
|
||||
const TextWidget(text: 'Mga Setting'),
|
||||
const Gap(16),
|
||||
SettingWidget(
|
||||
icon: Icons.language, title: 'Wika', value: currentLanguage, onPressed: () => gotoSettings()),
|
||||
const Gap(8),
|
||||
SettingWidget(
|
||||
icon: Icons.person,
|
||||
title: 'Pangalan',
|
||||
value: _isGuest ? 'Guest' : currentName,
|
||||
),
|
||||
const Gap(32),
|
||||
ButtonWidget(text: 'Log Out', onPressed: _signOut)
|
||||
],
|
||||
)
|
||||
else if (currentLanguage == languageList[2])
|
||||
Column(
|
||||
children: [
|
||||
const Gap(68),
|
||||
const CustomerTitleWidget(),
|
||||
const Gap(32),
|
||||
const TextWidget(text: 'Mga Setting'),
|
||||
const Gap(16),
|
||||
SettingWidget(
|
||||
icon: Icons.language, title: 'Lenggwahe', value: currentLanguage, onPressed: () => gotoSettings()),
|
||||
const Gap(8),
|
||||
SettingWidget(
|
||||
icon: Icons.person,
|
||||
title: 'Ngalan',
|
||||
value: _isGuest ? 'Guest' : currentName,
|
||||
),
|
||||
const Gap(32),
|
||||
ButtonWidget(text: 'Log Out', onPressed: _signOut)
|
||||
],
|
||||
)
|
||||
else
|
||||
Column(
|
||||
children: [
|
||||
const Gap(68),
|
||||
const CustomerTitleWidget(),
|
||||
const Gap(32),
|
||||
const TextWidget(text: 'Mga Setting'),
|
||||
const Gap(16),
|
||||
SettingWidget(
|
||||
icon: Icons.language, title: 'Pinulongan', value: currentLanguage, onPressed: () => gotoSettings()),
|
||||
const Gap(8),
|
||||
SettingWidget(
|
||||
icon: Icons.person,
|
||||
title: 'Ngalan',
|
||||
value: _isGuest ? 'Guest' : currentName,
|
||||
),
|
||||
const Gap(32),
|
||||
ButtonWidget(text: 'Log Out', onPressed: _signOut)
|
||||
],
|
||||
)
|
||||
],
|
||||
)));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue