Merge branch 'main' of https://github.com/flutter/samples into compass-app

pull/2398/head
Eric Windmill 4 months ago
commit a1ed3be4b7

@ -27,7 +27,7 @@ jobs:
persist-credentials: false
- name: "Run analysis"
uses: ossf/scorecard-action@dc50aa9510b46c811795eb24b2f1ba02a914e534
uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46
with:
results_file: results.sarif
results_format: sarif
@ -42,7 +42,7 @@ jobs:
# Upload the results as artifacts (optional).
- name: "Upload artifact"
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a
with:
name: SARIF file
path: results.sarif
@ -50,6 +50,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@23acc5c183826b7a8a97bce3cecc52db901f8251
uses: github/codeql-action/upload-sarif@429e1977040da7a23b6822b13c129cd1ba93dbb2
with:
sarif_file: results.sarif

@ -4,12 +4,16 @@ plugins {
}
android {
compileSdkVersion 31
compileSdk 35
lint {
baseline = file("lint-baseline.xml")
}
defaultConfig {
applicationId "dev.flutter.example.androidView"
minSdkVersion 16
targetSdkVersion 30
minSdkVersion 21
targetSdk 35
versionCode 1
versionName "1.0"
@ -32,22 +36,23 @@ android {
buildFeatures {
viewBinding true
}
namespace 'dev.flutter.example.androidView'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.2'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.2'
implementation "androidx.recyclerview:recyclerview:1.1.0"
implementation 'androidx.core:core-ktx:1.13.1'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'com.google.android.material:material:1.12.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.vectordrawable:vectordrawable:1.2.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.8.4'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.4'
implementation 'androidx.navigation:navigation-fragment-ktx:2.7.7'
implementation 'androidx.navigation:navigation-ui-ktx:2.7.7'
implementation "androidx.recyclerview:recyclerview:1.3.2"
implementation project(path: ':flutter')
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
}

@ -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=&quot;@string/app_name&quot;>"
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 &quot;org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version&quot;"
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 &apos;androidx.core:core-ktx:1.3.2&apos;"
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 &apos;androidx.appcompat:appcompat:1.2.0&apos;"
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 &apos;com.google.android.material:material:1.2.1&apos;"
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 &apos;androidx.constraintlayout:constraintlayout:2.0.4&apos;"
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 &apos;androidx.vectordrawable:vectordrawable:1.1.0&apos;"
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 &apos;androidx.lifecycle:lifecycle-livedata-ktx:2.2.0&apos;"
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 &apos;androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0&apos;"
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 &quot;androidx.recyclerview:recyclerview:1.1.0&quot;"
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: &apos;:flutter&apos;)"
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 &apos;androidx.navigation:navigation-ui-ktx:2.3.2&apos;"
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.&#xA;"
errorLine1=" defaultConfig {"
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="build.gradle"
line="12"
column="9"/>
</issue>
<issue
id="ObsoleteSdkInt"
message="Unnecessary; SDK_INT is always >= 21"
errorLine1=" &lt;item name=&quot;android:statusBarColor&quot; tools:targetApi=&quot;l&quot;>?attr/colorPrimaryVariant&lt;/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=" &lt;item name=&quot;android:statusBarColor&quot; tools:targetApi=&quot;l&quot;>?attr/colorPrimaryVariant&lt;/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=" &lt;dimen name=&quot;activity_horizontal_margin&quot;>16dp&lt;/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=" &lt;dimen name=&quot;activity_vertical_margin&quot;>16dp&lt;/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="&lt;vector xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;"
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="&lt;vector xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;"
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="&lt;vector xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;"
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="&lt;adaptive-icon xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;>"
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="&lt;adaptive-icon xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;>"
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"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.flutter.example.androidView">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:allowBackup="true"
@ -11,6 +10,7 @@
android:theme="@style/Theme.FlutterViewIntegration">
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

@ -8,6 +8,7 @@ import android.content.Intent
import android.os.Bundle
import android.os.Parcelable
import androidx.appcompat.app.AppCompatActivity
import androidx.core.os.BundleCompat
import androidx.recyclerview.widget.LinearLayoutManager
import dev.flutter.example.androidView.databinding.ActivityMainBinding
import io.flutter.FlutterInjector
@ -61,7 +62,14 @@ class MainActivity : AppCompatActivity() {
// If the activity was restarted, keep track of the previous scroll
// position and of the previous cell indices that were randomly selected
// 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")
if (previousFlutterCellsArray != null) {
adapter.previousFlutterCells = TreeSet(previousFlutterCellsArray)

@ -1,12 +1,12 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.6.0"
ext.kotlin_version = '1.8.22'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'
classpath 'com.android.tools.build:gradle:8.5.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
@ -21,6 +21,6 @@ allprojects {
}
}
task clean(type: Delete) {
tasks.register('clean', Delete) {
delete rootProject.buildDir
}

@ -16,4 +16,6 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# 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,6 @@
#Wed Mar 10 09:46:16 PST 2021
#Fri Jul 26 11:31:21 EDT 2024
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

@ -6,7 +6,7 @@ import 'dart:math';
import 'package:flutter/material.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
// a (multi-)view integration scenario.
@ -109,7 +109,7 @@ class _CellState extends State<Cell> with WidgetsBindingObserver {
// Don't continuously rebuild for nothing when the
// cell isn't visible.
stream: appLifecycleState == AppLifecycleState.resumed
? accelerometerEvents
? accelerometerEventStream()
: Stream.value(defaultPosition),
initialData: defaultPosition,
builder: (context, snapshot) {

@ -10,8 +10,8 @@ dependencies:
flutter:
sdk: flutter
provider: ^6.0.2
url_launcher: ^6.0.6
sensors: ^2.0.3
url_launcher: ^6.0.20
sensors_plus: ^5.0.1
dev_dependencies:
analysis_defaults:

@ -15,7 +15,7 @@ dependencies:
dev_dependencies:
analysis_defaults:
path: ../../../analysis_defaults
pigeon: ">=11.0.0 <21.0.0"
pigeon: ">=11.0.0 <22.0.0"
flutter_test:
sdk: flutter

@ -18,7 +18,7 @@ dev_dependencies:
sdk: flutter
flutter_driver:
sdk: flutter
espresso: ">=0.2.0 <0.4.0"
espresso: ">=0.2.0 <0.5.0"
flutter:
uses-material-design: true

@ -8,12 +8,12 @@ android {
self {
}
}
compileSdkVersion 33
compileSdk 35
defaultConfig {
applicationId "dev.flutter.multipleflutters"
minSdkVersion 24
targetSdkVersion 33
targetSdk 35
versionCode 1
versionName "1.0"
@ -40,12 +40,12 @@ android {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.core:core-ktx:1.13.1'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'com.google.android.material:material:1.12.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
implementation project(':flutter')
}

@ -11,7 +11,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="1dp"
android:layout_marginRight="260dp"
android:layout_marginEnd="260dp"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"

@ -10,7 +10,7 @@
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

@ -10,7 +10,7 @@
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

@ -6,7 +6,7 @@ buildscript {
mavenCentral()
}
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"
// NOTE: Do not place your application dependencies here; they belong
@ -21,6 +21,6 @@ allprojects {
}
}
task clean(type: Delete) {
tasks.register('clean', Delete) {
delete rootProject.buildDir
}

@ -18,4 +18,7 @@ android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
kotlin.code.style=official
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false

@ -1,6 +1,6 @@
#Mon Dec 11 09:57:20 AEDT 2023
distributionBase=GRADLE_USER_HOME
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
zipStorePath=wrapper/dists

@ -3,11 +3,11 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 33
compileSdk 34
defaultConfig {
applicationId "dev.flutter.example.androidusingplugin"
minSdkVersion 19
targetSdkVersion 33
minSdkVersion 21
targetSdk 34
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@ -17,19 +17,29 @@ android {
minifyEnabled false
}
}
// Remove when #flutter/flutter/issues/150955 is merged to stable.
lintOptions {
checkReleaseBuilds false
}
// Keep java and kotlin versions in sync.
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
kotlinOptions {
jvmTarget = '1.8'
}
namespace 'dev.flutter.example.androidusingplugin'
}
dependencies {
implementation project(':flutter')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.core:core-ktx:1.10.1'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.core:core-ktx:1.13.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
}

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.flutter.example.androidusingplugin">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:name=".MyApplication"

@ -7,7 +7,7 @@ buildscript {
mavenCentral()
}
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"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

@ -19,3 +19,5 @@ android.useAndroidX=true
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
android.nonTransitiveRClass=false
android.nonFinalResIds=false

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
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
zipStorePath=wrapper/dists

@ -6,7 +6,7 @@ import 'dart:math';
import 'package:flutter/material.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
// a (multi-)view integration scenario.
@ -109,7 +109,7 @@ class _CellState extends State<Cell> with WidgetsBindingObserver {
// Don't continuously rebuild for nothing when the
// cell isn't visible.
stream: appLifecycleState == AppLifecycleState.resumed
? accelerometerEvents
? accelerometerEventStream()
: Stream.value(defaultPosition),
initialData: defaultPosition,
builder: (context, snapshot) {

@ -11,7 +11,7 @@ dependencies:
sdk: flutter
provider: ^6.0.2
url_launcher: ^6.0.20
sensors: ^2.0.3
sensors_plus: ^5.0.1
dev_dependencies:
analysis_defaults:

@ -3,11 +3,11 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 33
compileSdk 34
defaultConfig {
applicationId "dev.flutter.example.androidusingprebuiltmodule"
minSdkVersion 19
targetSdkVersion 33
minSdkVersion 21
targetSdkVersion 34
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@ -22,6 +22,9 @@ android {
sourceCompatibility 1.8
targetCompatibility 1.8
}
kotlinOptions {
jvmTarget = '1.8'
}
namespace 'dev.flutter.example.androidusingprebuiltmodule'
}
@ -48,12 +51,12 @@ dependencies {
implementation 'androidx.multidex:multidex:2.0.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.core:core-ktx:1.10.1'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.core:core-ktx:1.13.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation "com.google.truth:truth:1.1.3"
androidTestImplementation 'androidx.test:runner:1.5.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
api 'androidx.test:core:1.5.0'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
api 'androidx.test:core:1.2.1'
}

@ -4,6 +4,7 @@
package dev.flutter.example.androidusingprebuiltmodule
import android.annotation.SuppressLint
import android.os.Bundle
import android.widget.Button
import android.widget.TextView
@ -29,6 +30,7 @@ class MainActivity : AppCompatActivity() {
}
}
@SuppressLint("SetTextI18n")
override fun onResume() {
super.onResume()
val app = application as MyApplication

@ -2,4 +2,5 @@
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

@ -2,4 +2,5 @@
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

@ -7,7 +7,7 @@ buildscript {
mavenCentral()
}
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"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

@ -19,6 +19,5 @@ android.useAndroidX=true
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
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
zipStorePath=wrapper/dists

@ -18,7 +18,7 @@ dev_dependencies:
sdk: flutter
flutter_driver:
sdk: flutter
espresso: ">=0.2.0 <0.4.0"
espresso: ">=0.2.0 <0.5.0"
flutter:
uses-material-design: true

@ -15,7 +15,7 @@ dependencies:
flutter:
sdk: flutter
flutter_floating_bottom_bar: ^1.2.0
flutter_markdown: ^0.6.20
flutter_markdown: ^0.7.3
flutter_svg: ^2.0.9
google_fonts: 6.1.0
google_generative_ai: ^0.4.0

@ -0,0 +1,62 @@
# To learn more about how to use Nix to configure your environment
# see: https://developers.google.com/idx/guides/customize-idx-env
{ pkgs, ... }: {
# Which nixpkgs channel to use.
channel = "stable-23.11"; # or "unstable"
# Use https://search.nixos.org/packages to find packages
packages = [
pkgs.nodePackages.firebase-tools
pkgs.jdk17
pkgs.unzip
];
# Sets environment variables in the workspace
env = {};
idx = {
# Search for the extensions you want on https://open-vsx.org/ and use "publisher.id"
extensions = [
"Dart-Code.flutter"
"Dart-Code.dart-code"
];
workspace = {
# Runs when a workspace is first created with this `dev.nix` file
onCreate = {
build-flutter = ''
cd /home/user/myapp/android
./gradlew \
--parallel \
-Pverbose=true \
-Ptarget-platform=android-x86 \
-Ptarget=/home/user/myapp/lib/main.dart \
-Pbase-application-name=android.app.Application \
-Pdart-defines=RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNvbS9mbHV0dGVyLWNhbnZhc2tpdC85NzU1MDkwN2I3MGY0ZjNiMzI4YjZjMTYwMGRmMjFmYWMxYTE4ODlhLw== \
-Pdart-obfuscation=false \
-Ptrack-widget-creation=true \
-Ptree-shake-icons=false \
-Pfilesystem-scheme=org-dartlang-root \
assembleDebug
# TODO: Execute web build in debug mode.
# flutter run does this transparently either way
# https://github.com/flutter/flutter/issues/96283#issuecomment-1144750411
# flutter build web --profile --dart-define=Dart2jsOptimization=O0
adb -s localhost:5555 wait-for-device
'';
};
# To run something each time the workspace is (re)started, use the `onStart` hook
};
# Enable previews and customize configuration
previews = {
enable = true;
previews = {
web = {
command = ["flutter" "run" "--machine" "-d" "web-server" "--web-hostname" "0.0.0.0" "--web-port" "$PORT"];
manager = "flutter";
};
android = {
command = ["flutter" "run" "--machine" "-d" "android" "-d" "localhost:5555"];
manager = "flutter";
};
};
};
};
}

@ -0,0 +1,9 @@
{
"name": "Flutter dynamic theme",
"description": "A template for a Flutter app that uses Gemini to dynamically create a theme.",
"icon": "https://www.gstatic.com/images/branding/productlogos/idx/v1/192px.svg",
"params": [],
"host": {
"virtualization": true
}
}

@ -0,0 +1,15 @@
# No user-configurable parameters
{ pkgs, ... }: {
packages = [
pkgs.flutter
];
# Shell script that produces the final environment
bootstrap = ''
export HOME=/home/user
export PATH="$PATH":"$HOME/flutter/bin"
cp -rf ${./.} "$out"
chmod -R +w "$out"
rm -rf "$out/.git" "$out/idx-template".{nix,json}
'';
}

@ -8,7 +8,7 @@ environment:
dependencies:
flutter:
sdk: flutter
flutter_markdown: ^0.7.1
flutter_markdown: ^0.7.3
google_generative_ai: ^0.4.0
url_launcher: ^6.2.6

@ -15,7 +15,7 @@ dependencies:
cupertino_icons: ^1.0.2
equatable: ^2.0.3
file_selector: ^1.0.0
flutter_markdown: ^0.7.0
flutter_markdown: ^0.7.3
google_fonts: ^6.0.0
hive: ^2.0.4
hive_flutter: ^1.1.0

@ -41,7 +41,7 @@ dependencies:
ffi: ^2.1.2
intl: ^0.19.0
jni: ^0.9.0
jni: ^0.10.1
fl_chart: ^0.68.0
dev_dependencies:

@ -10,12 +10,12 @@ dependencies:
flutter:
sdk: flutter
plugin_platform_interface: ^2.1.8
jni: ^0.9.0
jni: ^0.10.1
ffi: ^2.1.2
dev_dependencies:
ffigen: ^12.0.0
jnigen: ^0.9.0
ffigen: ^13.0.0
jnigen: ^0.10.0
flutter_test:
sdk: flutter
flutter_lints: ^4.0.0

@ -12,7 +12,7 @@ dependencies:
firebase_core: ">=2.11.0 <4.0.0"
google_maps_flutter: ^2.2.6
google_maps_webservice: ^0.0.20-nullsafety.5
location: ">=4.4.0 <7.0.0"
location: ^7.0.0
dev_dependencies:
analysis_defaults:

@ -0,0 +1,62 @@
# To learn more about how to use Nix to configure your environment
# see: https://developers.google.com/idx/guides/customize-idx-env
{ pkgs, ... }: {
# Which nixpkgs channel to use.
channel = "stable-23.11"; # or "unstable"
# Use https://search.nixos.org/packages to find packages
packages = [
pkgs.nodePackages.firebase-tools
pkgs.jdk17
pkgs.unzip
];
# Sets environment variables in the workspace
env = {};
idx = {
# Search for the extensions you want on https://open-vsx.org/ and use "publisher.id"
extensions = [
"Dart-Code.flutter"
"Dart-Code.dart-code"
];
workspace = {
# Runs when a workspace is first created with this `dev.nix` file
onCreate = {
build-flutter = ''
cd /home/user/myapp/android
./gradlew \
--parallel \
-Pverbose=true \
-Ptarget-platform=android-x86 \
-Ptarget=/home/user/myapp/lib/main.dart \
-Pbase-application-name=android.app.Application \
-Pdart-defines=RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNvbS9mbHV0dGVyLWNhbnZhc2tpdC85NzU1MDkwN2I3MGY0ZjNiMzI4YjZjMTYwMGRmMjFmYWMxYTE4ODlhLw== \
-Pdart-obfuscation=false \
-Ptrack-widget-creation=true \
-Ptree-shake-icons=false \
-Pfilesystem-scheme=org-dartlang-root \
assembleDebug
# TODO: Execute web build in debug mode.
# flutter run does this transparently either way
# https://github.com/flutter/flutter/issues/96283#issuecomment-1144750411
# flutter build web --profile --dart-define=Dart2jsOptimization=O0
adb -s localhost:5555 wait-for-device
'';
};
# To run something each time the workspace is (re)started, use the `onStart` hook
};
# Enable previews and customize configuration
previews = {
enable = true;
previews = {
web = {
command = ["flutter" "run" "--machine" "-d" "web-server" "--web-hostname" "0.0.0.0" "--web-port" "$PORT"];
manager = "flutter";
};
android = {
command = ["flutter" "run" "--machine" "-d" "android" "-d" "localhost:5555"];
manager = "flutter";
};
};
};
};
}

@ -0,0 +1,9 @@
{
"name": "Todo list with Flutter and Gemini",
"description": "A template for a todo list app that integrates with the Gemini API",
"icon": "https://www.gstatic.com/images/branding/productlogos/idx/v1/192px.svg",
"params": [],
"host": {
"virtualization": true
}
}

@ -0,0 +1,15 @@
# No user-configurable parameters
{ pkgs, ... }: {
packages = [
pkgs.flutter
];
# Shell script that produces the final environment
bootstrap = ''
export HOME=/home/user
export PATH="$PATH":"$HOME/flutter/bin"
cp -rf ${./.} "$out"
chmod -R +w "$out"
rm -rf "$out/.git" "$out/idx-template".{nix,json}
'';
}

@ -8,7 +8,7 @@ environment:
dependencies:
flutter:
sdk: flutter
flutter_markdown: ^0.7.1
flutter_markdown: ^0.7.3
google_generative_ai: ^0.4.0
url_launcher: ^6.2.6

@ -10,7 +10,7 @@ dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
google_maps_flutter: ^2.4.0
google_maps_flutter: ^2.7.0
http: ^1.0.0
json_annotation: ^4.7.0
json_serializable: ^6.5.4

@ -242,6 +242,7 @@ class Containment extends StatelessWidget {
return const ComponentGroupDecoration(label: 'Containment', children: [
BottomSheetSection(),
Cards(),
Carousels(),
Dialogs(),
Dividers(),
// TODO: Add Lists, https://github.com/flutter/flutter/issues/114006
@ -2416,6 +2417,65 @@ class _SearchAnchorsState extends State<SearchAnchors> {
}
}
class Carousels extends StatelessWidget {
const Carousels({super.key});
@override
Widget build(BuildContext context) {
return ComponentDecoration(
label: 'Carousel',
tooltipMessage: 'Use CarouselView',
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Padding(
padding: EdgeInsets.only(left: 8.0),
child: Text('Uncontained Carousel'),
),
ConstrainedBox(
constraints: const BoxConstraints.tightFor(height: 150),
child: CarouselView(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
side: BorderSide(color: Theme.of(context).colorScheme.outline),
),
shrinkExtent: 100,
itemExtent: 180,
children: List<Widget>.generate(20, (index) {
return Center(
child: Text('Item $index'),
);
}),
),
),
colDivider,
const Padding(
padding: EdgeInsets.only(left: 8.0),
child: Text('Uncontained Carousel with snapping effect'),
),
ConstrainedBox(
constraints: const BoxConstraints.tightFor(height: 150),
child: CarouselView(
itemSnapping: true,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
side: BorderSide(color: Theme.of(context).colorScheme.outline),
),
shrinkExtent: 100,
itemExtent: 180,
children: List<Widget>.generate(20, (index) {
return Center(
child: Text('Item $index'),
);
}),
),
),
],
),
);
}
}
class ComponentDecoration extends StatefulWidget {
const ComponentDecoration({
super.key,

@ -10,7 +10,7 @@ import 'package:material_3_demo/main.dart';
void main() {
testWidgets('Default main page shows all M3 components', (tester) async {
widgetSetup(tester, 800, windowHeight: 7000);
widgetSetup(tester, 800, windowHeight: 7500);
await tester.pumpWidget(const App());
// Elements on the app bar
@ -67,6 +67,9 @@ void main() {
expect(find.widgetWithText(Cards, 'Filled'), findsOneWidget);
expect(find.widgetWithText(Cards, 'Outlined'), findsOneWidget);
// Carousels
expect(find.byType(CarouselView), findsNWidgets(2));
// Dialogs
expect(find.widgetWithText(TextButton, 'Show dialog'), findsOneWidget);
expect(find.widgetWithText(TextButton, 'Show full-screen dialog'),

@ -16,7 +16,7 @@ dependencies:
path_to_regexp: ^0.4.0
quiver: ^3.1.0
url_launcher: ^6.1.1
url_strategy: ^0.2.0
url_strategy: ^0.3.0
window_size:
git:
url: https://github.com/google/flutter-desktop-embedding.git

@ -34,9 +34,6 @@ declare -ar PROJECT_NAMES=(
"experimental/federated_plugin/federated_plugin_platform_interface"
"experimental/federated_plugin/federated_plugin_web"
"experimental/federated_plugin/federated_plugin_windows"
# TODO: ewindmill to talk to team about removing.
# Depends on package context_menus, which breaks with Material3 by default.
# "experimental/linting_tool"
"experimental/pedometer"
"experimental/pedometer/example"
"experimental/varfont_shader_puzzle"

@ -34,13 +34,11 @@ declare -ar PROJECT_NAMES=(
"experimental/federated_plugin/federated_plugin_platform_interface"
"experimental/federated_plugin/federated_plugin_web"
"experimental/federated_plugin/federated_plugin_windows"
# TODO: ewindmill to talk to team about removing.
# Depends on package context_menus, which breaks with Material3 by default.
# "experimental/linting_tool"
"experimental/pedometer"
"experimental/pedometer/example"
"experimental/varfont_shader_puzzle"
"experimental/web_dashboard"
# TODO ewindmill -- whereNotNull deprecated in dart:collection
# "experimental/web_dashboard"
"flutter_maps_firestore"
"form_app"
"game_template"

@ -34,9 +34,6 @@ declare -ar PROJECT_NAMES=(
"experimental/federated_plugin/federated_plugin_platform_interface"
"experimental/federated_plugin/federated_plugin_web"
"experimental/federated_plugin/federated_plugin_windows"
# TODO: ewindmill to talk to team about removing.
# Depends on package context_menus, which breaks with Material3 by default.
# "experimental/linting_tool"
"experimental/pedometer"
"experimental/pedometer/example"
"experimental/varfont_shader_puzzle"

@ -0,0 +1,80 @@
#!/bin/bash
set -e
flutter doctor -v
declare -ar PROJECT_NAMES=(
"add_to_app/android_view/flutter_module_using_plugin"
"add_to_app/books/flutter_module_books"
"add_to_app/fullscreen/flutter_module"
"add_to_app/multiple_flutters/multiple_flutters_module"
"add_to_app/plugin/flutter_module_using_plugin"
"add_to_app/prebuilt_module/flutter_module"
"ai_recipe_generation"
"analysis_defaults"
"android_splash_screen"
"animations"
"asset_transformation"
"background_isolate_channels"
"code_sharing/client"
"code_sharing/server"
"code_sharing/shared"
"context_menus"
"deeplink_store_example"
"desktop_photo_search/fluent_ui"
"desktop_photo_search/material"
"dynamic_theme"
"experimental/federated_plugin/federated_plugin"
"experimental/federated_plugin/federated_plugin/example"
"experimental/federated_plugin/federated_plugin_macos"
"experimental/federated_plugin/federated_plugin_platform_interface"
"experimental/federated_plugin/federated_plugin_web"
"experimental/federated_plugin/federated_plugin_windows"
"experimental/pedometer"
"experimental/pedometer/example"
"experimental/varfont_shader_puzzle"
"experimental/web_dashboard"
"flutter_maps_firestore"
"form_app"
"game_template"
"gemini_tasks"
"google_maps"
"infinite_list"
"ios_app_clip"
"isolate_example"
"material_3_demo"
"navigation_and_routing"
"place_tracker"
"platform_channels"
"platform_design"
"platform_view_swift"
"provider_counter"
"provider_shopper"
"simple_shader"
"simplistic_calculator"
"simplistic_editor"
"testing_app"
"veggieseasons"
"web_embedding/element_embedding_demo"
"web/_tool"
"web/samples_index"
)
echo "--- Running flutter clean and flutter pub get for each sample ---"
for PROJECT_NAME in "${PROJECT_NAMES[@]}"
do
echo "== Cleaning '${PROJECT_NAME}' with Flutter clean =="
pushd "${PROJECT_NAME}"
# run `flutter clean` for project
flutter clean
# Grab packages.
flutter pub get
popd
done
echo "--- Success ---"

@ -10,7 +10,7 @@ environment:
dependencies:
flutter:
sdk: flutter
web: ^0.5.1
web: ^1.0.0
dev_dependencies:
flutter_test:

@ -27,16 +27,16 @@
},
"devDependencies": {
"@angular-devkit/build-angular": "^18.0.2",
"@angular/cli": "~18.0.2",
"@angular/cli": "~18.1.0",
"@angular/compiler-cli": "^18.0.1",
"@types/jasmine": "~5.1.0",
"jasmine-core": "~5.1.1",
"jasmine-core": "~5.2.0",
"karma": "~6.4.2",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"typescript": "~5.4.5"
"typescript": "~5.5.3"
},
"sideEffects": false
}

Loading…
Cancel
Save