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