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),
|
title: 'Toothache', description: "a.k.a tooth pain, is pain in the teeth or their...", margin: 16),
|
||||||
const Gap(8),
|
const Gap(8),
|
||||||
const DescriptionMenuWidget(
|
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> {
|
class _CustomerSettingsPageState extends State<CustomerSettingsPage> {
|
||||||
|
static const List<String> languageList = ['English', 'Tagalog', 'Hilogaynon (Ilonggo)', 'Cebuano (Bisaya)'];
|
||||||
final _authService = AuthService();
|
final _authService = AuthService();
|
||||||
|
|
||||||
late String currentName = '';
|
late String currentName = '';
|
||||||
|
|
@ -41,10 +42,10 @@ class _CustomerSettingsPageState extends State<CustomerSettingsPage> {
|
||||||
}
|
}
|
||||||
|
|
||||||
void gotoSettings() async {
|
void gotoSettings() async {
|
||||||
final changed = await context.push<bool>('/languagesetting');
|
await context.push('/languagesetting');
|
||||||
if (changed == true) {
|
// ignore: use_build_context_synchronously
|
||||||
setState(() {});
|
currentLanguage = await getLanguage(context);
|
||||||
}
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
void autoRun() async {
|
void autoRun() async {
|
||||||
|
|
@ -71,25 +72,86 @@ class _CustomerSettingsPageState extends State<CustomerSettingsPage> {
|
||||||
body: CustomerPagebackgroundWidget(
|
body: CustomerPagebackgroundWidget(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Column(
|
if (currentLanguage == languageList[0])
|
||||||
children: [
|
Column(
|
||||||
const Gap(68),
|
children: [
|
||||||
const CustomerTitleWidget(),
|
const Gap(68),
|
||||||
const Gap(32),
|
const CustomerTitleWidget(),
|
||||||
const TextWidget(text: 'Settings'),
|
const Gap(32),
|
||||||
const Gap(16),
|
const TextWidget(text: 'Settings'),
|
||||||
SettingWidget(
|
const Gap(16),
|
||||||
icon: Icons.language, title: 'Language', value: currentLanguage, onPressed: () => gotoSettings()),
|
SettingWidget(
|
||||||
const Gap(8),
|
icon: Icons.language, title: 'Language', value: currentLanguage, onPressed: () => gotoSettings()),
|
||||||
SettingWidget(
|
const Gap(8),
|
||||||
icon: Icons.person,
|
SettingWidget(
|
||||||
title: 'Display Name',
|
icon: Icons.person,
|
||||||
value: _isGuest ? 'Guest' : currentName,
|
title: 'Name',
|
||||||
),
|
value: _isGuest ? 'Guest' : currentName,
|
||||||
const Gap(32),
|
),
|
||||||
ButtonWidget(text: 'Log Out', onPressed: _signOut)
|
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)
|
||||||
|
],
|
||||||
|
)
|
||||||
],
|
],
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ class LanguageSettingPage extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _LanguageSettingPageState extends State<LanguageSettingPage> {
|
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 = '';
|
late String currentLanguage = '';
|
||||||
|
|
||||||
void autoRun() async {
|
void autoRun() async {
|
||||||
|
|
@ -37,20 +37,76 @@ class _LanguageSettingPageState extends State<LanguageSettingPage> {
|
||||||
const Gap(68),
|
const Gap(68),
|
||||||
const CustomerTitleWidget(),
|
const CustomerTitleWidget(),
|
||||||
const Gap(32),
|
const Gap(32),
|
||||||
const TextWidget(text: 'Language'),
|
if (currentLanguage == languageList[0])
|
||||||
const Gap(16),
|
Column(
|
||||||
SettingsMenuWidget(
|
children: [
|
||||||
title: 'Current',
|
const TextWidget(text: 'Language'),
|
||||||
value: currentLanguage,
|
const Gap(16),
|
||||||
),
|
SettingsMenuWidget(
|
||||||
const Gap(16),
|
title: 'Current',
|
||||||
SettingsMenuWidget(
|
value: currentLanguage,
|
||||||
title: 'Other Options',
|
),
|
||||||
value: currentLanguage,
|
const Gap(16),
|
||||||
isSelection: true,
|
SettingsMenuWidget(
|
||||||
selectionList: languageList,
|
title: 'Other Options',
|
||||||
selectionFor: 'Language',
|
value: currentLanguage,
|
||||||
)
|
isSelection: true,
|
||||||
|
selectionList: languageList,
|
||||||
|
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);
|
final language = await blocSetLanguage(context, newValue);
|
||||||
if (language) {
|
if (language) {
|
||||||
// ignore: use_build_context_synchronously
|
// ignore: use_build_context_synchronously
|
||||||
context.pop(true);
|
context.pop();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -55,7 +55,7 @@ class SettingsMenuWidget extends StatelessWidget {
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => setNewValue(item),
|
onTap: () => setNewValue(item),
|
||||||
child: Padding(
|
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)),
|
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