建议详情页面

hmxc
小赖 4 years ago
parent 28f111cb9d
commit 080b222b70

@ -90,8 +90,12 @@ class _Manager {
///appidid ///appidid
String get reportRepairFindBYLD => '/user/reportRepair/findById'; String get reportRepairFindBYLD => '/user/reportRepair/findById';
/// // /// //
String get addAdvice => '/user/advice/insert'; String get addAdvice => '/user/advice/insert';
///
String get adviceDetail => '/user/advice/findAdviceDetailByAdviceId';
} }
class _Upload { class _Upload {

@ -1,6 +1,6 @@
import 'dart:ui'; import 'dart:ui';
import 'package:akuCommunity/base/base_style.dart'; import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/widget/horizontal_image_view.dart'; import 'package:akuCommunity/widget/views/horizontal_image_view.dart';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';

@ -1,4 +1,4 @@
import 'package:akuCommunity/widget/horizontal_image_view.dart'; import 'package:akuCommunity/widget/views/horizontal_image_view.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_icons/flutter_icons.dart'; import 'package:flutter_icons/flutter_icons.dart';

@ -8,7 +8,7 @@ import 'package:akuCommunity/pages/things_page/widget/fixed_check_box.dart';
import 'package:akuCommunity/provider/user_provider.dart'; import 'package:akuCommunity/provider/user_provider.dart';
import 'package:akuCommunity/utils/bee_map.dart'; import 'package:akuCommunity/utils/bee_map.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:akuCommunity/widget/horizontal_image_view.dart'; import 'package:akuCommunity/widget/views/horizontal_image_view.dart';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';

@ -1,6 +1,6 @@
import 'package:akuCommunity/pages/things_page/things_evaluate_page/things_evaluate_page.dart'; import 'package:akuCommunity/pages/things_page/things_evaluate_page/things_evaluate_page.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:akuCommunity/widget/horizontal_image_view.dart'; import 'package:akuCommunity/widget/views/horizontal_image_view.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/utils/headers.dart';

@ -1,5 +1,5 @@
import 'package:akuCommunity/pages/things_page/things_detail_page/things_detail_page.dart'; import 'package:akuCommunity/pages/things_page/things_detail_page/things_detail_page.dart';
import 'package:akuCommunity/widget/horizontal_image_view.dart'; import 'package:akuCommunity/widget/views/horizontal_image_view.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/utils/headers.dart';

@ -1,7 +1,7 @@
import 'package:akuCommunity/model/manager/suggestion_or_complain_model.dart'; import 'package:akuCommunity/model/manager/suggestion_or_complain_model.dart';
import 'package:akuCommunity/ui/manager/advice/advice_detail_page.dart'; import 'package:akuCommunity/ui/manager/advice/advice_detail_page.dart';
import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/widget/horizontal_image_view.dart'; import 'package:akuCommunity/widget/views/horizontal_image_view.dart';
import 'package:common_utils/common_utils.dart'; import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
@ -27,7 +27,7 @@ class _AdviceCardState extends State<AdviceCard> {
elevation: 0, elevation: 0,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
color: Colors.white, color: Colors.white,
onPressed: AdviceDetailPage(type: widget.model.type).to, onPressed: AdviceDetailPage(model: widget.model).to,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.w), borderRadius: BorderRadius.circular(8.w),
), ),

