Skip to content

Commit 492a202

Browse files
committed
feat: ✨ migrates null safe example, adds chipselection
1 parent cfc371c commit 492a202

File tree

10 files changed

+1069
-26
lines changed

10 files changed

+1069
-26
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,18 @@ A widget that you can use to wrap other widgets (like a Scaffold or a Form) that
1616

1717
#### AutolinkText
1818

19-
A text widget, that turns URLs, email and phone numbers into clickable inline links in text for flutter. A null safe version of FogNature's [AutolinkText](https://github.com/FogNature/flutter_autolink_text).
19+
A text widget, that turns URLs, email and phone numbers into clickable inline links in text for flutter. For the moment, it's a null safe version of FogNature's [AutolinkText](https://github.com/FogNature/flutter_autolink_text).
2020

2121
### Material
2222

23-
#### Password TextField
23+
#### PasswordTextField
2424

2525
A widget that allows you to show or hide the password already embedded.
2626

27+
#### ChipSelection
28+
29+
A widget that provides an easy way to create a single or multiple selection chips. For the moment, it's a null safe version of davigmacode's [ChipsChoice](https://github.com/davigmacode/flutter_chips_choice)
30+
2731
### Cupertino
2832

2933
#### Coming Soon

example/lib/main.dart

Lines changed: 49 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class MyApp extends StatelessWidget {
2121
}
2222

2323
class MyHomePage extends StatefulWidget {
24-
MyHomePage({Key key, this.title}) : super(key: key);
24+
MyHomePage({Key? key, required this.title}) : super(key: key);
2525

2626
final String title;
2727

@@ -30,6 +30,9 @@ class MyHomePage extends StatefulWidget {
3030
}
3131

3232
class _MyHomePageState extends State<MyHomePage> {
33+
List<String> selectedChipsMultiple = [];
34+
late String selectedChip;
35+
3336
@override
3437
Widget build(BuildContext context) {
3538
return HideKeyboardOnTouchOutside(
@@ -54,19 +57,6 @@ class _MyHomePageState extends State<MyHomePage> {
5457
),
5558
),
5659
SizedBox(height: 32),
57-
Text(
58-
"CupertinoPasswordTextField",
59-
style: Theme.of(context).textTheme.headline6,
60-
),
61-
SizedBox(height: 16),
62-
CupertinoTextField(
63-
obscureText: true,
64-
suffix: Padding(
65-
padding: const EdgeInsets.symmetric(horizontal: 8),
66-
child: Icon(CupertinoIcons.eye),
67-
),
68-
),
69-
SizedBox(height: 32),
7060
Text(
7161
"AutolinkText",
7262
style: Theme.of(context).textTheme.headline6,
@@ -112,6 +102,51 @@ class _MyHomePageState extends State<MyHomePage> {
112102
),
113103
onPhoneTap: (String url) => print(url),
114104
),
105+
SizedBox(height: 32),
106+
Text(
107+
"ChipSelection",
108+
style: Theme.of(context).textTheme.headline6,
109+
),
110+
SizedBox(height: 16),
111+
Text(
112+
"Multiple Selection",
113+
style: Theme.of(context).textTheme.subtitle1,
114+
),
115+
ChipSelection<String>.multiple(
116+
wrapped: true,
117+
alignment: WrapAlignment.center,
118+
value: selectedChipsMultiple,
119+
onChanged: (selected) {
120+
setState(() {
121+
selectedChipsMultiple = selected;
122+
});
123+
},
124+
choiceItems: ChipSelectionData.listFrom<String, String>(
125+
source: ["Hello", "Multiple", "Chip", "Selection"],
126+
value: (i, v) => v,
127+
label: (i, v) => v,
128+
),
129+
),
130+
SizedBox(height: 16),
131+
Text(
132+
"Single Selection",
133+
style: Theme.of(context).textTheme.subtitle1,
134+
),
135+
ChipSelection<String>.single(
136+
wrapped: true,
137+
alignment: WrapAlignment.center,
138+
value: selectedChip,
139+
onChanged: (selected) {
140+
setState(() {
141+
selectedChip = selected;
142+
});
143+
},
144+
choiceItems: ChipSelectionData.listFrom<String, String>(
145+
source: ["Hello", "Single", "Chip", "Selection"],
146+
value: (i, v) => v,
147+
label: (i, v) => v,
148+
),
149+
),
115150
],
116151
),
117152
),

example/pubspec.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ packages:
4949
name: cupertino_icons
5050
url: "https://pub.dartlang.org"
5151
source: hosted
52-
version: "1.0.0"
52+
version: "1.0.3"
5353
fake_async:
5454
dependency: transitive
5555
description:
@@ -155,7 +155,7 @@ packages:
155155
path: ".."
156156
relative: true
157157
source: path
158-
version: "0.2.0"
158+
version: "0.3.0"
159159
sdks:
160160
dart: ">=2.12.0 <3.0.0"
161161
flutter: ">=1.17.0"

example/pubspec.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: A new Flutter project.
33

44
# The following line prevents the package from being accidentally published to
55
# pub.dev using `pub publish`. This is preferred for private packages.
6-
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
6+
publish_to: "none" # Remove this line if you wish to publish to pub.dev
77

88
# The following defines the version and build number for your application.
99
# A version number is three numbers separated by dots, like 1.2.43
@@ -18,18 +18,18 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
1818
version: 1.0.0+1
1919

2020
environment:
21-
sdk: ">=2.7.0 <3.0.0"
21+
sdk: '>=2.12.0 <3.0.0'
2222

2323
dependencies:
2424
flutter:
2525
sdk: flutter
2626
widgetkit:
2727
path: ../
28-
cupertino_icons: ^1.0.0
28+
cupertino_icons: ^1.0.3
2929

3030
dev_dependencies:
3131
flutter_test:
3232
sdk: flutter
3333

3434
flutter:
35-
uses-material-design: true
35+
uses-material-design: true
File renamed without changes.

0 commit comments

Comments
 (0)