Skip to content

Commit b9c3029

Browse files
Examples: re-create with 'flutter create .'
1 parent d411e35 commit b9c3029

File tree

108 files changed

+728
-625
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+728
-625
lines changed

dev-doc/updating-examples.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Updating Flutter examples
2+
3+
In the example directory delete the platform specific directories.
4+
5+
Then run `flutter create .` to re-create these files.
6+
7+
- Remove the web folder.
8+
- Remove the created default test.
9+
10+
Check changes do not break the example in any way, make additional changes as required.
11+
12+
Compare against a clean Flutter template (run `create` in an empty folder) to see if updates to
13+
other files like pubspec.yaml are needed.

objectbox/example/flutter/objectbox_demo/.gitignore

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
.buildlog/
99
.history
1010
.svn/
11+
migrate_working_dir/
1112

1213
# IntelliJ related
1314
*.iml
@@ -22,8 +23,10 @@
2223

2324
# Flutter/Dart/Pub related
2425
**/doc/api/
26+
**/ios/Flutter/.last_build_id
2527
.dart_tool/
26-
.flutter-plugins*
28+
.flutter-plugins
29+
.flutter-plugins-dependencies
2730
.packages
2831
.pub-cache/
2932
.pub/
@@ -32,7 +35,15 @@
3235
# Web related
3336
lib/generated_plugin_registrant.dart
3437

35-
# Exceptions to above rules.
36-
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
38+
# Symbolication related
39+
app.*.symbols
40+
41+
# Obfuscation related
42+
app.*.map.json
43+
44+
# Android Studio will place build artifacts here
45+
/android/app/debug
46+
/android/app/profile
47+
/android/app/release
3748

3849
objectbox
Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,45 @@
11
# This file tracks properties of this Flutter project.
22
# Used by Flutter tool to assess capabilities and perform upgrades etc.
33
#
4-
# This file should be version controlled and should not be manually edited.
4+
# This file should be version controlled.
55

66
version:
7-
revision: a4d5266b769e92286a48f6b6714e538f2c4578dc
8-
channel: master
7+
revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
8+
channel: stable
99

1010
project_type: app
11+
12+
# Tracks metadata for the flutter migrate command
13+
migration:
14+
platforms:
15+
- platform: root
16+
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
17+
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
18+
- platform: android
19+
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
20+
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
21+
- platform: ios
22+
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
23+
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
24+
- platform: linux
25+
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
26+
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
27+
- platform: macos
28+
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
29+
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
30+
- platform: web
31+
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
32+
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
33+
- platform: windows
34+
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
35+
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
36+
37+
# User provided section
38+
39+
# List of Local paths (relative to this file) that should be
40+
# ignored by the migrate tool.
41+
#
42+
# Files that are not part of the templates will be ignored by default.
43+
unmanaged_files:
44+
- 'lib/main.dart'
45+
- 'ios/Runner.xcodeproj/project.pbxproj'

objectbox/example/flutter/objectbox_demo/android/app/build.gradle

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

