Consumer Pattern
This commit is contained in:
parent
b48ad6a49b
commit
13743e93c4
|
@ -102,7 +102,8 @@ class FlwtchState extends State<Flwtch> {
|
||||||
print("FlwtchState.build() cwtchInit: $cwtchInit");
|
print("FlwtchState.build() cwtchInit: $cwtchInit");
|
||||||
return MultiProvider(
|
return MultiProvider(
|
||||||
providers: [getFlwtchStateProvider(), getOpaqueProvider()],
|
providers: [getFlwtchStateProvider(), getOpaqueProvider()],
|
||||||
builder: (context, widget) { return MaterialApp(
|
builder: (context, widget) {
|
||||||
|
return MaterialApp(
|
||||||
title: 'Cwtch',
|
title: 'Cwtch',
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
visualDensity: VisualDensity.adaptivePlatformDensity,
|
visualDensity: VisualDensity.adaptivePlatformDensity,
|
||||||
|
|
|
@ -28,34 +28,40 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildSettingsList() {
|
Widget _buildSettingsList() {
|
||||||
return Center(child:Column(
|
return Consumer<OpaqueTheme>(
|
||||||
children: [
|
builder: (context, theme, child) {
|
||||||
Text("Language"),
|
return Center(child: Column(
|
||||||
TextField(
|
children: [
|
||||||
controller: myController,
|
Text("Language"),
|
||||||
onChanged: (text) {
|
TextField(
|
||||||
print("First text field: $text");
|
controller: myController,
|
||||||
},
|
onChanged: (text) {
|
||||||
),
|
print("First text field: $text");
|
||||||
Text("Zoom"),
|
},
|
||||||
SwitchListTile(
|
),
|
||||||
title: const Text('Theme'),
|
Text("Zoom"),
|
||||||
value: Provider.of<OpaqueTheme>(context).current() == Opaque.light,
|
SwitchListTile(
|
||||||
onChanged: (bool value) {
|
title: Text('Theme',
|
||||||
if (value) {
|
style: TextStyle(color: theme.current().mainTextColor())),
|
||||||
Provider.of<OpaqueTheme>(context, listen: false).setLight();
|
value: theme.current() == Opaque.light,
|
||||||
} else {
|
onChanged: (bool value) {
|
||||||
Provider.of<OpaqueTheme>(context, listen: false).setDark();
|
if (value) {
|
||||||
}
|
theme.setLight();
|
||||||
},
|
} else {
|
||||||
secondary: const Icon(Icons.lightbulb_outline),
|
theme.setDark();
|
||||||
),
|
}
|
||||||
Text("Experiments enabled"),
|
},
|
||||||
Text("Text magnification reference"),
|
secondary: Icon(Icons.lightbulb_outline,
|
||||||
Text("Acknowledgements"),
|
color: theme.current().mainTextColor()),
|
||||||
Text("Version: xxx"),
|
),
|
||||||
Text("Built on: xxx"),
|
Text("Experiments enabled"),
|
||||||
]
|
Text("Text magnification reference"),
|
||||||
));
|
Text("Acknowledgements"),
|
||||||
|
Text("Version: xxx"),
|
||||||
|
Text("Built on: xxx"),
|
||||||
|
]
|
||||||
|
));
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue