fix languages in settings
This commit is contained in:
parent
6424e82d54
commit
023db31270
4 changed files with 159 additions and 41 deletions
|
|
@ -77,7 +77,7 @@ class _CustomerMainPageState extends State<CustomerMainPage> {
|
|||
title: 'Toothache', description: "a.k.a tooth pain, is pain in the teeth or their...", margin: 16),
|
||||
const Gap(8),
|
||||
const DescriptionMenuWidget(
|
||||
title: 'Stomach Ache', description: " is a symptom associated with both non-serious and...", margin: 16),
|
||||
title: 'Stomach Ache', description: " is a symptom associated with both non-serious...", margin: 16),
|
||||
],
|
||||
)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,11 +42,11 @@ class _CustomerSettingsPageState extends State<CustomerSettingsPage> {
|
|||
}
|
||||
|
||||
void gotoSettings() async {
|
||||
final changed = await context.push<bool>('/languagesetting');
|
||||
if (changed == true) {
|
||||
await context.push('/languagesetting');
|
||||
// ignore: use_build_context_synchronously
|
||||
currentLanguage = await getLanguage(context);
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
|
||||
void autoRun() async {
|
||||
final guest = await _checkGuest();
|
||||
|
|
@ -71,6 +72,7 @@ class _CustomerSettingsPageState extends State<CustomerSettingsPage> {
|
|||
body: CustomerPagebackgroundWidget(
|
||||
child: Column(
|
||||
children: [
|
||||
if (currentLanguage == languageList[0])
|
||||
Column(
|
||||
children: [
|
||||
const Gap(68),
|
||||
|
|
@ -83,7 +85,67 @@ class _CustomerSettingsPageState extends State<CustomerSettingsPage> {
|
|||
const Gap(8),
|
||||
SettingWidget(
|
||||
icon: Icons.person,
|
||||
title: 'Display Name',
|
||||
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),
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class LanguageSettingPage extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _LanguageSettingPageState extends State<LanguageSettingPage> {
|
||||
final languageList = ['English', 'Tagalog', 'Hilogaynon (Ilonggo)', 'Cebuano (Bisaya)'];
|
||||
static const List<String> languageList = ['English', 'Tagalog', 'Hilogaynon (Ilonggo)', 'Cebuano (Bisaya)'];
|
||||
late String currentLanguage = '';
|
||||
|
||||
void autoRun() async {
|
||||
|
|
@ -37,6 +37,9 @@ class _LanguageSettingPageState extends State<LanguageSettingPage> {
|
|||
const Gap(68),
|
||||
const CustomerTitleWidget(),
|
||||
const Gap(32),
|
||||
if (currentLanguage == languageList[0])
|
||||
Column(
|
||||
children: [
|
||||
const TextWidget(text: 'Language'),
|
||||
const Gap(16),
|
||||
SettingsMenuWidget(
|
||||
|
|
@ -52,6 +55,59 @@ class _LanguageSettingPageState extends State<LanguageSettingPage> {
|
|||
selectionFor: 'Language',
|
||||
)
|
||||
],
|
||||
)
|
||||
else if (currentLanguage == languageList[1])
|
||||
Column(children: [
|
||||
const TextWidget(text: 'Wika'),
|
||||
const Gap(16),
|
||||
SettingsMenuWidget(
|
||||
title: 'Kasalukuyan',
|
||||
value: currentLanguage,
|
||||
),
|
||||
const Gap(16),
|
||||
SettingsMenuWidget(
|
||||
title: 'Iba pang mga Opsyon',
|
||||
value: currentLanguage,
|
||||
isSelection: true,
|
||||
selectionList: languageList,
|
||||
selectionFor: 'Language',
|
||||
)
|
||||
])
|
||||
else if (currentLanguage == languageList[2])
|
||||
Column(children: [
|
||||
const TextWidget(text: 'Lenggwahe'),
|
||||
const Gap(16),
|
||||
SettingsMenuWidget(
|
||||
title: 'Ang Subong',
|
||||
value: currentLanguage,
|
||||
),
|
||||
const Gap(16),
|
||||
SettingsMenuWidget(
|
||||
title: 'Iban pa nga mga Opsyon',
|
||||
value: currentLanguage,
|
||||
isSelection: true,
|
||||
selectionList: languageList,
|
||||
selectionFor: 'Language',
|
||||
)
|
||||
])
|
||||
else if (currentLanguage == languageList[3])
|
||||
Column(children: [
|
||||
const TextWidget(text: 'Pinulongan'),
|
||||
const Gap(16),
|
||||
SettingsMenuWidget(
|
||||
title: 'Ang Karon',
|
||||
value: currentLanguage,
|
||||
),
|
||||
const Gap(16),
|
||||
SettingsMenuWidget(
|
||||
title: 'Uban pa na mga Opsyon',
|
||||
value: currentLanguage,
|
||||
isSelection: true,
|
||||
selectionList: languageList,
|
||||
selectionFor: 'Language',
|
||||
)
|
||||
])
|
||||
],
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class SettingsMenuWidget extends StatelessWidget {
|
|||
final language = await blocSetLanguage(context, newValue);
|
||||
if (language) {
|
||||
// ignore: use_build_context_synchronously
|
||||
context.pop(true);
|
||||
context.pop();
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ class SettingsMenuWidget extends StatelessWidget {
|
|||
GestureDetector(
|
||||
onTap: () => setNewValue(item),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
child: TextWidget(text: item, size: 12, color: const Color.fromRGBO(255, 255, 255, 1)),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue