diff --git a/add_to_app/prebuilt_module/android_using_prebuilt_module/app/build.gradle b/add_to_app/prebuilt_module/android_using_prebuilt_module/app/build.gradle index 4a0aa486c..95bbdffb7 100644 --- a/add_to_app/prebuilt_module/android_using_prebuilt_module/app/build.gradle +++ b/add_to_app/prebuilt_module/android_using_prebuilt_module/app/build.gradle @@ -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 21 - targetSdkVersion 33 + 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' } diff --git a/add_to_app/prebuilt_module/android_using_prebuilt_module/app/src/main/java/dev/flutter/example/androidusingprebuiltmodule/MainActivity.kt b/add_to_app/prebuilt_module/android_using_prebuilt_module/app/src/main/java/dev/flutter/example/androidusingprebuiltmodule/MainActivity.kt index 30d56992e..867aee592 100644 --- a/add_to_app/prebuilt_module/android_using_prebuilt_module/app/src/main/java/dev/flutter/example/androidusingprebuiltmodule/MainActivity.kt +++ b/add_to_app/prebuilt_module/android_using_prebuilt_module/app/src/main/java/dev/flutter/example/androidusingprebuiltmodule/MainActivity.kt @@ -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 diff --git a/add_to_app/prebuilt_module/android_using_prebuilt_module/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/add_to_app/prebuilt_module/android_using_prebuilt_module/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml index eca70cfe5..6f3b755bf 100644 --- a/add_to_app/prebuilt_module/android_using_prebuilt_module/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ b/add_to_app/prebuilt_module/android_using_prebuilt_module/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -2,4 +2,5 @@ + \ No newline at end of file diff --git a/add_to_app/prebuilt_module/android_using_prebuilt_module/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/add_to_app/prebuilt_module/android_using_prebuilt_module/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml index eca70cfe5..6f3b755bf 100644 --- a/add_to_app/prebuilt_module/android_using_prebuilt_module/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ b/add_to_app/prebuilt_module/android_using_prebuilt_module/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -2,4 +2,5 @@ + \ No newline at end of file diff --git a/add_to_app/prebuilt_module/android_using_prebuilt_module/build.gradle b/add_to_app/prebuilt_module/android_using_prebuilt_module/build.gradle index 6dfe3ca9f..2097733f9 100644 --- a/add_to_app/prebuilt_module/android_using_prebuilt_module/build.gradle +++ b/add_to_app/prebuilt_module/android_using_prebuilt_module/build.gradle @@ -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 diff --git a/add_to_app/prebuilt_module/android_using_prebuilt_module/gradle.properties b/add_to_app/prebuilt_module/android_using_prebuilt_module/gradle.properties index 9e73ebcb6..479548090 100644 --- a/add_to_app/prebuilt_module/android_using_prebuilt_module/gradle.properties +++ b/add_to_app/prebuilt_module/android_using_prebuilt_module/gradle.properties @@ -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 diff --git a/add_to_app/prebuilt_module/android_using_prebuilt_module/gradle/wrapper/gradle-wrapper.properties b/add_to_app/prebuilt_module/android_using_prebuilt_module/gradle/wrapper/gradle-wrapper.properties index 774fae876..17655d0ef 100644 --- a/add_to_app/prebuilt_module/android_using_prebuilt_module/gradle/wrapper/gradle-wrapper.properties +++ b/add_to_app/prebuilt_module/android_using_prebuilt_module/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/dynamic_theme/.idx/dev.nix b/dynamic_theme/.idx/dev.nix new file mode 100644 index 000000000..0354484f0 --- /dev/null +++ b/dynamic_theme/.idx/dev.nix @@ -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"; + }; + }; + }; + }; +} \ No newline at end of file diff --git a/dynamic_theme/idx-template.json b/dynamic_theme/idx-template.json new file mode 100644 index 000000000..8fca44b6c --- /dev/null +++ b/dynamic_theme/idx-template.json @@ -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 + } +} \ No newline at end of file diff --git a/dynamic_theme/idx-template.nix b/dynamic_theme/idx-template.nix new file mode 100644 index 000000000..5ef65ad7a --- /dev/null +++ b/dynamic_theme/idx-template.nix @@ -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} + ''; +} \ No newline at end of file diff --git a/gemini_tasks/.idx/dev.nix b/gemini_tasks/.idx/dev.nix new file mode 100644 index 000000000..0354484f0 --- /dev/null +++ b/gemini_tasks/.idx/dev.nix @@ -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"; + }; + }; + }; + }; +} \ No newline at end of file diff --git a/gemini_tasks/idx-template.json b/gemini_tasks/idx-template.json new file mode 100644 index 000000000..9db171f54 --- /dev/null +++ b/gemini_tasks/idx-template.json @@ -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 + } +} \ No newline at end of file diff --git a/gemini_tasks/idx-template.nix b/gemini_tasks/idx-template.nix new file mode 100644 index 000000000..5ef65ad7a --- /dev/null +++ b/gemini_tasks/idx-template.nix @@ -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} + ''; +} \ No newline at end of file