mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 22:09:06 +00:00
Update add to app code to run on modern versions of agp and gradle. (#2330)
## Pre-launch Checklist - [x] I read the [Flutter Style Guide] _recently_, and have followed its advice. - [x] I signed the [CLA]. - [x] I read the [Contributors Guide]. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-devrel channel on [Discord]. <!-- Links --> [Flutter Style Guide]: https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md [CLA]: https://cla.developers.google.com/ [Discord]: https://github.com/flutter/flutter/blob/master/docs/contributing/Chat.md [Contributors Guide]: https://github.com/flutter/samples/blob/main/CONTRIBUTING.md
This commit is contained in:
@@ -4,12 +4,16 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 31
|
compileSdk 34
|
||||||
|
|
||||||
|
lint {
|
||||||
|
baseline = file("lint-baseline.xml")
|
||||||
|
}
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "dev.flutter.example.androidView"
|
applicationId "dev.flutter.example.androidView"
|
||||||
minSdkVersion 16
|
minSdkVersion 21
|
||||||
targetSdkVersion 30
|
targetSdkVersion 34
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
|
|
||||||
@@ -32,11 +36,12 @@ android {
|
|||||||
buildFeatures {
|
buildFeatures {
|
||||||
viewBinding true
|
viewBinding true
|
||||||
}
|
}
|
||||||
|
namespace 'dev.flutter.example.androidView'
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||||
implementation 'androidx.core:core-ktx:1.3.2'
|
implementation 'androidx.core:core-ktx:1.10.0'
|
||||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||||
implementation 'com.google.android.material:material:1.2.1'
|
implementation 'com.google.android.material:material:1.2.1'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||||
|
|||||||
279
add_to_app/android_view/android_view/app/lint-baseline.xml
Normal file
279
add_to_app/android_view/android_view/app/lint-baseline.xml
Normal file
@@ -0,0 +1,279 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<issues format="6" by="lint 7.4.2" type="baseline" client="gradle" dependencies="false" name="AGP (7.4.2)" variant="all" version="7.4.2">
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="RedundantLabel"
|
||||||
|
message="Redundant label can be removed"
|
||||||
|
errorLine1=" android:label="@string/app_name">"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="14"
|
||||||
|
column="13"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="GradleDependency"
|
||||||
|
message="A newer version of org.jetbrains.kotlin:kotlin-stdlib than 1.8.22 is available: 1.9.20"
|
||||||
|
errorLine1="}"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="build.gradle"
|
||||||
|
line="39"
|
||||||
|
column="20"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="GradleDependency"
|
||||||
|
message="A newer version of androidx.core:core-ktx than 1.3.2 is available: 1.13.1"
|
||||||
|
errorLine1=""
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="build.gradle"
|
||||||
|
line="40"
|
||||||
|
column="20"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="GradleDependency"
|
||||||
|
message="A newer version of androidx.appcompat:appcompat than 1.2.0 is available: 1.7.0"
|
||||||
|
errorLine1="dependencies {"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="build.gradle"
|
||||||
|
line="41"
|
||||||
|
column="20"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="GradleDependency"
|
||||||
|
message="A newer version of com.google.android.material:material than 1.2.1 is available: 1.12.0"
|
||||||
|
errorLine1=" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version""
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="build.gradle"
|
||||||
|
line="42"
|
||||||
|
column="20"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="GradleDependency"
|
||||||
|
message="A newer version of androidx.constraintlayout:constraintlayout than 2.0.4 is available: 2.1.4"
|
||||||
|
errorLine1=" implementation 'androidx.core:core-ktx:1.3.2'"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="build.gradle"
|
||||||
|
line="43"
|
||||||
|
column="20"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="GradleDependency"
|
||||||
|
message="A newer version of androidx.vectordrawable:vectordrawable than 1.1.0 is available: 1.2.0"
|
||||||
|
errorLine1=" implementation 'androidx.appcompat:appcompat:1.2.0'"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="build.gradle"
|
||||||
|
line="44"
|
||||||
|
column="20"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="GradleDependency"
|
||||||
|
message="A newer version of androidx.lifecycle:lifecycle-livedata-ktx than 2.2.0 is available: 2.8.2"
|
||||||
|
errorLine1=" implementation 'com.google.android.material:material:1.2.1'"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="build.gradle"
|
||||||
|
line="45"
|
||||||
|
column="20"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="GradleDependency"
|
||||||
|
message="A newer version of androidx.lifecycle:lifecycle-viewmodel-ktx than 2.2.0 is available: 2.8.2"
|
||||||
|
errorLine1=" implementation 'androidx.constraintlayout:constraintlayout:2.0.4'"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="build.gradle"
|
||||||
|
line="46"
|
||||||
|
column="20"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="GradleDependency"
|
||||||
|
message="A newer version of androidx.navigation:navigation-fragment-ktx than 2.3.2 is available: 2.7.7"
|
||||||
|
errorLine1=" implementation 'androidx.vectordrawable:vectordrawable:1.1.0'"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="build.gradle"
|
||||||
|
line="47"
|
||||||
|
column="20"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="GradleDependency"
|
||||||
|
message="A newer version of androidx.navigation:navigation-ui-ktx than 2.3.2 is available: 2.7.7"
|
||||||
|
errorLine1=" implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="build.gradle"
|
||||||
|
line="48"
|
||||||
|
column="20"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="GradleDependency"
|
||||||
|
message="A newer version of androidx.recyclerview:recyclerview than 1.1.0 is available: 1.3.2"
|
||||||
|
errorLine1=" implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="build.gradle"
|
||||||
|
line="49"
|
||||||
|
column="20"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="GradleDependency"
|
||||||
|
message="A newer version of androidx.test.ext:junit than 1.1.2 is available: 1.1.5"
|
||||||
|
errorLine1=" implementation "androidx.recyclerview:recyclerview:1.1.0""
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="build.gradle"
|
||||||
|
line="52"
|
||||||
|
column="31"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="GradleDependency"
|
||||||
|
message="A newer version of androidx.test.espresso:espresso-core than 3.3.0 is available: 3.5.1"
|
||||||
|
errorLine1=" implementation project(path: ':flutter')"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="build.gradle"
|
||||||
|
line="53"
|
||||||
|
column="31"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="GradleDynamicVersion"
|
||||||
|
message="Avoid using + in version numbers; can lead to unpredictable and unrepeatable builds (junit:junit:4.+)"
|
||||||
|
errorLine1=" implementation 'androidx.navigation:navigation-ui-ktx:2.3.2'"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="build.gradle"
|
||||||
|
line="51"
|
||||||
|
column="24"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="ExpiredTargetSdkVersion"
|
||||||
|
message="Google Play requires that apps target API level 31 or higher.
"
|
||||||
|
errorLine1=" defaultConfig {"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="build.gradle"
|
||||||
|
line="12"
|
||||||
|
column="9"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="ObsoleteSdkInt"
|
||||||
|
message="Unnecessary; SDK_INT is always >= 21"
|
||||||
|
errorLine1=" <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/res/values-night/themes.xml"
|
||||||
|
line="13"
|
||||||
|
column="45"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="ObsoleteSdkInt"
|
||||||
|
message="Unnecessary; SDK_INT is always >= 21"
|
||||||
|
errorLine1=" <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/res/values/themes.xml"
|
||||||
|
line="13"
|
||||||
|
column="45"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="UnusedResources"
|
||||||
|
message="The resource `R.dimen.activity_horizontal_margin` appears to be unused"
|
||||||
|
errorLine1=" <dimen name="activity_horizontal_margin">16dp</dimen>"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/res/values/dimens.xml"
|
||||||
|
line="3"
|
||||||
|
column="12"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="UnusedResources"
|
||||||
|
message="The resource `R.dimen.activity_vertical_margin` appears to be unused"
|
||||||
|
errorLine1=" <dimen name="activity_vertical_margin">16dp</dimen>"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/res/values/dimens.xml"
|
||||||
|
line="4"
|
||||||
|
column="12"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="UnusedResources"
|
||||||
|
message="The resource `R.drawable.ic_dashboard_black_24dp` appears to be unused"
|
||||||
|
errorLine1="<vector xmlns:android="http://schemas.android.com/apk/res/android""
|
||||||
|
errorLine2="^">
|
||||||
|
<location
|
||||||
|
file="src/main/res/drawable/ic_dashboard_black_24dp.xml"
|
||||||
|
line="1"
|
||||||
|
column="1"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="UnusedResources"
|
||||||
|
message="The resource `R.drawable.ic_home_black_24dp` appears to be unused"
|
||||||
|
errorLine1="<vector xmlns:android="http://schemas.android.com/apk/res/android""
|
||||||
|
errorLine2="^">
|
||||||
|
<location
|
||||||
|
file="src/main/res/drawable/ic_home_black_24dp.xml"
|
||||||
|
line="1"
|
||||||
|
column="1"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="UnusedResources"
|
||||||
|
message="The resource `R.drawable.ic_notifications_black_24dp` appears to be unused"
|
||||||
|
errorLine1="<vector xmlns:android="http://schemas.android.com/apk/res/android""
|
||||||
|
errorLine2="^">
|
||||||
|
<location
|
||||||
|
file="src/main/res/drawable/ic_notifications_black_24dp.xml"
|
||||||
|
line="1"
|
||||||
|
column="1"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="MonochromeLauncherIcon"
|
||||||
|
message="The application adaptive icon is missing a monochrome tag"
|
||||||
|
errorLine1="<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">"
|
||||||
|
errorLine2="^">
|
||||||
|
<location
|
||||||
|
file="src/main/res/mipmap-anydpi-v26/ic_launcher.xml"
|
||||||
|
line="2"
|
||||||
|
column="1"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="MonochromeLauncherIcon"
|
||||||
|
message="The application adaptive roundIcon is missing a monochrome tag"
|
||||||
|
errorLine1="<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">"
|
||||||
|
errorLine2="^">
|
||||||
|
<location
|
||||||
|
file="src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml"
|
||||||
|
line="2"
|
||||||
|
column="1"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
</issues>
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
package="dev.flutter.example.androidView">
|
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
@@ -11,6 +10,7 @@
|
|||||||
android:theme="@style/Theme.FlutterViewIntegration">
|
android:theme="@style/Theme.FlutterViewIntegration">
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
|
android:exported="true"
|
||||||
android:label="@string/app_name">
|
android:label="@string/app_name">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import android.content.Intent
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.core.os.BundleCompat
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import dev.flutter.example.androidView.databinding.ActivityMainBinding
|
import dev.flutter.example.androidView.databinding.ActivityMainBinding
|
||||||
import io.flutter.FlutterInjector
|
import io.flutter.FlutterInjector
|
||||||
@@ -61,7 +62,14 @@ class MainActivity : AppCompatActivity() {
|
|||||||
// If the activity was restarted, keep track of the previous scroll
|
// If the activity was restarted, keep track of the previous scroll
|
||||||
// position and of the previous cell indices that were randomly selected
|
// position and of the previous cell indices that were randomly selected
|
||||||
// as Flutter cells to preserve immersion.
|
// as Flutter cells to preserve immersion.
|
||||||
layoutManager.onRestoreInstanceState(savedInstanceState?.getParcelable<Parcelable>("layoutManager"))
|
if (savedInstanceState != null) {
|
||||||
|
val state = BundleCompat.getParcelable<Parcelable>(
|
||||||
|
savedInstanceState,
|
||||||
|
"layoutManager",
|
||||||
|
Parcelable::class.java
|
||||||
|
)
|
||||||
|
layoutManager.onRestoreInstanceState(state)
|
||||||
|
}
|
||||||
val previousFlutterCellsArray = savedInstanceState?.getIntegerArrayList("adapter")
|
val previousFlutterCellsArray = savedInstanceState?.getIntegerArrayList("adapter")
|
||||||
if (previousFlutterCellsArray != null) {
|
if (previousFlutterCellsArray != null) {
|
||||||
adapter.previousFlutterCells = TreeSet(previousFlutterCellsArray)
|
adapter.previousFlutterCells = TreeSet(previousFlutterCellsArray)
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = "1.6.0"
|
ext.kotlin_version = '1.8.0'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:4.1.2'
|
classpath 'com.android.tools.build:gradle:8.3.2'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
|||||||
@@ -17,3 +17,5 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
|||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
# Kotlin code style for this project: "official" or "obsolete":
|
# Kotlin code style for this project: "official" or "obsolete":
|
||||||
kotlin.code.style=official
|
kotlin.code.style=official
|
||||||
|
android.nonTransitiveRClass=false
|
||||||
|
android.nonFinalResIds=false
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
#Wed Mar 10 09:46:16 PST 2021
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
|
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStorePath=wrapper/dists
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import 'dart:math';
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:sensors/sensors.dart';
|
import 'package:sensors_plus/sensors_plus.dart';
|
||||||
|
|
||||||
// This is on alternate entrypoint for this module to display Flutter UI in
|
// This is on alternate entrypoint for this module to display Flutter UI in
|
||||||
// a (multi-)view integration scenario.
|
// a (multi-)view integration scenario.
|
||||||
@@ -109,7 +109,7 @@ class _CellState extends State<Cell> with WidgetsBindingObserver {
|
|||||||
// Don't continuously rebuild for nothing when the
|
// Don't continuously rebuild for nothing when the
|
||||||
// cell isn't visible.
|
// cell isn't visible.
|
||||||
stream: appLifecycleState == AppLifecycleState.resumed
|
stream: appLifecycleState == AppLifecycleState.resumed
|
||||||
? accelerometerEvents
|
? accelerometerEventStream()
|
||||||
: Stream.value(defaultPosition),
|
: Stream.value(defaultPosition),
|
||||||
initialData: defaultPosition,
|
initialData: defaultPosition,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ dependencies:
|
|||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
provider: ^6.0.2
|
provider: ^6.0.2
|
||||||
url_launcher: ^6.0.6
|
url_launcher: ^6.0.20
|
||||||
sensors: ^2.0.3
|
sensors_plus: ^5.0.1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
analysis_defaults:
|
analysis_defaults:
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ apply plugin: 'com.android.application'
|
|||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 33
|
compileSdk 34
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "dev.flutter.example.androidusingplugin"
|
applicationId "dev.flutter.example.androidusingplugin"
|
||||||
minSdkVersion 19
|
minSdkVersion 21
|
||||||
targetSdkVersion 33
|
targetSdk 34
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
@@ -17,19 +17,29 @@ android {
|
|||||||
minifyEnabled false
|
minifyEnabled false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Remove when #flutter/flutter/issues/150955 is merged to stable.
|
||||||
|
lintOptions {
|
||||||
|
checkReleaseBuilds false
|
||||||
|
}
|
||||||
|
// Keep java and kotlin versions in sync.
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility 1.8
|
sourceCompatibility 1.8
|
||||||
targetCompatibility 1.8
|
targetCompatibility 1.8
|
||||||
}
|
}
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = '1.8'
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace 'dev.flutter.example.androidusingplugin'
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':flutter')
|
implementation project(':flutter')
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
implementation 'androidx.appcompat:appcompat:1.7.0'
|
||||||
implementation 'androidx.core:core-ktx:1.10.1'
|
implementation 'androidx.core:core-ktx:1.13.1'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
package="dev.flutter.example.androidusingplugin">
|
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name=".MyApplication"
|
android:name=".MyApplication"
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ buildscript {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:7.4.2'
|
classpath 'com.android.tools.build:gradle:8.3.2'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
|
|||||||
@@ -19,3 +19,5 @@ android.useAndroidX=true
|
|||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
# Kotlin code style for this project: "official" or "obsolete":
|
# Kotlin code style for this project: "official" or "obsolete":
|
||||||
kotlin.code.style=official
|
kotlin.code.style=official
|
||||||
|
android.nonTransitiveRClass=false
|
||||||
|
android.nonFinalResIds=false
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import 'dart:math';
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:sensors/sensors.dart';
|
import 'package:sensors_plus/sensors_plus.dart';
|
||||||
|
|
||||||
// This is on alternate entrypoint for this module to display Flutter UI in
|
// This is on alternate entrypoint for this module to display Flutter UI in
|
||||||
// a (multi-)view integration scenario.
|
// a (multi-)view integration scenario.
|
||||||
@@ -109,7 +109,7 @@ class _CellState extends State<Cell> with WidgetsBindingObserver {
|
|||||||
// Don't continuously rebuild for nothing when the
|
// Don't continuously rebuild for nothing when the
|
||||||
// cell isn't visible.
|
// cell isn't visible.
|
||||||
stream: appLifecycleState == AppLifecycleState.resumed
|
stream: appLifecycleState == AppLifecycleState.resumed
|
||||||
? accelerometerEvents
|
? accelerometerEventStream()
|
||||||
: Stream.value(defaultPosition),
|
: Stream.value(defaultPosition),
|
||||||
initialData: defaultPosition,
|
initialData: defaultPosition,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ dependencies:
|
|||||||
sdk: flutter
|
sdk: flutter
|
||||||
provider: ^6.0.2
|
provider: ^6.0.2
|
||||||
url_launcher: ^6.0.20
|
url_launcher: ^6.0.20
|
||||||
sensors: ^2.0.3
|
sensors_plus: ^5.0.1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
analysis_defaults:
|
analysis_defaults:
|
||||||
|
|||||||
Reference in New Issue
Block a user