From 8ae3f01e89aa7dd331992c6616d8842439eff40c Mon Sep 17 00:00:00 2001 From: iqFareez <60868965+fareezMaple@users.noreply.github.com> Date: Fri, 14 Aug 2020 19:33:46 +0800 Subject: [PATCH] first android prerelease --- README.md | 2 +- android/.gitignore | 1 + android/app/build.gradle | 27 ++++++++++++++++++------ android/app/src/main/AndroidManifest.xml | 3 +++ lib/AppBody.dart | 3 ++- lib/main.dart | 14 ++++++++++-- pubspec.lock | 7 ++++++ pubspec.yaml | 3 ++- 8 files changed, 48 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 825f632..6695751 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ https://bmi-flutter-2e776.web.app/ ## Download app (coming soon) 1. Google Play Store -2. APK +2. [APK](https://github.com/fareezMaple/bmi_calculator-Flutter/releases) ## Legalese diff --git a/android/.gitignore b/android/.gitignore index bc2100d..5a35ffe 100644 --- a/android/.gitignore +++ b/android/.gitignore @@ -5,3 +5,4 @@ gradle-wrapper.jar /gradlew.bat /local.properties GeneratedPluginRegistrant.java +key.properties diff --git a/android/app/build.gradle b/android/app/build.gradle index 058b445..5c64768 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -24,6 +24,11 @@ if (flutterVersionName == null) { apply plugin: 'com.android.application' 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 { compileSdkVersion 28 @@ -40,14 +45,22 @@ android { 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 - } - } + signingConfigs { + release { + keyAlias keystoreProperties['keyAlias'] + keyPassword keystoreProperties['keyPassword'] + storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null + storePassword keystoreProperties['storePassword'] + } + } + buildTypes { + release { + signingConfig signingConfigs.release + } + } + } + } flutter { source '../..' diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index a54b51b..228de48 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -5,6 +5,9 @@ In most cases you can leave this as-is, but you if you want to provide additional functionality it is fine to subclass or reimplement FlutterApplication and put your custom class here. --> + + + { counter: Offstage(), border: OutlineInputBorder(), labelText: "Height", - hintText: "Eg: 1.7", + hintText: "Eg: 1.73", suffixText: "m", alignLabelWithHint: false, filled: true), @@ -141,6 +141,7 @@ class _AppBodyState extends State { ), color: Colors.green, onPressed: () { + FocusManager.instance.primaryFocus.unfocus(); print('Button calculate pressed'); print('height is ' + heightController.text); print('weight is ' + weightController.text); diff --git a/lib/main.dart b/lib/main.dart index bcde52b..871aef2 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:share/share.dart'; import 'AppBody.dart'; @@ -11,7 +12,7 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( - title: 'BMI Calculator ', + title: 'BMI Calculator', theme: ThemeData( primarySwatch: Colors.deepOrange, visualDensity: VisualDensity.adaptivePlatformDensity, @@ -33,6 +34,7 @@ class MyHomePage extends StatelessWidget { icon: Icon(Icons.share), onPressed: () { print('Pressed'); + Share.share('Not implemented yet :")'); }, tooltip: 'Share your current BMI', ), @@ -40,7 +42,15 @@ class MyHomePage extends StatelessWidget { icon: Icon(Icons.info), onPressed: () { print('Info'); - showAboutDialog(context: context); + showAboutDialog( + context: context, + applicationName: 'BMI Calculator Lite', + applicationVersion: '1.0.0-pre+1', + applicationIcon: Image.network( + 'https://firebasestorage.googleapis.com/v0/b/bmi-flutter-2e776.appspot.com/o/logounnamed%20(Custom).png?alt=media&token=b22b53f7-bfc6-4a9b-89f3-92e681d1fe6c', + width: 50, + ), + applicationLegalese: '© maplerr aka fareez'); }, tooltip: 'View some info', ) diff --git a/pubspec.lock b/pubspec.lock index 897b426..152444b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -233,6 +233,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.4.4" + share: + dependency: "direct main" + description: + name: share + url: "https://pub.dartlang.org" + source: hosted + version: "0.6.4+3" sky_engine: dependency: transitive description: flutter diff --git a/pubspec.yaml b/pubspec.yaml index 043c63d..2ae5cca 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.0.0+1 +version: 1.0.0-pre+1 environment: sdk: ">=2.7.0 <3.0.0" @@ -24,6 +24,7 @@ dependencies: google_fonts: ^1.1.0 url_launcher: ^5.4.11 flutter_linkify: ^3.1.3 + share: ^0.6.4+3 flutter: sdk: flutter