diff --git a/lib/base/assets_image.dart b/lib/base/assets_image.dart index 57688cda..63d9f842 100644 --- a/lib/base/assets_image.dart +++ b/lib/base/assets_image.dart @@ -1,3 +1,5 @@ +//TODO CLEAN BOTTOM CODES. +@Deprecated("sh*t assets_image need to be cleaned.") class AssetsImage { static const TAB_HOME_UNSELECT = 'assets/icons/tabbar_home_no.png'; diff --git a/lib/constants/api.dart b/lib/constants/api.dart index 97e612de..5c32fcc3 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -84,6 +84,9 @@ class _Manager { ///报事报修:批量删除报事报修信息(业主端) String get reportRepairDelete => '/user/reportRepair/falseDelete'; + + ///咨询建议/投诉表扬:查询所有的app建议咨询/投诉表扬 信息(包含条件搜索 type 【类型(1.咨询,2.建议,3.投诉,4.表扬)】) + String get advice => '/user/advice/list'; } class _Upload { diff --git a/lib/model/manager/suggestion_or_complain_model.dart b/lib/model/manager/suggestion_or_complain_model.dart new file mode 100644 index 00000000..877edf23 --- /dev/null +++ b/lib/model/manager/suggestion_or_complain_model.dart @@ -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; + + SuggestionOrComplainModel( + {this.id, + this.type, + this.status, + this.content, + this.score, + this.createDate, + this.imgUrls}); + + SuggestionOrComplainModel.fromJson(Map 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(); + 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 json) { + url = json['url']; + size = json['size']; + longs = json['longs']; + paragraph = json['paragraph']; + sort = json['sort']; + } + + Map toJson() { + final Map data = new Map(); + data['url'] = this.url; + data['size'] = this.size; + data['longs'] = this.longs; + data['paragraph'] = this.paragraph; + data['sort'] = this.sort; + return data; + } +} diff --git a/lib/pages/activities_page/activities_page.dart b/lib/pages/activities_page/activities_page.dart index 99d83a96..c71bff98 100644 --- a/lib/pages/activities_page/activities_page.dart +++ b/lib/pages/activities_page/activities_page.dart @@ -7,87 +7,26 @@ import 'package:akuCommunity/routers/page_routers.dart'; import 'package:akuCommunity/widget/activity_card.dart'; class ActivitiesPage extends StatefulWidget { - final Bundle bundle; - ActivitiesPage({Key key, this.bundle}) : super(key: key); + ActivitiesPage({Key key}) : super(key: key); @override _ActivitiesPageState createState() => _ActivitiesPageState(); } class _ActivitiesPageState extends State { - List images = [ - "https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=1151143562,4115642159&fm=26&gp=0.jpg", - "https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=2551412680,857245643&fm=26&gp=0.jpg", - "https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3604827221,1047385274&fm=26&gp=0.jpg", - ]; + List images = []; List> _listView = []; - List> _listVote = [ - { - 'imagePath': - 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1600058454436&di=76f6d526c4108b582c540d24bad316d8&imgtype=0&src=http%3A%2F%2Fimg003.hc360.cn%2Fm2%2FM00%2FFD%2FB9%2FwKhQclRLWoqEAosNAAAAABnzxUo896.jpg', - 'title': '为优秀点赞!2020第一届最美服务之星评选', - 'subtitleFirst': '快来为你支持的保洁员投票吧!~', - 'subtitleSecond': '06月17日 12:00至06月27日18:30', - 'isOver': false, - 'isVoteOver': true, - }, - { - 'imagePath': - 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1600058583164&di=04000bc0e0394edb0c74f7c8fa0efcb2&imgtype=0&src=http%3A%2F%2Fn.sinaimg.cn%2Ftranslate%2F161%2Fw1080h681%2F20180814%2FzWKK-hhtfwqr0303774.jpg', - 'title': '投票!选出你心中“乘风破浪的绿化保卫员”', - 'subtitleFirst': '建设美丽的边疆,爱护我们的家园', - 'subtitleSecond': '04月17日 13:00至04月23日18:30', - 'isOver': false, - 'isVoteOver': true, - }, - { - 'imagePath': - 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1600058626924&di=568c1c35b47e6c8bb762f71a883c9e09&imgtype=0&src=http%3A%2F%2Fimg.soufunimg.com%2Fnews%2F2015_11%2F26%2F1448505277039.jpg', - 'title': '特别忠诚,在生死抉择的时刻,他把人民利益举过他把人民利益举过……', - 'subtitleFirst': '平凡服务者,最美保安员', - 'subtitleSecond': '04月12日 12:00至04月15日18:30', - 'isOver': true, - 'isVoteOver': false, - } - ]; + List> _listVote = []; - List> _listEnter = [ - { - 'imagePath': - 'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3786472598,2225627644&fm=26&gp=0.jpg', - 'title': '宁化社区第一届煎蛋比赛报名开始', - 'subtitleFirst': '活动室二楼', - 'subtitleSecond': '06月17日 12:00至06月27日18:30', - 'isOver': false, - 'isVoteOver': true, - }, - { - 'imagePath': - 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1600339523640&di=be179b5e314f9e198c000e7726affef6&imgtype=0&src=http%3A%2F%2Fa.hiphotos.baidu.com%2Fbaike%2Fpic%2Fitem%2F7e3e6709c93d70cf7371f1f3f1dcd100bba12b40.jpg', - 'title': '美嘉社区第三届六一亲子活动开始啦', - 'subtitleFirst': '中央活动区', - 'subtitleSecond': '04月17日 13:00至04月23日18:30', - 'isOver': false, - 'isVoteOver': true, - }, - { - 'imagePath': - 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=347834970,829932821&fm=26&gp=0.jpg', - 'title': '生命在与运动,华侨小区拔河比赛开始', - 'subtitleFirst': '小区外围体育馆', - 'subtitleSecond': '04月12日 12:00至04月15日18:30', - 'isOver': true, - 'isVoteOver': false, - } - ]; + List> _listEnter = []; RefreshController _refreshController = RefreshController(initialRefresh: false); @override void initState() { super.initState(); - _listView = widget.bundle.getBool('isVote') ? _listVote : _listEnter; + _listView = _listVote; } void _onRefresh() async { @@ -105,17 +44,7 @@ class _ActivitiesPageState extends State { void detailsRouter(String imagePath, title, bool isOver, isVote, isVoteOver, List memberList) { - Get.to(ActivitiesPage( - bundle: Bundle() - ..putMap('details', { - 'title': title, - 'imagePath': imagePath, - 'isOver': isOver, - 'isVote': isVote, - 'isVoteOver': isVoteOver, - 'memberList': memberList - }), - )); + Get.to(ActivitiesPage()); } @override @@ -148,7 +77,7 @@ class _ActivitiesPageState extends State { subtitleSecond: _listView[index]['subtitleSecond'], memberList: images, isOver: _listView[index]['isOver'], - isVote: widget.bundle.getBool('isVote'), + isVote: false, isVoteOver: _listView[index]['isVoteOver'], fun: detailsRouter, ), diff --git a/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart b/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart index 40c37dc7..7da44c25 100644 --- a/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart +++ b/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart @@ -4,7 +4,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/base/assets_image.dart'; -import 'package:akuCommunity/widget/common_image_picker.dart'; import 'package:akuCommunity/widget/bottom_button.dart'; import 'widget/common_radio.dart'; import 'widget/common_picker.dart'; @@ -188,7 +187,7 @@ class _DetoCreatePageState extends State { ), ), ), - GridImagePicker(), + GridImagePicker(onChange: (files) {}), ], ), ), diff --git a/lib/pages/goods_deto_page/goods_deto_page.dart b/lib/pages/goods_deto_page/goods_deto_page.dart index 1e4b0886..568849a9 100644 --- a/lib/pages/goods_deto_page/goods_deto_page.dart +++ b/lib/pages/goods_deto_page/goods_deto_page.dart @@ -7,7 +7,6 @@ import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:akuCommunity/widget/bottom_button.dart'; import 'widget/goods_info_card.dart'; diff --git a/lib/pages/home/home_page.dart b/lib/pages/home/home_page.dart index b69ab2b2..3f5e5052 100644 --- a/lib/pages/home/home_page.dart +++ b/lib/pages/home/home_page.dart @@ -10,16 +10,15 @@ import 'package:akuCommunity/pages/message_center_page/message_center_page.dart' import 'package:akuCommunity/pages/open_door_page/open_door_page.dart'; import 'package:akuCommunity/pages/scan/scan_page.dart'; import 'package:akuCommunity/pages/things_page/fixed_submit_page.dart'; -import 'package:akuCommunity/pages/things_page/things_page.dart'; import 'package:akuCommunity/pages/total_application_page/total_applications_page.dart'; import 'package:akuCommunity/pages/visitor_access_page/visitor_access_page.dart'; import 'package:akuCommunity/extensions/num_ext.dart'; +import 'package:akuCommunity/ui/manager/advice/advice_page.dart'; import 'package:akuCommunity/widget/grid_buttons.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter_icons/flutter_icons.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:akuCommunity/utils/headers.dart'; import 'widget/home_search.dart'; @@ -30,8 +29,6 @@ import 'package:akuCommunity/widget/container_comment.dart'; import 'package:akuCommunity/widget/single_ad_space.dart'; import 'package:akuCommunity/service/base_model.dart'; import 'package:akuCommunity/model/aku_shop_model.dart'; -import 'package:akuCommunity/routers/page_routers.dart'; - import 'package:velocity_x/velocity_x.dart'; import 'package:akuCommunity/extensions/page_router.dart'; @@ -58,39 +55,16 @@ class _HomePageState extends State int page = 1; List _gridList = [ - GridButton('一键开门', R.ASSETS_ICONS_TOOL_YJKM_PNG, () { - OpenDoorPage().to(); - }), - GridButton('访客通行', R.ASSETS_ICONS_TOOL_FKYQ_PNG, () { - VisitorAccessPage().to(); - }), - GridButton('报事报修', R.ASSETS_ICONS_TOOL_BSBX_PNG, () { - FixedSubmitPage().to(); - }), - GridButton('生活缴费', R.ASSETS_ICONS_TOOL_SHJF_PNG, () { - LifePayPage().to(); - }), - GridButton('业委会', R.ASSETS_ICONS_TOOL_YWH_PNG, () { - IndustryCommitteePage().to(); - }), - GridButton('建议咨询', R.ASSETS_ICONS_TOOL_JYTS_PNG, () { - Get.to(ThingsPage( - bundle: Bundle() - ..putMap('things', { - 'title': '建议咨询', - 'treeList': >[ - {'name': '您的建议'}, - {'name': '您的咨询'}, - ] - }), - )); - }), - GridButton('便民电话', R.ASSETS_ICONS_TOOL_BMDH_PNG, () { - ConvenientPhonePage().to(); - }), - GridButton('全部应用', R.ASSETS_ICONS_TOOL_QBYY_PNG, () { - TotalApplicationsPage().to(); - }), + GridButton('一键开门', R.ASSETS_ICONS_TOOL_YJKM_PNG, OpenDoorPage().to), + GridButton('访客通行', R.ASSETS_ICONS_TOOL_FKYQ_PNG, VisitorAccessPage().to), + GridButton('报事报修', R.ASSETS_ICONS_TOOL_BSBX_PNG, FixedSubmitPage().to), + GridButton('生活缴费', R.ASSETS_ICONS_TOOL_SHJF_PNG, LifePayPage().to), + GridButton('业委会', R.ASSETS_ICONS_TOOL_YWH_PNG, IndustryCommitteePage().to), + GridButton('建议咨询', R.ASSETS_ICONS_TOOL_JYTS_PNG, + AdvicePage(type: AdviceType.SUGGESTION).to), + GridButton('便民电话', R.ASSETS_ICONS_TOOL_BMDH_PNG, ConvenientPhonePage().to), + GridButton( + '全部应用', R.ASSETS_ICONS_TOOL_QBYY_PNG, TotalApplicationsPage().to), ]; @override @@ -157,12 +131,12 @@ class _HomePageState extends State _buildColButton( icon: AntDesign.scan1, title: '扫一扫', - onTap: () => Get.to(ScanPage()), + onTap: ScanPage().to, ), _buildColButton( icon: AntDesign.bells, title: '消息', - onTap: () => Get.to(MessageCenterPage()), + onTap: MessageCenterPage().to, ), 16.wb, ], @@ -207,9 +181,7 @@ class _HomePageState extends State tag: '活动', isShowImage: false, fun: () { - ActivitiesPage( - bundle: Bundle()..putBool('isVote', false), - ).to; + ActivitiesPage().to; }, ), HomeCard( diff --git a/lib/pages/personal/personal_page.dart b/lib/pages/personal/personal_page.dart index 064bdc9b..4a3725df 100644 --- a/lib/pages/personal/personal_page.dart +++ b/lib/pages/personal/personal_page.dart @@ -52,9 +52,7 @@ class _PersonalIndexState extends State )); }), GridButton('社区活动', R.ASSETS_ICONS_USER_ICON_WDSQHD_PNG, () { - Get.to(ActivitiesPage( - bundle: Bundle()..putBool('isVote', false), - )); + Get.to(ActivitiesPage()); }), GridButton('我的缴费', R.ASSETS_ICONS_USER_ICON_WDJF_PNG, () { LifePayPage().to(); diff --git a/lib/pages/personal/user_profile_page.dart b/lib/pages/personal/user_profile_page.dart index 1e2d79fa..25a16dc8 100644 --- a/lib/pages/personal/user_profile_page.dart +++ b/lib/pages/personal/user_profile_page.dart @@ -10,6 +10,7 @@ import 'package:akuCommunity/utils/network/base_file_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/picker/bee_image_picker.dart'; import 'package:bot_toast/bot_toast.dart'; import 'package:common_utils/common_utils.dart'; import 'package:flutter/cupertino.dart'; @@ -62,35 +63,14 @@ class _UserProfilePageState extends State { _pickAvatar() async { final userProvider = Provider.of(context, listen: false); - PickedFile file = await Get.bottomSheet(CupertinoActionSheet( - title: '选择头像'.text.isIntrinsic.make(), - actions: [ - CupertinoDialogAction( - onPressed: () async => Get.back( - result: await ImagePicker().getImage(source: ImageSource.gallery), - ), - child: '相册'.text.isIntrinsic.make(), - ), - CupertinoDialogAction( - onPressed: () async => Get.back( - result: await ImagePicker().getImage(source: ImageSource.camera), - ), - child: '相机'.text.isIntrinsic.make(), - ), - ], - cancelButton: CupertinoDialogAction( - onPressed: Get.back, - child: '取消'.text.isIntrinsic.make(), - ), - )); + File file = await BeeImagePicker.pick(title: '选择头像'); if (file == null) return; else { //Upload Avatar Function cancel = BotToast.showLoading(); - File rawFile = File(file.path); BaseFileModel model = - await NetUtil().upload(API.upload.uploadAvatar, rawFile); + await NetUtil().upload(API.upload.uploadAvatar, file); if (model.status) userProvider.updateAvatar(model.url); else diff --git a/lib/pages/property/property_index.dart b/lib/pages/property/property_index.dart index 91fdebe1..6e8f2bab 100644 --- a/lib/pages/property/property_index.dart +++ b/lib/pages/property/property_index.dart @@ -11,9 +11,9 @@ import 'package:akuCommunity/pages/open_door_page/open_door_page.dart'; import 'package:akuCommunity/pages/opening_code_page/opening_code_page.dart'; import 'package:akuCommunity/pages/questionnaire_page/questionnaire_page.dart'; import 'package:akuCommunity/pages/things_page/fixed_submit_page.dart'; -import 'package:akuCommunity/pages/things_page/things_page.dart'; import 'package:akuCommunity/pages/total_application_page/total_applications_page.dart'; import 'package:akuCommunity/pages/visitor_access_page/visitor_access_page.dart'; +import 'package:akuCommunity/ui/manager/advice/advice_page.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:akuCommunity/widget/grid_buttons.dart'; import 'package:flutter/material.dart'; @@ -57,41 +57,19 @@ class _PropertyIndexState extends State GridButton('业委会', R.ASSETS_ICONS_TOOL_YWH_PNG, () { IndustryCommitteePage().to(); }), - GridButton('建议咨询', R.ASSETS_ICONS_TOOL_JYTS_PNG, () { - Get.to(ThingsPage( - bundle: Bundle() - ..putMap('things', { - 'title': '建议咨询', - 'treeList': >[ - {'name': '您的建议'}, - {'name': '您的咨询'}, - ] - }), - )); - }), + GridButton('建议咨询', R.ASSETS_ICONS_TOOL_JYTS_PNG, + AdvicePage(type: AdviceType.SUGGESTION).to), GridButton('便民电话', R.ASSETS_ICONS_TOOL_BMDH_PNG, () { ConvenientPhonePage().to(); }), GridButton('活动投票', R.ASSETS_ICONS_TOOL_HDTP_PNG, () { - Get.to(ActivitiesPage( - bundle: Bundle()..putBool('isVote', true), - )); + Get.to(ActivitiesPage()); }), GridButton('物品出户', R.ASSETS_ICONS_TOOL_WPCM_PNG, () { GoodsDetoPage().to(); }), - GridButton('投诉表扬', R.ASSETS_ICONS_TOOL_TSBY_PNG, () { - Get.to(ThingsPage( - bundle: Bundle() - ..putMap('things', { - 'title': '投诉表扬', - 'treeList': >[ - {'name': '您的表扬'}, - {'name': '您的投诉'}, - ] - }), - )); - }), + GridButton('投诉表扬', R.ASSETS_ICONS_TOOL_TSBY_PNG, + AdvicePage(type: AdviceType.SUGGESTION).to), GridButton('问卷调查', R.ASSETS_ICONS_TOOL_WJDC_PNG, () { QuestionnairePage().to(); }), @@ -165,9 +143,7 @@ class _PropertyIndexState extends State } void activityRouter() { - ActivitiesPage( - bundle: Bundle()..putBool('isVote', false), - ).to; + ActivitiesPage().to; } void activityDetailsRouter(String imagePath, title, bool isOver, isVote, diff --git a/lib/pages/setting_page/account_manager_page.dart b/lib/pages/setting_page/account_manager_page.dart index b631262d..3c642ea8 100644 --- a/lib/pages/setting_page/account_manager_page.dart +++ b/lib/pages/setting_page/account_manager_page.dart @@ -48,7 +48,7 @@ class _AccountManagerPageState extends State { }, ); }, - ), + ).material(color: Colors.white), ], ), ); diff --git a/lib/pages/setting_page/settings_page.dart b/lib/pages/setting_page/settings_page.dart index 80de4030..cc75a31e 100644 --- a/lib/pages/setting_page/settings_page.dart +++ b/lib/pages/setting_page/settings_page.dart @@ -105,13 +105,13 @@ class _SettingsPageState extends State { padding: EdgeInsets.zero, children: [ ...[ - _buildTile( - title: '是否接受信息通知', - suffix: CupertinoSwitch( - value: false, - onChanged: (state) {}, - ), - ), + // _buildTile( + // title: '是否接受信息通知', + // suffix: CupertinoSwitch( + // value: false, + // onChanged: (state) {}, + // ), + // ), _buildTile( title: '关于小蜜蜂智慧社区', onTap: () => AboutPage().to(), diff --git a/lib/pages/tab_navigator.dart b/lib/pages/tab_navigator.dart index 22431361..1619967a 100644 --- a/lib/pages/tab_navigator.dart +++ b/lib/pages/tab_navigator.dart @@ -1,3 +1,4 @@ +import 'package:akuCommunity/const/resource.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -62,16 +63,16 @@ class _TabNavigatorState extends State { Widget build(BuildContext context) { //底部导航来 List _bottomNav = [ - _buildBottomBar( - '首页', AssetsImage.TAB_HOME_UNSELECT, AssetsImage.TAB_HOME_SELECT), + _buildBottomBar('首页', R.ASSETS_ICONS_TABBAR_HOME_NO_PNG, + R.ASSETS_ICONS_TABBAR_HOME_PNG), // _buildBottomBar( // '商城', AssetsImage.TAB_MARKET_UNSELECT, AssetsImage.TAB_MARKET_SELECT), - _buildBottomBar( - '物业', AssetsImage.TAB_HOUSE_UNSELECT, AssetsImage.TAB_HOUSE_SELECT), - _buildBottomBar('社区', AssetsImage.TAB_MESSAGE_UNSELECT, - AssetsImage.TAB_MESSAGE_SELECT), - _buildBottomBar( - '我的', AssetsImage.TAB_USER_UNSELECT, AssetsImage.TAB_USER_SELECT), + _buildBottomBar('物业', R.ASSETS_ICONS_TABBAR_HOUSE_NO_PNG, + R.ASSETS_ICONS_TABBAR_HOUSE_PNG), + _buildBottomBar('社区', R.ASSETS_ICONS_TABBAR_MESSAGE_NO_PNG, + R.ASSETS_ICONS_TABBAR_MESSAGE_PNG), + _buildBottomBar('我的', R.ASSETS_ICONS_TABBAR_USER_NO_PNG, + R.ASSETS_ICONS_TABBAR_USER_PNG), ]; return Scaffold( body: WillPopScope( diff --git a/lib/pages/things_page/things_page.dart b/lib/pages/things_page/things_page.dart deleted file mode 100644 index 77536c1c..00000000 --- a/lib/pages/things_page/things_page.dart +++ /dev/null @@ -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 with TickerProviderStateMixin { - List> _listCard = [ - { - 'time': '2020年10月13日', - 'tag': '已提交', - 'content': '我觉得我们小区的绿化可以再多一点', - 'imageList': [ - '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': [] - }, - { - 'time': '2020年08月12日', - 'tag': '已反馈', - 'content': '夏天蛇蚁虫属真多,希望小区能组队给整个小区保洁一下', - 'imageList': [ - '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> _listRepair = [ - { - 'time': '公区报修', - 'tag': '已处理', - 'content': '小区花园的健身器材坏了请注意抓紧时间维修。还有一些健身器材年限到了麻烦注意更换,因为怕出现安全隐患。', - 'imageList': [ - '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': [ - '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': [ - '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': [ - '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': [ - '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(), - ], - ), - ); - } -} diff --git a/lib/pages/things_page/widget/things_app_bar.dart b/lib/pages/things_page/widget/things_app_bar.dart index 855267a5..11c945dc 100644 --- a/lib/pages/things_page/widget/things_app_bar.dart +++ b/lib/pages/things_page/widget/things_app_bar.dart @@ -4,6 +4,8 @@ import 'package:flutter_icons/flutter_icons.dart'; import 'package:akuCommunity/utils/headers.dart'; import 'package:get/get.dart'; +//TODO CLEAN BOTTOM CODES. +@Deprecated("sh*t app bar need to be cleaned.") class ThingsAppBar extends StatelessWidget { final String title, subtitle; final List> treeList; diff --git a/lib/pages/total_application_page/total_applications_page.dart b/lib/pages/total_application_page/total_applications_page.dart index 4dbe7e93..6a4a7c2e 100644 --- a/lib/pages/total_application_page/total_applications_page.dart +++ b/lib/pages/total_application_page/total_applications_page.dart @@ -10,8 +10,9 @@ import 'package:akuCommunity/pages/one_alarm/widget/alarm_page.dart'; import 'package:akuCommunity/pages/open_door_page/open_door_page.dart'; import 'package:akuCommunity/pages/opening_code_page/opening_code_page.dart'; import 'package:akuCommunity/pages/questionnaire_page/questionnaire_page.dart'; -import 'package:akuCommunity/pages/things_page/things_page.dart'; +import 'package:akuCommunity/pages/things_page/fixed_submit_page.dart'; import 'package:akuCommunity/pages/visitor_access_page/visitor_access_page.dart'; +import 'package:akuCommunity/ui/manager/advice/advice_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:akuCommunity/utils/headers.dart'; @@ -135,12 +136,7 @@ class _TotalApplicationsPageState extends State { VisitorAccessPage().to(); break; case '报事报修': - ThingsPage( - bundle: Bundle() - ..putMap('things', { - 'title': '报事报修', - }), - ).to; + FixedSubmitPage().to(); break; case '生活缴费': case '我的缴费': @@ -150,44 +146,22 @@ class _TotalApplicationsPageState extends State { IndustryCommitteePage().to(); break; case '建议咨询': - ThingsPage( - bundle: Bundle() - ..putMap('things', { - 'title': '建议咨询', - 'treeList': >[ - {'name': '您的建议'}, - {'name': '您的咨询'}, - ] - }), - ).to(); + AdvicePage(type: AdviceType.SUGGESTION).to(); break; case '便民电话': ConvenientPhonePage().to(); break; case '活动投票': - ActivitiesPage( - bundle: Bundle()..putBool('isVote', true), - ).to; + ActivitiesPage().to(); break; case '社区活动': - ActivitiesPage( - bundle: Bundle()..putBool('isVote', false), - ).to; + ActivitiesPage().to(); break; case '物品出户': GoodsDetoPage().to(); break; case '投诉表扬': - ThingsPage( - bundle: Bundle() - ..putMap('things', { - 'title': '投诉表扬', - 'treeList': >[ - {'name': '您的表扬'}, - {'name': '您的投诉'}, - ] - }), - ).to; + AdvicePage(type: AdviceType.COMPLAIN).to(); break; case '问卷调查': QuestionnairePage().to(); diff --git a/lib/routers/page_routers.dart b/lib/routers/page_routers.dart index 09a9f87d..0aed9284 100644 --- a/lib/routers/page_routers.dart +++ b/lib/routers/page_routers.dart @@ -1,5 +1,5 @@ - - +//TODO CLEAN BOTTOM CODES. +@Deprecated("sh*t page_routers need to be cleaned.") class Bundle { Map _map = {}; @@ -12,7 +12,6 @@ class Bundle { return _map[k]; } - putString(String k, String v) => _setValue(k, v); putBool(String k, bool v) => _setValue(k, v); @@ -34,4 +33,3 @@ class Bundle { return _map.toString(); } } - diff --git a/lib/ui/manager/advice/advice_page.dart b/lib/ui/manager/advice/advice_page.dart new file mode 100644 index 00000000..aefb26a1 --- /dev/null +++ b/lib/ui/manager/advice/advice_page.dart @@ -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 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 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(), + ), + ); + } +} diff --git a/lib/widget/bee_scaffold.dart b/lib/widget/bee_scaffold.dart index 35863d59..6ac9b5e3 100644 --- a/lib/widget/bee_scaffold.dart +++ b/lib/widget/bee_scaffold.dart @@ -14,6 +14,7 @@ class BeeScaffold extends StatefulWidget { final List actions; final Widget leading; final Widget bottomNavi; + final PreferredSizeWidget appBarBottom; BeeScaffold( {Key key, @required this.title, @@ -21,7 +22,8 @@ class BeeScaffold extends StatefulWidget { this.actions, this.leading, this.bgColor, - this.bottomNavi}) + this.bottomNavi, + this.appBarBottom}) : super(key: key); @override @@ -41,6 +43,7 @@ class _BeeScaffoldState extends State { centerTitle: true, leading: widget.leading ?? BeeBackButton(), actions: widget.actions, + bottom: widget.appBarBottom, ), body: widget.body, bottomNavigationBar: widget.bottomNavi, diff --git a/lib/widget/common_app_bar.dart b/lib/widget/common_app_bar.dart index 80996b6b..add237b8 100644 --- a/lib/widget/common_app_bar.dart +++ b/lib/widget/common_app_bar.dart @@ -12,6 +12,8 @@ import 'package:akuCommunity/routers/page_routers.dart'; import 'package:akuCommunity/pages/one_alarm/widget/explain_template.dart'; import 'package:get/get.dart'; +//TODO CLEAN BOTTOM CODES. +@Deprecated("sh*t common_app_bar need to be cleaned.") class CommonAppBar extends StatelessWidget { final String title, subtitle; final List> treeList; diff --git a/lib/widget/picker/bee_image_picker.dart b/lib/widget/picker/bee_image_picker.dart index fd7c7e38..9d7f0617 100644 --- a/lib/widget/picker/bee_image_picker.dart +++ b/lib/widget/picker/bee_image_picker.dart @@ -1,5 +1,5 @@ import 'dart:io'; - +import 'package:akuCommunity/utils/headers.dart'; import 'package:flutter/cupertino.dart'; import 'package:get/get.dart'; import 'package:image_picker/image_picker.dart'; @@ -16,13 +16,21 @@ class BeeImagePicker { onPressed: () async => Get.back( result: await ImagePicker().getImage(source: ImageSource.gallery), ), - child: '相册'.text.isIntrinsic.make(), + child: [ + Icon(CupertinoIcons.photo), + 30.wb, + '相册'.text.isIntrinsic.make(), + ].row(), ), CupertinoDialogAction( onPressed: () async => Get.back( result: await ImagePicker().getImage(source: ImageSource.camera), ), - child: '相机'.text.isIntrinsic.make(), + child: [ + Icon(CupertinoIcons.camera), + 30.wb, + '相机'.text.isIntrinsic.make(), + ].row(), ), ], cancelButton: CupertinoDialogAction( diff --git a/lib/widget/tab_bar/bee_tab_bar.dart b/lib/widget/tab_bar/bee_tab_bar.dart new file mode 100644 index 00000000..1f5574f7 --- /dev/null +++ b/lib/widget/tab_bar/bee_tab_bar.dart @@ -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 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 { + @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(), + ); + } +}