@ -1,16 +1,21 @@
import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/model/manager/advice_detail_model.dart'; import 'package:akuCommunity/model/manager/advice_detail_model.dart';
import 'package:akuCommunity/ui/manager/advice/advice_page.dart'; import 'package:akuCommunity/model/manager/suggestion_or_complain_model.dart';
import 'package:akuCommunity/utils/network/net_util.dart'; import 'package:akuCommunity/utils/network/net_util.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/widget/views/bee_grid_image_view.dart';
import 'package:common_utils/common_utils.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:shimmer/shimmer.dart'; import 'package:shimmer/shimmer.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
class AdviceDetailPage extends StatefulWidget { class AdviceDetailPage extends StatefulWidget {
final int type; final SuggestionOrComplainModel model;
AdviceDetailPage({Key key, @required this.type}) : super(key: key); AdviceDetailPage({Key key, @required this.model}) : super(key: key);
@override @override
_AdviceDetailPageState createState() => _AdviceDetailPageState(); _AdviceDetailPageState createState() => _AdviceDetailPageState();
@ -21,7 +26,7 @@ class _AdviceDetailPageState extends State<AdviceDetailPage> {
EasyRefreshController _refreshController = EasyRefreshController(); EasyRefreshController _refreshController = EasyRefreshController();
AdviceDetailModel _model; AdviceDetailModel _model;
String get adviceValue { String get adviceValue {
switch (widget.type) { switch (widget.model.type) {
case 1: case 1:
return '咨询'; return '咨询';
case 2: case 2:
@ -35,28 +40,42 @@ class _AdviceDetailPageState extends State<AdviceDetailPage> {
} }
_buildShimmer() { _buildShimmer() {
return Shimmer.fromColors( return Padding(
child: Padding( padding: EdgeInsets.all(32.w),
padding: EdgeInsets.all(32.w), child: Column(
child: Column( crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: [
children: [ Shimmer.fromColors(
VxBox().height(53.w).width(152.w).color(Colors.white).make(), baseColor: Colors.black12,
30.hb, highlightColor: Colors.white10,
VxBox().height(40.w).width(600.w).color(Colors.white).make(), child: Column(
24.hb, crossAxisAlignment: CrossAxisAlignment.start,
VxBox().height(33.w).width(263.w).color(Colors.white).make(), children: [
50.hb, VxBox().height(53.w).width(152.w).color(Colors.white).make(),
VxBox().height(53.w).width(152.w).color(Colors.white).make(), 30.hb,
30.hb, VxBox().height(40.w).width(600.w).color(Colors.white).make(),
VxBox().height(40.w).width(600.w).color(Colors.white).make(), 24.hb,
24.hb, VxBox().height(33.w).width(263.w).color(Colors.white).make(),
VxBox().height(33.w).width(263.w).color(Colors.white).make(), 50.hb,
], VxBox().height(53.w).width(152.w).color(Colors.white).make(),
), 30.hb,
VxBox().height(40.w).width(600.w).color(Colors.white).make(),
24.hb,
VxBox().height(33.w).width(263.w).color(Colors.white).make(),
],
),
),
Divider(
height: 50.w,
thickness: 1.w,
color: Color(0xFFD8D8D8),
),
BeeGridImageView(
urls: widget.model.imgUrls.map((e) => e.url).toList(),
padding: EdgeInsets.only(right: 100.w),
),
],
), ),
baseColor: Colors.black12,
highlightColor: Colors.white10,
); );
} }
@ -66,10 +85,34 @@ class _AdviceDetailPageState extends State<AdviceDetailPage> {
children: [ children: [
'您的$adviceValue'.text.black.bold.size(38.sp).make(), '您的$adviceValue'.text.black.bold.size(38.sp).make(),
30.hb, 30.hb,
_model.appAdviceDetailVo.appAdviceVo.content.text
.color(ktextSubColor)
.size(28.sp)
.make(),
24.hb,
DateUtil.formatDate(
_model.appAdviceDetailVo.appAdviceVo.date,
format: 'yyyy年MM月dd日 HH:mm',
).text.make(),
Divider(
height: 50.w,
thickness: 1.w,
color: Color(0xFFD8D8D8),
),
BeeGridImageView(
urls: widget.model.imgUrls.map((e) => e.url).toList(),
padding: EdgeInsets.only(right: 100.w),
),
], ],
); );
} }
@override
void dispose() {
_refreshController?.dispose();
super.dispose();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BeeScaffold( return BeeScaffold(
@ -80,8 +123,13 @@ class _AdviceDetailPageState extends State<AdviceDetailPage> {
controller: _refreshController, controller: _refreshController,
header: MaterialHeader(), header: MaterialHeader(),
onRefresh: () async { onRefresh: () async {
Response res = await NetUtil().dio.get(
API.manager.adviceDetail,
queryParameters: {'adviceId': widget.model.id},
);
_model = AdviceDetailModel.fromJson(res.data);
_loading = false; _loading = false;
setState(() {}); if (mounted) setState(() {});
}, },
), ),
); );

@ -112,16 +112,18 @@ class _AdvicePageState extends State<AdvicePage> with TickerProviderStateMixin {
bottomNavi: BottomButton( bottomNavi: BottomButton(
onPressed: () async { onPressed: () async {
bool needRefresh = await Get.to(NewAdvicePage(type: widget.type)); bool needRefresh = await Get.to(NewAdvicePage(type: widget.type));
if (needRefresh == true) _refreshController.callRefresh(); if (needRefresh == true) {
Get.dialog(CupertinoAlertDialog( _refreshController.callRefresh();
title: '您的信息已提交,我们会尽快回复您,祝您生活愉快'.text.isIntrinsic.make(), Get.dialog(CupertinoAlertDialog(
actions: [ title: '您的信息已提交,我们会尽快回复您,祝您生活愉快'.text.isIntrinsic.make(),
CupertinoDialogAction( actions: [
child: '确定'.text.color(Color(0xFFFF8200)).isIntrinsic.make(), CupertinoDialogAction(
onPressed: Get.back, child: '确定'.text.color(Color(0xFFFF8200)).isIntrinsic.make(),
), onPressed: Get.back,
], ),
)); ],
));
}
}, },
child: Text('新增'), child: Text('新增'),
), ),

@ -37,6 +37,23 @@ class NetUtil {
headers: {}, headers: {},
); );
if (_dio == null) _dio = Dio(options); if (_dio == null) _dio = Dio(options);
dio.interceptors.add(InterceptorsWrapper(
onRequest: (RequestOptions options) async => options,
onResponse: (Response response) async {
_logger.v({
'path': response.request.path,
'header': response.request.headers,
'params': response.request.queryParameters,
'data': response.data,
});
LoggerData.addData(response);
return response;
},
onError: (DioError error) async {
_parseErr(error);
return error;
},
));
} }
///call auth after login ///call auth after login
@ -55,13 +72,6 @@ class NetUtil {
}) async { }) async {
try { try {
Response res = await _dio.get(path, queryParameters: params); Response res = await _dio.get(path, queryParameters: params);
_logger.v({
'path': res.request.path,
'header': res.request.headers,
'params': res.request.queryParameters,
'data': res.data,
});
LoggerData.addData(res);
BaseModel baseModel = BaseModel.fromJson(res.data); BaseModel baseModel = BaseModel.fromJson(res.data);
_parseRequestError(baseModel, showMessage: showMessage); _parseRequestError(baseModel, showMessage: showMessage);
return baseModel; return baseModel;
@ -83,13 +93,7 @@ class NetUtil {
}) async { }) async {
try { try {
Response res = await _dio.post(path, data: params); Response res = await _dio.post(path, data: params);
_logger.v({
'path': res.request.path,
'header': res.request.headers,
'params': res.request.queryParameters,
'data': res.data,
});
LoggerData.addData(res);
BaseModel baseModel = BaseModel.fromJson(res.data); BaseModel baseModel = BaseModel.fromJson(res.data);
_parseRequestError(baseModel, showMessage: showMessage); _parseRequestError(baseModel, showMessage: showMessage);
@ -127,17 +131,10 @@ class NetUtil {
data: FormData.fromMap({ data: FormData.fromMap({
'file': await MultipartFile.fromFile(file.path), 'file': await MultipartFile.fromFile(file.path),
})); }));
_logger.v({
'path': res.request.path,
'header': res.request.headers,
'params': res.request.queryParameters,
'data': res.data,
});
LoggerData.addData(res);
BaseFileModel baseListModel = BaseFileModel.fromJson(res.data); BaseFileModel baseListModel = BaseFileModel.fromJson(res.data);
return baseListModel; return baseListModel;
} on DioError catch (e) { } on DioError catch (e) {
_parseErr(e); print(e);
} }
return BaseFileModel.err(); return BaseFileModel.err();
} }

