Skip to content

Commit 0caa83c

Browse files
author
BuildTools
committed
Stoere geavanceerde color picker
1 parent 0eee102 commit 0caa83c

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

lib/src/ui/tabs/Instellingen.dart

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,38 @@ class _Instellingen extends State<Instellingen> {
234234
);
235235
}
236236

237+
Future showColorAdvanced(pick) {
238+
return showDialog(
239+
context: context,
240+
builder: (BuildContext context) {
241+
return AlertDialog(
242+
title: Text("Kies een kleur"),
243+
content: Column(mainAxisSize: MainAxisSize.min, children: [
244+
ColorPicker(
245+
enableAlpha: false,
246+
pickerColor: userdata.get(pick),
247+
onColorChanged: (color) {
248+
appState.setState(() {
249+
userdata.put(pick, color);
250+
});
251+
},
252+
),
253+
]),
254+
actions: <Widget>[
255+
FlatButton(
256+
child: Text(
257+
"Sluit",
258+
),
259+
onPressed: () {
260+
Navigator.of(context).pop();
261+
},
262+
),
263+
],
264+
);
265+
},
266+
);
267+
}
268+
237269
Widget build(BuildContext context) {
238270
return AppPage(
239271
title: Text("Instellingen"),
@@ -511,6 +543,38 @@ class _Instellingen extends State<Instellingen> {
511543
subtitle: "Schakel developer opties uit",
512544
setting: "developerMode",
513545
),
546+
CustomInstelling(
547+
title: 'Aangepaste primaire kleur',
548+
onTap: () => showColorAdvanced("primaryColor"),
549+
subtitle: '#${Theme.of(context).primaryColor.value.toRadixString(16).substring(2, 8).toUpperCase()}',
550+
trailing: Container(
551+
width: 40,
552+
height: 40,
553+
decoration: BoxDecoration(
554+
shape: BoxShape.circle,
555+
color: userdata.get("primaryColor"),
556+
border: Border.all(
557+
color: Colors.black,
558+
),
559+
),
560+
),
561+
),
562+
CustomInstelling(
563+
title: 'Aangepaste secundaire kleur',
564+
onTap: () => showColorAdvanced("accentColor"),
565+
subtitle: '#${Theme.of(context).accentColor.value.toRadixString(16).substring(2, 8).toUpperCase()}',
566+
trailing: Container(
567+
width: 40,
568+
height: 40,
569+
decoration: BoxDecoration(
570+
shape: BoxShape.circle,
571+
color: userdata.get("accentColor"),
572+
border: Border.all(
573+
color: Colors.black,
574+
),
575+
),
576+
),
577+
),
514578
],
515579
);
516580
},

0 commit comments

Comments
 (0)