Skip to content

Commit 2eec1ad

Browse files
committed
Added author info, Updated Changelog and Readme. More work needed on
documentation
1 parent 95d91e6 commit 2eec1ad

File tree

9 files changed

+318
-171
lines changed

9 files changed

+318
-171
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ build/
88
ios/.generated/
99
ios/Flutter/Generated.xcconfig
1010
ios/Runner/GeneratedPluginRegistrant.*
11+
/.project

.idea/vcs.xml

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

.idea/workspace.xml

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

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
## [0.0.1-beta0] - TODO: Add release date.
1+
## [0.0.1] - 1-Nov-2018.
22

3-
* TODO: Describe initial release.
3+
* Initial Release

README.md

Lines changed: 120 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,124 @@
1-
# flutter_form_builder
1+
# Flutter FormBuilder - flutter_form_builder
22

3-
A new flutter package project.
3+
This widget helps in generation of forms in [Flutter](https://flutter.io/)
44

5-
## Getting Started
65

7-
For help getting started with Flutter, view our online [documentation](https://flutter.io/).
6+
## Usage
7+
To use this plugin, add `flutter_form_builder` as a [dependency in your pubspec.yaml file](https://flutter.io/platform-plugins/).
8+
9+
10+
### Example
11+
12+
```
13+
import 'package:flutter/material.dart';
14+
import 'package:flutter_form_builder/flutter_form_builder.dart';
15+
16+
void main() => runApp(new MyApp());
17+
18+
class MyApp extends StatelessWidget {
19+
@override
20+
Widget build(BuildContext context) {
21+
return new MaterialApp(
22+
title: 'Flutter Demo',
23+
theme: new ThemeData(
24+
primarySwatch: Colors.blue,
25+
),
26+
home: new MyHomePage(),
27+
);
28+
}
29+
}
30+
31+
class MyHomePage extends StatelessWidget {
32+
@override
33+
Widget build(BuildContext context) {
34+
return Scaffold(
35+
appBar: AppBar(
36+
title: Text('Flutter FormBuilder Example'),
37+
),
38+
body: Container(
39+
margin: EdgeInsets.all(15.0),
40+
child: FormBuilder(
41+
context,
42+
autovalidate: true,
43+
controls: [
44+
FormBuilderInput.dropdown(
45+
attribute: "dropdown",
46+
require: true,
47+
label: "Dropdown",
48+
placeholder: "Select Option",
49+
options: [
50+
FormBuilderInputOption(value: "Option 1"),
51+
FormBuilderInputOption(value: "Option 2"),
52+
FormBuilderInputOption(value: "Option 3"),
53+
],
54+
),
55+
FormBuilderInput(
56+
type: FormBuilderInput.TYPE_NUMBER,
57+
attribute: "age",
58+
label: "Age",
59+
require: true,
60+
),
61+
FormBuilderInput(
62+
type: FormBuilderInput.TYPE_EMAIL,
63+
attribute: "email",
64+
label: "Email",
65+
require: true,
66+
),
67+
FormBuilderInput(
68+
type: FormBuilderInput.TYPE_URL,
69+
attribute: "url",
70+
label: "URL",
71+
require: true,
72+
),
73+
FormBuilderInput.datePicker(
74+
label: "Date of Birth",
75+
attribute: "dob",
76+
),
77+
FormBuilderInput.timePicker(
78+
label: "Appointment Time",
79+
attribute: "time",
80+
),
81+
FormBuilderInput.checkboxList(
82+
label: "My Languages",
83+
attribute: "languages",
84+
require: false,
85+
options: [
86+
FormBuilderInputOption(label: "Dart", value: false),
87+
FormBuilderInputOption(label: "Kotlin", value: false),
88+
FormBuilderInputOption(label: "Java", value: false),
89+
FormBuilderInputOption(label: "Swift", value: false),
90+
FormBuilderInputOption(label: "Objective-C", value: false),
91+
]),
92+
FormBuilderInput.radio(
93+
label: "My Best Language",
94+
attribute: "best_language",
95+
require: true,
96+
options: [
97+
FormBuilderInputOption(value: "Dart"),
98+
FormBuilderInputOption(value: "Kotlin"),
99+
FormBuilderInputOption(value: "Java"),
100+
FormBuilderInputOption(value: "Swift"),
101+
FormBuilderInputOption(value: "Objective-C"),
102+
]),
103+
],
104+
onChanged: () {
105+
print("Form Changed");
106+
},
107+
onSubmit: (formValue) {
108+
if (formValue != null) {
109+
print(formValue);
110+
} else {
111+
print("Form invalid");
112+
}
113+
},
114+
),
115+
),
116+
);
117+
}
118+
}
119+
```
120+
121+
## TODO:
122+
* Improve documentation
123+
* Add new `FormBuilderInput` types
8124

9-
For help on maintaining this package, view the [documentation](https://flutter.io/developing-packages/).

example/test/widget_test.dart

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1 @@
1-
// This is a basic Flutter widget test.
2-
// To perform an interaction with a widget in your test, use the WidgetTester utility that Flutter
3-
// provides. For example, you can send tap and scroll gestures. You can also use WidgetTester to
4-
// find child widgets in the widget tree, read text, and verify that the values of widget properties
5-
// are correct.
61

7-
import 'package:flutter/material.dart';
8-
import 'package:flutter_test/flutter_test.dart';
9-
10-
import 'package:example/main.dart';
11-
12-
void main() {
13-
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
14-
// Build our app and trigger a frame.
15-
await tester.pumpWidget(new MyApp());
16-
17-
// Verify that our counter starts at 0.
18-
expect(find.text('0'), findsOneWidget);
19-
expect(find.text('1'), findsNothing);
20-
21-
// Tap the '+' icon and trigger a frame.
22-
await tester.tap(find.byIcon(Icons.add));
23-
await tester.pump();
24-
25-
// Verify that our counter has incremented.
26-
expect(find.text('0'), findsNothing);
27-
expect(find.text('1'), findsOneWidget);
28-
});
29-
}

lib/src/form_builder_input.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import 'package:flutter/material.dart';
2-
import 'package:meta/meta.dart';
32
import 'package:flutter_typeahead/flutter_typeahead.dart';
43

54
import './form_builder_input_option.dart';

pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: flutter_form_builder
22
description: Package to build Material Form with components such as TextField (With number, url, email validation), DropDown, TypeAhead, Radios, Checkboxes
3-
version: 0.0.1-beta0
4-
author:
5-
homepage:
3+
version: 0.0.1
4+
author: Danvick Miller <[email protected]>
5+
homepage: https://github.com/danvick/flutter_form_builder
66

77
environment:
88
sdk: ">=2.0.0-dev.68.0 <3.0.0"

test/flutter_form_builder_test.dart

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import 'package:test/test.dart';
1+
// import 'package:test/test.dart';
2+
// import 'package:flutter_form_builder/flutter_form_builder.dart';
23

3-
import '../lib/flutter_form_builder.dart';
4-
5-
void main() {
4+
/*void main() {
65
test('', () {
76
87
});
9-
}
8+
}*/

0 commit comments

Comments
 (0)