You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
3.6 KiB

4 years ago
import 'package:flutter/material.dart';
import 'package:flustars/flustars.dart';
import 'package:get/get.dart';
4 years ago
import 'package:velocity_x/velocity_x.dart';
import 'package:aku_community/const/resource.dart';
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/model/common/img_model.dart';
import 'package:aku_community/model/community/activity_item_model.dart';
import 'package:aku_community/ui/community/activity/activity_detail_page.dart';
import 'package:aku_community/utils/headers.dart';
import 'package:aku_community/widget/others/stack_avatar.dart';
class ActivityCard extends StatelessWidget {
4 years ago
final ActivityItemModel? model;
const ActivityCard({
4 years ago
Key? key,
required this.model,
}) : super(key: key);
4 years ago
bool get outdate => model!.end!.compareTo(DateTime.now()) == -1;
Widget build(BuildContext context) {
return MaterialButton(
clipBehavior: Clip.antiAlias,
color: Colors.white,
padding: EdgeInsets.zero,
4 years ago
onPressed: () => Get.to(() => ActivityDetailPage(id: model!.id)),
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.w),
side: BorderSide(
color: Colors.grey,
),
),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
4 years ago
ImgModel.first(model!.imgUrls) == null
? SizedBox()
: Hero(
4 years ago
tag: ImgModel.first(model!.imgUrls),
child: Material(
color: Colors.grey,
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
4 years ago
image: API.image(ImgModel.first(model!.imgUrls)),
height: 210.w,
width: double.infinity,
fit: BoxFit.cover,
),
),
),
4 years ago
model!.title!.text
.size(28.sp)
.black
4 years ago
.bold
.make()
.pSymmetric(h: 24.w, v: 16.w),
[
'地 点:'.text.size(24.sp).color(Color(0xFF999999)).make(),
4 years ago
model!.location!.text.size(24.sp).make(),
].row().pSymmetric(h: 24.w),
6.hb,
[
'活动时间:'.text.size(24.sp).color(Color(0xFF999999)).make(),
'${DateUtil.formatDate(
4 years ago
model!.begin,
format: 'MM月dd日 HH:mm',
)}${DateUtil.formatDate(
4 years ago
model!.end,
format: 'MM月dd日 HH:mm',
)}'
.text
.size(24.sp)
.make(),
].row().pSymmetric(h: 24.w),
[
StackAvatar(
avatars: model!.headImgURls!.map((e) => e.url).toList()),
Spacer(),
MaterialButton(
elevation: 0,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
color: Color(0xFFFFC40C),
shape: StadiumBorder(),
height: 44.w,
minWidth: 120.w,
disabledColor: Color(0xFFABABAB),
onPressed: outdate
? null
: () {
4 years ago
Get.to(() => ActivityDetailPage(id: model!.id));
},
child: outdate
? '已结束'.text.size(20.sp).bold.make()
: '去看看'.text.size(20.sp).bold.make(),
),
].row().p(24.w),
],
),
);
}
}