Skip to content

Commit 87ef7bb

Browse files
committed
Updated project dependencies and make it null-safe.
1 parent 12cbb0b commit 87ef7bb

28 files changed

+87
-193
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
build/
77
.packages
88
pubspec.lock
9+
*.iml
910

1011
# iOS not required for this plugin
1112
ios/**
13+
windows/**
14+
macos/**

CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# 1.0.0
2+
3+
- Null Safety Migration (Finally!)
4+
- Thanks to Rexios and Peter Ullrich.
5+
- Min Dart 2.12 / Flutter 2.5
6+
- Updated native component versions:
7+
- Gradle 6.5
8+
- Android Gradle Plugin 4.1.0
9+
- Android compileSdkVersion 31
10+
- AndroidX Wear 1.2.0
11+
- Kotlin 1.5.10
12+
- Removed `jcenter()` repo requirement.
13+
114
# 0.1.1
215

316
- Fix Kotlin/Android compileOnly dep on com.google.android.wearable:wearable.

README.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ A plugin that offers Flutter support for Wear OS by Google (Android Wear).
55
__To use this plugin you must set your `minSdkVersion` to `23`.__
66

77

8+
# Tutorial
9+
10+
https://medium.com/flutter-community/flutter-building-wearos-app-fedf0f06d1b4
11+
12+
813
# Widgets
914

1015
There currently three widgets provided by the plugin:
@@ -15,22 +20,22 @@ There currently three widgets provided by the plugin:
1520

1621
## Example
1722

18-
Typically all three of these widgets would be used near the root of your app's widget tree:
23+
Typically, all three of these widgets would be used near the root of your app's widget tree:
1924

2025
```dart
2126
class WatchScreen extends StatelessWidget {
2227
@override
2328
Widget build(BuildContext context) {
2429
return WatchShape(
25-
builder: (context, shape, child) {
30+
builder: (BuildContext context, WearShape shape, Widget? child) {
2631
return AmbientMode(
2732
builder: (context, mode, child) {
2833
return mode == Mode.active ? ActiveWatchFace() : AmbientWatchFace();
2934
},
3035
);
3136
},
3237
);
33-
},
38+
}
3439
}
3540
```
3641

android/.gitignore

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
*.iml
22
.gradle
3-
/local.properties
4-
/.idea/workspace.xml
5-
/.idea/libraries
3+
local.properties
64
.DS_Store
7-
/build
5+
.idea/
6+
build/
87
/captures

android/build.gradle

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@ group 'com.mjohnsullivan.flutterwear.wear'
22
version '1.0-SNAPSHOT'
33

44
buildscript {
5-
ext.kotlin_version = '1.3.50'
5+
ext.kotlin_version = '1.5.10'
66
repositories {
77
google()
8-
jcenter()
8+
mavenCentral()
99
}
1010

1111
dependencies {
12-
classpath 'com.android.tools.build:gradle:3.5.4'
12+
classpath 'com.android.tools.build:gradle:4.1.0'
1313
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1414
}
1515
}
1616

1717
rootProject.allprojects {
1818
repositories {
1919
google()
20-
jcenter()
20+
mavenCentral()
2121
}
2222
}
2323

@@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
2626
//apply plugin: 'kotlin-android-extensions'
2727

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

3131
sourceSets {
3232
main.java.srcDirs += 'src/main/kotlin'
@@ -42,9 +42,9 @@ android {
4242
dependencies {
4343
//implementation "androidx.core:core-ktx:+"
4444
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
45-
implementation 'androidx.wear:wear:1.0.0'
45+
implementation 'androidx.wear:wear:1.2.0'
4646
implementation 'com.google.android.support:wearable:2.8.1'
4747
compileOnly 'com.google.android.wearable:wearable:2.8.1'
4848

49-
// compileOnly files('C:\\Android\\flutter\\bin\\cache\\artifacts\\engine\\android-x64\\flutter.jar')
49+
compileOnly files('C:\\Android\\flutter\\bin\\cache\\artifacts\\engine\\android-x64\\flutter.jar')
5050
}

android/gradle.properties

-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
org.gradle.jvmargs=-Xmx1536M
21
android.useAndroidX=true
32
android.enableJetifier=true

android/gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip

example/.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
.packages
3030
.pub-cache/
3131
.pub/
32-
/build/
32+
build/
3333

3434
# Web related
3535
lib/generated_plugin_registrant.dart
@@ -42,3 +42,5 @@ app.*.map.json
4242

4343
# iOS not required for this plugin
4444
ios/**
45+
windows/**
46+
macos/**

example/.idea/libraries/Dart_SDK.xml

-19
This file was deleted.

example/.idea/modules.xml

-9
This file was deleted.

example/.idea/runConfigurations/main_dart.xml

-6
This file was deleted.

example/.idea/workspace.xml

-36
This file was deleted.

example/README.md

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
# wear_example
22

33
Demonstrates how to use the wear plugin.
4-
5-
## Getting Started
6-

example/analysis_options.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include: package:flutter_lints/flutter.yaml

example/android/.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ gradle-wrapper.jar
33
/captures/
44
/gradlew
55
/gradlew.bat
6-
/local.properties
6+
/.idea
7+
local.properties
78
GeneratedPluginRegistrant.java
8-
.idea/
99

1010
# Remember to never publicly share your keystore.
1111
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app

example/android/app/build.gradle

+3-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if(localPropertiesFile.exists()) {
88

99
def flutterRoot = localProperties.getProperty('flutter.sdk')
1010
if(flutterRoot == null) {
11-
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
11+
throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
1212
}
1313

1414
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
@@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
2626
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
2727

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

3131
sourceSets {
3232
main.java.srcDirs += 'src/main/kotlin'
@@ -40,7 +40,7 @@ android {
4040
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
4141
applicationId "com.mjohnsullivan.flutterwear.wear_example"
4242
minSdkVersion 23
43-
targetSdkVersion 29
43+
targetSdkVersion 25
4444
versionCode flutterVersionCode.toInteger()
4545
versionName flutterVersionName
4646
}
@@ -60,7 +60,4 @@ flutter {
6060

6161
dependencies {
6262
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
63-
implementation 'androidx.wear:wear:1.0.0'
64-
implementation 'com.google.android.support:wearable:2.8.1'
65-
compileOnly 'com.google.android.wearable:wearable:2.8.1'
6663
}

example/android/build.gradle

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
buildscript {
2-
ext.kotlin_version = '1.3.50'
2+
ext.kotlin_version = '1.5.10'
33
repositories {
44
google()
5-
jcenter()
5+
mavenCentral()
66
}
77

88
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.5.4'
9+
classpath 'com.android.tools.build:gradle:4.1.0'
1010
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1111
}
1212
}
1313

1414
allprojects {
1515
repositories {
1616
google()
17-
jcenter()
17+
mavenCentral()
1818
}
1919
}
2020

example/android/gradle.properties

-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
org.gradle.jvmargs=-Xmx1536M
21
android.useAndroidX=true
32
android.enableJetifier=true
4-
android.enableR8=true
-52.4 KB
Binary file not shown.

example/android/gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip

example/lib/main.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ class MyApp extends StatelessWidget {
1010
home: Scaffold(
1111
body: Center(
1212
child: WatchShape(
13-
builder: (context, shape, child) {
13+
builder: (BuildContext context, WearShape shape, Widget? child) {
1414
return Column(
1515
mainAxisAlignment: MainAxisAlignment.center,
1616
children: <Widget>[
1717
Text(
1818
'Shape: ${shape == WearShape.round ? 'round' : 'square'}',
1919
),
20-
child,
20+
child!,
2121
],
2222
);
2323
},
2424
child: AmbientMode(
25-
builder: (context, mode, child) {
25+
builder: (BuildContext context, WearMode mode, Widget? child) {
2626
return Text(
2727
'Mode: ${mode == WearMode.active ? 'Active' : 'Ambient'}',
2828
);

example/pubspec.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ description: Demonstrates how to use the wear plugin.
33
publish_to: 'none'
44

55
environment:
6-
sdk: ">=2.7.0 <3.0.0"
6+
sdk: ">=2.12.0 <3.0.0"
7+
flutter: ">=2.5.0"
78

89
dependencies:
910
wear:
1011
path: ../
1112
flutter:
1213
sdk: flutter
14+
flutter_lints: ^1.0.4
1315

1416
dev_dependencies:
1517
flutter_test:

example/wear_example.iml

-18
This file was deleted.

0 commit comments

Comments
 (0)