liuyuqi-dellpc 5 years ago
parent
commit
b41c44bfac

+ 10 - 0
README_cn.md

@@ -25,6 +25,16 @@ Flutter 学习工具,主要开发 android UI。
 ./test
 ```
 
+## 开发
 
 
 
+## 注意事项
+
+1、依赖有严格要求:
+```
+ext.kotlin_version = '1.2.71'
+
+classpath 'com.android.tools.build:gradle:3.2.0'
+```
+

+ 15 - 1
android/app/build.gradle

@@ -27,7 +27,21 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
 
 android {
     compileSdkVersion 28
-
+    signingConfigs {
+        release {
+            storeFile file("../sign/release.jks")
+            keyAlias "alias_release"
+            keyPassword "123456"
+            storePassword "123456"
+        }
+//        debug {
+//            storeFile file("../sign/debug.jks")
+//            keyAlias "alias_debug"
+//            keyPassword "123456"
+//            storePassword "123456"
+//        }
+    }
+    signingConfig signingConfigs.release
     sourceSets {
         main.java.srcDirs += 'src/main/kotlin'
     }

+ 3 - 1
android/app/src/main/AndroidManifest.xml

@@ -6,7 +6,9 @@
          to allow setting breakpoints, to provide hot reload, etc.
     -->
     <uses-permission android:name="android.permission.INTERNET"/>
-
+    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
     <!-- io.flutter.app.FlutterApplication is an android.app.Application that
          calls FlutterMain.startInitialization(this); in its onCreate method.
          In most cases you can leave this as-is, but you if you want to provide

+ 0 - 0
android/sign/release.jks


+ 0 - 0
lib/config/httpHeaders.dart → lib/config/http_headers.dart


+ 1 - 1
lib/main.dart

@@ -15,7 +15,7 @@ import 'package:flutter_note/provide/page_index_provide.dart';
 import 'package:flutter_note/provide/goods_detail_provide.dart';
 import 'package:flutter_note/provide/mall_goods_provide.dart';
 import 'package:flutter_note/provide/sub_category_provide.dart';
-
+//程序入口
 void main() {
   final providers = Providers()
     ..provide(Provider.function((_) => HomeProvide())) // 主页面

+ 5 - 4
lib/service/service_method.dart

@@ -4,9 +4,10 @@ import 'dart:io';
 import 'package:dio/dio.dart';
 import '../config/service_url.dart';
 
-Future<Response> getCategories() => request(servicePath['getCategory']);
-
-Future<Response> getMallGoods(String categoryId, String categorySubId, int page) => request(servicePath['getMallGoods'],
+//获得火爆专区商品的方法
+Future<Response> getCategories() async => request(servicePath['getCategory']);
+//获得商城首页信息的方法
+Future<Response> getMallGoods(String categoryId, String categorySubId, int page) async=> request(servicePath['getMallGoods'],
     formData:
     categorySubId != null ? {'categoryId': categoryId, 'categorySubId': categorySubId, 'page': page} : {'categoryId': categoryId, 'page': page});
 
@@ -23,7 +24,7 @@ Future<Response> request(String url, {Map formData}) async {
     if (response.statusCode == 200) {
       return response;
     } else {
-      throw Exception('Net Error');
+      throw Exception('后端接口出现异常,请检测代码和服务器情况.........');
     }
   } catch (e) {
     print('ERROR: $e');