parent
d30613391b
commit
898721faa4
@ -1,208 +1,259 @@
|
||||
import 'package:aku_new_community/const/resource.dart';
|
||||
import 'package:aku_new_community/constants/api.dart';
|
||||
import 'package:aku_new_community/constants/app_theme.dart';
|
||||
import 'package:aku_new_community/model/community/activity_detail_model.dart';
|
||||
import 'package:aku_new_community/ui/community/activity/activity_people_list_page.dart';
|
||||
import 'package:aku_new_community/gen/assets.gen.dart';
|
||||
import 'package:aku_new_community/utils/headers.dart';
|
||||
import 'package:aku_new_community/utils/network/base_model.dart';
|
||||
import 'package:aku_new_community/utils/network/net_util.dart';
|
||||
import 'package:aku_new_community/widget/bee_divider.dart';
|
||||
import 'package:aku_new_community/widget/bee_scaffold.dart';
|
||||
import 'package:aku_new_community/widget/buttons/bottom_button.dart';
|
||||
import 'package:aku_new_community/widget/others/stack_avatar.dart';
|
||||
import 'package:aku_new_community/widget/picker/bee_image_preview.dart';
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:flustars/flustars.dart';
|
||||
import 'package:flutter/cupertino.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:shimmer/shimmer.dart';
|
||||
import 'package:velocity_x/velocity_x.dart';
|
||||
|
||||
class ActivityDetailPage extends StatefulWidget {
|
||||
final int? id;
|
||||
|
||||
ActivityDetailPage({Key? key, required this.id}) : super(key: key);
|
||||
const ActivityDetailPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_ActivityDetailPageState createState() => _ActivityDetailPageState();
|
||||
}
|
||||
|
||||
class _ActivityDetailPageState extends State<ActivityDetailPage> {
|
||||
ActivityDetailModel? model;
|
||||
EasyRefreshController _refreshController = EasyRefreshController();
|
||||
|
||||
bool get outdate =>
|
||||
(model?.registEndDate ?? DateTime(0)).compareTo(DateTime.now()) == -1;
|
||||
|
||||
Widget get emptyWidget => Shimmer.fromColors(
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var content = Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(32.w),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
VxBox().white.height(45.w).width(544.w).make(),
|
||||
48.hb,
|
||||
VxBox()
|
||||
.white
|
||||
.height(228.w)
|
||||
.width(double.infinity)
|
||||
.withRounded(value: 8.w)
|
||||
.make(),
|
||||
44.hb,
|
||||
'活动详情'.text.size(32.sp).color(Colors.black).bold.make(),
|
||||
32.w.heightBox,
|
||||
''.text.size(28.sp).color(Colors.black.withOpacity(0.45)).make(),
|
||||
32.w.heightBox,
|
||||
...List.generate(
|
||||
3,
|
||||
(index) => VxBox()
|
||||
.white
|
||||
.height(45.w)
|
||||
.width(544.w)
|
||||
.margin(EdgeInsets.symmetric(vertical: 5.w))
|
||||
.make(),
|
||||
0,
|
||||
(index) => Container(
|
||||
width: 686.w,
|
||||
height: 432.w,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8.w),
|
||||
),
|
||||
child: Image.network(
|
||||
'',
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
)),
|
||||
],
|
||||
).pSymmetric(h: 32.w, v: 24.w),
|
||||
baseColor: Colors.black12,
|
||||
highlightColor: Colors.white,
|
||||
),
|
||||
);
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_refreshController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
_buildTile(String title, String subTitle) {
|
||||
return Row(
|
||||
return BeeScaffold(
|
||||
title: '活动详情',
|
||||
body: ListView(
|
||||
children: [
|
||||
title.text.size(28.sp).make().box.width(136.w).make(),
|
||||
subTitle.text.size(28.sp).make().expand(),
|
||||
_headWidget(),
|
||||
24.w.heightBox,
|
||||
content,
|
||||
24.w.heightBox,
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 16.w),
|
||||
height: 132.w,
|
||||
child: Row(
|
||||
children: [
|
||||
CircleAvatar(
|
||||
child: FadeInImage.assetNetwork(
|
||||
placeholder: Assets.images.placeholder.path,
|
||||
image: '',
|
||||
),
|
||||
),
|
||||
20.w.widthBox,
|
||||
Column(
|
||||
children: [
|
||||
'印象物业'.text.size(28.sp).color(Colors.black).make(),
|
||||
8.w.heightBox,
|
||||
'${S.of(context)!.tempPlotName}'
|
||||
.text
|
||||
.size(24.sp)
|
||||
.color(Colors.black.withOpacity(0.25))
|
||||
.make()
|
||||
],
|
||||
).pSymmetric(h: 32.w);
|
||||
),
|
||||
Spacer(),
|
||||
MaterialButton(
|
||||
minWidth: 120.w,
|
||||
height: 60.w,
|
||||
onPressed: () {},
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(
|
||||
color: Colors.blueAccent,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(30.w)),
|
||||
child:
|
||||
'联系物业'.text.size(24.sp).color(Colors.blueAccent).make(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
bottomNavi: BottomButton(
|
||||
child: '立即报名'.text.size(32.sp).color(Colors.black).bold.make(),
|
||||
onPressed: () {},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BeeScaffold(
|
||||
title: '活动详情',
|
||||
systemStyle: SystemStyle.yellowBottomBar,
|
||||
body: EasyRefresh(
|
||||
header: MaterialHeader(),
|
||||
onRefresh: () async {
|
||||
BaseModel baseModel = await NetUtil().get(
|
||||
API.community.activityDetail,
|
||||
params: {'activityId': widget.id},
|
||||
);
|
||||
model = ActivityDetailModel.fromJson(baseModel.data);
|
||||
setState(() {});
|
||||
},
|
||||
controller: _refreshController,
|
||||
firstRefresh: true,
|
||||
emptyWidget: model == null ? emptyWidget : null,
|
||||
child: model == null
|
||||
? SizedBox()
|
||||
: ListView(
|
||||
Container _headWidget() {
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
children: [
|
||||
Image.asset(
|
||||
Assets.images.logo.path,
|
||||
width: double.infinity,
|
||||
height: 280.w,
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.all(32.w),
|
||||
child: Column(
|
||||
children: [
|
||||
model!.title!.text
|
||||
'人才公寓党政建设讲座系列活动——庆祝中国共产党建党71周年活动'
|
||||
.text
|
||||
.size(32.sp)
|
||||
.color(Colors.black.withOpacity(0.85))
|
||||
.maxLines(3)
|
||||
.bold
|
||||
.make()
|
||||
.pSymmetric(h: 32.w, v: 24.w),
|
||||
48.hb,
|
||||
...model!.imgUrls!
|
||||
.map((e) => GestureDetector(
|
||||
onTap: () {
|
||||
BeeImagePreview.toPath(path: e.url);
|
||||
},
|
||||
child: Hero(
|
||||
tag: e.url!,
|
||||
child: Container(
|
||||
.make(),
|
||||
32.w.heightBox,
|
||||
Container(
|
||||
width: 104.w,
|
||||
height: 42.w,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black12,
|
||||
borderRadius: BorderRadius.circular(8.w),
|
||||
color: Color(0xFFFEC076).withOpacity(0.5),
|
||||
borderRadius: BorderRadius.circular(10.w)),
|
||||
alignment: Alignment.center,
|
||||
child:
|
||||
'报名中'.text.size(24.sp).color(Color(0xFFF481170)).make(),
|
||||
),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: FadeInImage.assetNetwork(
|
||||
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
|
||||
image: API.image(e.url),
|
||||
fit: BoxFit.cover,
|
||||
32.w.heightBox,
|
||||
_buildTile(
|
||||
'报名时间',
|
||||
'${DateUtil.formatDate(
|
||||
DateTime.now(),
|
||||
format: 'yyyy.MM.dd HH:mm',
|
||||
)}-${DateUtil.formatDate(
|
||||
DateTime.now(),
|
||||
format: 'yyyy.MM.dd HH:mm',
|
||||
)}',
|
||||
),
|
||||
_buildTile(
|
||||
'活动时间',
|
||||
'${DateUtil.formatDate(
|
||||
DateTime.now(),
|
||||
format: 'yyyy.MM.dd HH:mm',
|
||||
)}-${DateUtil.formatDate(
|
||||
DateTime.now(),
|
||||
format: 'yyyy.MM.dd HH:mm',
|
||||
)}',
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 32.w),
|
||||
child: Row(
|
||||
children: [
|
||||
'活动方式'.text.size(28.sp).make().box.width(136.w).make(),
|
||||
'本次活动介绍'
|
||||
.richText
|
||||
.tap(() {
|
||||
var bottomSheet = Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(32.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(16.w)),
|
||||
child: Column(
|
||||
children: [
|
||||
'活动介绍'.text.size(32.sp).black.bold.make(),
|
||||
32.w.heightBox,
|
||||
],
|
||||
),
|
||||
).pSymmetric(h: 32.w))
|
||||
.toList(),
|
||||
44.hb,
|
||||
model!.content!.text.size(28.sp).make().pSymmetric(h: 32.w),
|
||||
44.hb,
|
||||
_buildTile(
|
||||
'开始时间',
|
||||
DateUtil.formatDate(
|
||||
model!.startDate,
|
||||
format: 'yyyy年MM月dd日 HH:mm',
|
||||
);
|
||||
Get.bottomSheet(
|
||||
bottomSheet,
|
||||
);
|
||||
})
|
||||
.size(28.sp)
|
||||
.make(),
|
||||
Spacer(),
|
||||
],
|
||||
),
|
||||
),
|
||||
_buildTile(
|
||||
'结束时间',
|
||||
DateUtil.formatDate(
|
||||
model!.endDate,
|
||||
format: 'yyyy年MM月dd日 HH:mm',
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 32.w),
|
||||
child: Row(
|
||||
children: [
|
||||
'活动费用'.text.size(28.sp).make().box.width(136.w).make(),
|
||||
'免费'.richText.size(28.sp).make(),
|
||||
Spacer(),
|
||||
],
|
||||
),
|
||||
),
|
||||
_buildTile('地 点', model!.location!),
|
||||
_buildTile('参与人数', '不限'),
|
||||
_buildTile(
|
||||
'报名截止',
|
||||
DateUtil.formatDate(
|
||||
model!.registEndDate,
|
||||
format: 'yyyy年MM月dd日 HH:mm',
|
||||
32.w.heightBox,
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 32.w),
|
||||
child: Row(
|
||||
children: [
|
||||
'活动地点'.text.size(28.sp).make().box.width(136.w).make(),
|
||||
'永恒智慧大厦'.richText.tap(() {}).size(28.sp).make(),
|
||||
Spacer(),
|
||||
],
|
||||
),
|
||||
),
|
||||
115.hb,
|
||||
Container(
|
||||
height: 24.w,
|
||||
color: Color(0xFFF9F9F9),
|
||||
32.w.heightBox,
|
||||
BeeDivider.horizontal(
|
||||
indent: 32.w,
|
||||
endIndent: 32.w,
|
||||
),
|
||||
MaterialButton(
|
||||
height: 92.w,
|
||||
onPressed: () =>
|
||||
Get.to(() => ActivityPeopleListPage(id: widget.id)),
|
||||
InkWell(
|
||||
onTap: () {},
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: 32.w, right: 32.w, top: 16.w, bottom: 24.w),
|
||||
child: Row(
|
||||
children: [
|
||||
StackAvatar(
|
||||
avatars:
|
||||
model!.headImgURls!.map((e) => e.url).toList(),
|
||||
avatars: [],
|
||||
),
|
||||
Spacer(),
|
||||
'已有${model!.countRegistration}人参加'
|
||||
.text
|
||||
.size(28.sp)
|
||||
16.w.heightBox,
|
||||
'200'
|
||||
.richText
|
||||
.withTextSpanChildren(
|
||||
['/1000人参与'.textSpan.size(24.sp).black.make()])
|
||||
.color(Colors.blueAccent)
|
||||
.size(24.sp)
|
||||
.make(),
|
||||
16.wb,
|
||||
Spacer(),
|
||||
Icon(
|
||||
CupertinoIcons.chevron_forward,
|
||||
size: 30.w,
|
||||
color: Color(0xFFD8D8D8),
|
||||
CupertinoIcons.chevron_right,
|
||||
size: 40.w,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Divider(height: 1.w, indent: 32.w, endIndent: 32.w),
|
||||
),
|
||||
],
|
||||
),
|
||||
).material(color: Colors.white),
|
||||
bottomNavi: outdate
|
||||
? BottomButton(
|
||||
onPressed: null,
|
||||
child: '该活动已结束'.text.make(),
|
||||
)
|
||||
: BottomButton(
|
||||
onPressed: () async {
|
||||
VoidCallback cancel = BotToast.showLoading();
|
||||
NetUtil().get(
|
||||
API.community.signUpActivity,
|
||||
params: {'activityId': widget.id},
|
||||
showMessage: true,
|
||||
);
|
||||
cancel();
|
||||
},
|
||||
child: '我要报名'.text.make(),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_buildTile(String title, String subTitle) {
|
||||
return Row(
|
||||
children: [
|
||||
title.text.size(28.sp).make().box.width(136.w).make(),
|
||||
subTitle.text.size(28.sp).make().expand(),
|
||||
],
|
||||
).pSymmetric(h: 32.w);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,220 @@
|
||||
import 'package:aku_new_community/const/resource.dart';
|
||||
import 'package:aku_new_community/constants/api.dart';
|
||||
import 'package:aku_new_community/constants/app_theme.dart';
|
||||
import 'package:aku_new_community/model/common/img_model.dart';
|
||||
import 'package:aku_new_community/model/community/activity_detail_model.dart';
|
||||
import 'package:aku_new_community/ui/community/activity/activity_people_list_page.dart';
|
||||
import 'package:aku_new_community/utils/headers.dart';
|
||||
import 'package:aku_new_community/utils/network/net_util.dart';
|
||||
import 'package:aku_new_community/widget/bee_scaffold.dart';
|
||||
import 'package:aku_new_community/widget/buttons/bottom_button.dart';
|
||||
import 'package:aku_new_community/widget/others/stack_avatar.dart';
|
||||
import 'package:aku_new_community/widget/picker/bee_image_preview.dart';
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:flustars/flustars.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:shimmer/shimmer.dart';
|
||||
|
||||
@Deprecated('旧页面 酌情删除')
|
||||
class ActivityDetailPage extends StatefulWidget {
|
||||
final int? id;
|
||||
|
||||
ActivityDetailPage({Key? key, required this.id}) : super(key: key);
|
||||
|
||||
@override
|
||||
_ActivityDetailPageState createState() => _ActivityDetailPageState();
|
||||
}
|
||||
|
||||
class _ActivityDetailPageState extends State<ActivityDetailPage> {
|
||||
ActivityDetailModel? model;
|
||||
EasyRefreshController _refreshController = EasyRefreshController();
|
||||
|
||||
bool get outdate =>
|
||||
(model?.registEndDate ?? DateTime(0)).compareTo(DateTime.now()) == -1;
|
||||
|
||||
Widget get emptyWidget => Shimmer.fromColors(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
VxBox().white.height(45.w).width(544.w).make(),
|
||||
48.hb,
|
||||
VxBox()
|
||||
.white
|
||||
.height(228.w)
|
||||
.width(double.infinity)
|
||||
.withRounded(value: 8.w)
|
||||
.make(),
|
||||
44.hb,
|
||||
...List.generate(
|
||||
3,
|
||||
(index) => VxBox()
|
||||
.white
|
||||
.height(45.w)
|
||||
.width(544.w)
|
||||
.margin(EdgeInsets.symmetric(vertical: 5.w))
|
||||
.make(),
|
||||
),
|
||||
],
|
||||
).pSymmetric(h: 32.w, v: 24.w),
|
||||
baseColor: Colors.black12,
|
||||
highlightColor: Colors.white,
|
||||
);
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_refreshController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
_buildTile(String title, String subTitle) {
|
||||
return Row(
|
||||
children: [
|
||||
title.text.size(28.sp).make().box.width(136.w).make(),
|
||||
subTitle.text.size(28.sp).make().expand(),
|
||||
],
|
||||
).pSymmetric(h: 32.w);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BeeScaffold(
|
||||
title: '活动详情',
|
||||
systemStyle: SystemStyle.yellowBottomBar,
|
||||
body: EasyRefresh(
|
||||
header: MaterialHeader(),
|
||||
onRefresh: () async {
|
||||
// BaseModel baseModel = await NetUtil().get(
|
||||
// API.community.activityDetail,
|
||||
// params: {'activityId': widget.id},
|
||||
// );
|
||||
// model = ActivityDetailModel.fromJson(baseModel.data);
|
||||
model = ActivityDetailModel(
|
||||
id: 0,
|
||||
title: '111',
|
||||
content: '2222',
|
||||
location: '',
|
||||
activityStartTime: '',
|
||||
activityEndTime: '',
|
||||
registrationEndTime: '',
|
||||
countRegistration: 0,
|
||||
imgUrls: [ImgModel(url: '')],
|
||||
headImgURls: [ImgModel(url: '')]);
|
||||
setState(() {});
|
||||
},
|
||||
controller: _refreshController,
|
||||
firstRefresh: true,
|
||||
emptyWidget: model == null ? emptyWidget : null,
|
||||
child: model == null
|
||||
? SizedBox()
|
||||
: ListView(
|
||||
children: [
|
||||
model!.title!.text
|
||||
.size(32.sp)
|
||||
.bold
|
||||
.make()
|
||||
.pSymmetric(h: 32.w, v: 24.w),
|
||||
48.hb,
|
||||
...model!.imgUrls!
|
||||
.map((e) => GestureDetector(
|
||||
onTap: () {
|
||||
BeeImagePreview.toPath(path: e.url);
|
||||
},
|
||||
child: Hero(
|
||||
tag: e.url!,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black12,
|
||||
borderRadius: BorderRadius.circular(8.w),
|
||||
),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: FadeInImage.assetNetwork(
|
||||
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
|
||||
image: API.image(e.url),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
).pSymmetric(h: 32.w))
|
||||
.toList(),
|
||||
44.hb,
|
||||
model!.content!.text.size(28.sp).make().pSymmetric(h: 32.w),
|
||||
44.hb,
|
||||
_buildTile(
|
||||
'开始时间',
|
||||
DateUtil.formatDate(
|
||||
model!.startDate,
|
||||
format: 'yyyy年MM月dd日 HH:mm',
|
||||
),
|
||||
),
|
||||
_buildTile(
|
||||
'结束时间',
|
||||
DateUtil.formatDate(
|
||||
model!.endDate,
|
||||
format: 'yyyy年MM月dd日 HH:mm',
|
||||
),
|
||||
),
|
||||
_buildTile('地 点', model!.location!),
|
||||
_buildTile('参与人数', '不限'),
|
||||
_buildTile(
|
||||
'报名截止',
|
||||
DateUtil.formatDate(
|
||||
model!.registEndDate,
|
||||
format: 'yyyy年MM月dd日 HH:mm',
|
||||
),
|
||||
),
|
||||
115.hb,
|
||||
Container(
|
||||
height: 24.w,
|
||||
color: Color(0xFFF9F9F9),
|
||||
),
|
||||
MaterialButton(
|
||||
height: 92.w,
|
||||
onPressed: () =>
|
||||
Get.to(() => ActivityPeopleListPage(id: widget.id)),
|
||||
child: Row(
|
||||
children: [
|
||||
StackAvatar(
|
||||
avatars:
|
||||
model!.headImgURls!.map((e) => e.url).toList(),
|
||||
),
|
||||
Spacer(),
|
||||
'已有${model!.countRegistration}人参加'
|
||||
.text
|
||||
.size(28.sp)
|
||||
.make(),
|
||||
16.wb,
|
||||
Icon(
|
||||
CupertinoIcons.chevron_forward,
|
||||
size: 30.w,
|
||||
color: Color(0xFFD8D8D8),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Divider(height: 1.w, indent: 32.w, endIndent: 32.w),
|
||||
],
|
||||
),
|
||||
).material(color: Colors.white),
|
||||
bottomNavi: outdate
|
||||
? BottomButton(
|
||||
onPressed: null,
|
||||
child: '该活动已结束'.text.make(),
|
||||
)
|
||||
: BottomButton(
|
||||
onPressed: () async {
|
||||
VoidCallback cancel = BotToast.showLoading();
|
||||
NetUtil().get(
|
||||
API.community.signUpActivity,
|
||||
params: {'activityId': widget.id},
|
||||
showMessage: true,
|
||||
);
|
||||
cancel();
|
||||
},
|
||||
child: '我要报名'.text.make(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue