parent
616797033f
commit
532a83674f
After Width: | Height: | Size: 1.9 KiB |
@ -0,0 +1,49 @@
|
|||||||
|
import 'package:akuCommunity/model/common/img_model.dart';
|
||||||
|
|
||||||
|
class BoardDetailModel {
|
||||||
|
int id;
|
||||||
|
String title;
|
||||||
|
String content;
|
||||||
|
String fileDocUrl;
|
||||||
|
String fileDocName;
|
||||||
|
String releaseTime;
|
||||||
|
List<ImgModel> imgUrls;
|
||||||
|
|
||||||
|
BoardDetailModel(
|
||||||
|
{this.id,
|
||||||
|
this.title,
|
||||||
|
this.content,
|
||||||
|
this.fileDocUrl,
|
||||||
|
this.fileDocName,
|
||||||
|
this.releaseTime,
|
||||||
|
this.imgUrls});
|
||||||
|
|
||||||
|
BoardDetailModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
id = json['id'];
|
||||||
|
title = json['title'];
|
||||||
|
content = json['content'];
|
||||||
|
fileDocUrl = json['fileDocUrl'];
|
||||||
|
fileDocName = json['fileDocName'];
|
||||||
|
releaseTime = json['releaseTime'];
|
||||||
|
if (json['imgUrls'] != null) {
|
||||||
|
imgUrls = new List<ImgModel>();
|
||||||
|
json['imgUrls'].forEach((v) {
|
||||||
|
imgUrls.add(new ImgModel.fromJson(v));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['id'] = this.id;
|
||||||
|
data['title'] = this.title;
|
||||||
|
data['content'] = this.content;
|
||||||
|
data['fileDocUrl'] = this.fileDocUrl;
|
||||||
|
data['fileDocName'] = this.fileDocName;
|
||||||
|
data['releaseTime'] = this.releaseTime;
|
||||||
|
if (this.imgUrls != null) {
|
||||||
|
data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
import 'package:akuCommunity/model/common/img_model.dart';
|
||||||
|
import 'package:flustars/flustars.dart';
|
||||||
|
|
||||||
|
class BoardItemModel {
|
||||||
|
int id;
|
||||||
|
String title;
|
||||||
|
String releaseTime;
|
||||||
|
List<ImgModel> imgUrls;
|
||||||
|
|
||||||
|
DateTime get releaseDate => DateUtil.getDateTime(releaseTime);
|
||||||
|
|
||||||
|
BoardItemModel({this.id, this.title, this.releaseTime, this.imgUrls});
|
||||||
|
|
||||||
|
BoardItemModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
id = json['id'];
|
||||||
|
title = json['title'];
|
||||||
|
releaseTime = json['releaseTime'];
|
||||||
|
if (json['imgUrls'] != null) {
|
||||||
|
imgUrls = new List<ImgModel>();
|
||||||
|
json['imgUrls'].forEach((v) {
|
||||||
|
imgUrls.add(new ImgModel.fromJson(v));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['id'] = this.id;
|
||||||
|
data['title'] = this.title;
|
||||||
|
data['releaseTime'] = this.releaseTime;
|
||||||
|
if (this.imgUrls != null) {
|
||||||
|
data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
@ -1,203 +0,0 @@
|
|||||||
// Flutter imports:
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
// Package imports:
|
|
||||||
import 'package:image_stack/image_stack.dart';
|
|
||||||
|
|
||||||
// Project imports:
|
|
||||||
import 'package:akuCommunity/utils/headers.dart';
|
|
||||||
import 'package:akuCommunity/widget/cached_image_wrapper.dart';
|
|
||||||
|
|
||||||
class PropertyActivityCard extends StatelessWidget {
|
|
||||||
final Function fun;
|
|
||||||
PropertyActivityCard({Key key, this.fun}) : super(key: key);
|
|
||||||
|
|
||||||
final List<String> 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",
|
|
||||||
];
|
|
||||||
|
|
||||||
final List<Map<String, dynamic>> _listView = [
|
|
||||||
{
|
|
||||||
'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',
|
|
||||||
'peopleNum': '37',
|
|
||||||
'isOver': false,
|
|
||||||
'isVote': false,
|
|
||||||
'isVoteOver': false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'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',
|
|
||||||
'peopleNum': '37',
|
|
||||||
'isOver': false,
|
|
||||||
'isVote': false,
|
|
||||||
'isVoteOver': false
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
TextStyle _textStyleTitle() {
|
|
||||||
return TextStyle(fontSize: 28.sp, color: Color(0xff4a4b51));
|
|
||||||
}
|
|
||||||
|
|
||||||
TextStyle _textStyleTag() {
|
|
||||||
return TextStyle(fontSize: 24.sp, color: Color(0xff999999));
|
|
||||||
}
|
|
||||||
|
|
||||||
TextStyle _textStyleSubtitle() {
|
|
||||||
return TextStyle(fontSize: 24.sp, color: Color(0xff4a4b51));
|
|
||||||
}
|
|
||||||
|
|
||||||
Container _activityCard(String imagePath, title, subtitleFirst,
|
|
||||||
subtitleSecond, peopleNum, bool isOver, isVote, isVoteOver, int index) {
|
|
||||||
return Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(8)),
|
|
||||||
),
|
|
||||||
margin: EdgeInsets.only(
|
|
||||||
top: index == 0 ? 0 : 32.w,
|
|
||||||
left: 32.w,
|
|
||||||
right: 32.w,
|
|
||||||
),
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
top: 12.w,
|
|
||||||
left: 10.w,
|
|
||||||
right: 22.w,
|
|
||||||
bottom: 20.w),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
margin: EdgeInsets.only(right: 20.w),
|
|
||||||
child: ClipRRect(
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(6)),
|
|
||||||
child: CachedImageWrapper(
|
|
||||||
url: imagePath,
|
|
||||||
width: 160.w,
|
|
||||||
height: 120.w,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
margin: EdgeInsets.only(bottom: 6.w),
|
|
||||||
child: Text(
|
|
||||||
title,
|
|
||||||
style: _textStyleTitle(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
margin: EdgeInsets.only(bottom: 8.w),
|
|
||||||
child: RichText(
|
|
||||||
text: TextSpan(
|
|
||||||
text: '地点:',
|
|
||||||
style: _textStyleTag(),
|
|
||||||
children: [
|
|
||||||
TextSpan(
|
|
||||||
text: subtitleFirst, style: _textStyleSubtitle()),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
RichText(
|
|
||||||
text: TextSpan(
|
|
||||||
text: '活动时间:',
|
|
||||||
style: _textStyleTag(),
|
|
||||||
children: [
|
|
||||||
TextSpan(
|
|
||||||
text: subtitleSecond, style: _textStyleSubtitle()),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SizedBox(height: 40.w),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
margin: EdgeInsets.only(left: 80.w),
|
|
||||||
child: ImageStack(
|
|
||||||
imageList: images,
|
|
||||||
imageRadius: 44.sp,
|
|
||||||
imageCount: 3,
|
|
||||||
imageBorderWidth: 1,
|
|
||||||
totalCount: 3,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(width: 26.w),
|
|
||||||
Text(
|
|
||||||
'$peopleNum人已参加',
|
|
||||||
style: _textStyleSubtitle(),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
InkWell(
|
|
||||||
onTap: () {
|
|
||||||
fun(imagePath, title, isOver, isVote, isVoteOver, images);
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
height: 44.w,
|
|
||||||
width: 120.w,
|
|
||||||
padding: EdgeInsets.symmetric(
|
|
||||||
vertical: 7.w,
|
|
||||||
),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Color(0xffffc40c),
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(22)),
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
'去参与',
|
|
||||||
style: _textStyleSubtitle(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Container(
|
|
||||||
child: Column(
|
|
||||||
children: _listView
|
|
||||||
.asMap()
|
|
||||||
.keys
|
|
||||||
.map((index) => _activityCard(
|
|
||||||
_listView[index]['imagePath'],
|
|
||||||
_listView[index]['title'],
|
|
||||||
_listView[index]['subtitleFirst'],
|
|
||||||
_listView[index]['subtitleSecond'],
|
|
||||||
_listView[index]['peopleNum'],
|
|
||||||
_listView[index]['isOver'],
|
|
||||||
_listView[index]['isVote'],
|
|
||||||
_listView[index]['isVoteOver'],
|
|
||||||
index,
|
|
||||||
))
|
|
||||||
.toList(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,84 +0,0 @@
|
|||||||
// Flutter imports:
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
// Package imports:
|
|
||||||
import 'package:flutter_icons/flutter_icons.dart';
|
|
||||||
|
|
||||||
// Project imports:
|
|
||||||
import 'package:akuCommunity/utils/headers.dart';
|
|
||||||
import 'package:akuCommunity/widget/sliver_app_bar_delegate.dart';
|
|
||||||
|
|
||||||
class PropertyBar extends StatelessWidget {
|
|
||||||
final String title;
|
|
||||||
final String subtitle;
|
|
||||||
final String more;
|
|
||||||
final Function fun;
|
|
||||||
PropertyBar({Key key, this.title, this.subtitle, this.more,this.fun})
|
|
||||||
: super(key: key);
|
|
||||||
|
|
||||||
TextStyle _textStyleTitle() {
|
|
||||||
return TextStyle(
|
|
||||||
fontSize: 36.sp,
|
|
||||||
color: Color(0xff333333),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
TextStyle _textStyleSubtitle() {
|
|
||||||
return TextStyle(
|
|
||||||
fontSize: 24.sp,
|
|
||||||
color: Color(0xff999999),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return SliverPersistentHeader(
|
|
||||||
// pinned: true, //是否固定在顶部
|
|
||||||
// floating: true,
|
|
||||||
delegate: SliverAppBarDelegate(
|
|
||||||
minHeight: 93,
|
|
||||||
maxHeight: 93,
|
|
||||||
child: Container(
|
|
||||||
margin: EdgeInsets.only(
|
|
||||||
top: 40.w,
|
|
||||||
bottom: 32.w,
|
|
||||||
left: 32.w,
|
|
||||||
right: 32.w,
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(title, style: _textStyleTitle()),
|
|
||||||
SizedBox(height: 10.w),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Text(subtitle, style: _textStyleSubtitle()),
|
|
||||||
more != null
|
|
||||||
? InkWell(
|
|
||||||
onTap: () {
|
|
||||||
fun();
|
|
||||||
},
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Text(more, style: _textStyleSubtitle()),
|
|
||||||
SizedBox(width: 12.w),
|
|
||||||
Icon(
|
|
||||||
AntDesign.right,
|
|
||||||
color: Color(0xff999999),
|
|
||||||
size: 20.sp,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: SizedBox(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,116 @@
|
|||||||
|
import 'package:akuCommunity/const/resource.dart';
|
||||||
|
import 'package:akuCommunity/constants/api.dart';
|
||||||
|
import 'package:akuCommunity/ui/community/notice/notice_detail_page.dart';
|
||||||
|
import 'package:akuCommunity/utils/headers.dart';
|
||||||
|
import 'package:akuCommunity/model/community/board_model.dart';
|
||||||
|
import 'package:akuCommunity/widget/picker/bee_image_preview.dart';
|
||||||
|
import 'package:flustars/flustars.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:velocity_x/velocity_x.dart';
|
||||||
|
|
||||||
|
class NoticeCard extends StatelessWidget {
|
||||||
|
final BoardItemModel model;
|
||||||
|
final BoardItemModel preModel;
|
||||||
|
const NoticeCard({
|
||||||
|
Key key,
|
||||||
|
@required this.model,
|
||||||
|
@required this.preModel,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
bool get sameDay =>
|
||||||
|
model.releaseDate.year == (preModel?.releaseDate?.year ?? 0) &&
|
||||||
|
model.releaseDate.month == (preModel?.releaseDate?.month ?? 0) &&
|
||||||
|
model.releaseDate.day == (preModel?.releaseDate?.day ?? 0);
|
||||||
|
|
||||||
|
bool get isYesterday {
|
||||||
|
DateTime now = DateTime.now();
|
||||||
|
DateTime yestoday = DateTime(now.year, now.month, now.day - 1);
|
||||||
|
return yestoday.year == model.releaseDate.year &&
|
||||||
|
yestoday.month == model.releaseDate.month &&
|
||||||
|
yestoday.day == model.releaseDate.day;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool get isFirst => preModel == null;
|
||||||
|
|
||||||
|
bool get notSameYear =>
|
||||||
|
model.releaseDate.year != (preModel?.releaseDate?.year ?? 0);
|
||||||
|
|
||||||
|
Widget title() {
|
||||||
|
if (DateUtil.isToday(model.releaseDate.millisecond))
|
||||||
|
return '今天'.text.size(52.sp).bold.make();
|
||||||
|
if (isYesterday)
|
||||||
|
return '昨天'.text.size(52.sp).bold.make();
|
||||||
|
else
|
||||||
|
return Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
model.releaseDate.day.toString().text.size(52.sp).bold.make(),
|
||||||
|
'${model.releaseDate.month}月'.text.size(36.sp).make(),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
(notSameYear && model.releaseDate.year != DateTime.now().year)
|
||||||
|
? '${model.releaseDate.year}年'
|
||||||
|
.text
|
||||||
|
.bold
|
||||||
|
.size(52.sp)
|
||||||
|
.make()
|
||||||
|
.paddingOnly(left: 32.w, top: isFirst ? 0 : 64.w, bottom: 32.w)
|
||||||
|
: SizedBox(),
|
||||||
|
MaterialButton(
|
||||||
|
onPressed: () {
|
||||||
|
Get.to(NoticeDetailPage(id: model.id));
|
||||||
|
},
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 200.w,
|
||||||
|
padding: EdgeInsets.only(left: 32.w),
|
||||||
|
alignment: Alignment.topLeft,
|
||||||
|
child: sameDay ? SizedBox() : title(),
|
||||||
|
),
|
||||||
|
model.imgUrls.length == 0
|
||||||
|
? SizedBox(height: 152.w)
|
||||||
|
: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
Get.to(
|
||||||
|
BeeImagePreview.path(path: model.imgUrls.first.url),
|
||||||
|
opaque: false,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Hero(
|
||||||
|
tag: model.imgUrls.first.url,
|
||||||
|
child: Container(
|
||||||
|
clipBehavior: Clip.antiAlias,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.black12,
|
||||||
|
borderRadius: BorderRadius.circular(8.w),
|
||||||
|
),
|
||||||
|
child: FadeInImage.assetNetwork(
|
||||||
|
placeholder: R.ASSETS_IMAGES_LOGO_PNG,
|
||||||
|
image: API.image(model.imgUrls.first.url),
|
||||||
|
width: 152.w,
|
||||||
|
height: 152.w,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
10.wb,
|
||||||
|
model.title.text.make().expand(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,119 @@
|
|||||||
|
import 'package:akuCommunity/const/resource.dart';
|
||||||
|
import 'package:akuCommunity/utils/headers.dart';
|
||||||
|
import 'package:akuCommunity/constants/api.dart';
|
||||||
|
import 'package:akuCommunity/model/community/board_detail_model.dart';
|
||||||
|
import 'package:akuCommunity/utils/network/base_model.dart';
|
||||||
|
import 'package:akuCommunity/utils/network/net_util.dart';
|
||||||
|
import 'package:akuCommunity/widget/bee_scaffold.dart';
|
||||||
|
import 'package:akuCommunity/widget/picker/bee_image_preview.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:velocity_x/velocity_x.dart';
|
||||||
|
|
||||||
|
class NoticeDetailPage extends StatefulWidget {
|
||||||
|
final int id;
|
||||||
|
NoticeDetailPage({Key key, @required this.id}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_NoticeDetailPageState createState() => _NoticeDetailPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _NoticeDetailPageState extends State<NoticeDetailPage> {
|
||||||
|
EasyRefreshController _refreshController = EasyRefreshController();
|
||||||
|
BoardDetailModel model;
|
||||||
|
|
||||||
|
Widget get emptyWidget => Column(
|
||||||
|
children: [],
|
||||||
|
);
|
||||||
|
|
||||||
|
Widget docView(String title, String path) {
|
||||||
|
return Container(
|
||||||
|
margin: EdgeInsets.only(right: 113.w),
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: MaterialButton(
|
||||||
|
minWidth: 606.w,
|
||||||
|
height: 154.w,
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 32.w),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
title.text.size(32.sp).make().expand(),
|
||||||
|
Image.asset(
|
||||||
|
R.ASSETS_ICONS_FILE_PNG,
|
||||||
|
height: 52.w,
|
||||||
|
width: 52.w,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
onPressed: () {},
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(8.w),
|
||||||
|
side: BorderSide(color: Color(0xFFD4CFBE)),
|
||||||
|
),
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BeeScaffold(
|
||||||
|
title: '社区公告',
|
||||||
|
body: EasyRefresh(
|
||||||
|
controller: _refreshController,
|
||||||
|
header: MaterialHeader(),
|
||||||
|
onRefresh: () async {
|
||||||
|
BaseModel baseModel = await NetUtil().get(
|
||||||
|
API.community.boardDetail,
|
||||||
|
params: {'announcementId': widget.id},
|
||||||
|
);
|
||||||
|
model = BoardDetailModel.fromJson(baseModel.data);
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
firstRefresh: true,
|
||||||
|
firstRefreshWidget: emptyWidget,
|
||||||
|
child: model == null
|
||||||
|
? SizedBox()
|
||||||
|
: ListView(
|
||||||
|
padding: EdgeInsets.all(32.w),
|
||||||
|
children: [
|
||||||
|
model.title.text.size(32.sp).bold.make(),
|
||||||
|
50.hb,
|
||||||
|
...model.imgUrls
|
||||||
|
.map(
|
||||||
|
(e) => GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
Get.to(
|
||||||
|
BeeImagePreview.path(path: e.url),
|
||||||
|
opaque: false,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Hero(
|
||||||
|
tag: e.url,
|
||||||
|
child: Container(
|
||||||
|
height: 228.w,
|
||||||
|
clipBehavior: Clip.antiAlias,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(8.w),
|
||||||
|
color: Colors.black12,
|
||||||
|
),
|
||||||
|
child: FadeInImage.assetNetwork(
|
||||||
|
placeholder: R.ASSETS_IMAGES_LOGO_PNG,
|
||||||
|
image: API.image(e.url),
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
|
44.hb,
|
||||||
|
model.content.text.size(28.sp).make(),
|
||||||
|
43.hb,
|
||||||
|
docView(model.fileDocName, model.fileDocUrl),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
).material(color: Colors.white),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
import 'package:akuCommunity/ui/community/notice/notice_card.dart';
|
||||||
|
import 'package:akuCommunity/utils/headers.dart';
|
||||||
|
import 'package:akuCommunity/constants/api.dart';
|
||||||
|
import 'package:akuCommunity/model/community/board_model.dart';
|
||||||
|
import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart';
|
||||||
|
import 'package:akuCommunity/widget/bee_scaffold.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
||||||
|
|
||||||
|
class NoticePage extends StatefulWidget {
|
||||||
|
NoticePage({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_NoticePageState createState() => _NoticePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _NoticePageState extends State<NoticePage> {
|
||||||
|
EasyRefreshController _refreshController = EasyRefreshController();
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BeeScaffold(
|
||||||
|
title: '社区公告',
|
||||||
|
body: BeeListView(
|
||||||
|
controller: _refreshController,
|
||||||
|
path: API.community.boardList,
|
||||||
|
convert: (model) =>
|
||||||
|
model.tableList.map((e) => BoardItemModel.fromJson(e)).toList(),
|
||||||
|
builder: (items) {
|
||||||
|
return ListView.separated(
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 32.w),
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
final BoardItemModel model = items[index];
|
||||||
|
BoardItemModel preModel;
|
||||||
|
if (index >= 1) preModel = items[index - 1];
|
||||||
|
return NoticeCard(
|
||||||
|
model: model,
|
||||||
|
preModel: preModel,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
separatorBuilder: (_, __) => 8.hb,
|
||||||
|
itemCount: items.length,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue