-
-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathmain.dart
More file actions
126 lines (117 loc) · 3.59 KB
/
Copy pathmain.dart
File metadata and controls
126 lines (117 loc) · 3.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:material_ui/material_ui.dart' hide GlobalMaterialLocalizations;
import 'package:form_builder_validators/form_builder_validators.dart';
import 'code_page.dart';
import 'sources/color_picker.dart';
import 'sources/complete_form.dart';
import 'sources/rating_bar.dart';
import 'sources/searchable_dropdown.dart';
import 'sources/searchable_multiselect.dart';
import 'sources/signature_pad.dart';
import 'sources/touch_spin.dart';
import 'sources/typeahead.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Form Builder Extra Fields',
theme: ThemeData(primarySwatch: Colors.blue),
localizationsDelegates: const [
FormBuilderLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
supportedLocales: const [Locale('en')],
home: const _HomePage(),
);
}
}
class _HomePage extends StatelessWidget {
const _HomePage();
@override
Widget build(BuildContext context) {
return CodePage(
title: 'Extra Fields Example',
child: ListView(
children: [
_ExampleTile(
title: 'Complete form',
subtitle: 'Every extra field on one form, same as before',
page: const CompleteForm(),
),
const Divider(),
_ExampleTile(
title: 'Color picker',
subtitle: 'Material, HSV, and block pickers, plus a disabled field',
page: const ColorPickerExamples(),
),
const Divider(),
_ExampleTile(
title: 'Searchable dropdown',
subtitle: 'Offline filter vs a delayed online lookup',
page: const SearchableDropdownExamples(),
),
const Divider(),
_ExampleTile(
title: 'Searchable multiselect',
subtitle: 'Same search, but the value is a list',
page: const SearchableMultiSelectExamples(),
),
const Divider(),
_ExampleTile(
title: 'TypeAhead',
subtitle: 'Autocomplete from a country list, including validation',
page: const TypeAheadExamples(),
),
const Divider(),
_ExampleTile(
title: 'TouchSpin',
subtitle: 'Step size, min/max, and a disabled control',
page: const TouchSpinExamples(),
),
const Divider(),
_ExampleTile(
title: 'Rating bar',
subtitle: 'Whole stars, half stars, and a read-only rating',
page: const RatingBarExamples(),
),
const Divider(),
_ExampleTile(
title: 'Signature pad',
subtitle: 'Draw a signature and see the saved PNG size',
page: const SignaturePadExamples(),
),
],
),
);
}
}
class _ExampleTile extends StatelessWidget {
final String title;
final String subtitle;
final Widget page;
const _ExampleTile({
required this.title,
required this.subtitle,
required this.page,
});
@override
Widget build(BuildContext context) {
return ListTile(
title: Text(title),
subtitle: Text(subtitle),
trailing: const Icon(Icons.arrow_right_sharp),
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => CodePage(title: title, child: page),
),
);
},
);
}
}