@@ -37,26 +37,57 @@ class _ExamplePageState extends State<_ExamplePage> {
3737 @override
3838 Widget build (BuildContext context) {
3939 return Scaffold (
40- body: FormBuilder (
41- key: _formKey,
42- child: Column (
43- children: [
44- FormBuilderTextField (
45- name: 'full_name' ,
46- decoration: const InputDecoration (labelText: 'Full Name' ),
47- validator: FormBuilderValidators .compose ([
48- FormBuilderValidators .required (),
49- ]),
50- ),
51- const SizedBox (height: 10 ),
52- ElevatedButton (
53- onPressed: () {
54- _formKey.currentState? .saveAndValidate ();
55- debugPrint (_formKey.currentState? .value.toString ());
56- },
57- child: const Text ('Print' ),
58- )
59- ],
40+ appBar: AppBar (title: const Text ('Minimal code example' )),
41+ body: Padding (
42+ padding: const EdgeInsets .all (16 ),
43+ child: FormBuilder (
44+ key: _formKey,
45+ child: Column (
46+ children: [
47+ FormBuilderFilterChip <String >(
48+ decoration: const InputDecoration (
49+ labelText: 'The language of my people' ,
50+ enabled: false ,
51+ ),
52+ name: 'languages_filter' ,
53+ selectedColor: Colors .red,
54+ options: const [
55+ FormBuilderChipOption (
56+ value: 'Dart' ,
57+ avatar: CircleAvatar (child: Text ('D' )),
58+ ),
59+ FormBuilderChipOption (
60+ value: 'Kotlin' ,
61+ avatar: CircleAvatar (child: Text ('K' )),
62+ ),
63+ FormBuilderChipOption (
64+ value: 'Java' ,
65+ avatar: CircleAvatar (child: Text ('J' )),
66+ ),
67+ FormBuilderChipOption (
68+ value: 'Swift' ,
69+ avatar: CircleAvatar (child: Text ('S' )),
70+ ),
71+ FormBuilderChipOption (
72+ value: 'Objective-C' ,
73+ avatar: CircleAvatar (child: Text ('O' )),
74+ ),
75+ ],
76+ validator: FormBuilderValidators .compose ([
77+ FormBuilderValidators .minLength (1 ),
78+ FormBuilderValidators .maxLength (3 ),
79+ ]),
80+ ),
81+ const SizedBox (height: 10 ),
82+ ElevatedButton (
83+ onPressed: () {
84+ _formKey.currentState? .saveAndValidate ();
85+ debugPrint (_formKey.currentState? .value.toString ());
86+ },
87+ child: const Text ('Print' ),
88+ )
89+ ],
90+ ),
6091 ),
6192 ),
6293 );
0 commit comments