Skip to content

Commit 76c5430

Browse files
authored
✨ update example to support latest flutter versions. (#379)
1 parent e3c127b commit 76c5430

File tree

17 files changed

+164
-61
lines changed

17 files changed

+164
-61
lines changed

example/.metadata

Lines changed: 37 additions & 2 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: c5a4b4029c0798f37c4a39b479d7cb75daa7b05c
7+
revision: 135454af32477f815a7525073027a3ff9eff1bfd
88
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: 135454af32477f815a7525073027a3ff9eff1bfd
17+
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
18+
- platform: android
19+
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
20+
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
21+
- platform: ios
22+
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
23+
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
24+
- platform: linux
25+
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
26+
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
27+
- platform: macos
28+
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
29+
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
30+
- platform: web
31+
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
32+
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
33+
- platform: windows
34+
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
35+
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
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'

example/analysis_options.yaml

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:lints/core.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

example/android/app/build.gradle

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
plugins {
2+
id "com.android.application"
3+
id "kotlin-android"
4+
id "dev.flutter.flutter-gradle-plugin"
5+
}
6+
17
def localProperties = new Properties()
28
def localPropertiesFile = rootProject.file('local.properties')
39
if (localPropertiesFile.exists()) {
@@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) {
612
}
713
}
814

9-
def flutterRoot = localProperties.getProperty('flutter.sdk')
10-
if (flutterRoot == null) {
11-
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12-
}
13-
1415
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
1516
if (flutterVersionCode == null) {
1617
flutterVersionCode = '1'
@@ -21,10 +22,6 @@ if (flutterVersionName == null) {
2122
flutterVersionName = '1.0'
2223
}
2324

24-
apply plugin: 'com.android.application'
25-
apply plugin: 'kotlin-android'
26-
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27-
2825
android {
2926
compileSdkVersion 31
3027

@@ -34,8 +31,8 @@ android {
3431

3532
defaultConfig {
3633
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
37-
applicationId "com.calendar.page.example.example"
38-
minSdkVersion 16
34+
applicationId "com.simformsolutions.calendarview"
35+
minSdkVersion flutter.minSdkVersion
3936
targetSdkVersion 31
4037
versionCode flutterVersionCode.toInteger()
4138
versionName flutterVersionName
@@ -48,12 +45,13 @@ android {
4845
signingConfig signingConfigs.debug
4946
}
5047
}
48+
namespace 'com.simformsolutions.calendarview'
5149
}
5250

5351
flutter {
5452
source '../..'
5553
}
5654

5755
dependencies {
58-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
56+
// Add required dependencies...
5957
}

example/android/app/src/debug/AndroidManifest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.calendar.page.example.example">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
32
<!-- Flutter needs it to communicate with the running application
43
to allow setting breakpoints, to provide hot reload, etc.
54
-->

example/android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.calendar.page.example.example">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
32
<application
43
android:label="example"
54
android:icon="@mipmap/ic_launcher">

example/android/app/src/main/kotlin/com/calendar/page/example/example/MainActivity.kt renamed to example/android/app/src/main/kotlin/com/simformsolutions/calendarview/MainActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.calendar.page.example.example
1+
package com.simformsolutions.calendarview
22

33
import io.flutter.embedding.android.FlutterActivity
44

example/android/app/src/profile/AndroidManifest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.calendar.page.example.example">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
32
<!-- Flutter needs it to communicate with the running application
43
to allow setting breakpoints, to provide hot reload, etc.
54
-->

example/android/build.gradle

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,7 @@
1-
buildscript {
2-
ext.kotlin_version = '1.5.31'
3-
repositories {
4-
google()
5-
jcenter()
6-
}
7-
8-
dependencies {
9-
classpath 'com.android.tools.build:gradle:4.1.0'
10-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11-
}
12-
}
13-
141
allprojects {
152
repositories {
163
google()
17-
jcenter()
4+
mavenCentral()
185
}
196
}
207

example/android/settings.gradle

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
1-
include ':app'
1+
pluginManagement {
2+
def flutterSdkPath = {
3+
def properties = new Properties()
4+
file("local.properties").withInputStream { properties.load(it) }
5+
def flutterSdkPath = properties.getProperty("flutter.sdk")
6+
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
7+
return flutterSdkPath
8+
}()
29

3-
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4-
def properties = new Properties()
10+
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
511

6-
assert localPropertiesFile.exists()
7-
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
12+
repositories {
13+
google()
14+
mavenCentral()
15+
gradlePluginPortal()
16+
}
17+
}
818

9-
def flutterSdkPath = properties.getProperty("flutter.sdk")
10-
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11-
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
19+
plugins {
20+
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21+
id "com.android.application" version "7.4.2" apply false
22+
id "org.jetbrains.kotlin.android" version "1.6.21" apply false
23+
}
24+
25+
include ":app"

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,11 @@
293293
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
294294
ENABLE_BITCODE = NO;
295295
INFOPLIST_FILE = Runner/Info.plist;
296-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
297-
PRODUCT_BUNDLE_IDENTIFIER = com.calendar.page.example.example;
296+
LD_RUNPATH_SEARCH_PATHS = (
297+
"$(inherited)",
298+
"@executable_path/Frameworks",
299+
);
300+
PRODUCT_BUNDLE_IDENTIFIER = com.simformsolutions.calendarview;
298301
PRODUCT_NAME = "$(TARGET_NAME)";
299302
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
300303
SWIFT_VERSION = 5.0;
@@ -417,8 +420,11 @@
417420
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
418421
ENABLE_BITCODE = NO;
419422
INFOPLIST_FILE = Runner/Info.plist;
420-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
421-
PRODUCT_BUNDLE_IDENTIFIER = com.calendar.page.example.example;
423+
LD_RUNPATH_SEARCH_PATHS = (
424+
"$(inherited)",
425+
"@executable_path/Frameworks",
426+
);
427+
PRODUCT_BUNDLE_IDENTIFIER = com.simformsolutions.calendarview;
422428
PRODUCT_NAME = "$(TARGET_NAME)";
423429
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
424430
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@@ -436,8 +442,11 @@
436442
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
437443
ENABLE_BITCODE = NO;
438444
INFOPLIST_FILE = Runner/Info.plist;
439-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
440-
PRODUCT_BUNDLE_IDENTIFIER = com.calendar.page.example.example;
445+
LD_RUNPATH_SEARCH_PATHS = (
446+
"$(inherited)",
447+
"@executable_path/Frameworks",
448+
);
449+
PRODUCT_BUNDLE_IDENTIFIER = com.simformsolutions.calendarview;
441450
PRODUCT_NAME = "$(TARGET_NAME)";
442451
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
443452
SWIFT_VERSION = 5.0;

0 commit comments

Comments
 (0)