General page in profile

merge-update-with-lab-changes
Mirza.Shafique 4 years ago
parent d664a216c6
commit dde16a13fe

@ -1499,4 +1499,7 @@ const Map localizedValues = {
"extremeObese": {"en": "Extreme Obese", "ar": "السمنة المفرطة"}, "extremeObese": {"en": "Extreme Obese", "ar": "السمنة المفرطة"},
"selectLanguage": { "en": "Please select any language:", "ar": ":الرجاء تحديد أي لغة" }, "selectLanguage": { "en": "Please select any language:", "ar": ":الرجاء تحديد أي لغة" },
"recAlert": { "en": "How do you want to receive alerts?", "ar": "كيف تريد تلقي التنبيهات؟" }, "recAlert": { "en": "How do you want to receive alerts?", "ar": "كيف تريد تلقي التنبيهات؟" },
"modesBelow": { "en": "Please select the modes below:", "ar": ":الرجاء تحديد الأوضاع أدناه" },
"prefferedMode": { "en": "Please select the preferred mode below:", "ar": ":الرجاء تحديد الوضع المفضل أدناه" },
"permissionsBellow": { "en": "Please allow the permissions below:", "ar": ":الرجاء السماح الأذونات أدناه" },
}; };

@ -244,10 +244,7 @@ class _AllHabibMedicalServiceState extends State<AllHabibMedicalService> {
imageLocation: 'assets/images/emergency_service_image.png', imageLocation: 'assets/images/emergency_service_image.png',
title: TranslationBase.of(context).emergencyService, title: TranslationBase.of(context).emergencyService,
), ),
ServicesContainer( ServicesContainer(onTap: () => getPharmacyToken(), imageLocation: 'assets/images/pharmacy_logo.png', title: TranslationBase.of(context).pharmacy),
onTap: () => getPharmacyToken(),
imageLocation: 'assets/images/pharmacy_logo.png',
title: TranslationBase.of(context).pharmacy),
ServicesContainer( ServicesContainer(
onTap: () => Navigator.push( onTap: () => Navigator.push(
context, context,
@ -332,9 +329,7 @@ class _AllHabibMedicalServiceState extends State<AllHabibMedicalService> {
ServicesContainer( ServicesContainer(
onTap: () => Navigator.push( onTap: () => Navigator.push(
context, context,
FadePage( FadePage(page: SmartWatchInstructions()),
page: SmartWatchInstructions()
),
), ),
imageLocation: 'assets/images/new-design/smartwatch_icon.png', imageLocation: 'assets/images/new-design/smartwatch_icon.png',
title: TranslationBase.of(context).smartWatches, title: TranslationBase.of(context).smartWatches,

@ -1,9 +1,11 @@
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/services/permission/permission_service.dart'; import 'package:diplomaticquarterapp/services/permission/permission_service.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/theme/theme_notifier.dart'; import 'package:diplomaticquarterapp/theme/theme_notifier.dart';
import 'package:diplomaticquarterapp/theme/theme_value.dart'; import 'package:diplomaticquarterapp/theme/theme_value.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -16,8 +18,7 @@ class GeneralSettings extends StatefulWidget {
_GeneralSettings createState() => _GeneralSettings(); _GeneralSettings createState() => _GeneralSettings();
} }
class _GeneralSettings extends State<GeneralSettings> class _GeneralSettings extends State<GeneralSettings> with TickerProviderStateMixin {
with TickerProviderStateMixin {
var themeNotifier; var themeNotifier;
int blindValue = 0; int blindValue = 0;
bool vibration = false; bool vibration = false;
@ -28,6 +29,7 @@ class _GeneralSettings extends State<GeneralSettings>
var permission = new PermissionService(); var permission = new PermissionService();
LocationPermission locationPermission; LocationPermission locationPermission;
var mediaQueryData; var mediaQueryData;
@override @override
void initState() { void initState() {
this.getValues(); this.getValues();
@ -38,161 +40,196 @@ class _GeneralSettings extends State<GeneralSettings>
mediaQueryData = MediaQuery.of(context); mediaQueryData = MediaQuery.of(context);
themeNotifier = Provider.of<ThemeNotifier>(context); themeNotifier = Provider.of<ThemeNotifier>(context);
return Container( return Container(
child: ListView(scrollDirection: Axis.vertical, children: <Widget>[ child: SingleChildScrollView(
Container( child: Padding(
color: Theme.of(context).scaffoldBackgroundColor, padding: const EdgeInsets.all(21.0),
padding: EdgeInsets.all(10), child: Column(
child: AppText( crossAxisAlignment: CrossAxisAlignment.start,
TranslationBase.of(context).modes, children: <Widget>[
fontWeight: FontWeight.bold,
), Text(
), TranslationBase.of(context).alert,
Container( style: TextStyle(
color: Theme.of(context).scaffoldBackgroundColor, fontSize: 16,
padding: EdgeInsets.all(10), fontWeight: FontWeight.w600,
child: Row( letterSpacing: -0.64,
mainAxisAlignment: MainAxisAlignment.spaceBetween, ),
),
Text(
TranslationBase.of(context).modesBelow,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
letterSpacing: -0.48,
),
),
Row(
children: [ children: [
AppText(TranslationBase.of(context).vibration), Checkbox(
Switch(
value: vibration, value: vibration,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
vibration = value; vibration = value;
}); });
setVibration(value);
}, },
activeTrackColor: Colors.lightGreenAccent, activeColor: CustomColors.accentColor,
activeColor: Colors.green, ),
) Text(
TranslationBase.of(context).prefferedMode,
style: TextStyle(
fontSize: 12,
letterSpacing: -0.48,
),
),
], ],
)), ),
Container( Row(
color: Theme.of(context).scaffoldBackgroundColor,
padding: EdgeInsets.all(10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
AppText(TranslationBase.of(context).accessibility), Checkbox(
Switch(
value: accsibility, value: accsibility,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
accsibility = value; accsibility = value;
}); });
}, },
activeTrackColor: Colors.lightGreenAccent, activeColor: CustomColors.accentColor,
activeColor: Colors.green, ),
) Text(
TranslationBase.of(context).accessibility,
style: TextStyle(
fontSize: 12,
letterSpacing: -0.48,
),
),
], ],
)), ),
Container( mHeight(16),
color: Theme.of(context).scaffoldBackgroundColor, mHeight(12),
padding: EdgeInsets.all(10), Text(
child: AppText(
TranslationBase.of(context).blindMode, TranslationBase.of(context).blindMode,
fontWeight: FontWeight.bold, style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
letterSpacing: -0.64,
), ),
), ),
new Container( Text(
color: Theme.of(context).scaffoldBackgroundColor, TranslationBase.of(context).prefferedMode,
padding: EdgeInsets.all(8.0), style: TextStyle(
child: new Column( fontSize: 12,
mainAxisAlignment: MainAxisAlignment.center, fontWeight: FontWeight.w600,
children: <Widget>[ letterSpacing: -0.48,
new Column( ),
mainAxisAlignment: MainAxisAlignment.center, ),
children: <Widget>[ Column(
children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
new Text( new Radio(
TranslationBase.of(context).offTheme,
style: new TextStyle(fontSize: 16.0),
),
Radio(
value: 0, value: 0,
groupValue: blindValue, groupValue: blindValue,
onChanged: (value) { onChanged: (value) {
setState(() => {this.blindValue = value}); setState(() {
blindValue = value;
setTheme(value); setTheme(value);
});
}, },
), ),
Text(
TranslationBase.of(context).offTheme,
style: TextStyle(
fontSize: 12,
letterSpacing: -0.48,
),
),
], ],
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
new Text( Radio(
TranslationBase.of(context).invertTheme,
style: new TextStyle(
fontSize: 16.0,
),
),
new Radio(
value: 1, value: 1,
groupValue: blindValue, groupValue: blindValue,
onChanged: (value) { onChanged: (value) {
setState(() => {this.blindValue = value}); setState(() {
blindValue = value;
setTheme(value); setTheme(value);
});
}, },
) ),
Text(
TranslationBase.of(context).invertTheme,
style: TextStyle(
fontSize: 12,
letterSpacing: -0.48,
),
),
], ],
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
new Text( Radio(
TranslationBase.of(context).dimTheme,
style: new TextStyle(fontSize: 16.0),
),
new Radio(
value: 2, value: 2,
groupValue: blindValue, groupValue: blindValue,
onChanged: (value) { onChanged: (value) {
setState(() => {this.blindValue = value}); setState(() {
blindValue = value;
setTheme(value); setTheme(value);
});
}, },
), ),
Text(
TranslationBase.of(context).dimTheme,
style: TextStyle(
fontSize: 12,
letterSpacing: -0.48,
),
),
], ],
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
new Text( Radio(
TranslationBase.of(context).bwTheme, value: 1,
style: new TextStyle(fontSize: 16.0),
),
new Radio(
value: 3,
groupValue: blindValue, groupValue: blindValue,
onChanged: (value) { onChanged: (value) {
setState(() => {this.blindValue = value}); setState(() {
blindValue = value;
setTheme(value); setTheme(value);
});
}, },
), ),
Text(
TranslationBase.of(context).bwTheme,
style: TextStyle(
fontSize: 12,
letterSpacing: -0.48,
),
),
], ],
), ),
], ],
) ),
])), mHeight(12),
Container( mHeight(12),
color: Theme.of(context).scaffoldBackgroundColor, Text(
padding: EdgeInsets.all(10),
child: AppText(
TranslationBase.of(context).permissions, TranslationBase.of(context).permissions,
fontWeight: FontWeight.bold, style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
letterSpacing: -0.64,
),
),
Text(
TranslationBase.of(context).permissionsBellow,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
letterSpacing: -0.48,
), ),
), ),
Container( Row(
color: Theme.of(context).scaffoldBackgroundColor,
padding: EdgeInsets.all(10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
AppText(TranslationBase.of(context).cameraPermission), Checkbox(
Switch(
value: camera, value: camera,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
@ -200,19 +237,20 @@ class _GeneralSettings extends State<GeneralSettings>
}); });
this.permission.openSettings(); this.permission.openSettings();
}, },
activeTrackColor: Colors.lightGreenAccent, activeColor: CustomColors.accentColor,
activeColor: Colors.green, ),
) Text(
TranslationBase.of(context).cameraPermission,
style: TextStyle(
fontSize: 12,
letterSpacing: -0.48,
),
),
], ],
)), ),
Container( Row(
color: Theme.of(context).scaffoldBackgroundColor,
padding: EdgeInsets.all(10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
AppText(TranslationBase.of(context).locationPermission), Checkbox(
Switch(
value: location, value: location,
onChanged: (value) { onChanged: (value) {
if (value == true) { if (value == true) {
@ -222,12 +260,23 @@ class _GeneralSettings extends State<GeneralSettings>
Geolocator.openLocationSettings(); Geolocator.openLocationSettings();
} }
}, },
activeTrackColor: Colors.lightGreenAccent, activeColor: CustomColors.accentColor,
activeColor: Colors.green, ),
) Text(
TranslationBase.of(context).locationPermission,
style: TextStyle(
fontSize: 12,
letterSpacing: -0.48,
),
),
], ],
)) ),
])); mHeight(16),
],
),
),
),
);
} }
setLocationPermission() async { setLocationPermission() async {
@ -292,11 +341,8 @@ class _GeneralSettings extends State<GeneralSettings>
getValues() async { getValues() async {
if (permission.isThemeEnabled() != null) { if (permission.isThemeEnabled() != null) {
blindValue = blindValue = permission.isThemeEnabled() == null ? 0 : permission.isThemeEnabled();
permission.isThemeEnabled() == null ? 0 : permission.isThemeEnabled(); vibration = permission.isVibrationEnabled() == null ? false : permission.isVibrationEnabled();
vibration = permission.isVibrationEnabled() == null
? false
: permission.isVibrationEnabled();
// accsibility = mediaQueryData.accessibleNavigation; // accsibility = mediaQueryData.accessibleNavigation;
//setTheme(blindValue); //setTheme(blindValue);
} }
@ -310,19 +356,11 @@ class _GeneralSettings extends State<GeneralSettings>
getTheme(value) async { getTheme(value) async {
if (value == 1) { if (value == 1) {
return invertThemes( return invertThemes(fontName: Provider.of<ProjectViewModel>(context, listen: false).isArabic ? 'Cairo' : 'Poppins');
fontName: Provider.of<ProjectViewModel>(context, listen: false).isArabic ? 'Cairo' : 'Poppins'
);
} else if (value == 3) { } else if (value == 3) {
return bwThemes( return bwThemes(fontName: Provider.of<ProjectViewModel>(context, listen: false).isArabic ? 'Cairo' : 'Poppins');
fontName: Provider.of<ProjectViewModel>(context, listen: false).isArabic ? 'Cairo' : 'Poppins'
);
} else { } else {
return defaultTheme( return defaultTheme(fontName: Provider.of<ProjectViewModel>(context, listen: false).isArabic ? 'Cairo' : 'Poppins');
fontName:
Provider.of<ProjectViewModel>(context, listen: false).isArabic
? 'Cairo'
: 'Poppins');
} }
} }
} }

@ -47,7 +47,7 @@ class _ProfileSettings extends State<ProfileSettings> with TickerProviderStateMi
Expanded( Expanded(
child: SingleChildScrollView( child: SingleChildScrollView(
child: Padding( child: Padding(
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(21.0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[

@ -2364,6 +2364,10 @@ class TranslationBase {
String get selectLanguage => localizedValues["selectLanguage"][locale.languageCode]; String get selectLanguage => localizedValues["selectLanguage"][locale.languageCode];
String get recAlert => localizedValues["recAlert"][locale.languageCode]; String get recAlert => localizedValues["recAlert"][locale.languageCode];
String get modesBelow => localizedValues["modesBelow"][locale.languageCode];
String get prefferedMode => localizedValues["prefferedMode"][locale.languageCode];
String get permissionsBellow => localizedValues["permissionsBellow"][locale.languageCode];
} }
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> { class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

Loading…
Cancel
Save