diff --git a/lib/ui/service/hall/hall_view.dart b/lib/ui/service/hall/hall_view.dart index addbcb0f..1934be13 100644 --- a/lib/ui/service/hall/hall_view.dart +++ b/lib/ui/service/hall/hall_view.dart @@ -9,18 +9,19 @@ import 'package:velocity_x/src/extensions/num_ext.dart'; import 'hall_card.dart'; class HallView extends StatefulWidget { - const HallView({Key? key}) : super(key: key); + final EasyRefreshController refreshController; + final int type; + const HallView( + {Key? key, required this.refreshController, required this.type}) + : super(key: key); @override _HallViewState createState() => _HallViewState(); } class _HallViewState extends State { - EasyRefreshController _refreshController = EasyRefreshController(); - @override void dispose() { - _refreshController.dispose(); super.dispose(); } @@ -28,9 +29,10 @@ class _HallViewState extends State { Widget build(BuildContext context) { return BeeListView( path: SARSAPI.task.list, - controller: _refreshController, + controller: widget.refreshController, extraParams: { 'taskModel': 1, + 'type': widget.type + 1, }, convert: (json) => json.rows.map((e) => HallListModel.fromJson(e)).toList(), @@ -41,7 +43,7 @@ class _HallViewState extends State { return HallCard( key: ValueKey(models[index].id), model: models[index], - refresh: () => _refreshController.callRefresh()); + refresh: () => widget.refreshController.callRefresh()); }, separatorBuilder: (_, __) { return 24.w.heightBox; diff --git a/lib/ui/service/my_take_task/my_take_task_card.dart b/lib/ui/service/my_take_task/my_take_task_card.dart index d3306f02..bfb97cda 100644 --- a/lib/ui/service/my_take_task/my_take_task_card.dart +++ b/lib/ui/service/my_take_task/my_take_task_card.dart @@ -5,6 +5,8 @@ import 'package:aku_new_community/ui/service/my_take_task/my_take_task_detail_pa import 'package:aku_new_community/ui/service/task_map.dart'; import 'package:aku_new_community/widget/bee_divider.dart'; import 'package:aku_new_community/widget/buttons/card_bottom_button.dart'; +import 'package:aku_new_community/widget/views/bee_grid_image_view.dart'; +import 'package:aku_new_community/widget/voice_player.dart'; import 'package:common_utils/common_utils.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -22,6 +24,28 @@ class MyTakeTaskCard extends StatelessWidget { @override Widget build(BuildContext context) { + var appointment = Row( + children: [ + Container( + width: 40.w, + height: 40.w, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFFFA8C16), + borderRadius: BorderRadius.circular(8.w)), + child: Text( + '预', + style: TextStyle(color: Colors.white, fontSize: 24.sp), + ), + ), + 24.w.widthBox, + '${DateUtil.formatDateStr(model.readyEndTime, format: 'MM月dd日 HH:mm')}前' + .text + .size(24.sp) + .color(Colors.black.withOpacity(0.65)) + .make(), + ], + ); return GestureDetector( onTap: () { Get.to(() => MyTakeTaskDetailPage(model: model)); @@ -53,7 +77,9 @@ class MyTakeTaskCard extends StatelessWidget { ), 20.w.heightBox, BeeDivider.horizontal(), - 34.w.heightBox, + 24.w.heightBox, + appointment, + 20.w.heightBox, Row( children: [ Assets.icons.clockCircle.image(width: 36.w, height: 36.w), @@ -77,6 +103,32 @@ class MyTakeTaskCard extends StatelessWidget { .make(), ], ), + Row( + children: [ + Assets.icons.watch.image(width: 40.w, height: 40.w), + 24.w.widthBox, + '${model.serviceTime ?? '0'}' + .richText + .withTextSpanChildren([ + ' 分钟'.textSpan.size(28.sp).color(Colors.black).make(), + ]) + .size(28.sp) + .color(Color(0xFFFA8C16)) + .make(), + ], + ), + 24.w.heightBox, + Row( + children: [ + Assets.icons.environment.image(width: 36.w, height: 36.w), + 24.w.widthBox, + '${model.accessAddress}' + .text + .size(24.sp) + .color(Colors.black.withOpacity(0.65)) + .make(), + ], + ), 34.w.heightBox, Container( width: 638.w, @@ -87,16 +139,17 @@ class MyTakeTaskCard extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - '#${TaskMap.typeToString[model.type]}' - .text - .size(28.sp) - .color(Colors.black.withOpacity(0.85)) - .make(), - 16.w.heightBox, model.remarks.text .size(28.sp) .color(Colors.black.withOpacity(0.65)) .make(), + 24.w.heightBox, + VoicePlayer( + url: model.voiceUrl, + ), + 24.w.heightBox, + BeeGridImageView( + urls: model.imgList?.map((e) => e.url).toList() ?? []), ], ), ), diff --git a/lib/ui/service/my_take_task/my_take_task_view.dart b/lib/ui/service/my_take_task/my_take_task_view.dart index 83a5ee7b..5f8982ad 100644 --- a/lib/ui/service/my_take_task/my_take_task_view.dart +++ b/lib/ui/service/my_take_task/my_take_task_view.dart @@ -8,18 +8,19 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:velocity_x/velocity_x.dart'; class MyTakeTaskView extends StatefulWidget { - const MyTakeTaskView({Key? key}) : super(key: key); + final EasyRefreshController refreshController; + final int type; + const MyTakeTaskView( + {Key? key, required this.refreshController, required this.type}) + : super(key: key); @override _MyTakeTaskViewState createState() => _MyTakeTaskViewState(); } class _MyTakeTaskViewState extends State { - EasyRefreshController _refreshController = EasyRefreshController(); - @override void dispose() { - _refreshController.dispose(); super.dispose(); } @@ -27,9 +28,10 @@ class _MyTakeTaskViewState extends State { Widget build(BuildContext context) { return BeeListView( path: SARSAPI.task.list, - controller: _refreshController, + controller: widget.refreshController, extraParams: { 'taskModel': 2, + 'type': widget.type + 1, }, convert: (json) => json.rows.map((e) => MyTakeTaskListModel.fromJson(e)).toList(), @@ -39,7 +41,7 @@ class _MyTakeTaskViewState extends State { itemBuilder: (context, index) { return MyTakeTaskCard( model: models[index], - refresh: () => _refreshController.callRefresh()); + refresh: () => widget.refreshController.callRefresh()); }, separatorBuilder: (_, __) { return 24.w.heightBox; diff --git a/lib/ui/service/my_task/my_task_card.dart b/lib/ui/service/my_task/my_task_card.dart index a0aea9bd..3882dfbd 100644 --- a/lib/ui/service/my_task/my_task_card.dart +++ b/lib/ui/service/my_task/my_task_card.dart @@ -3,6 +3,8 @@ import 'package:aku_new_community/models/task/my_task_list_model.dart'; import 'package:aku_new_community/ui/service/my_task/my_task_detail_page.dart'; import 'package:aku_new_community/ui/service/task_map.dart'; import 'package:aku_new_community/widget/buttons/card_bottom_button.dart'; +import 'package:aku_new_community/widget/views/bee_grid_image_view.dart'; +import 'package:aku_new_community/widget/voice_player.dart'; import 'package:common_utils/common_utils.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -45,6 +47,28 @@ class MyTaskCard extends StatelessWidget { .make() ], ); + var appointment = Row( + children: [ + Container( + width: 40.w, + height: 40.w, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFFFA8C16), + borderRadius: BorderRadius.circular(8.w)), + child: Text( + '预', + style: TextStyle(color: Colors.white, fontSize: 24.sp), + ), + ), + 24.w.widthBox, + '${DateUtil.formatDateStr(model.readyEndTime, format: 'MM月dd日 HH:mm')}前' + .text + .size(24.sp) + .color(Colors.black.withOpacity(0.65)) + .make(), + ], + ); return GestureDetector( onTap: () { Get.to(() => MyTaskDetailPage(model: model)); @@ -59,19 +83,24 @@ class MyTaskCard extends StatelessWidget { child: Column( children: [ head, - 34.w.heightBox, + 24.w.heightBox, + appointment, + 20.w.heightBox, Row( children: [ - Assets.icons.clockCircle.image(width: 36.w, height: 36.w), + Assets.icons.watch.image(width: 40.w, height: 40.w), 24.w.widthBox, - '${DateUtil.formatDateStr(model.readyEndTime)}' - .text - .size(24.sp) - .color(Colors.black.withOpacity(0.65)) + '${model.serviceTime ?? '0'}' + .richText + .withTextSpanChildren([ + ' 分钟'.textSpan.size(28.sp).color(Colors.black).make(), + ]) + .size(28.sp) + .color(Color(0xFFFA8C16)) .make(), ], ), - 20.w.heightBox, + 24.w.heightBox, Row( children: [ Assets.icons.environment.image(width: 36.w, height: 36.w), @@ -93,16 +122,17 @@ class MyTaskCard extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - '#${TaskMap.typeToString[model.type]}' - .text - .size(28.sp) - .color(Colors.black.withOpacity(0.85)) - .make(), - 16.w.heightBox, model.remarks.text .size(28.sp) .color(Colors.black.withOpacity(0.65)) .make(), + 24.w.heightBox, + VoicePlayer( + url: model.voiceUrl, + ), + 24.w.heightBox, + BeeGridImageView( + urls: model.imgList?.map((e) => e.url).toList() ?? []), ], ), ), diff --git a/lib/ui/service/my_task/my_task_view.dart b/lib/ui/service/my_task/my_task_view.dart index 34b1e79d..fa45b7cc 100644 --- a/lib/ui/service/my_task/my_task_view.dart +++ b/lib/ui/service/my_task/my_task_view.dart @@ -8,18 +8,19 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:velocity_x/velocity_x.dart'; class MyTaskView extends StatefulWidget { - const MyTaskView({Key? key}) : super(key: key); + final EasyRefreshController refreshController; + final int type; + const MyTaskView( + {Key? key, required this.refreshController, required this.type}) + : super(key: key); @override _MyTaskViewState createState() => _MyTaskViewState(); } class _MyTaskViewState extends State { - EasyRefreshController _refreshController = EasyRefreshController(); - @override void dispose() { - _refreshController.dispose(); super.dispose(); } @@ -27,9 +28,10 @@ class _MyTaskViewState extends State { Widget build(BuildContext context) { return BeeListView( path: SARSAPI.task.list, - controller: _refreshController, + controller: widget.refreshController, extraParams: { 'taskModel': 2, + 'type': widget.type + 1, }, convert: (json) => json.rows.map((e) => MyTaskListModel.fromJson(e)).toList(), @@ -39,7 +41,7 @@ class _MyTaskViewState extends State { itemBuilder: (context, index) { return MyTaskCard( model: models[index], - refresh: () => _refreshController.callRefresh()); + refresh: () => widget.refreshController.callRefresh()); }, separatorBuilder: (_, __) { return 24.w.heightBox; diff --git a/lib/ui/service/publish_task_page.dart b/lib/ui/service/publish_task_page.dart index 787c93dc..11cff943 100644 --- a/lib/ui/service/publish_task_page.dart +++ b/lib/ui/service/publish_task_page.dart @@ -32,7 +32,7 @@ class PublishTaskPage extends StatefulWidget { } class _PublishTaskPageState extends State { - List _types = ['跑腿', '代驾', '装修', '陪玩', '家政', '维修', '搬家', '家教', '其他']; + List _types = ['跑腿', '家政', '维修', '家教', '其他']; //类型 int _type = 0; @@ -41,7 +41,9 @@ class _PublishTaskPageState extends State { //服务人员 int _service = 0; - List _serviceObject = ['住户', '物业', '不限']; + List _serviceObject = [ + '住户', + ]; List _rewardTypes = ['赏金', '积分']; //报酬类型 @@ -305,6 +307,20 @@ class _PublishTaskPageState extends State { .color(Colors.black.withOpacity(0.85)) .make()), actions: [ + ..._serviceObject + .mapIndexed((e, index) => CupertinoActionSheetAction( + onPressed: () { + _service = index + 1; + Get.back(); + setState(() {}); + }, + child: 'e' + .text + .size(28.sp) + .isIntrinsic + .color(Colors.black.withOpacity(0.85)) + .make())) + .toList(), CupertinoActionSheetAction( onPressed: () { _service = 1; diff --git a/lib/ui/service/task_page.dart b/lib/ui/service/task_page.dart index dd4c3b3f..da6e3870 100644 --- a/lib/ui/service/task_page.dart +++ b/lib/ui/service/task_page.dart @@ -1,15 +1,14 @@ -import 'package:flutter/material.dart'; - -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:velocity_x/velocity_x.dart'; - import 'package:aku_new_community/ui/service/hall/hall_view.dart'; import 'package:aku_new_community/ui/service/my_take_task/my_take_task_view.dart'; import 'package:aku_new_community/ui/service/my_task/my_task_view.dart'; import 'package:aku_new_community/ui/service/publish_task_page.dart'; import 'package:aku_new_community/widget/bee_scaffold.dart'; import 'package:aku_new_community/widget/painter/tab_indicator.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:velocity_x/velocity_x.dart'; class TaskPage extends StatefulWidget { const TaskPage({Key? key}) : super(key: key); @@ -22,13 +21,25 @@ class _TaskPageState extends State with TickerProviderStateMixin { late TabController _tabController; List _tabs = ['大厅', '我服务的', '我发布的']; + List _types = ['跑腿', '家政', '维修', '家教', '其他']; + List _refreshControllers = []; + int _currentType = 0; @override void initState() { _tabController = TabController(length: _tabs.length, vsync: this); + _refreshControllers = _tabs.map((e) => EasyRefreshController()).toList(); super.initState(); } + @override + void dispose() { + _refreshControllers.forEach((element) { + element.dispose(); + }); + super.dispose(); + } + @override Widget build(BuildContext context) { return BeeScaffold( @@ -45,20 +56,46 @@ class _TaskPageState extends State with TickerProviderStateMixin { )) ], appBarBottom: PreferredSize( - preferredSize: Size.fromHeight(88.w), - child: Row( + preferredSize: Size.fromHeight((88 + 50 + 48).w), + child: Column( + mainAxisSize: MainAxisSize.min, children: [ - ..._tabs - .mapIndexed( - (currentValue, index) => _tabCard(currentValue, index)) - .toList(), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Row( + children: [ + ..._tabs + .mapIndexed((currentValue, index) => + _tabCard(currentValue, index)) + .toList(), + ], + ), + ), + Padding( + padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), + child: Row( + children: _types + .mapIndexed((currentValue, index) => + _typeBar(currentValue, index)) + .toList(), + ), + ) ], )), body: SafeArea( child: TabBarView(controller: _tabController, children: [ - HallView(), - MyTakeTaskView(), - MyTaskView(), + HallView( + refreshController: _refreshControllers[0], + type: _currentType, + ), + MyTakeTaskView( + refreshController: _refreshControllers[1], + type: _currentType, + ), + MyTaskView( + refreshController: _refreshControllers[2], + type: _currentType, + ), ])), ); } @@ -90,4 +127,36 @@ class _TaskPageState extends State with TickerProviderStateMixin { ), ); } + + Widget _typeBar(String text, int index) { + return GestureDetector( + onTap: () { + _currentType = index; + _refreshControllers[_tabController.index].callRefresh(); + setState(() {}); + }, + child: Material( + color: Colors.transparent, + child: _currentType == index + ? Container( + padding: EdgeInsets.symmetric(vertical: 8.w, horizontal: 24.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(30.w), + color: Color(0xFFFAC058).withOpacity(0.5), + ), + child: text.text + .size(24.sp) + .color(Colors.black.withOpacity(0.65)) + .make(), + ) + : Container( + padding: EdgeInsets.symmetric(vertical: 8.w, horizontal: 24.w), + child: text.text + .size(24.sp) + .color(Colors.black.withOpacity(0.45)) + .make(), + ), + ), + ); + } }