Skip to content

Commit 31ce02e

Browse files
Merge pull request #423 from objectbox/example-updates
Examples: re-create with latest Flutter template
2 parents 2c14492 + b7a46fb commit 31ce02e

File tree

113 files changed

+808
-704
lines changed

Some content is hidden

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

113 files changed

+808
-704
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'
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This file configures the analyzer, which statically analyzes Dart code to
2+
# check for errors, warnings, and lints.
3+
#
4+
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5+
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6+
# invoked from the command line by running `flutter analyze`.
7+
8+
# The following line activates a set of recommended lints for Flutter apps,
9+
# packages, and plugins designed to encourage good coding practices.
10+
include: package:flutter_lints/flutter.yaml
11+
12+
linter:
13+
# The lint rules applied to this project can be customized in the
14+
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
15+
# included above or to enable additional rules. A list of all available lints
16+
# and their documentation is published at
17+
# https://dart-lang.github.io/linter/lints/index.html.
18+
#
19+
# Instead of disabling a lint rule for the entire project in the
20+
# section below, it can also be suppressed for a single line of code
21+
# or a specific dart file by using the `// ignore: name_of_lint` and
22+
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
23+
# producing the lint.
24+
rules:
25+
# avoid_print: false # Uncomment to disable the `avoid_print` rule
26+
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27+
28+
# Additional information about this file can be found at
29+
# https://dart.dev/guides/language/analysis-options

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

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

2828
android {
29+
// Using explicit versions to build with Flutter 2.2.0 in CI.
30+
// compileSdkVersion flutter.compileSdkVersion
31+
// ndkVersion flutter.ndkVersion
2932
compileSdkVersion 31
3033

3134
compileOptions {
@@ -43,6 +46,11 @@ android {
4346

4447
defaultConfig {
4548
applicationId "com.example.objectbox_demo"
49+
// You can update the following values to match your application needs.
50+
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
51+
// minSdkVersion flutter.minSdkVersion
52+
// targetSdkVersion flutter.targetSdkVersion
53+
// Using explicit versions to build with Flutter 2.2.0 in CI.
4654
minSdkVersion 16
4755
targetSdkVersion 29
4856
versionCode flutterVersionCode.toInteger()

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: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
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"
55
android:icon="@mipmap/ic_launcher">
66
<activity
77
android:name=".MainActivity"
8+
android:exported="true"
89
android:launchMode="singleTop"
910
android:theme="@style/LaunchTheme"
1011
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
@@ -15,18 +16,9 @@
1516
while the Flutter UI initializes. After that, this theme continues
1617
to determine the Window background behind the Flutter UI. -->
1718
<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-
/>
19+
android:name="io.flutter.embedding.android.NormalTheme"
20+
android:resource="@style/NormalTheme"
21+
/>
3022
<intent-filter>
3123
<action android:name="android.intent.action.MAIN"/>
3224
<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"/>

0 commit comments

Comments
 (0)