Skip to content

Commit 0f6e72a

Browse files
committed
Include code sample in README
1 parent a69ffdd commit 0f6e72a

File tree

4 files changed

+30
-11
lines changed

4 files changed

+30
-11
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1+
## [0.1.1] - 31-Dec-2020
2+
* Include code sample in README
3+
14
## [0.1.0] - 31-Dec-2020
25
* Initial release.

README.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,23 @@
22

33
Field for picking image(s) from Gallery or Camera for flutter_form_builder package
44

5-
## Getting Started
5+
## Usage
66

7-
This project is a starting point for a Dart
8-
[package](https://flutter.dev/developing-packages/),
9-
a library module containing code that can be shared easily across
10-
multiple Flutter or Dart projects.
11-
12-
For help getting started with Flutter, view our
13-
[online documentation](https://flutter.dev/docs), which offers tutorials,
14-
samples, guidance on mobile development, and a full API reference.
7+
FormBuilder(
8+
child: Column(
9+
mainAxisAlignment: MainAxisAlignment.center,
10+
children: <Widget>[
11+
FormBuilderImagePicker(
12+
name: 'photos',
13+
decoration: const InputDecoration(labelText: 'Pick Photos'),
14+
maxImages: 1,
15+
),
16+
const SizedBox(height: 15),
17+
RaisedButton(onPressed: (){
18+
if(_formKey.currentState.saveAndValidate()){
19+
print(_formKey.currentState.value);
20+
}
21+
})
22+
],
23+
),
24+
),

example/lib/main.dart

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

2323
class MyHomePage extends StatelessWidget {
24+
final _formKey = GlobalKey<FormBuilderState>();
2425

2526
@override
2627
Widget build(BuildContext context) {
@@ -41,6 +42,11 @@ class MyHomePage extends StatelessWidget {
4142
maxImages: 1,
4243
),
4344
const SizedBox(height: 15),
45+
RaisedButton(onPressed: () {
46+
if (_formKey.currentState.saveAndValidate()) {
47+
print(_formKey.currentState.value);
48+
}
49+
})
4450
],
4551
),
4652
),

pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: form_builder_image_picker
2-
description: Field for picking image(s) from Gallery or Camera for flutter_form_builder package
3-
version: 0.1.0
2+
description: Field for picking image(s) from Gallery or Camera for flutter_form_builder package
3+
version: 0.1.1
44
homepage: https://github.com/danvick/form_builder_image_picker
55

66
environment:

0 commit comments

Comments
 (0)