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