You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PatientApp-KKUMC/lib/pages/settings/general_setting.dart

228 lines
7.6 KiB
Dart

5 years ago
import 'package:diplomaticquarterapp/theme/theme_notifier.dart';
import 'package:diplomaticquarterapp/theme/theme_value.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
5 years ago
import 'package:provider/provider.dart';
class GeneralSettings extends StatefulWidget {
@override
_GeneralSettings createState() => _GeneralSettings();
}
class _GeneralSettings extends State<GeneralSettings>
with TickerProviderStateMixin {
5 years ago
var themeNotifier;
int blindValue = 0;
Widget build(BuildContext context) {
bool isVibration = true;
5 years ago
themeNotifier = Provider.of<ThemeNotifier>(context);
return Container(
child: ListView(scrollDirection: Axis.vertical, children: <Widget>[
Container(
padding: EdgeInsets.all(10),
child: AppText(
5 years ago
TranslationBase.of(context).modes,
color: Colors.black,
fontWeight: FontWeight.bold,
),
),
Container(
color: Colors.white,
padding: EdgeInsets.all(10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
5 years ago
Text(TranslationBase.of(context).vibration),
Switch(
value: isVibration,
onChanged: (value) {
setState(() {
isVibration = value;
});
},
activeTrackColor: Colors.lightGreenAccent,
activeColor: Colors.green,
)
],
)),
Container(
color: Colors.white,
padding: EdgeInsets.all(10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
5 years ago
AppText(TranslationBase.of(context).accessibility),
Switch(
value: isVibration,
onChanged: (value) {
setState(() {
isVibration = value;
});
},
activeTrackColor: Colors.lightGreenAccent,
activeColor: Colors.green,
)
],
)),
Container(
padding: EdgeInsets.all(10),
child: AppText(
5 years ago
TranslationBase.of(context).blindMode,
color: Colors.black,
fontWeight: FontWeight.bold,
),
),
new Container(
color: Colors.white,
padding: EdgeInsets.all(8.0),
child: new Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
new Text(
5 years ago
TranslationBase.of(context).offTheme,
style: new TextStyle(fontSize: 16.0),
),
5 years ago
Radio(
value: 0,
5 years ago
groupValue: blindValue,
onChanged: (value) {
5 years ago
setState(() => {this.blindValue = value});
setTheme(value);
},
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
new Text(
5 years ago
TranslationBase.of(context).invertTheme,
style: new TextStyle(
fontSize: 16.0,
),
),
new Radio(
value: 1,
5 years ago
groupValue: blindValue,
onChanged: (value) {
5 years ago
setState(() => {this.blindValue = value});
setTheme(value);
},
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
new Text(
5 years ago
TranslationBase.of(context).dimTheme,
5 years ago
style: new TextStyle(fontSize: 16.0),
),
new Radio(
value: 2,
5 years ago
groupValue: blindValue,
5 years ago
onChanged: (value) {
5 years ago
setState(() => {this.blindValue = value});
setTheme(value);
5 years ago
},
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
new Text(
5 years ago
TranslationBase.of(context).bwTheme,
style: new TextStyle(fontSize: 16.0),
),
new Radio(
5 years ago
value: 3,
groupValue: blindValue,
onChanged: (value) {
5 years ago
setState(() => {this.blindValue = value});
setTheme(value);
},
),
],
),
],
)
5 years ago
])),
Container(
padding: EdgeInsets.all(10),
child: AppText(
5 years ago
TranslationBase.of(context).permissions,
5 years ago
color: Colors.black,
fontWeight: FontWeight.bold,
),
),
Container(
color: Colors.white,
padding: EdgeInsets.all(10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
5 years ago
AppText(TranslationBase.of(context).cameraPermission),
5 years ago
Switch(
value: isVibration,
onChanged: (value) {
setState(() {
isVibration = value;
});
},
activeTrackColor: Colors.lightGreenAccent,
activeColor: Colors.green,
)
],
)),
Container(
color: Colors.white,
padding: EdgeInsets.all(10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
5 years ago
AppText(TranslationBase.of(context).locationPermission),
5 years ago
Switch(
value: isVibration,
onChanged: (value) {
setState(() {
isVibration = value;
});
},
activeTrackColor: Colors.lightGreenAccent,
activeColor: Colors.green,
)
],
))
]));
}
5 years ago
setTheme(value) {
switch (value) {
case 0:
themeNotifier.setTheme(defaultTheme);
break;
case 1:
themeNotifier.setTheme(invertTheme);
break;
case 2:
themeNotifier.setTheme(dimTheme);
break;
default:
themeNotifier.setTheme(defaultTheme);
break;
}
}
}