@ -1,4 +1,5 @@
import 'dart:io'; import 'dart:io';
import 'dart:ui';
import 'package:akuCommunity/const/resource.dart'; import 'package:akuCommunity/const/resource.dart';
import 'package:akuCommunity/constants/api.dart'; import 'package:akuCommunity/constants/api.dart';
@ -43,10 +44,13 @@ class _BeeImagePreviewState extends State<BeeImagePreview> {
onTap: Get.back, onTap: Get.back,
child: Scaffold( child: Scaffold(
backgroundColor: Colors.black54, backgroundColor: Colors.black54,
body: Center( body: BackdropFilter(
child: InteractiveViewer( filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
minScale: 0.2, child: Center(
child: image, child: InteractiveViewer(
minScale: 0.2,
child: image,
),
), ),
), ),
), ),

@ -0,0 +1,54 @@
import 'package:akuCommunity/const/resource.dart';
import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/widget/picker/bee_image_preview.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class BeeGridImageView extends StatelessWidget {
final List<String> urls;
final EdgeInsetsGeometry padding;
const BeeGridImageView({
Key key,
@required this.urls,
this.padding = EdgeInsets.zero,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return GridView.builder(
padding: padding,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
crossAxisSpacing: 16.w,
mainAxisSpacing: 16.w,
),
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
Get.to(
BeeImagePreview.path(path: urls[index]),
opaque: false,
);
},
child: Hero(
tag: urls[index],
child: ClipRRect(
borderRadius: BorderRadius.circular(8.w),
child: FadeInImage.assetNetwork(
height: 184.w,
width: 184.w,
placeholder: R.ASSETS_IMAGES_LOGO_PNG,
image: API.image(urls[index]),
fit: BoxFit.cover,
),
),
),
);
},
itemCount: urls.length,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
);
}
}

