This commit is contained in:
parent
94073fe1f1
commit
5ed74aa5af
@ -32,12 +32,11 @@ class _MountSettingsWidgetState extends State<MountSettingsWidget> {
|
|||||||
leading: Icon(Icons.quiz),
|
leading: Icon(Icons.quiz),
|
||||||
title: Text(key),
|
title: Text(key),
|
||||||
initialValue: (value as bool),
|
initialValue: (value as bool),
|
||||||
onPressed: (_) {
|
onPressed:
|
||||||
setState(() {
|
(_) => setState(() {
|
||||||
root[key] = !value;
|
root[key] = !value;
|
||||||
widget.onChanged?.call(widget.settings);
|
widget.onChanged?.call(widget.settings);
|
||||||
});
|
}),
|
||||||
},
|
|
||||||
onToggle: (bool nextValue) {
|
onToggle: (bool nextValue) {
|
||||||
setState(() {
|
setState(() {
|
||||||
root[key] = nextValue;
|
root[key] = nextValue;
|
||||||
@ -65,9 +64,7 @@ class _MountSettingsWidgetState extends State<MountSettingsWidget> {
|
|||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
child: Text('Cancel'),
|
child: Text('Cancel'),
|
||||||
onPressed: () {
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
child: Text('OK'),
|
child: Text('OK'),
|
||||||
@ -85,9 +82,7 @@ class _MountSettingsWidgetState extends State<MountSettingsWidget> {
|
|||||||
controller: TextEditingController(text: updatedValue),
|
controller: TextEditingController(text: updatedValue),
|
||||||
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
|
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
|
||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
onChanged: (nextValue) {
|
onChanged: (nextValue) => updatedValue = nextValue,
|
||||||
updatedValue = nextValue;
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
title: Text(key),
|
title: Text(key),
|
||||||
);
|
);
|
||||||
@ -151,12 +146,11 @@ class _MountSettingsWidgetState extends State<MountSettingsWidget> {
|
|||||||
leading: Icon(icon),
|
leading: Icon(icon),
|
||||||
value: DropdownButton<String>(
|
value: DropdownButton<String>(
|
||||||
value: value,
|
value: value,
|
||||||
onChanged: (newValue) {
|
onChanged:
|
||||||
setState(() {
|
(newValue) => setState(() {
|
||||||
root[key] = newValue;
|
root[key] = newValue;
|
||||||
widget.onChanged?.call(widget.settings);
|
widget.onChanged?.call(widget.settings);
|
||||||
});
|
}),
|
||||||
},
|
|
||||||
items:
|
items:
|
||||||
valueList.map<DropdownMenuItem<String>>((item) {
|
valueList.map<DropdownMenuItem<String>>((item) {
|
||||||
return DropdownMenuItem<String>(
|
return DropdownMenuItem<String>(
|
||||||
@ -198,9 +192,7 @@ class _MountSettingsWidgetState extends State<MountSettingsWidget> {
|
|||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
child: Text('Cancel'),
|
child: Text('Cancel'),
|
||||||
onPressed: () {
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
child: Text('OK'),
|
child: Text('OK'),
|
||||||
@ -216,9 +208,7 @@ class _MountSettingsWidgetState extends State<MountSettingsWidget> {
|
|||||||
content: TextField(
|
content: TextField(
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
controller: TextEditingController(text: updatedValue),
|
controller: TextEditingController(text: updatedValue),
|
||||||
onChanged: (value) {
|
onChanged: (value) => updatedValue = value,
|
||||||
updatedValue = value;
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
title: Text(key),
|
title: Text(key),
|
||||||
);
|
);
|
||||||
|
@ -37,9 +37,8 @@ class _MountWidgetState extends State<MountWidget> {
|
|||||||
isThreeLine: true,
|
isThreeLine: true,
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
icon: Icon(Icons.settings, color: textColor),
|
icon: Icon(Icons.settings, color: textColor),
|
||||||
onPressed: () {
|
onPressed:
|
||||||
Navigator.pushNamed(context, '/edit', arguments: mount);
|
() => Navigator.pushNamed(context, '/edit', arguments: mount),
|
||||||
},
|
|
||||||
),
|
),
|
||||||
subtitle: Column(
|
subtitle: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user