From 39c76ff04a2e1ebfb9b4f26d8a4d0bbabedc827e Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Tue, 18 May 2021 15:42:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E5=92=A8=E8=AF=A2?= =?UTF-8?q?=E5=BB=BA=E8=AE=AE/=E6=8A=95=E8=AF=89=E8=A1=A8=E6=BC=94=20?= =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=8F=8D=E9=A6=88=20=E5=AF=B9=E6=8E=A5?= =?UTF-8?q?=E5=85=B6=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/constants/api.dart | 3 + .../service_browse/service_browse_page.dart | 70 +++++++------- lib/ui/manager/advice/advice_detail_page.dart | 91 +++++++++++++------ lib/widget/buttons/bottom_button.dart | 9 +- 4 files changed, 105 insertions(+), 68 deletions(-) diff --git a/lib/constants/api.dart b/lib/constants/api.dart index 2fdcd41e..0077b411 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -230,6 +230,9 @@ class _Manager { ///app社区介绍:查询开启的社区介绍模版 String get communityIntroduceInfo => '/user/communityIntroduction/findEnable'; + + ///咨询建议/投诉表扬:完成反馈 + String get completeFeedBack => '/user/advice/completeFeedback'; } class _Community { diff --git a/lib/pages/service_browse/service_browse_page.dart b/lib/pages/service_browse/service_browse_page.dart index db422a99..2ffe1dea 100644 --- a/lib/pages/service_browse/service_browse_page.dart +++ b/lib/pages/service_browse/service_browse_page.dart @@ -43,7 +43,7 @@ class _ServiceBrowsePageState extends State { }, builder: (items) { return ListView.separated( - padding: EdgeInsets.symmetric(vertical: 24.w), + padding: EdgeInsets.symmetric(vertical: 24.w), itemBuilder: (context, index) { return _buildCard(items[index]); }, @@ -58,39 +58,39 @@ class _ServiceBrowsePageState extends State { Widget _buildCard(ServiceBrowseListModel model) { return Container( color: Colors.white, - - padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), - width: double.infinity, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - model.name.text - .size(32.sp) - .color(ktextPrimary) - .maxLines(1) - .overflow(TextOverflow.ellipsis) - .bold - .make(), - 32.w.heightBox, - model.content.text - .size(24.sp) - .color(ktextSubColor) - .maxLines(3) - .overflow(TextOverflow.ellipsis) - .make(), - 32.w.heightBox, - Row( - children: [ - '南宁人才公寓'.text.size(20.sp).color(ktextSubColor).make(), - Spacer(), - '发布于 ${DateUtil.formatDateStr(model.createDate, format: 'MM-dd HH:mm')}' - .text - .size(20.sp) - .color(ktextSubColor) - .make(), - ], - ), - ], - )); + padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + model.name.text + .size(32.sp) + .color(ktextPrimary) + .maxLines(1) + .overflow(TextOverflow.ellipsis) + .bold + .make(), + 32.w.heightBox, + model.content.text + .size(24.sp) + .color(ktextSubColor) + .maxLines(3) + .overflow(TextOverflow.ellipsis) + .make(), + 32.w.heightBox, + Row( + children: [ + '南宁人才公寓'.text.size(20.sp).color(ktextSubColor).make(), + Spacer(), + '发布于 ${DateUtil.formatDateStr(model.createDate, format: 'MM-dd HH:mm')}' + .text + .size(20.sp) + .color(ktextSubColor) + .make(), + ], + ), + ], + ), + ); } } diff --git a/lib/ui/manager/advice/advice_detail_page.dart b/lib/ui/manager/advice/advice_detail_page.dart index d4d6adfc..b1e01f91 100644 --- a/lib/ui/manager/advice/advice_detail_page.dart +++ b/lib/ui/manager/advice/advice_detail_page.dart @@ -1,3 +1,5 @@ +import 'package:aku_community/utils/network/base_model.dart'; +import 'package:bot_toast/bot_toast.dart'; import 'package:flutter/material.dart'; import 'package:dio/dio.dart'; @@ -165,38 +167,67 @@ class _AdviceDetailPageState extends State { @override Widget build(BuildContext context) { return BeeScaffold( - title: '查看详情', - systemStyle: SystemStyle.yellowBottomBar, - actions: [ - TextButton( - onPressed: () => - Get.to(() => AdviceEvaluatePage(id: widget.model!.id)), - child: '评价'.text.make(), + title: '查看详情', + systemStyle: SystemStyle.yellowBottomBar, + // actions: [ + // TextButton( + // onPressed: () => + // Get.to(() => AdviceEvaluatePage(id: widget.model!.id)), + // child: '评价'.text.make(), + // ), + // ], + body: EasyRefresh( + firstRefresh: true, + child: _loading ? _buildShimmer() : _buildChild(), + controller: _refreshController, + header: MaterialHeader(), + onRefresh: () async { + Response res = await NetUtil().dio!.get( + API.manager.adviceDetail, + queryParameters: {'adviceId': widget.model!.id}, + ); + _model = AdviceDetailModel.fromJson(res.data); + _loading = false; + if (mounted) setState(() {}); + }, ), + bottomNavi: _bottomButtons()); + } + + Widget _bottomButtons() { + return Row( + children: [ + widget.model?.status == 3 + ? SizedBox() + : SizedBox( + width: 290.w, + child: BottomButton( + bgColor: Colors.black, + textColor: Colors.white, + onPressed: () async { + bool result = await (Get.to( + () => AdviceAddCommentPage(id: widget.model!.id))); + if (result && mounted) _refreshController.callRefresh(); + }, + child: '继续提问'.text.bold.make(), + ), + ), + Expanded( + child: BottomButton( + onPressed: () async { + BaseModel baseModel = + await NetUtil().get(API.manager.completeFeedBack, params: { + "adviceId": widget.model!.id, + }); + if (baseModel.status ?? false) { + Get.to(() => AdviceEvaluatePage(id: widget.model!.id)); + } + BotToast.showText(text: baseModel.message ?? '未知错误'); + }, + child: '完成沟通'.text.bold.make(), + ), + ) ], - body: EasyRefresh( - firstRefresh: true, - child: _loading ? _buildShimmer() : _buildChild(), - controller: _refreshController, - header: MaterialHeader(), - onRefresh: () async { - Response res = await NetUtil().dio!.get( - API.manager.adviceDetail, - queryParameters: {'adviceId': widget.model!.id}, - ); - _model = AdviceDetailModel.fromJson(res.data); - _loading = false; - if (mounted) setState(() {}); - }, - ), - bottomNavi: BottomButton( - onPressed: () async { - bool result = - await (Get.to(() => AdviceAddCommentPage(id: widget.model!.id))); - if (result && mounted) _refreshController.callRefresh(); - }, - child: '继续提问'.text.bold.make(), - ), ); } } diff --git a/lib/widget/buttons/bottom_button.dart b/lib/widget/buttons/bottom_button.dart index 1fecd1af..60d301e6 100644 --- a/lib/widget/buttons/bottom_button.dart +++ b/lib/widget/buttons/bottom_button.dart @@ -7,11 +7,14 @@ import 'package:aku_community/base/base_style.dart'; class BottomButton extends StatelessWidget { final VoidCallback? onPressed; final Widget child; - + final Color bgColor; + final Color textColor; const BottomButton({ Key? key, required this.onPressed, required this.child, + this.bgColor = kPrimaryColor, + this.textColor = ktextPrimary, }) : super(key: key); @override @@ -23,10 +26,10 @@ class BottomButton extends StatelessWidget { materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, disabledColor: Colors.white.withOpacity(0.5), disabledTextColor: ktextSubColor.withOpacity(0.8), - textColor: ktextPrimary, + textColor: textColor, child: child, onPressed: onPressed, - color: kPrimaryColor, + color: bgColor, height: 98.w, minWidth: double.infinity, ),