@ -7,21 +7,16 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:akuCommunity/const/resource.dart'; import 'package:akuCommunity/const/resource.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
class HorizontalImageView extends StatefulWidget { class HorizontalImageView extends StatelessWidget {
final List<String> urls; final List<String> urls;
HorizontalImageView( HorizontalImageView(
this.urls, { this.urls, {
Key key, Key key,
}) : super(key: key); }) : super(key: key);
@override
_HorizontalImageViewState createState() => _HorizontalImageViewState();
}
class _HorizontalImageViewState extends State<HorizontalImageView> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (widget.urls.isEmpty) return 15.hb; if (urls.isEmpty) return 15.hb;
return Container( return Container(
height: 184.w + 32.w, height: 184.w + 32.w,
child: ListView.separated( child: ListView.separated(
@ -29,29 +24,29 @@ class _HorizontalImageViewState extends State<HorizontalImageView> {
separatorBuilder: (_, __) => 16.wb, separatorBuilder: (_, __) => 16.wb,
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return ClipRRect( return GestureDetector(
borderRadius: BorderRadius.circular(8.w), onTap: () {
child: GestureDetector( Get.to(
onTap: () { BeeImagePreview.path(path: urls[index]),
Get.to( opaque: false,
BeeImagePreview.path(path: widget.urls[index]), );
opaque: false, },
); child: Hero(
}, tag: urls[index],
child: Hero( child: ClipRRect(
tag: widget.urls[index], borderRadius: BorderRadius.circular(8.w),
child: FadeInImage.assetNetwork( child: FadeInImage.assetNetwork(
height: 184.w, height: 184.w,
width: 184.w, width: 184.w,
placeholder: R.ASSETS_IMAGES_LOGO_PNG, placeholder: R.ASSETS_IMAGES_LOGO_PNG,
image: API.image(widget.urls[index]), image: API.image(urls[index]),
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
), ),
), ),
); );
}, },
itemCount: widget.urls.length, itemCount: urls.length,
), ),
); );
} }
Loading…
Cancel
Save