update advice page

hmxc
小赖 4 years ago
parent cfa7b2c54d
commit c342e4be56

@ -0,0 +1,161 @@
import 'package:common_utils/common_utils.dart';
class AdviceDetailModel {
AppAdviceDetailVo appAdviceDetailVo;
AdviceDetailModel({this.appAdviceDetailVo});
AdviceDetailModel.fromJson(Map<String, dynamic> json) {
appAdviceDetailVo = json['appAdviceDetailVo'] != null
? new AppAdviceDetailVo.fromJson(json['appAdviceDetailVo'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.appAdviceDetailVo != null) {
data['appAdviceDetailVo'] = this.appAdviceDetailVo.toJson();
}
return data;
}
}
class AppAdviceDetailVo {
AppAdviceVo appAdviceVo;
List<AppAdviceContentVos> appAdviceContentVos;
AppAdviceDetailVo({this.appAdviceVo, this.appAdviceContentVos});
AppAdviceDetailVo.fromJson(Map<String, dynamic> json) {
appAdviceVo = json['appAdviceVo'] != null
? new AppAdviceVo.fromJson(json['appAdviceVo'])
: null;
if (json['appAdviceContentVos'] != null) {
appAdviceContentVos = new List<AppAdviceContentVos>();
json['appAdviceContentVos'].forEach((v) {
appAdviceContentVos.add(new AppAdviceContentVos.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.appAdviceVo != null) {
data['appAdviceVo'] = this.appAdviceVo.toJson();
}
if (this.appAdviceContentVos != null) {
data['appAdviceContentVos'] =
this.appAdviceContentVos.map((v) => v.toJson()).toList();
}
return data;
}
}
class AppAdviceVo {
int id;
int type;
int status;
String content;
String createDate;
List<ImgUrls> imgUrls;
DateTime get date => DateUtil.getDateTime(createDate);
AppAdviceVo(
{this.id,
this.type,
this.status,
this.content,
this.createDate,
this.imgUrls});
AppAdviceVo.fromJson(Map<String, dynamic> json) {
id = json['id'];
type = json['type'];
status = json['status'];
content = json['content'];
createDate = json['createDate'];
if (json['imgUrls'] != null) {
imgUrls = new List<ImgUrls>();
json['imgUrls'].forEach((v) {
imgUrls.add(new ImgUrls.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['type'] = this.type;
data['status'] = this.status;
data['content'] = this.content;
data['createDate'] = this.createDate;
if (this.imgUrls != null) {
data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList();
}
return data;
}
}
class ImgUrls {
String url;
String size;
int longs;
int paragraph;
int sort;
ImgUrls({this.url, this.size, this.longs, this.paragraph, this.sort});
ImgUrls.fromJson(Map<String, dynamic> json) {
url = json['url'];
size = json['size'];
longs = json['longs'];
paragraph = json['paragraph'];
sort = json['sort'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['url'] = this.url;
data['size'] = this.size;
data['longs'] = this.longs;
data['paragraph'] = this.paragraph;
data['sort'] = this.sort;
return data;
}
}
class AppAdviceContentVos {
int id;
int createUserType;
String content;
String createDate;
int parentId;
AppAdviceContentVos(
{this.id,
this.createUserType,
this.content,
this.createDate,
this.parentId});
DateTime get date => DateUtil.getDateTime(createDate);
AppAdviceContentVos.fromJson(Map<String, dynamic> json) {
id = json['id'];
createUserType = json['createUserType'];
content = json['content'];
createDate = json['createDate'];
parentId = json['parentId'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['createUserType'] = this.createUserType;
data['content'] = this.content;
data['createDate'] = this.createDate;
data['parentId'] = this.parentId;
return data;
}
}

@ -1,4 +1,5 @@
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:common_utils/common_utils.dart';
@ -26,7 +27,7 @@ class _AdviceCardState extends State<AdviceCard> {
elevation: 0,
padding: EdgeInsets.zero,
color: Colors.white,
onPressed: () {},
onPressed: AdviceDetailPage(type: widget.model.type).to,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.w),
),

@ -0,0 +1,89 @@
import 'package:akuCommunity/model/manager/advice_detail_model.dart';
import 'package:akuCommunity/ui/manager/advice/advice_page.dart';
import 'package:akuCommunity/utils/network/net_util.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:akuCommunity/utils/headers.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);
@override
_AdviceDetailPageState createState() => _AdviceDetailPageState();
}
class _AdviceDetailPageState extends State<AdviceDetailPage> {
bool _loading = true;
EasyRefreshController _refreshController = EasyRefreshController();
AdviceDetailModel _model;
String get adviceValue {
switch (widget.type) {
case 1:
return '咨询';
case 2:
return '建议';
case 3:
return '投诉';
case 4:
return '表扬';
}
return '';
}
_buildShimmer() {
return Shimmer.fromColors(
child: Padding(
padding: EdgeInsets.all(32.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
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(),
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(),
],
),
),
baseColor: Colors.black12,
highlightColor: Colors.white10,
);
}
_buildChild() {
return ListView(
padding: EdgeInsets.all(32.w),
children: [
'您的$adviceValue'.text.black.bold.size(38.sp).make(),
30.hb,
],
);
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '查看详情',
body: EasyRefresh(
firstRefresh: true,
child: _loading ? _buildShimmer() : _buildChild(),
controller: _refreshController,
header: MaterialHeader(),
onRefresh: () async {
_loading = false;
setState(() {});
},
),
);
}
}

@ -7,8 +7,11 @@ import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/widget/buttons/bottom_button.dart';
import 'package:akuCommunity/widget/tab_bar/bee_tab_bar.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
enum AdviceType {
SUGGESTION,
@ -107,7 +110,19 @@ class _AdvicePageState extends State<AdvicePage> with TickerProviderStateMixin {
}).toList(),
),
bottomNavi: BottomButton(
onPressed: NewAdvicePage(type: widget.type).to,
onPressed: () async {
bool needRefresh = await Get.to(NewAdvicePage(type: widget.type));
if (needRefresh == true) _refreshController.callRefresh();
Get.dialog(CupertinoAlertDialog(
title: '您的信息已提交,我们会尽快回复您,祝您生活愉快'.text.isIntrinsic.make(),
actions: [
CupertinoDialogAction(
child: '确定'.text.color(Color(0xFFFF8200)).isIntrinsic.make(),
onPressed: Get.back,
),
],
));
},
child: Text('新增'),
),
);

@ -11,6 +11,7 @@ import 'package:akuCommunity/widget/buttons/bottom_button.dart';
import 'package:akuCommunity/widget/picker/grid_image_picker.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
@ -104,7 +105,7 @@ class _NewAdvicePageState extends State<NewAdvicePage> {
);
cancel();
if (baseModel.status) {
Get.back();
Get.back(result: true);
}
}

@ -69,7 +69,7 @@ dependencies:
#http
dio: ^3.0.10
#骨架
shimmer: ^1.1.1
shimmer: ^1.1.2
#动画alert
rflutter_alert: ^1.1.0
@ -102,6 +102,8 @@ dependencies:
power_logger:
git:
url: http://192.168.2.201:8099/aku_fe/power_logger.git
dev_dependencies:
flutter_test:

Loading…
Cancel
Save