Skip to content

Commit f963a15

Browse files
committed
Added support for FormBuilder 4.*
1 parent 9373e67 commit f963a15

File tree

24 files changed

+495
-271
lines changed

24 files changed

+495
-271
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
.buildlog/
99
.history
1010
.svn/
11+
*.old
1112

1213
# IntelliJ related
1314
*.iml

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,23 @@ Since this package makes use of [file_picker package](https://pub.dev/packages/f
99
# Usage
1010

1111
```dart
12-
import 'package:flutter_form_builder/flutter_form_builder.dart';
13-
import 'package:form_builder_file_picker/form_builder_file_picker.dart';
12+
import 'package:flutter_form_builder/flutter_form_builder.dart';
13+
import 'package:form_builder_file_picker/form_builder_file_picker.dart';
1414
15-
FormBuilderFilePicker(
16-
attribute: "images",
15+
FormBuilderFilePicker(
16+
name: "images",
1717
decoration: InputDecoration(labelText: "Attachments"),
18-
maxFiles: 5,
19-
multiple: true,
18+
maxFiles: null,
2019
previewImages: true,
2120
onChanged: (val) => print(val),
22-
fileType: FileType.any,
2321
selector: Row(
2422
children: <Widget>[
2523
Icon(Icons.file_upload),
2624
Text('Upload'),
2725
],
2826
),
29-
),
27+
onFileLoading: (val) {
28+
print(val);
29+
},
30+
),
3031
```

example/.flutter-plugins-dependencies

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"_info":"// This is a generated file; do not edit or check into version control.","dependencyGraph":[{"name":"file_picker","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"flutter_keyboard_visibility","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"image_picker","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"permission_handler","dependencies":[]},{"name":"phone_number","dependencies":[]}]}
1+
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"file_picker","path":"/Users/danvick/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-2.1.4/","dependencies":[]},{"name":"flutter_keyboard_visibility","path":"/Users/danvick/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_keyboard_visibility-4.0.2/","dependencies":[]},{"name":"image_picker","path":"/Users/danvick/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.6.7+17/","dependencies":[]},{"name":"permission_handler","path":"/Users/danvick/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-5.0.1+1/","dependencies":[]},{"name":"phone_number","path":"/Users/danvick/flutter/.pub-cache/hosted/pub.dartlang.org/phone_number-0.8.1/","dependencies":[]}],"android":[{"name":"file_picker","path":"/Users/danvick/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-2.1.4/","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"flutter_keyboard_visibility","path":"/Users/danvick/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_keyboard_visibility-4.0.2/","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","path":"/Users/danvick/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-1.0.6/","dependencies":[]},{"name":"image_picker","path":"/Users/danvick/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.6.7+17/","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"permission_handler","path":"/Users/danvick/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-5.0.1+1/","dependencies":[]},{"name":"phone_number","path":"/Users/danvick/flutter/.pub-cache/hosted/pub.dartlang.org/phone_number-0.8.1/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[{"name":"file_picker","path":"/Users/danvick/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-2.1.4/","dependencies":[]},{"name":"flutter_keyboard_visibility_web","path":"/Users/danvick/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_keyboard_visibility_web-1.0.1/","dependencies":[]},{"name":"image_picker_for_web","path":"/Users/danvick/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker_for_web-0.1.0+2/","dependencies":[]}]},"dependencyGraph":[{"name":"file_picker","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"flutter_keyboard_visibility","dependencies":["flutter_keyboard_visibility_web"]},{"name":"flutter_keyboard_visibility_web","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"image_picker","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"permission_handler","dependencies":[]},{"name":"phone_number","dependencies":[]}],"date_created":"2020-12-28 21:15:44.666605","version":"1.22.4"}

example/android/.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
gradle-wrapper.jar
2+
/.gradle
3+
/captures/
4+
/gradlew
5+
/gradlew.bat
6+
/local.properties
7+
GeneratedPluginRegistrant.java
8+
9+
# Remember to never publicly share your keystore.
10+
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11+
key.properties

example/android/app/build.gradle

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
2626
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
2727

