[READ-ONLY] Mirror of https://github.com/probablykasper/notifier. Android app for scheduling notifications
android
app
flutter
notifications
1import 'package:flutter/material.dart'
2 show
3 Alignment,
4 AnimatedContainer,
5 Border,
6 BorderRadius,
7 BoxDecoration,
8 Color,
9 Colors,
10 Container,
11 Curves,
12 FontWeight,
13 GestureDetector,
14 Radius,
15 StatelessWidget,
16 Text,
17 TextAlign,
18 TextStyle,
19 ValueChanged,
20 Widget;
21
22class LetterCheckbox extends StatelessWidget {
23 final bool value;
24 final String text;
25 final ValueChanged<bool> toggle;
26 final Color enabledColor;
27 final Color disabledColor;
28
29 const LetterCheckbox({
30 required this.value,
31 required this.toggle,
32 required this.text,
33 required this.enabledColor,
34 required this.disabledColor,
35 });
36
37 @override
38 Widget build(context) {
39 int padding = 5;
40 return GestureDetector(
41 onTap: () {
42 toggle(!value);
43 },
44 child: Container(
45 width: 30 + padding * 2,
46 height: 30 + padding * 2,
47 color: Colors.transparent,
48 alignment: Alignment.center,
49 child: AnimatedContainer(
50 duration: const Duration(milliseconds: 80),
51 curve: Curves.ease,
52 width: value == true ? 30 : 26,
53 height: value == true ? 30 : 26,
54 alignment: const Alignment(0.0, 0.0),
55 decoration: BoxDecoration(
56 border: value == true
57 ? Border.all(color: enabledColor, width: 2.5)
58 : Border.all(color: disabledColor, width: 2),
59 borderRadius: const BorderRadius.all(Radius.circular(50)),
60 ),
61 child: Text(
62 text,
63 textAlign: TextAlign.center,
64 style: const TextStyle(
65 fontSize: 12,
66 fontWeight: FontWeight.w500,
67 ),
68 ),
69 ),
70 ),
71 );
72 }
73
74 // @override
75 // Widget build(context) {
76 // final themeModel = ScopedModel.of<ThemeModel>(context);
77 // return ScopedModel<LetterCheckboxModel>(
78 // model: LetterCheckboxModel(value: value),
79 // child: ScopedModelDescendant<LetterCheckboxModel>(
80 // builder: (context, child, model) {
81 // double padding = 5;
82 // return GestureDetector(
83 // onTap: () {
84 // bool newValue = model.toggle();
85 // onChanged(newValue);
86 // },
87 // child: Container(
88 // width: 30 + padding * 2,
89 // height: 30 + padding * 2,
90 // color: Colors.transparent,
91 // alignment: Alignment.center,
92 // child: AnimatedContainer(
93 // duration: const Duration(milliseconds: 80),
94 // curve: Curves.ease,
95 // width: model.value == true ? 30 : 26,
96 // height: model.value == true ? 30 : 26,
97 // alignment: const Alignment(0.0, 0.0),
98 // decoration: BoxDecoration(
99 // border: Border.all(
100 // color: model.value == true
101 // ? themeModel.checkboxEnabledColor
102 // : themeModel.checkboxDisabledColor,
103 // width: model.value == true ? 2.5 : 2,
104 // ),
105 // borderRadius: const BorderRadius.all(Radius.circular(50)),
106 // ),
107 // child: Text(
108 // text,
109 // textAlign: TextAlign.center,
110 // style: const TextStyle(
111 // fontSize: 12,
112 // fontWeight: FontWeight.w500,
113 // ),
114 // ),
115 // ),
116 // ),
117 // );
118 // },
119 // ),
120 // );
121 // }
122}