diff --git a/example/android/.gitignore b/example/android/.gitignore new file mode 100644 index 0000000..6f56801 --- /dev/null +++ b/example/android/.gitignore @@ -0,0 +1,13 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +key.properties +**/*.keystore +**/*.jks diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle new file mode 100644 index 0000000..b92c4eb --- /dev/null +++ b/example/android/app/build.gradle @@ -0,0 +1,71 @@ +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader('UTF-8') { reader -> + localProperties.load(reader) + } +} + +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' +} + +def flutterVersionName = localProperties.getProperty('flutter.versionName') +if (flutterVersionName == null) { + flutterVersionName = '1.0' +} + +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" + +android { + compileSdkVersion flutter.compileSdkVersion + ndkVersion flutter.ndkVersion + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = '1.8' + } + + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId "ru.auroraos.flutter_example_packages" + // You can update the following values to match your application needs. + // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. + minSdkVersion flutter.minSdkVersion + targetSdkVersion flutter.targetSdkVersion + versionCode flutterVersionCode.toInteger() + versionName flutterVersionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig signingConfigs.debug + } + } +} + +flutter { + source '../..' +} + +dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" +} diff --git a/example/android/app/src/debug/AndroidManifest.xml b/example/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 0000000..22f758d --- /dev/null +++ b/example/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,8 @@ + + + + diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..bff9527 --- /dev/null +++ b/example/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + diff --git a/example/android/app/src/main/kotlin/ru/auroraos/flutter_example_packages/MainActivity.kt b/example/android/app/src/main/kotlin/ru/auroraos/flutter_example_packages/MainActivity.kt new file mode 100644 index 0000000..619a0b7 --- /dev/null +++ b/example/android/app/src/main/kotlin/ru/auroraos/flutter_example_packages/MainActivity.kt @@ -0,0 +1,6 @@ +package ru.auroraos.flutter_example_packages + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() { +} diff --git a/example/android/app/src/main/res/drawable-v21/launch_background.xml b/example/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000..f74085f --- /dev/null +++ b/example/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/example/android/app/src/main/res/drawable/launch_background.xml b/example/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 0000000..304732f --- /dev/null +++ b/example/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..db77bb4 Binary files /dev/null and b/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..17987b7 Binary files /dev/null and b/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..09d4391 Binary files /dev/null and b/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..d5f1c8d Binary files /dev/null and b/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..4d6372e Binary files /dev/null and b/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/example/android/app/src/main/res/values-night/styles.xml b/example/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..06952be --- /dev/null +++ b/example/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/example/android/app/src/main/res/values/styles.xml b/example/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..cb1ef88 --- /dev/null +++ b/example/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/example/android/app/src/profile/AndroidManifest.xml b/example/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 0000000..22f758d --- /dev/null +++ b/example/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,8 @@ + + + + diff --git a/example/android/build.gradle b/example/android/build.gradle new file mode 100644 index 0000000..83ae220 --- /dev/null +++ b/example/android/build.gradle @@ -0,0 +1,31 @@ +buildscript { + ext.kotlin_version = '1.6.10' + repositories { + google() + mavenCentral() + } + + dependencies { + classpath 'com.android.tools.build:gradle:7.1.2' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +allprojects { + repositories { + google() + mavenCentral() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(':app') +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/example/android/gradle.properties b/example/android/gradle.properties new file mode 100644 index 0000000..94adc3a --- /dev/null +++ b/example/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx1536M +android.useAndroidX=true +android.enableJetifier=true diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..cb24abd --- /dev/null +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip diff --git a/example/android/settings.gradle b/example/android/settings.gradle new file mode 100644 index 0000000..44e62bc --- /dev/null +++ b/example/android/settings.gradle @@ -0,0 +1,11 @@ +include ':app' + +def localPropertiesFile = new File(rootProject.projectDir, "local.properties") +def properties = new Properties() + +assert localPropertiesFile.exists() +localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + +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" diff --git a/example/lib/pages/home/page.dart b/example/lib/pages/home/page.dart index a6a566e..535d6f6 100644 --- a/example/lib/pages/home/page.dart +++ b/example/lib/pages/home/page.dart @@ -111,7 +111,7 @@ class _HomePageState extends AppState { child: Opacity( opacity: 0.2, child: Image.asset( - 'images/logo-head.png', + 'assets/images/logo-head.png', width: 250, ), ), diff --git a/example/lib/pages/home/widgets/home_app_bar.dart b/example/lib/pages/home/widgets/home_app_bar.dart index d3819bb..b47a5e2 100644 --- a/example/lib/pages/home/widgets/home_app_bar.dart +++ b/example/lib/pages/home/widgets/home_app_bar.dart @@ -22,7 +22,7 @@ class HomeAppBar extends AppStatefulWidget implements PreferredSizeWidget { State createState() => _HomeAppBarState(); @override - Size get preferredSize => const Size.fromHeight(56.0); + Size get preferredSize => const Size.fromHeight(60.0); } class _HomeAppBarState extends AppState { @@ -83,66 +83,74 @@ class _HomeAppBarState extends AppState { if (!_enableSearch) Padding( padding: const EdgeInsets.all(8.0), - child: ClipOval( - child: Material( - color: Colors.blueGrey, - child: IconButton( - icon: const Icon(Icons.search), - tooltip: l10n.homeSearch, - onPressed: () { - setState(() { - _enableSearch = true; - _searchFocus.requestFocus(); - }); - }, + child: SizedBox( + width: 40, + height: 40, + child: ClipOval( + child: Material( + color: Colors.blueGrey, + child: IconButton( + icon: const Icon(Icons.search), + tooltip: l10n.homeSearch, + onPressed: () { + setState(() { + _enableSearch = true; + _searchFocus.requestFocus(); + }); + }, + ), ), ), ), ), Padding( padding: const EdgeInsets.all(8.0), - child: ClipOval( - child: Material( - color: () { - switch (_filter) { - case PlatformFilter.disable: - return Colors.blueGrey; - case PlatformFilter.dependent: - return Colors.deepOrangeAccent; - case PlatformFilter.independent: - return Colors.blueAccent; - } - }.call(), - child: IconButton( - icon: () { + child: SizedBox( + width: 40, + height: 40, + child: ClipOval( + child: Material( + color: () { switch (_filter) { case PlatformFilter.disable: - return const Icon(Icons.filter_list_off); + return Colors.blueGrey; case PlatformFilter.dependent: - return const Icon(Icons.filter_list); + return Colors.deepOrangeAccent; case PlatformFilter.independent: - return const Icon(Icons.filter_list); + return Colors.blueAccent; } }.call(), - tooltip: l10n.homeFilter, - onPressed: () { - setState(() { + child: IconButton( + icon: () { switch (_filter) { case PlatformFilter.disable: - _filter = PlatformFilter.dependent; - widget.onChangeFilter.call(_filter); - break; + return const Icon(Icons.filter_list_off); case PlatformFilter.dependent: - _filter = PlatformFilter.independent; - widget.onChangeFilter.call(_filter); - break; + return const Icon(Icons.filter_list); case PlatformFilter.independent: - _filter = PlatformFilter.disable; - widget.onChangeFilter.call(_filter); - break; + return const Icon(Icons.filter_list); } - }); - }, + }.call(), + tooltip: l10n.homeFilter, + onPressed: () { + setState(() { + switch (_filter) { + case PlatformFilter.disable: + _filter = PlatformFilter.dependent; + widget.onChangeFilter.call(_filter); + break; + case PlatformFilter.dependent: + _filter = PlatformFilter.independent; + widget.onChangeFilter.call(_filter); + break; + case PlatformFilter.independent: + _filter = PlatformFilter.disable; + widget.onChangeFilter.call(_filter); + break; + } + }); + }, + ), ), ), ),