From 73f5836aae77bb5787de7bba57477a6bf2f54ed4 Mon Sep 17 00:00:00 2001 From: vaishnavi-2301 Date: Sat, 6 Jul 2024 14:43:23 +0530 Subject: [PATCH] Update build.gradle and settings.gradle files, and fix color scheme in material_controls.dart and material_desktop_controls.dart --- example/android/app/build.gradle | 51 ++++++++++++------- example/android/build.gradle | 19 +++---- example/android/settings.gradle | 30 ++++++++--- lib/src/material/material_controls.dart | 2 +- .../material/material_desktop_controls.dart | 2 +- 5 files changed, 63 insertions(+), 41 deletions(-) diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 014531d74..e1911eb0b 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -1,3 +1,10 @@ +plugins { + id "com.android.application" + id "kotlin-android" + id "dev.flutter.flutter-gradle-plugin" +} + + def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { @@ -6,11 +13,6 @@ if (localPropertiesFile.exists()) { } } -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' @@ -21,26 +23,33 @@ if (flutterVersionName == null) { flutterVersionName = '1.0' } -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" +def keystoreProperties = new Properties() +def keystorePropertiesFile = rootProject.file('key.properties') +if (keystorePropertiesFile.exists()) { + keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) +} android { - namespace "com.example.example" - - compileSdkVersion 34 + compileSdk = 34 sourceSets { main.java.srcDirs += 'src/main/kotlin' } + lintOptions { + disable 'InvalidPackage' + checkReleaseBuilds false + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.example.example" - minSdkVersion 21 - targetSdkVersion 33 - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName + applicationId = "com.example.example" + minSdk = 24 + targetSdk = 33 + versionCode = flutterVersionCode.toInteger() + versionName = flutterVersionName } buildTypes { @@ -50,6 +59,10 @@ android { signingConfig signingConfigs.debug } } + + buildFeatures { + viewBinding true + } } flutter { @@ -57,5 +70,7 @@ flutter { } dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + implementation 'androidx.appcompat:appcompat:1.4.1' + implementation 'com.google.android.material:material:1.5.0' } + diff --git a/example/android/build.gradle b/example/android/build.gradle index ab08cc259..37f57b71c 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,19 +1,10 @@ -buildscript { - ext.kotlin_version = '1.7.22' - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:7.4.2' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - allprojects { repositories { google() + maven { + url 'https://maven.google.com' + } + jcenter() mavenCentral() } } @@ -21,6 +12,8 @@ allprojects { rootProject.buildDir = '../build' subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { project.evaluationDependsOn(':app') } diff --git a/example/android/settings.gradle b/example/android/settings.gradle index 44e62bcf0..1ad19a117 100644 --- a/example/android/settings.gradle +++ b/example/android/settings.gradle @@ -1,11 +1,25 @@ -include ':app' +pluginManagement { + def flutterSdkPath = { + def properties = new Properties() + file("local.properties").withInputStream { properties.load(it) } + def flutterSdkPath = properties.getProperty("flutter.sdk") + assert flutterSdkPath != null, "flutter.sdk not set in local.properties" + return flutterSdkPath + }() -def localPropertiesFile = new File(rootProject.projectDir, "local.properties") -def properties = new Properties() + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") -assert localPropertiesFile.exists() -localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} -def flutterSdkPath = properties.getProperty("flutter.sdk") -assert flutterSdkPath != null, "flutter.sdk not set in local.properties" -apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" + plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "7.3.0" apply false + id "org.jetbrains.kotlin.android" version "2.0.0" apply false + } + +include ":app" diff --git a/lib/src/material/material_controls.dart b/lib/src/material/material_controls.dart index 70711173b..9cb24802e 100644 --- a/lib/src/material/material_controls.dart +++ b/lib/src/material/material_controls.dart @@ -612,7 +612,7 @@ class _MaterialControlsState extends State playedColor: Theme.of(context).colorScheme.secondary, handleColor: Theme.of(context).colorScheme.secondary, bufferedColor: - Theme.of(context).colorScheme.background.withOpacity(0.5), + Theme.of(context).colorScheme.surface.withOpacity(0.5), backgroundColor: Theme.of(context).disabledColor.withOpacity(.5), ), ), diff --git a/lib/src/material/material_desktop_controls.dart b/lib/src/material/material_desktop_controls.dart index 41ab86906..c220759df 100644 --- a/lib/src/material/material_desktop_controls.dart +++ b/lib/src/material/material_desktop_controls.dart @@ -589,7 +589,7 @@ class _MaterialDesktopControlsState extends State playedColor: Theme.of(context).colorScheme.secondary, handleColor: Theme.of(context).colorScheme.secondary, bufferedColor: - Theme.of(context).colorScheme.background.withOpacity(0.5), + Theme.of(context).colorScheme.surface.withOpacity(0.5), backgroundColor: Theme.of(context).disabledColor.withOpacity(.5), ), ),