Skip to content

Commit 2baf7b9

Browse files
committed
Tapping on checkbox/radio's label changes value, Fixed setting Initial
value for checkboxList, Created constructor for checkbox
1 parent cf50e84 commit 2baf7b9

File tree

4 files changed

+186
-123
lines changed

4 files changed

+186
-123
lines changed

.idea/workspace.xml

Lines changed: 21 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/lib/main.dart

Lines changed: 62 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -85,28 +85,39 @@ class MyHomePage extends StatelessWidget {
8585
attribute: "time",
8686
),
8787
FormBuilderInput.checkboxList(
88-
label: "My Languages",
89-
attribute: "languages",
90-
require: false,
91-
value: ["Dart"],
92-
options: [
93-
FormBuilderInputOption(label: "Dart", value: false),
94-
FormBuilderInputOption(label: "Kotlin", value: false),
95-
FormBuilderInputOption(label: "Java", value: false),
96-
FormBuilderInputOption(label: "Swift", value: false),
97-
FormBuilderInputOption(label: "Objective-C", value: false),
98-
]),
88+
label: "My Languages",
89+
attribute: "languages",
90+
require: false,
91+
value: ["Dart"],
92+
options: [
93+
FormBuilderInputOption(value: "Dart"),
94+
FormBuilderInputOption(value: "Kotlin"),
95+
FormBuilderInputOption(value: "Java"),
96+
FormBuilderInputOption(value: "Swift"),
97+
FormBuilderInputOption(value: "Objective-C"),
98+
],
99+
),
99100
FormBuilderInput.radio(
100-
label: "My Best Language",
101-
attribute: "best_language",
102-
require: true,
103-
options: [
104-
FormBuilderInputOption(value: "Dart"),
105-
FormBuilderInputOption(value: "Kotlin"),
106-
FormBuilderInputOption(value: "Java"),
107-
FormBuilderInputOption(value: "Swift"),
108-
FormBuilderInputOption(value: "Objective-C"),
109-
]),
101+
label: "My Best Language",
102+
attribute: "best_language",
103+
require: true,
104+
options: [
105+
FormBuilderInputOption(value: "Dart"),
106+
FormBuilderInputOption(value: "Kotlin"),
107+
FormBuilderInputOption(value: "Java"),
108+
FormBuilderInputOption(value: "Swift"),
109+
FormBuilderInputOption(value: "Objective-C"),
110+
],
111+
),
112+
FormBuilderInput.checkbox(
113+
label: "I accept the terms and conditions",
114+
attribute: "accept_terms",
115+
hint: "Kindly make sure you've read all the terms and conditions",
116+
validator: (value){
117+
if(!value)
118+
return "Accept terms to continue";
119+
}
120+
),
110121
FormBuilderInput.slider(
111122
label: "Slider",
112123
attribute: "slider",
@@ -137,16 +148,36 @@ class MyHomePage extends StatelessWidget {
137148
attribute: "movie_rating",
138149
require: true,
139150
options: [
140-
FormBuilderInputOption(value: 1,),
141-
FormBuilderInputOption(value: 2,),
142-
FormBuilderInputOption(value: 3,),
143-
FormBuilderInputOption(value: 4,),
144-
FormBuilderInputOption(value: 5,),
145-
FormBuilderInputOption(value: 6,),
146-
FormBuilderInputOption(value: 7,),
147-
FormBuilderInputOption(value: 8,),
148-
FormBuilderInputOption(value: 9,),
149-
FormBuilderInputOption(value: 10,),
151+
FormBuilderInputOption(
152+
value: 1,
153+
),
154+
FormBuilderInputOption(
155+
value: 2,
156+
),
157+
FormBuilderInputOption(
158+
value: 3,
159+
),
160+
FormBuilderInputOption(
161+
value: 4,
162+
),
163+
FormBuilderInputOption(
164+
value: 5,
165+
),
166+
FormBuilderInputOption(
167+
value: 6,
168+
),
169+
FormBuilderInputOption(
170+
value: 7,
171+
),
172+
FormBuilderInputOption(
173+
value: 8,
174+
),
175+
FormBuilderInputOption(
176+
value: 9,
177+
),
178+
FormBuilderInputOption(
179+
value: 10,
180+
),
150181
]),
151182
],
152183
onChanged: () {

0 commit comments

Comments
 (0)