diff --git a/android/.gitignore b/android/.gitignore new file mode 100644 index 0000000..0a741cb --- /dev/null +++ b/android/.gitignore @@ -0,0 +1,11 @@ +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 diff --git a/android/app/build.gradle b/android/app/build.gradle new file mode 100644 index 0000000..c8a562c --- /dev/null +++ b/android/app/build.gradle @@ -0,0 +1,97 @@ +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 { + namespace 'org.selfprivacy.app' + + compileSdkVersion flutter.compileSdkVersion + ndkVersion flutter.ndkVersion + + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = '1.8' + } + + lintOptions { + disable 'InvalidPackage' + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId "org.selfprivacy.app" + minSdkVersion 21 + targetSdkVersion 31 + versionCode flutterVersionCode.toInteger() + versionName flutterVersionName + } + + flavorDimensions "default" + productFlavors { + fdroid { + applicationId "pro.kherel.selfprivacy" + } + production { + applicationIdSuffix "" + } + nightly { + applicationIdSuffix ".nightly" + versionCode project.getVersionCode() + versionName "nightly-" + project.getVersionCode() + } + } + + flavorDimensions "default" + productFlavors { + fdroid { + applicationId "pro.kherel.selfprivacy" + } + production { + applicationIdSuffix "" + } + nightly { + applicationIdSuffix ".nightly" + versionCode project.getVersionCode() + versionName "nightly-" + project.getVersionCode() + } + } +} + +flutter { + source '../..' +} + +dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" +} diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 0000000..dddeb01 --- /dev/null +++ b/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..50f4747 --- /dev/null +++ b/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/kotlin/org/selfprivacy/app/MainActivity.kt b/android/app/src/main/kotlin/org/selfprivacy/app/MainActivity.kt new file mode 100644 index 0000000..440e86e --- /dev/null +++ b/android/app/src/main/kotlin/org/selfprivacy/app/MainActivity.kt @@ -0,0 +1,6 @@ +package org.selfprivacy.app + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() { +} diff --git a/android/app/src/main/res/drawable-v21/launch_background.xml b/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000..f74085f --- /dev/null +++ b/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/android/app/src/main/res/drawable/launch_background.xml b/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 0000000..304732f --- /dev/null +++ b/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..db77bb4 Binary files /dev/null and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-hdpi/launcher_icon.png b/android/app/src/main/res/mipmap-hdpi/launcher_icon.png new file mode 100644 index 0000000..fc3149a Binary files /dev/null and b/android/app/src/main/res/mipmap-hdpi/launcher_icon.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..17987b7 Binary files /dev/null and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/launcher_icon.png b/android/app/src/main/res/mipmap-mdpi/launcher_icon.png new file mode 100644 index 0000000..148b8c4 Binary files /dev/null and b/android/app/src/main/res/mipmap-mdpi/launcher_icon.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..09d4391 Binary files /dev/null and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png b/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png new file mode 100644 index 0000000..8e2086b Binary files /dev/null and b/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..d5f1c8d Binary files /dev/null and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png b/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png new file mode 100644 index 0000000..898cb80 Binary files /dev/null and b/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..4d6372e Binary files /dev/null and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png b/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png new file mode 100644 index 0000000..89b9c94 Binary files /dev/null and b/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png differ diff --git a/android/app/src/main/res/values-night/styles.xml b/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..3db14bb --- /dev/null +++ b/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..1f83a33 --- /dev/null +++ b/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/android/app/src/nightly/AndroidManifest.xml b/android/app/src/nightly/AndroidManifest.xml new file mode 100644 index 0000000..1a08196 --- /dev/null +++ b/android/app/src/nightly/AndroidManifest.xml @@ -0,0 +1,8 @@ + + + + diff --git a/android/app/src/nightly/res/mipmap-hdpi/ic_launcher.png b/android/app/src/nightly/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..db77bb4 Binary files /dev/null and b/android/app/src/nightly/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android/app/src/nightly/res/mipmap-hdpi/launcher_icon.png b/android/app/src/nightly/res/mipmap-hdpi/launcher_icon.png new file mode 100644 index 0000000..0f0b95e Binary files /dev/null and b/android/app/src/nightly/res/mipmap-hdpi/launcher_icon.png differ diff --git a/android/app/src/nightly/res/mipmap-mdpi/ic_launcher.png b/android/app/src/nightly/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..17987b7 Binary files /dev/null and b/android/app/src/nightly/res/mipmap-mdpi/ic_launcher.png differ diff --git a/android/app/src/nightly/res/mipmap-mdpi/launcher_icon.png b/android/app/src/nightly/res/mipmap-mdpi/launcher_icon.png new file mode 100644 index 0000000..e4ab713 Binary files /dev/null and b/android/app/src/nightly/res/mipmap-mdpi/launcher_icon.png differ diff --git a/android/app/src/nightly/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/nightly/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..09d4391 Binary files /dev/null and b/android/app/src/nightly/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/android/app/src/nightly/res/mipmap-xhdpi/launcher_icon.png b/android/app/src/nightly/res/mipmap-xhdpi/launcher_icon.png new file mode 100644 index 0000000..207a9cd Binary files /dev/null and b/android/app/src/nightly/res/mipmap-xhdpi/launcher_icon.png differ diff --git a/android/app/src/nightly/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/nightly/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..d5f1c8d Binary files /dev/null and b/android/app/src/nightly/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/android/app/src/nightly/res/mipmap-xxhdpi/launcher_icon.png b/android/app/src/nightly/res/mipmap-xxhdpi/launcher_icon.png new file mode 100644 index 0000000..97f25aa Binary files /dev/null and b/android/app/src/nightly/res/mipmap-xxhdpi/launcher_icon.png differ diff --git a/android/app/src/nightly/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/nightly/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..4d6372e Binary files /dev/null and b/android/app/src/nightly/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/android/app/src/nightly/res/mipmap-xxxhdpi/launcher_icon.png b/android/app/src/nightly/res/mipmap-xxxhdpi/launcher_icon.png new file mode 100644 index 0000000..fdad70a Binary files /dev/null and b/android/app/src/nightly/res/mipmap-xxxhdpi/launcher_icon.png differ diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 0000000..dddeb01 --- /dev/null +++ b/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/android/build.gradle b/android/build.gradle new file mode 100644 index 0000000..bf7e09c --- /dev/null +++ b/android/build.gradle @@ -0,0 +1,44 @@ +buildscript { + ext.kotlin_version = '1.6.10' + ext.getVersionCode = { -> + try { + def stdout = new ByteArrayOutputStream() + exec { + commandLine 'git', 'rev-list', '--first-parent', '--count', 'HEAD' + standardOutput = stdout + } + return Integer.parseInt(stdout.toString().trim()) + } + catch (ignored) { + return -1 + } + } + repositories { + google() + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:7.1.2' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +allprojects { + repositories { + google() + jcenter() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(':app') +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/android/gradle.properties b/android/gradle.properties new file mode 100644 index 0000000..94adc3a --- /dev/null +++ b/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx1536M +android.useAndroidX=true +android.enableJetifier=true diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..cc5527d --- /dev/null +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Jun 23 08:50:38 CEST 2017 +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/android/settings.gradle b/android/settings.gradle new file mode 100644 index 0000000..44e62bc --- /dev/null +++ b/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/lib/logic/orderscubit.dart b/lib/logic/orderscubit.dart index a9ed87b..bcd73ce 100644 --- a/lib/logic/orderscubit.dart +++ b/lib/logic/orderscubit.dart @@ -7,8 +7,8 @@ export 'package:provider/provider.dart'; part 'ordersstate.dart'; -class ItemsCubit extends Cubit { - ItemsCubit() +class OrdersCubit extends Cubit { + OrdersCubit() : super( const OrdersState( [], diff --git a/lib/ui/courier.dart b/lib/ui/courier.dart index 85e8489..480cd72 100644 --- a/lib/ui/courier.dart +++ b/lib/ui/courier.dart @@ -10,10 +10,10 @@ class _Courier extends StatelessWidget { @override Widget build(final BuildContext context) => InkWell( onTap: () { - Navigator.of(context).push( - MaterialPageRoute( - builder: (final BuildContext context) => CourierDetails(courier), - ); + // Navigator.of(context).push( + // MaterialPageRoute( + // builder: (final BuildContext context) => CourierDetails(courier), + // ); }, child: Container( padding: const EdgeInsets.symmetric(horizontal: 15), @@ -35,7 +35,7 @@ class _Courier extends StatelessWidget { ), const SizedBox(width: 20), Flexible( - child: Text(courier.title), + child: Text('${courier.name} ${courier.surname}'), ), ], ), diff --git a/lib/ui/courierspage.dart b/lib/ui/courierspage.dart index 2ff64ff..5c354c1 100644 --- a/lib/ui/courierspage.dart +++ b/lib/ui/courierspage.dart @@ -1,5 +1,6 @@ import 'package:cubit_form/cubit_form.dart'; import 'package:flutter/material.dart'; +import 'package:selfprivacy/logic/courierscubit.dart'; import 'package:selfprivacy/models/courier.dart'; part 'courier.dart'; diff --git a/lib/ui/item.dart b/lib/ui/item.dart index e7182fb..5bdb85d 100644 --- a/lib/ui/item.dart +++ b/lib/ui/item.dart @@ -10,10 +10,10 @@ class _Item extends StatelessWidget { @override Widget build(final BuildContext context) => InkWell( onTap: () { - Navigator.of(context).push( - MaterialPageRoute( - builder: (final BuildContext context) => ItemDetails(item), - ); + // Navigator.of(context).push( + // MaterialPageRoute( + // builder: (final BuildContext context) => ItemDetails(item), + // ); }, child: Container( padding: const EdgeInsets.symmetric(horizontal: 15), diff --git a/lib/ui/itemspage.dart b/lib/ui/itemspage.dart index 99842a0..5f47d99 100644 --- a/lib/ui/itemspage.dart +++ b/lib/ui/itemspage.dart @@ -1,5 +1,6 @@ import 'package:cubit_form/cubit_form.dart'; import 'package:flutter/material.dart'; +import 'package:selfprivacy/logic/itemscubit.dart'; import 'package:selfprivacy/models/item.dart'; part 'item.dart'; @@ -11,9 +12,9 @@ class ItemsPage extends StatelessWidget { Widget build(final BuildContext context) { final Widget child = BlocBuilder( builder: (final BuildContext context, final ItemsState state) { - final List users = state.users; + final List items = state.items; - if (users.isEmpty) { + if (items.isEmpty) { if (state.isLoading) { return const Center( child: CircularProgressIndicator(), @@ -58,9 +59,9 @@ class ItemsPage extends StatelessWidget { context.read().refresh(); }, child: ListView.builder( - itemCount: users.length, + itemCount: items.length, itemBuilder: (final BuildContext context, final int index) => _Item( - item: users[index], + item: items[index], ), ), ); diff --git a/lib/ui/order.dart b/lib/ui/order.dart index ad58a03..7d741fe 100644 --- a/lib/ui/order.dart +++ b/lib/ui/order.dart @@ -10,10 +10,10 @@ class _Order extends StatelessWidget { @override Widget build(final BuildContext context) => InkWell( onTap: () { - Navigator.of(context).push( - MaterialPageRoute( - builder: (final BuildContext context) => OrderDetails(order), - ); + // Navigator.of(context).push( + // MaterialPageRoute( + // builder: (final BuildContext context) => OrderDetails(order), + // ); }, child: Container( padding: const EdgeInsets.symmetric(horizontal: 15), diff --git a/lib/ui/orderspage.dart b/lib/ui/orderspage.dart index a9398ed..6453ec0 100644 --- a/lib/ui/orderspage.dart +++ b/lib/ui/orderspage.dart @@ -1,5 +1,6 @@ import 'package:cubit_form/cubit_form.dart'; import 'package:flutter/material.dart'; +import 'package:selfprivacy/logic/orderscubit.dart'; import 'package:selfprivacy/models/order.dart'; part 'order.dart'; diff --git a/pubspec.yaml b/pubspec.yaml index b06f504..ffb4515 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -64,3 +64,6 @@ flutter_icons: ios: true image_path_android: "assets/images/icon/logo_android.png" image_path_ios: "assets/images/icon/logo_ios.png" + +flutter: + uses-material-design: true