2828
android {
29-
compileSdkVersion 31
29+
compileSdkVersion flutter.compileSdkVersion
30+
ndkVersion flutter.ndkVersion
3031

3132
compileOptions {
3233
sourceCompatibility JavaVersion.VERSION_1_8
@@ -43,8 +44,10 @@ android {
4344

4445
defaultConfig {
4546
applicationId "com.example.objectbox_demo"
46-
minSdkVersion 16
47-
targetSdkVersion 29
47+
// You can update the following values to match your application needs.
48+
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
49+
minSdkVersion flutter.minSdkVersion
50+
targetSdkVersion flutter.targetSdkVersion
4851
versionCode flutterVersionCode.toInteger()
4952
versionName flutterVersionName
5053
}

objectbox/example/flutter/objectbox_demo/android/app/src/debug/AndroidManifest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="com.example.objectbox_demo">
3-
<!-- Flutter needs it to communicate with the running application
3+
<!-- The INTERNET permission is required for development. Specifically,
4+
the Flutter tool needs it to communicate with the running application
45
to allow setting breakpoints, to provide hot reload, etc.
56
-->
67
<uses-permission android:name="android.permission.INTERNET"/>

objectbox/example/flutter/objectbox_demo/android/app/src/main/AndroidManifest.xml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="com.example.objectbox_demo">
3-
<application
3+
<application
44
android:label="objectbox_demo"
5+
android:name="${applicationName}"
56
android:icon="@mipmap/ic_launcher">
67
<activity
78
android:name=".MainActivity"
9+
android:exported="true"
810
android:launchMode="singleTop"
911
android:theme="@style/LaunchTheme"
1012
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
@@ -15,18 +17,9 @@
1517
while the Flutter UI initializes. After that, this theme continues
1618
to determine the Window background behind the Flutter UI. -->
1719
<meta-data
18-
android:name="io.flutter.embedding.android.NormalTheme"
19-
android:resource="@style/NormalTheme"
20-
/>
21-
<!-- Displays an Android View that continues showing the launch screen
22-
Drawable until Flutter paints its first frame, then this splash
23-
screen fades out. A splash screen is useful to avoid any visual
24-
gap between the end of Android's launch screen and the painting of
25-
Flutter's first frame. -->
26-
<meta-data
27-
android:name="io.flutter.embedding.android.SplashScreenDrawable"
28-
android:resource="@drawable/launch_background"
29-
/>
20+
android:name="io.flutter.embedding.android.NormalTheme"
21+
android:resource="@style/NormalTheme"
22+
/>
3023
<intent-filter>
3124
<action android:name="android.intent.action.MAIN"/>
3225
<category android:name="android.intent.category.LAUNCHER"/>

objectbox/example/flutter/objectbox_demo/android/app/src/main/res/values-night/styles.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
44
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
55
<!-- Show a splash screen on the activity. Automatically removed when
6-
Flutter draws its first frame -->
6+
the Flutter engine draws its first frame -->
77
<item name="android:windowBackground">@drawable/launch_background</item>
88
</style>
99
<!-- Theme applied to the Android Window as soon as the process has started.
1010
This theme determines the color of the Android Window while your
1111
Flutter UI initializes, as well as behind your Flutter UI while its
1212
running.
13-
13+
1414
This Theme is only used starting with V2 of Flutter's Android embedding. -->
1515
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
1616
<item name="android:windowBackground">?android:colorBackground</item>
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3-
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
3+
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
4+
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
45
<!-- Show a splash screen on the activity. Automatically removed when
5-
Flutter draws its first frame -->
6+
the Flutter engine draws its first frame -->
67
<item name="android:windowBackground">@drawable/launch_background</item>
78
</style>
8-
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
9-
<item name="android:windowBackground">@drawable/launch_background</item>
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.Light.NoTitleBar">
16+
<item name="android:windowBackground">?android:colorBackground</item>
1017
</style>
1118
</resources>

objectbox/example/flutter/objectbox_demo/android/app/src/profile/AndroidManifest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="com.example.objectbox_demo">
3-
<!-- Flutter needs it to communicate with the running application
3+
<!-- The INTERNET permission is required for development. Specifically,
4+
the Flutter tool needs it to communicate with the running application
45
to allow setting breakpoints, to provide hot reload, etc.
56
-->
67
<uses-permission android:name="android.permission.INTERNET"/>
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
buildscript {
2-
ext.kotlin_version = "1.6.10"
2+
ext.kotlin_version = '1.6.10'
33
repositories {
44
google()
55
mavenCentral()
66
}
77

88
dependencies {
9-
classpath("com.android.tools.build:gradle:7.0.4")
10-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
9+
classpath 'com.android.tools.build:gradle:7.1.2'
10+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1111
}
1212
}
1313

@@ -21,13 +21,11 @@ allprojects {
2121
rootProject.buildDir = '../build'
2222
subprojects {
2323
project.buildDir = "${rootProject.buildDir}/${project.name}"
24+
}
25+
subprojects {
2426
project.evaluationDependsOn(':app')
2527
}
2628

2729
task clean(type: Delete) {
2830
delete rootProject.buildDir
2931
}
30-
31-
wrapper {
32-
distributionType Wrapper.DistributionType.ALL
33-
}

0 commit comments

Comments
 (0)