diff --git a/android/app/build.gradle b/android/app/build.gradle index 4091af1..c3c8f8f 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -51,6 +51,10 @@ android { // 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 + minifyEnabled true + useProguard true + + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro new file mode 100644 index 0000000..2f9b4bf --- /dev/null +++ b/android/app/proguard-rules.pro @@ -0,0 +1,81 @@ +-optimizationpasses 5 + +# 混合时不使用大小写混合,混合后的类名为小写 +-dontusemixedcaseclassnames + +# 指定不去忽略非公共库的类 +-dontskipnonpubliclibraryclasses + +# 这句话能够使我们的项目混淆后产生映射文件 +# 包含有类名->混淆后类名的映射关系 +-verbose + +# 指定不去忽略非公共库的类成员 +-dontskipnonpubliclibraryclassmembers + +# 不做预校验,preverify是proguard的四个步骤之一,Android不需要preverify,去掉这一步能够加快混淆速度。 +-dontpreverify + +# 保留Annotation不混淆 +-keepattributes *Annotation*,InnerClasses + +# 避免混淆泛型 +-keepattributes Signature + +# 抛出异常时保留代码行号 +-keepattributes SourceFile,LineNumberTable + +# 指定混淆是采用的算法,后面的参数是一个过滤器 +# 这个过滤器是谷歌推荐的算法,一般不做更改 +-optimizations !code/simplification/cast,!field/*,!class/merging/* + + +# 保留我们使用的四大组件,自定义的Application等等这些类不被混淆 +# 因为这些子类都有可能被外部调用 +-keep public class * extends android.app.Activity +-keep public class * extends android.app.Appliction +-keep public class * extends android.app.Service +-keep public class * extends android.content.BroadcastReceiver +-keep public class * extends android.content.ContentProvider +-keep public class * extends android.app.backup.BackupAgentHelper +-keep public class * extends android.preference.Preference +-keep public class * extends android.view.View +-keep public class com.android.vending.licensing.ILicensingService + + -keep class * extends android.app.Fragment { + public void setUserVisibleHint(boolean); + public void onHiddenChanged(boolean); + public void onResume(); + public void onPause(); + } + -keep class android.support.v4.app.Fragment { + public void setUserVisibleHint(boolean); + public void onHiddenChanged(boolean); + public void onResume(); + public void onPause(); + } + -keep class * extends android.support.v4.app.Fragment { + public void setUserVisibleHint(boolean); + public void onHiddenChanged(boolean); + public void onResume(); + public void onPause(); + } + +##---------------Begin: proguard configuration for Gson ---------- +# Gson uses generic type information stored in a class file when working with fields. Proguard +# removes such information by default, so configure it to keep all of it. +-keepattributes Signature + +# For using GSON @Expose annotation +-keepattributes *Annotation* + +-keep class io.flutter.app.** { *; } +-keep class io.flutter.plugin.** { *; } +-keep class io.flutter.util.** { *; } +-keep class io.flutter.view.** { *; } +-keep class io.flutter.** { *; } +-keep class io.flutter.plugins.** { *; } + + +-dontwarn android.arch.** +-dontwarn io.flutter.** \ No newline at end of file diff --git a/lib/member/LoanInfo.dart b/lib/member/LoanInfo.dart index f858c29..9d199db 100644 --- a/lib/member/LoanInfo.dart +++ b/lib/member/LoanInfo.dart @@ -31,7 +31,7 @@ class LoandInfo{ StringBuffer sb=new StringBuffer(); // sb.write("本金:"+Utils.formatNumber(baseMoney)+"元"); // sb.write("\n总的利息:"+ Utils.formatNumber(interestTotal)+"元"); - sb.write("年利率:"+Utils.formatNumber(yearRate*100)+" %"+"元"); + sb.write("年利率:"+Utils.formatNumber(yearRate*100)+" %"); if(interestYear!=0){ sb.write("\n一年的利息:"+Utils.formatNumber(interestYear)+"元"); } diff --git a/lib/utils/Utils.dart b/lib/utils/Utils.dart index 01ada20..4f61cdc 100644 --- a/lib/utils/Utils.dart +++ b/lib/utils/Utils.dart @@ -1,3 +1,4 @@ +import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; class Utils{ @@ -12,4 +13,10 @@ class Utils{ } + + static void closeKeybord(BuildContext context){ + + FocusScope.of(context).requestFocus(FocusNode()); + } + } \ No newline at end of file diff --git a/lib/view/loan_page.dart b/lib/view/loan_page.dart index 5725964..ae4c280 100644 --- a/lib/view/loan_page.dart +++ b/lib/view/loan_page.dart @@ -6,6 +6,7 @@ import 'package:loan_calc/utils/ToastUtils.dart'; import 'package:loan_calc/utils/calc.dart'; import 'package:loan_calc/view/date_drop_down.dart'; import 'package:loan_calc/view/rate_drop_down.dart'; +import 'package:loan_calc/utils/Utils.dart'; class LoanActivity extends StatelessWidget { @override @@ -49,6 +50,7 @@ class _MyLoadPageState extends State { String displayDetail = ""; void checkAndCalc(TapUpDetails details) { + Utils.closeKeybord(context); if (moneyController.text.isEmpty) { showTaost("金额不能为空"); return null; @@ -64,6 +66,7 @@ class _MyLoadPageState extends State { return null; } + double money = double.parse(moneyController.text); int time = int.parse(timeController.text);