2828
android {
29-
compileSdkVersion 28
29+
compileSdkVersion 29
3030

3131
sourceSets {
3232
main.java.srcDirs += 'src/main/kotlin'
@@ -39,11 +39,10 @@ android {
3939
defaultConfig {
4040
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
4141
applicationId "dev.formbuilderfilepicker.example"
42-
minSdkVersion 19
43-
targetSdkVersion 28
42+
minSdkVersion 16
43+
targetSdkVersion 29
4444
versionCode flutterVersionCode.toInteger()
4545
versionName flutterVersionName
46-
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
4746
}
4847

4948
buildTypes {
@@ -61,7 +60,4 @@ flutter {
6160

6261
dependencies {
6362
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
64-
testImplementation 'junit:junit:4.12'
65-
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
66-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
6763
}
Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="dev.formbuilderfilepicker.example">
3-
4-
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
5-
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
6-
<uses-permission android:name="android.permission.CAMERA" />
3+
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
4+
calls FlutterMain.startInitialization(this); in its onCreate method.
5+
In most cases you can leave this as-is, but you if you want to provide
6+
additional functionality it is fine to subclass or reimplement
7+
FlutterApplication and put your custom class here. -->
78
<application
89
android:name="io.flutter.app.FlutterApplication"
910
android:label="example"
@@ -12,20 +13,35 @@
1213
android:name=".MainActivity"
1314
android:launchMode="singleTop"
1415
android:theme="@style/LaunchTheme"
15-
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
16+
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
1617
android:hardwareAccelerated="true"
1718
android:windowSoftInputMode="adjustResize">
18-
<!-- This keeps the window background of the activity showing
19-
until Flutter renders its first frame. It can be removed if
20-
there is no splash screen (such as the default splash screen
21-
defined in @style/LaunchTheme). -->
19+
<!-- Specifies an Android theme to apply to this Activity as soon as
20+
the Android process has started. This theme is visible to the user
21+
while the Flutter UI initializes. After that, this theme continues
22+
to determine the Window background behind the Flutter UI. -->
2223
<meta-data
23-
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
24-
android:value="true" />
24+
android:name="io.flutter.embedding.android.NormalTheme"
25+
android:resource="@style/NormalTheme"
26+
/>
27+
<!-- Displays an Android View that continues showing the launch screen
28+
Drawable until Flutter paints its first frame, then this splash
29+
screen fades out. A splash screen is useful to avoid any visual
30+
gap between the end of Android's launch screen and the painting of
31+
Flutter's first frame. -->
32+
<meta-data
33+
android:name="io.flutter.embedding.android.SplashScreenDrawable"
34+
android:resource="@drawable/launch_background"
35+
/>
2536
<intent-filter>
2637
<action android:name="android.intent.action.MAIN"/>
2738
<category android:name="android.intent.category.LAUNCHER"/>
2839
</intent-filter>
2940
</activity>
41+
<!-- Don't delete the meta-data below.
42+
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
43+
<meta-data
44+
android:name="flutterEmbedding"
45+
android:value="2" />
3046
</application>
3147
</manifest>
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
package dev.formbuilderfilepicker.example
22

3-
import android.os.Bundle
4-
5-
import io.flutter.app.FlutterActivity
6-
import io.flutter.plugins.GeneratedPluginRegistrant
3+
import io.flutter.embedding.android.FlutterActivity
74

85
class MainActivity: FlutterActivity() {
9-
override fun onCreate(savedInstanceState: Bundle?) {
10-
super.onCreate(savedInstanceState)
11-
GeneratedPluginRegistrant.registerWith(this)
12-
}
136
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3+
<!-- Theme applied to the Android Window while the process is starting -->
34
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
45
<!-- Show a splash screen on the activity. Automatically removed when
56
Flutter draws its first frame -->
67
<item name="android:windowBackground">@drawable/launch_background</item>
78
</style>
9+
<!-- Theme applied to the Android Window as soon as the process has started.
10+
This theme determines the color of the Android Window while your
11+
Flutter UI initializes, as well as behind your Flutter UI while its
12+
running.
13+
14+
This Theme is only used starting with V2 of Flutter's Android embedding. -->
15+
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
16+
<item name="android:windowBackground">@android:color/white</item>
17+
</style>
818
</resources>

example/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
buildscript {
2-
ext.kotlin_version = '1.3.10'
2+
ext.kotlin_version = '1.3.50'
33
repositories {
44
google()
55
jcenter()

example/android/gradle.properties

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
org.gradle.jvmargs=-Xmx1536M
2-
3-
android.enableR8=true
42
android.useAndroidX=true
53
android.enableJetifier=true
4+
android.enableR8=true

0 commit comments

Comments
 (0)