From f395b2d9f1cb69bdac1fafa62209465df29513ba Mon Sep 17 00:00:00 2001 From: laiiihz Date: Mon, 22 Mar 2021 10:53:29 +0800 Subject: [PATCH] update power logger version, add feedback page --- ios/Flutter/.last_build_id | 2 +- ios/Podfile.lock | 6 +++ lib/constants/api.dart | 4 +- .../feedback_page/feedback_page.dart | 43 +++++++++++++------ pubspec.lock | 10 ++--- pubspec.yaml | 6 +-- 6 files changed, 47 insertions(+), 24 deletions(-) diff --git a/ios/Flutter/.last_build_id b/ios/Flutter/.last_build_id index 67265b10..7d60eab0 100644 --- a/ios/Flutter/.last_build_id +++ b/ios/Flutter/.last_build_id @@ -1 +1 @@ -1d25ad0f6dab6b4c703ddfca43e3d476 \ No newline at end of file +b3de84cadfa8d6fa60e695b0306683c9 \ No newline at end of file diff --git a/ios/Podfile.lock b/ios/Podfile.lock index b1801e73..56fe612f 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -31,6 +31,8 @@ PODS: - core_location_fluttify (0.0.1): - Flutter - foundation_fluttify + - device_info (0.0.1): + - Flutter - Flutter (1.0.0) - fluwx (0.0.1): - Flutter @@ -76,6 +78,7 @@ DEPENDENCIES: - amap_map_fluttify (from `.symlinks/plugins/amap_map_fluttify/ios`) - amap_search_fluttify (from `.symlinks/plugins/amap_search_fluttify/ios`) - core_location_fluttify (from `.symlinks/plugins/core_location_fluttify/ios`) + - device_info (from `.symlinks/plugins/device_info/ios`) - Flutter (from `Flutter`) - fluwx (from `.symlinks/plugins/fluwx/ios`) - foundation_fluttify (from `.symlinks/plugins/foundation_fluttify/ios`) @@ -113,6 +116,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/amap_search_fluttify/ios" core_location_fluttify: :path: ".symlinks/plugins/core_location_fluttify/ios" + device_info: + :path: ".symlinks/plugins/device_info/ios" Flutter: :path: Flutter fluwx: @@ -152,6 +157,7 @@ SPEC CHECKSUMS: AMapLocation-NO-IDFA: 2a3edfee336b38481b892e1ecc85df0f6b365851 AMapSearch-NO-IDFA: 85555dc9ba312949d39a259baa4ef4e0619fa944 core_location_fluttify: 9466a411ea7d22c6349c7e6a767ae4623f01eb1d + device_info: d7d233b645a32c40dfdc212de5cf646ca482f175 Flutter: 0e3d915762c693b495b44d77113d4970485de6ec fluwx: 07a55ed66bf3a4961e836a2a411b02dcada32902 FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a diff --git a/lib/constants/api.dart b/lib/constants/api.dart index 89880874..90c36363 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -63,6 +63,9 @@ class _User { ///修改头像 String get udpdateAvatar => '/user/personalData/updateHeadPortrait'; + + ///意见反馈:app意见反馈提交(建议) + String get feedback => '/user/feedback/submit'; } class _Manager { @@ -248,5 +251,4 @@ class _Message { ///消息中心:评论通知全部已读(进入评论通知列表后调用) String get allReadComment => '/user/message/allReadComment'; - } diff --git a/lib/pages/setting_page/feedback_page/feedback_page.dart b/lib/pages/setting_page/feedback_page/feedback_page.dart index 255b728d..5095ad7b 100644 --- a/lib/pages/setting_page/feedback_page/feedback_page.dart +++ b/lib/pages/setting_page/feedback_page/feedback_page.dart @@ -1,7 +1,10 @@ // Dart imports: +import 'dart:io'; import 'dart:math'; // Flutter imports: +import 'package:akuCommunity/constants/api.dart'; +import 'package:akuCommunity/utils/network/net_util.dart'; import 'package:akuCommunity/widget/picker/grid_image_picker.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -24,6 +27,8 @@ class FeedBackPage extends StatefulWidget { class _FeedBackPageState extends State { TextEditingController _ideaContent = new TextEditingController(); + GlobalKey _formKey = GlobalKey(); + List _files = []; Widget _containerTextField() { return Container( @@ -39,6 +44,10 @@ class _FeedBackPageState extends State { fontWeight: FontWeight.w600, ), controller: _ideaContent, + validator: (text) { + if (text?.isEmpty ?? true) return '意见不能为空'; + return null; + }, onChanged: (String value) {}, maxLines: 10, decoration: InputDecoration( @@ -63,17 +72,22 @@ class _FeedBackPageState extends State { Widget _inkWellSubmit() { return InkWell( - onTap: () { - if (TextUtil.isEmpty(_ideaContent.text)) - BotToast.showText(text: '意见不能为空'); - else { + onTap: () async { + if (_formKey.currentState.validate()) { + if (_files?.isNotEmpty ?? false) { + //TODO upload file + } var cancelAction = BotToast.showLoading(); - Future.delayed(Duration(milliseconds: 1000 + Random().nextInt(1000)), - () { - BotToast.showText(text: '提交成功'); - cancelAction(); - Get.back(); - }); + await NetUtil().post( + API.user.feedback, + params: { + 'content': _ideaContent.text, + 'fileUrls': [], + }, + showMessage: true, + ); + cancelAction(); + Get.back(); } }, child: Container( @@ -123,14 +137,19 @@ class _FeedBackPageState extends State { style: TextStyle(fontSize: 28.sp, color: Color(0xff333333)), ), SizedBox(height: 24.w), - _containerTextField(), + Form( + child: _containerTextField(), + key: _formKey, + ), SizedBox(height: 24.w), Text( '添加图片信息(0/9)', style: TextStyle(fontSize: 28.sp, color: Color(0xff333333)), ), SizedBox(height: 24.w), - GridImagePicker(onChange: (files) {}), + GridImagePicker(onChange: (files) { + _files = files; + }), SizedBox(height: 76.w), _inkWellSubmit(), ], diff --git a/pubspec.lock b/pubspec.lock index 17f75bc7..2d7ef73f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -836,12 +836,10 @@ packages: power_logger: dependency: "direct main" description: - path: "." - ref: HEAD - resolved-ref: "0436e0b02d1673ee828a757413a86999cd25603c" - url: "http://159.75.73.143:8080/laiiihz/power_logger" - source: git - version: "0.1.1" + name: power_logger + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.1.3" pretty_json: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index db2c99a5..45245d0e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: akuCommunity description: A new Flutter project. publish_to: "none" # Remove this line if you wish to publish to pub.dev -version: 1.1.0-dev+12 +version: 1.1.10-dev+17 environment: sdk: ">=2.7.0 <3.0.0" @@ -89,9 +89,7 @@ dependencies: url: http://192.168.2.201:8099/zhangmeng/random_character.git image_picker: ^0.6.7+21 - power_logger: - git: - url: http://159.75.73.143:8080/laiiihz/power_logger + power_logger: ^0.1.3 flutter_rating_bar: ^3.2.0+1 jpush_flutter: ^0.6.3 badges: ^1.1.6