Merge branch 'master' of http://192.168.2.201:8099/laiiihz/akuCommunity
commit
5532be4986
@ -0,0 +1,63 @@
|
||||
import 'package:common_utils/common_utils.dart';
|
||||
|
||||
class SuggestionOrComplainModel {
|
||||
int id;
|
||||
int type;
|
||||
int status;
|
||||
String content;
|
||||
int score;
|
||||
DateTime createDate;
|
||||
List<ImgUrls> imgUrls;
|
||||
|
||||
SuggestionOrComplainModel(
|
||||
{this.id,
|
||||
this.type,
|
||||
this.status,
|
||||
this.content,
|
||||
this.score,
|
||||
this.createDate,
|
||||
this.imgUrls});
|
||||
|
||||
SuggestionOrComplainModel.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
type = json['type'];
|
||||
status = json['status'];
|
||||
content = json['content'];
|
||||
score = json['score'];
|
||||
createDate = DateUtil.getDateTime(json['createDate']);
|
||||
if (json['imgUrls'] != null) {
|
||||
imgUrls = new List<ImgUrls>();
|
||||
json['imgUrls'].forEach((v) {
|
||||
imgUrls.add(new ImgUrls.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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,200 +0,0 @@
|
||||
import 'package:akuCommunity/pages/things_page/things_create_page/things_create_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:akuCommunity/routers/page_routers.dart';
|
||||
import 'package:akuCommunity/utils/headers.dart';
|
||||
import 'package:akuCommunity/widget/common_app_bar.dart';
|
||||
import 'widget/things_app_bar.dart';
|
||||
import 'widget/things_list.dart';
|
||||
|
||||
class ThingsPage extends StatefulWidget {
|
||||
final Bundle bundle;
|
||||
ThingsPage({Key key, this.bundle}) : super(key: key);
|
||||
|
||||
@override
|
||||
_ThingsPageState createState() => _ThingsPageState();
|
||||
}
|
||||
|
||||
class _ThingsPageState extends State<ThingsPage> with TickerProviderStateMixin {
|
||||
List<Map<String, dynamic>> _listCard = [
|
||||
{
|
||||
'time': '2020年10月13日',
|
||||
'tag': '已提交',
|
||||
'content': '我觉得我们小区的绿化可以再多一点',
|
||||
'imageList': <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',
|
||||
]
|
||||
},
|
||||
{
|
||||
'time': '2020年09月23日',
|
||||
'tag': '已审阅',
|
||||
'content': '我觉得外面的小摊贩还是不要来了,毕竟为了环保,还有小区的孩子很多,大狗什么的希望主人能管好它',
|
||||
'imageList': <String>[]
|
||||
},
|
||||
{
|
||||
'time': '2020年08月12日',
|
||||
'tag': '已反馈',
|
||||
'content': '夏天蛇蚁虫属真多,希望小区能组队给整个小区保洁一下',
|
||||
'imageList': <String>[
|
||||
'https://dss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1696975393,2205543181&fm=26&gp=0.jpg',
|
||||
'https://dss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3220834958,1457978756&fm=26&gp=0.jpg',
|
||||
]
|
||||
},
|
||||
];
|
||||
|
||||
List<Map<String, dynamic>> _listRepair = [
|
||||
{
|
||||
'time': '公区报修',
|
||||
'tag': '已处理',
|
||||
'content': '小区花园的健身器材坏了请注意抓紧时间维修。还有一些健身器材年限到了麻烦注意更换,因为怕出现安全隐患。',
|
||||
'imageList': <String>[
|
||||
'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2390449629,3468003032&fm=26&gp=0.jpg',
|
||||
'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=123602716,1727529947&fm=26&gp=0.jpg',
|
||||
'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3789981542,2569571902&fm=26&gp=0.jpg',
|
||||
]
|
||||
},
|
||||
{
|
||||
'time': '家庭维修',
|
||||
'tag': '待分配',
|
||||
'content': '家里的洗衣机坏了请师傅抓紧时间,赶快支援。',
|
||||
'imageList': <String>[
|
||||
'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1199114124,190063793&fm=26&gp=0.jpg',
|
||||
'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1009468563,227812083&fm=26&gp=0.jpg',
|
||||
]
|
||||
},
|
||||
{
|
||||
'time': '家庭维修',
|
||||
'tag': '维修中',
|
||||
'content': '家里的空调坏了,热死人了,请师傅火速来修。',
|
||||
'imageList': <String>[
|
||||
'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1349979411,865756316&fm=26&gp=0.jpg',
|
||||
'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2162579969,1968776994&fm=26&gp=0.jpg',
|
||||
]
|
||||
},
|
||||
{
|
||||
'time': '家庭维修',
|
||||
'tag': '已完成',
|
||||
'content': '家里的冰箱坏了,师傅赶紧来看看',
|
||||
'imageList': <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',
|
||||
]
|
||||
},
|
||||
{
|
||||
'time': '家庭维修',
|
||||
'tag': '已取消',
|
||||
'content': '家里的电饭煲坏了,师傅快上门修一下。',
|
||||
'imageList': <String>[
|
||||
'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=61782379,2829421550&fm=26&gp=0.jpg',
|
||||
'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=921027380,3023940375&fm=15&gp=0.jpg',
|
||||
]
|
||||
},
|
||||
];
|
||||
|
||||
TabController _controller;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
if (widget.bundle.getMap('things')['treeList'] != null) {
|
||||
_controller = TabController(
|
||||
length: widget.bundle.getMap('things')['treeList'].length,
|
||||
vsync: this);
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
if (widget.bundle.getMap('things')['treeList'] != null) {
|
||||
_controller.dispose();
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Widget _positionedButton() {
|
||||
return Positioned(
|
||||
bottom: 0,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
bool isIdea;
|
||||
switch (widget.bundle.getMap('things')['title']) {
|
||||
case '建议咨询':
|
||||
isIdea = true;
|
||||
break;
|
||||
case '投诉表扬':
|
||||
isIdea = false;
|
||||
break;
|
||||
case '报事报修':
|
||||
break;
|
||||
default:
|
||||
}
|
||||
ThingsCreatePage(
|
||||
bundle: Bundle()
|
||||
..putMap('create', {
|
||||
'title': widget.bundle.getMap('things')['title'],
|
||||
'isIdea': isIdea
|
||||
}),
|
||||
).to;
|
||||
},
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
height: 98.w,
|
||||
width: 750.w,
|
||||
padding: EdgeInsets.symmetric(vertical: 26.5.w),
|
||||
color: Color(0xffffc40c),
|
||||
child: Text(
|
||||
'新增',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 32.sp,
|
||||
color: Color(0xff333333),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: PreferredSize(
|
||||
child: widget.bundle.getMap('things')['title'] == '报事报修'
|
||||
? CommonAppBar(
|
||||
title: '${widget.bundle.getMap('things')['title']}',
|
||||
)
|
||||
: ThingsAppBar(
|
||||
title: '${widget.bundle.getMap('things')['title']}',
|
||||
tabController: _controller,
|
||||
treeList: widget.bundle.getMap('things')['treeList'],
|
||||
),
|
||||
preferredSize: Size.fromHeight(
|
||||
widget.bundle.getMap('things')['title'] == '报事报修'
|
||||
? kToolbarHeight
|
||||
: kToolbarHeight * 1.8),
|
||||
),
|
||||
body: Stack(
|
||||
children: [
|
||||
widget.bundle.getMap('things')['title'] == '报事报修'
|
||||
? ThingsList(
|
||||
listCard: _listRepair,
|
||||
isRepair: true,
|
||||
)
|
||||
: TabBarView(
|
||||
controller: _controller,
|
||||
children: List.generate(
|
||||
widget.bundle.getMap('things')['treeList'].length,
|
||||
(index) => ThingsList(
|
||||
listCard: _listCard,
|
||||
isRepair: false,
|
||||
),
|
||||
),
|
||||
),
|
||||
_positionedButton(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,113 @@
|
||||
import 'package:akuCommunity/constants/api.dart';
|
||||
import 'package:akuCommunity/model/manager/suggestion_or_complain_model.dart';
|
||||
import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart';
|
||||
import 'package:akuCommunity/widget/bee_scaffold.dart';
|
||||
import 'package:akuCommunity/utils/headers.dart';
|
||||
import 'package:akuCommunity/widget/tab_bar/bee_tab_bar.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
||||
|
||||
enum AdviceType {
|
||||
SUGGESTION,
|
||||
COMPLAIN,
|
||||
}
|
||||
|
||||
enum _adviceInnerType {
|
||||
SUGGESTION,
|
||||
QUESTION,
|
||||
COMPLAIN,
|
||||
PRAISE,
|
||||
}
|
||||
|
||||
class AdvicePage extends StatefulWidget {
|
||||
final AdviceType type;
|
||||
AdvicePage({Key key, @required this.type}) : super(key: key);
|
||||
|
||||
@override
|
||||
_AdvicePageState createState() => _AdvicePageState();
|
||||
}
|
||||
|
||||
class _AdvicePageState extends State<AdvicePage> with TickerProviderStateMixin {
|
||||
EasyRefreshController _refreshController = EasyRefreshController();
|
||||
TabController _tabController;
|
||||
|
||||
String get title {
|
||||
switch (widget.type) {
|
||||
case AdviceType.SUGGESTION:
|
||||
return '建议咨询';
|
||||
break;
|
||||
case AdviceType.COMPLAIN:
|
||||
return '投诉表扬';
|
||||
break;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
List<String> get tabs {
|
||||
switch (widget.type) {
|
||||
case AdviceType.SUGGESTION:
|
||||
return ['您的建议', '您的咨询'];
|
||||
break;
|
||||
case AdviceType.COMPLAIN:
|
||||
return ['您的投诉', '您的表扬'];
|
||||
break;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
int adviceValue(int index) {
|
||||
switch (widget.type) {
|
||||
case AdviceType.SUGGESTION:
|
||||
return index == 0 ? 2 : 1;
|
||||
break;
|
||||
case AdviceType.COMPLAIN:
|
||||
return index == 0 ? 4 : 3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_tabController = TabController(length: 2, vsync: this);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_tabController?.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BeeScaffold(
|
||||
title: title,
|
||||
appBarBottom: BeeTabBar(
|
||||
controller: _tabController,
|
||||
tabs: tabs,
|
||||
),
|
||||
body: TabBarView(
|
||||
controller: _tabController,
|
||||
children: List.generate(2, (index) {
|
||||
return BeeListView(
|
||||
path: API.manager.advice,
|
||||
extraParams: {'adviceType': adviceValue(index)},
|
||||
controller: _refreshController,
|
||||
convert: (model) => model.tableList
|
||||
.map((e) => SuggestionOrComplainModel.fromJson(e))
|
||||
.toList(),
|
||||
builder: (items) {
|
||||
return ListView.separated(
|
||||
itemBuilder: (context, index) {
|
||||
return SizedBox();
|
||||
},
|
||||
separatorBuilder: (_, __) => 20.hb,
|
||||
itemCount: items.length,
|
||||
);
|
||||
},
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
import 'package:akuCommunity/base/base_style.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
|
||||
class BeeTabBar extends StatefulWidget with PreferredSizeWidget {
|
||||
final TabController controller;
|
||||
final List<String> tabs;
|
||||
BeeTabBar({Key key, @required this.controller, @required this.tabs})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_BeeTabBarState createState() => _BeeTabBarState();
|
||||
|
||||
@override
|
||||
Size get preferredSize => Size.fromHeight(96.w);
|
||||
}
|
||||
|
||||
class _BeeTabBarState extends State<BeeTabBar> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TabBar(
|
||||
controller: widget.controller,
|
||||
unselectedLabelStyle: TextStyle(
|
||||
fontSize: BaseStyle.fontSize28,
|
||||
),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: BaseStyle.fontSize28,
|
||||
),
|
||||
indicatorColor: Color(0xffffc40c),
|
||||
indicatorSize: TabBarIndicatorSize.label,
|
||||
tabs: widget.tabs.map((e) => Tab(text: e)).toList(),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue