update fixed submit page

hmxc
张萌 4 years ago
parent 727333af5f
commit c2cf7e7f6f

@ -53,4 +53,8 @@ class _Manager {
///便
String get convenientPhone => '/convenientTelephone/list';
///
String get fixedSubmit => '/user/reportRepair/list';
}

@ -0,0 +1,63 @@
class FixedSubmitModel {
int id;
int type;
int status;
String reportDetail;
List<ImgUrls> imgUrls;
FixedSubmitModel(
{this.id, this.type, this.status, this.reportDetail, this.imgUrls});
FixedSubmitModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
type = json['type'];
status = json['status'];
reportDetail = json['reportDetail'];
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['reportDetail'] = this.reportDetail;
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;
}
}

@ -1,8 +1,12 @@
import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/model/user/fixed_submit_model.dart';
import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart';
import 'package:akuCommunity/pages/things_page/widget/image_grid.dart';
import 'package:akuCommunity/utils/bee_map.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:akuCommunity/extensions/num_ext.dart';
@ -15,42 +19,37 @@ class FixedSubmitPage extends StatefulWidget {
_FixedSubmitPageState createState() => _FixedSubmitPageState();
}
class FixedSubmitMode {
int tag;
int state;
String text;
List<String> images;
FixedSubmitMode(this.tag, this.state, this.text, this.images);
}
class _FixedSubmitPageState extends State<FixedSubmitPage> {
List<FixedSubmitMode> _model = [
FixedSubmitMode(1, 0, '家里的冰箱坏了,师傅赶紧来看看', <String>[
'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=466219337,2269488732&fm=15&gp=0.jpg',
'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=907707978,1526051881&fm=26&gp=0.jpg',
]),
FixedSubmitMode(0, 3, '我觉得我们小区的绿化可以再多一点', <String>[
'https://dss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=111636878,534819054&fm=26&gp=0.jpg',
'https://dss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3834533673,769780989&fm=26&gp=0.jpg',
'https://dss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1683501076,3787404077&fm=26&gp=0.jpg',
'https://dss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=1040644610,2290865162&fm=26&gp=0.jpg',
]),
];
EasyRefreshController _easyRefreshController;
@override
void initState() {
super.initState();
_easyRefreshController = EasyRefreshController();
}
@override
void dispose() {
_easyRefreshController?.dispose();
super.dispose();
}
Color _getColor(int state) {
switch (state) {
case 0:
case 1:
return kDarkPrimaryColor;
case 2:
case 3:
return kDarkPrimaryColor;
case 4:
case 5:
case 6:
case 7:
return ktextSubColor;
default:
return kPrimaryColor;
}
}
Widget _buildCard(int fixedTag, int state, String text, List<String> images) {
Widget _buildCard(FixedSubmitModel model) {
return Container(
decoration: BoxDecoration(
color: kForeGroundColor, borderRadius: BorderRadius.circular(8.w)),
@ -61,7 +60,7 @@ class _FixedSubmitPageState extends State<FixedSubmitPage> {
Row(
children: [
BeeMap()
.fixTag[fixedTag]
.fixTag[model.type]
.text
.color(ktextPrimary)
.bold
@ -69,9 +68,9 @@ class _FixedSubmitPageState extends State<FixedSubmitPage> {
.make(),
Spacer(),
BeeMap()
.fixState[state]
.fixState[model.status]
.text
.color(_getColor(state))
.color(_getColor(model.status))
.size(24.sp)
.make(),
],
@ -82,9 +81,16 @@ class _FixedSubmitPageState extends State<FixedSubmitPage> {
height: 0,
),
24.hb,
text.text.color(ktextSubColor).size(28.sp).ellipsis.make(),
model.reportDetail.text
.color(ktextSubColor)
.size(28.sp)
.ellipsis
.make(),
16.hb,
images.length != 0 ? ImageGrid(images) : SizedBox(),
model.imgUrls.length != 0
? ImageGrid(List.generate(
model.imgUrls.length, (index) => model.imgUrls[index].url))
: SizedBox(),
],
),
);
@ -94,23 +100,57 @@ class _FixedSubmitPageState extends State<FixedSubmitPage> {
Widget build(BuildContext context) {
return BeeScaffold(
title: '报事报修',
// body: Column(
// children: [
// Expanded(
// child: ListView(
// padding: EdgeInsets.all(32.w),
// children: [
// ..._model
// .map((e) => _buildCard(e.tag, e.state, e.text, e.images))
// .toList()
// ].sepWidget(separate: 24.hb),
// ),
// ),
// Padding(
// padding:
// EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
// child: MaterialButton(
// color: kPrimaryColor,
// onPressed: () {},
// child: '新增'.text.bold.color(ktextPrimary).size(32.sp).make(),
// minWidth: double.infinity,
// height: 98.w,
// elevation: 0,
// materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
// padding: EdgeInsets.zero,
// ),
// )
// ],
// ),
body: Column(
children: [
Expanded(
child: ListView(
BeeListView(
controller: _easyRefreshController,
path: API.manager.fixedSubmit,
convert: (model) {
return model.tableList
.map((e) => FixedSubmitModel.fromJson(e))
.toList();
},
builder: (items) {
return ListView.separated(
padding: EdgeInsets.all(32.w),
children: [
..._model
.map((e) => _buildCard(e.tag, e.state, e.text, e.images))
.toList()
].sepWidget(separate: 24.hb),
),
),
Padding(
padding:
EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
child: MaterialButton(
color: kPrimaryColor,
itemBuilder: (context, index) {
return _buildCard(items[index]);
},
separatorBuilder: (context, index) {
return 24.heightBox;
},
itemCount: items.length);
},
).expand(),
MaterialButton(
onPressed: () {},
child: '新增'.text.bold.color(ktextPrimary).size(32.sp).make(),
minWidth: double.infinity,
@ -118,8 +158,12 @@ class _FixedSubmitPageState extends State<FixedSubmitPage> {
elevation: 0,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
padding: EdgeInsets.zero,
),
)
.box
.padding(EdgeInsets.only(
bottom: MediaQuery.of(context).padding.bottom))
.color(kPrimaryColor)
.make(),
],
),
);

@ -1,8 +1,8 @@
class BeeMap {
Map<int, String> fixTag = {
0: '公区报修',
1: '家庭报修',
1: '公区报修',
2: '家庭报修',
};
Map<int, String> fixState = {0: '待分配', 1: '维修中', 2: '已处理',3:'已完成',4:'已取消'};
Map<int, String> fixState = {1: '待分配', 2: '未接单', 3: '处理中',4:'已处理',5:'已完成',6:'已关闭',7:'已作废'};
}

Loading…
Cancel
Save