新 社区活动页面

pull/1/head
张萌 3 years ago
parent d30613391b
commit 898721faa4

@ -136,20 +136,6 @@ class _HomePageState extends State<HomePage>
), ),
], ],
), ),
// floatingActionButton: FloatingActionButton(
//
// child: Container(
// decoration: BoxDecoration(
// image: DecorationImage(
// fit: BoxFit.fill,
// image:
// AssetImage(R.ASSETS_ICONS_ICON_MAIN_OPEN_PNG),)
// ),
// ),
// onPressed: (){
// print('FloatingActionButton');
// },
// ),
body: Stack( body: Stack(
children: [ children: [
EasyRefresh( EasyRefresh(
@ -381,23 +367,6 @@ class _HomePageState extends State<HomePage>
SliverToBoxAdapter( SliverToBoxAdapter(
child: Column( child: Column(
children: [ children: [
// HomeTitle(
// title: '公共资讯',
// suffixTitle: '更多资讯',
// onTap: () async {
// final cancel = BotToast.showLoading();
// BaseModel model = await NetUtil().get(API.news.category);
// List<NewsCategoryModel>? category;
// if (model.status == true && model.data != null) {
// category = (model.data as List)
// .map((e) => NewsCategoryModel.fromJson(e))
// .toList();
// }
// cancel();
// Get.to(
// () => PublicInfomationPage(models: category ?? []));
// },
// ),
HomeTitle( HomeTitle(
title: '社区活动', title: '社区活动',
suffixTitle: '查看全部', suffixTitle: '查看全部',

@ -2,13 +2,14 @@ import 'package:aku_new_community/const/resource.dart';
import 'package:aku_new_community/constants/api.dart'; import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/model/common/img_model.dart'; import 'package:aku_new_community/model/common/img_model.dart';
import 'package:aku_new_community/model/community/activity_item_model.dart'; import 'package:aku_new_community/model/community/activity_item_model.dart';
import 'package:aku_new_community/ui/community/activity/activity_detail_page.dart';
import 'package:aku_new_community/utils/headers.dart'; import 'package:aku_new_community/utils/headers.dart';
import 'package:flustars/flustars.dart'; import 'package:flustars/flustars.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
import 'activity_detail_page_old.dart';
class ActivityCard extends StatelessWidget { class ActivityCard extends StatelessWidget {
final ActivityItemModel? model; final ActivityItemModel? model;

@ -1,208 +1,259 @@
import 'package:aku_new_community/const/resource.dart'; import 'package:aku_new_community/gen/assets.gen.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/utils/headers.dart'; import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/utils/network/base_model.dart'; import 'package:aku_new_community/widget/bee_divider.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/bee_scaffold.dart';
import 'package:aku_new_community/widget/buttons/bottom_button.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/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:flustars/flustars.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.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:get/get.dart'; import 'package:get/get.dart';
import 'package:shimmer/shimmer.dart'; import 'package:velocity_x/velocity_x.dart';
class ActivityDetailPage extends StatefulWidget { class ActivityDetailPage extends StatefulWidget {
final int? id; const ActivityDetailPage({Key? key}) : super(key: key);
ActivityDetailPage({Key? key, required this.id}) : super(key: key);
@override @override
_ActivityDetailPageState createState() => _ActivityDetailPageState(); _ActivityDetailPageState createState() => _ActivityDetailPageState();
} }
class _ActivityDetailPageState extends State<ActivityDetailPage> { 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var content = Container(
width: double.infinity,
padding: EdgeInsets.all(32.w),
child: Column(
children: [
'活动详情'.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(
0,
(index) => Container(
width: 686.w,
height: 432.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
),
child: Image.network(
'',
fit: BoxFit.fill,
),
)),
],
),
);
return BeeScaffold( return BeeScaffold(
title: '活动详情', title: '活动详情',
systemStyle: SystemStyle.yellowBottomBar, body: ListView(
body: EasyRefresh( children: [
header: MaterialHeader(), _headWidget(),
onRefresh: () async { 24.w.heightBox,
BaseModel baseModel = await NetUtil().get( content,
API.community.activityDetail, 24.w.heightBox,
params: {'activityId': widget.id}, Container(
); width: double.infinity,
model = ActivityDetailModel.fromJson(baseModel.data); padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 16.w),
setState(() {}); height: 132.w,
}, child: Row(
controller: _refreshController, children: [
firstRefresh: true, CircleAvatar(
emptyWidget: model == null ? emptyWidget : null, child: FadeInImage.assetNetwork(
child: model == null placeholder: Assets.images.placeholder.path,
? SizedBox() image: '',
: 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( ),
'结束时间', 20.w.widthBox,
DateUtil.formatDate( Column(
model!.endDate, children: [
format: 'yyyy年MM月dd日 HH:mm', '印象物业'.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()
],
),
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: () {},
),
);
}
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: [
'人才公寓党政建设讲座系列活动——庆祝中国共产党建党71周年活动'
.text
.size(32.sp)
.color(Colors.black.withOpacity(0.85))
.maxLines(3)
.bold
.make(),
32.w.heightBox,
Container(
width: 104.w,
height: 42.w,
decoration: BoxDecoration(
color: Color(0xFFFEC076).withOpacity(0.5),
borderRadius: BorderRadius.circular(10.w)),
alignment: Alignment.center,
child:
'报名中'.text.size(24.sp).color(Color(0xFFF481170)).make(),
),
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,
],
),
);
Get.bottomSheet(
bottomSheet,
);
})
.size(28.sp)
.make(),
Spacer(),
],
), ),
_buildTile('地 点', model!.location!), ),
_buildTile('参与人数', '不限'), Padding(
_buildTile( padding: EdgeInsets.symmetric(horizontal: 32.w),
'报名截止', child: Row(
DateUtil.formatDate( children: [
model!.registEndDate, '活动费用'.text.size(28.sp).make().box.width(136.w).make(),
format: 'yyyy年MM月dd日 HH:mm', '免费'.richText.size(28.sp).make(),
), Spacer(),
],
), ),
115.hb, ),
Container( 32.w.heightBox,
height: 24.w, Padding(
color: Color(0xFFF9F9F9), 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(),
],
), ),
MaterialButton( ),
height: 92.w, 32.w.heightBox,
onPressed: () => BeeDivider.horizontal(
Get.to(() => ActivityPeopleListPage(id: widget.id)), indent: 32.w,
endIndent: 32.w,
),
InkWell(
onTap: () {},
child: Container(
padding: EdgeInsets.only(
left: 32.w, right: 32.w, top: 16.w, bottom: 24.w),
child: Row( child: Row(
children: [ children: [
StackAvatar( StackAvatar(
avatars: avatars: [],
model!.headImgURls!.map((e) => e.url).toList(),
), ),
Spacer(), 16.w.heightBox,
'已有${model!.countRegistration}人参加' '200'
.text .richText
.size(28.sp) .withTextSpanChildren(
['/1000人参与'.textSpan.size(24.sp).black.make()])
.color(Colors.blueAccent)
.size(24.sp)
.make(), .make(),
16.wb, Spacer(),
Icon( Icon(
CupertinoIcons.chevron_forward, CupertinoIcons.chevron_right,
size: 30.w, size: 40.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(),
), ),
),
],
),
); );
} }
_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(),
),
);
}
}

@ -6,6 +6,9 @@ import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart'; import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'activity_detail_page_old.dart';
class ActivityListPage extends StatefulWidget { class ActivityListPage extends StatefulWidget {
ActivityListPage({Key? key}) : super(key: key); ActivityListPage({Key? key}) : super(key: key);
@ -27,6 +30,13 @@ class _ActivityListPageState extends State<ActivityListPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BeeScaffold( return BeeScaffold(
title: '往期精彩', title: '往期精彩',
actions: [
IconButton(
onPressed: () {
Get.to(() => ActivityDetailPage(id: 0));
},
icon: Icon(Icons.delete))
],
body: BeeListView<ActivityItemModel>( body: BeeListView<ActivityItemModel>(
controller: _refreshController, controller: _refreshController,
path: API.community.activityList, path: API.community.activityList,

@ -5,7 +5,7 @@ import 'package:aku_new_community/model/common/img_model.dart';
import 'package:aku_new_community/model/community/activity_item_model.dart'; import 'package:aku_new_community/model/community/activity_item_model.dart';
import 'package:aku_new_community/model/community/community_topic_model.dart'; import 'package:aku_new_community/model/community/community_topic_model.dart';
import 'package:aku_new_community/models/search/search_model.dart'; import 'package:aku_new_community/models/search/search_model.dart';
import 'package:aku_new_community/ui/community/activity/activity_detail_page.dart'; import 'package:aku_new_community/ui/community/activity/activity_detail_page_old.dart';
import 'package:aku_new_community/ui/community/community_views/topic/topic_detail_page.dart'; import 'package:aku_new_community/ui/community/community_views/topic/topic_detail_page.dart';
import 'package:aku_new_community/utils/headers.dart'; import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/utils/login_util.dart'; import 'package:aku_new_community/utils/login_util.dart';

Loading…
Cancel
Save