建议详情页面

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

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

@ -1,6 +1,6 @@
import 'dart:ui';
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:flutter/material.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/cupertino.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/utils/bee_map.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:flutter/cupertino.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/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/cupertino.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/widget/horizontal_image_view.dart';
import 'package:akuCommunity/widget/views/horizontal_image_view.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:akuCommunity/utils/headers.dart';

@ -1,7 +1,7 @@
import 'package:akuCommunity/model/manager/suggestion_or_complain_model.dart';
import 'package:akuCommunity/ui/manager/advice/advice_detail_page.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:flutter/material.dart';
import 'package:velocity_x/velocity_x.dart';
@ -27,7 +27,7 @@ class _AdviceCardState extends State<AdviceCard> {
elevation: 0,
padding: EdgeInsets.zero,
color: Colors.white,
onPressed: AdviceDetailPage(type: widget.model.type).to,
onPressed: AdviceDetailPage(model: widget.model).to,
shape: RoundedRectangleBorder(
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/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/widget/bee_scaffold.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_easyrefresh/easy_refresh.dart';
import 'package:shimmer/shimmer.dart';
import 'package:velocity_x/velocity_x.dart';
class AdviceDetailPage extends StatefulWidget {
final int type;
AdviceDetailPage({Key key, @required this.type}) : super(key: key);
final SuggestionOrComplainModel model;
AdviceDetailPage({Key key, @required this.model}) : super(key: key);
@override
_AdviceDetailPageState createState() => _AdviceDetailPageState();
@ -21,7 +26,7 @@ class _AdviceDetailPageState extends State<AdviceDetailPage> {
EasyRefreshController _refreshController = EasyRefreshController();
AdviceDetailModel _model;
String get adviceValue {
switch (widget.type) {
switch (widget.model.type) {
case 1:
return '咨询';
case 2:
@ -35,9 +40,14 @@ class _AdviceDetailPageState extends State<AdviceDetailPage> {
}
_buildShimmer() {
return Shimmer.fromColors(
child: Padding(
return Padding(
padding: EdgeInsets.all(32.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Shimmer.fromColors(
baseColor: Colors.black12,
highlightColor: Colors.white10,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -55,8 +65,17 @@ class _AdviceDetailPageState extends State<AdviceDetailPage> {
],
),
),
baseColor: Colors.black12,
highlightColor: Colors.white10,
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),
),
],
),
);
}
@ -66,10 +85,34 @@ class _AdviceDetailPageState extends State<AdviceDetailPage> {
children: [
'您的$adviceValue'.text.black.bold.size(38.sp).make(),
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
Widget build(BuildContext context) {
return BeeScaffold(
@ -80,8 +123,13 @@ class _AdviceDetailPageState extends State<AdviceDetailPage> {
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;
setState(() {});
if (mounted) setState(() {});
},
),
);

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

@ -37,6 +37,23 @@ class NetUtil {
headers: {},
);
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
@ -55,13 +72,6 @@ class NetUtil {
}) async {
try {
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);
_parseRequestError(baseModel, showMessage: showMessage);
return baseModel;
@ -83,13 +93,7 @@ class NetUtil {
}) async {
try {
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);
_parseRequestError(baseModel, showMessage: showMessage);
@ -127,17 +131,10 @@ class NetUtil {
data: FormData.fromMap({
'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);
return baseListModel;
} on DioError catch (e) {
_parseErr(e);
print(e);
}
return BaseFileModel.err();
}

@ -1,4 +1,5 @@
import 'dart:io';
import 'dart:ui';
import 'package:akuCommunity/const/resource.dart';
import 'package:akuCommunity/constants/api.dart';
@ -43,13 +44,16 @@ class _BeeImagePreviewState extends State<BeeImagePreview> {
onTap: Get.back,
child: Scaffold(
backgroundColor: Colors.black54,
body: Center(
body: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
child: Center(
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:get/get.dart';
class HorizontalImageView extends StatefulWidget {
class HorizontalImageView extends StatelessWidget {
final List<String> urls;
HorizontalImageView(
this.urls, {
Key key,
}) : super(key: key);
@override
_HorizontalImageViewState createState() => _HorizontalImageViewState();
}
class _HorizontalImageViewState extends State<HorizontalImageView> {
@override
Widget build(BuildContext context) {
if (widget.urls.isEmpty) return 15.hb;
if (urls.isEmpty) return 15.hb;
return Container(
height: 184.w + 32.w,
child: ListView.separated(
@ -29,29 +24,29 @@ class _HorizontalImageViewState extends State<HorizontalImageView> {
separatorBuilder: (_, __) => 16.wb,
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) {
return ClipRRect(
borderRadius: BorderRadius.circular(8.w),
child: GestureDetector(
return GestureDetector(
onTap: () {
Get.to(
BeeImagePreview.path(path: widget.urls[index]),
BeeImagePreview.path(path: urls[index]),
opaque: false,
);
},
child: Hero(
tag: widget.urls[index],
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(widget.urls[index]),
image: API.image(urls[index]),
fit: BoxFit.cover,
),
),
),
);
},
itemCount: widget.urls.length,
itemCount: urls.length,
),
);
}
Loading…
Cancel
Save