notice page

activity page
home refactor
hmxc
小赖 4 years ago
parent 616797033f
commit 532a83674f

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

@ -122,6 +122,9 @@ class R {
/// ![preview](file:///Users/akufe/Documents/akuCommunity/assets/icons/consult.png)
static const String ASSETS_ICONS_CONSULT_PNG = 'assets/icons/consult.png';
/// ![preview](file:///Users/akufe/Documents/akuCommunity/assets/icons/file.png)
static const String ASSETS_ICONS_FILE_PNG = 'assets/icons/file.png';
/// ![preview](file:///Users/akufe/Documents/akuCommunity/assets/icons/groupbuy_tab_selected.png)
static const String ASSETS_ICONS_GROUPBUY_TAB_SELECTED_PNG =
'assets/icons/groupbuy_tab_selected.png';

@ -129,6 +129,12 @@ class _Community {
///
String get activityPeopleList => '/user/activity/participantsList';
///
String get boardList => '/user/announcement/list';
///id
String get boardDetail => '/user/announcement/findById';
}
class _Upload {

@ -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;
}
}

@ -3,6 +3,7 @@ import 'dart:async';
import 'dart:convert';
// Flutter imports:
import 'package:akuCommunity/model/community/board_model.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -28,8 +29,8 @@ import 'package:akuCommunity/pages/things_page/fixed_submit_page.dart';
import 'package:akuCommunity/pages/total_application_page/total_applications_page.dart';
import 'package:akuCommunity/pages/visitor_access_page/visitor_access_page.dart';
import 'package:akuCommunity/service/base_model.dart';
import 'package:akuCommunity/ui/community/activity_card.dart';
import 'package:akuCommunity/ui/community/activity_list_page.dart';
import 'package:akuCommunity/ui/community/activity/activity_card.dart';
import 'package:akuCommunity/ui/community/activity/activity_list_page.dart';
import 'package:akuCommunity/ui/community/community_func.dart';
import 'package:akuCommunity/ui/home/home_notification.dart';
import 'package:akuCommunity/ui/home/home_title.dart';
@ -61,7 +62,8 @@ class _HomePageState extends State<HomePage>
int page = 1;
ActivityItemModel model;
ActivityItemModel _activityItemModel;
List<BoardItemModel> _boardItemModels = [];
List<GridButton> _gridList = [
GridButton('一键开门', R.ASSETS_ICONS_TOOL_YJKM_PNG, OpenDoorPage().to),
@ -142,7 +144,8 @@ class _HomePageState extends State<HomePage>
header: MaterialHeader(),
firstRefresh: true,
onRefresh: () async {
model = await CommunityFunc.activity();
_activityItemModel = await CommunityFunc.activity();
_boardItemModels = await CommunityFunc.board();
setState(() {});
},
child: CustomScrollView(
@ -204,15 +207,16 @@ class _HomePageState extends State<HomePage>
SliverToBoxAdapter(
child: Column(
children: [
HomeNotification(),
HomeNotification(items: _boardItemModels),
HomeTitle(
title: '社区活动',
suffixTitle: '更多活动',
onTap: ActivityListPage().to,
),
model == null
_activityItemModel == null
? SizedBox()
: ActivityCard(model: model).pSymmetric(h: 24.w, v: 24.w),
: ActivityCard(model: _activityItemModel)
.pSymmetric(h: 24.w, v: 24.w),
],
)
.box

@ -1,163 +0,0 @@
// Flutter imports:
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
// Package imports:
import 'package:flutter_html/flutter_html.dart';
// Project imports:
import 'package:akuCommunity/routers/page_routers.dart';
import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:akuCommunity/widget/cached_image_wrapper.dart';
const htmlData = '''
<p>
1
5<br /><br /><br />
1<br />
<br />
24
<br />
<br />
5<br /><br /><br />
APP
线
<br />
使
<br />
<br />
<br />
<br />
</p>
''';
class NoticePage extends StatelessWidget {
final Bundle bundle;
NoticePage({Key key,this.bundle}) : super(key: key);
Widget _creater() {
return Container(
child: Row(
children: [
Container(
margin: EdgeInsets.only(right: 12.w),
child: ClipOval(
child: CachedImageWrapper(
url:
'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1380335538,732392216&fm=26&gp=0.jpg',
width: 45.w,
height: 45.w,
),
),
),
RichText(
text: TextSpan(
children: <InlineSpan>[
TextSpan(
text: '管理员 ',
style: TextStyle(
fontSize: 24.sp,
color: Color(0xff999999),
),
),
TextSpan(
text: ' 发布于 ',
style: TextStyle(
fontSize: 24.sp,
color: Color(0xff666666),
),
),
TextSpan(
text: '2020-08-12',
style: TextStyle(
fontSize: 24.sp,
color: Color(0xff999999),
),
),
],
),
),
],
),
);
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '社区公告',
body: Stack(
children: [
Container(
color: Colors.white,
child: ListView(
padding: EdgeInsets.only(
top: 26.w,
left: 32.w,
right: 32.w,
bottom: 60.w),
children: [
Text(
bundle.getMap('details')['title'],
style: TextStyle(
fontSize: 32.sp,
color: Color(0xff333333),
fontWeight: FontWeight.w600,),
),
Container(
margin: EdgeInsets.only(top: 45.w),
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(6)),
child: CachedImageWrapper(
url: bundle.getMap('details')['imagePath'],
width: 686.w,
height: 228.w,
),
),
),
Container(
margin: EdgeInsets.only(top: 44.w),
width: 647.w,
child: Html(data: htmlData),
),
_creater(),
],
),
),
],
),
);
}
}

@ -1,4 +1,5 @@
// Flutter imports:
import 'package:akuCommunity/ui/community/notice/notice_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -15,7 +16,6 @@ import 'package:akuCommunity/pages/fitup_manage/fitup_manage_page.dart';
import 'package:akuCommunity/pages/goods_deto_page/goods_deto_page.dart';
import 'package:akuCommunity/pages/industry_committee/industry_committee_page.dart';
import 'package:akuCommunity/pages/life_pay/life_pay_page.dart';
import 'package:akuCommunity/pages/notice_page/notice_page.dart';
import 'package:akuCommunity/pages/open_door_page/open_door_page.dart';
import 'package:akuCommunity/pages/opening_code_page/opening_code_page.dart';
import 'package:akuCommunity/pages/questionnaire_page/questionnaire_page.dart';
@ -30,10 +30,10 @@ import 'package:akuCommunity/widget/circle_trend.dart';
import 'package:akuCommunity/widget/container_comment.dart';
import 'package:akuCommunity/widget/grid_buttons.dart';
import 'package:akuCommunity/widget/single_ad_space.dart';
import 'widget/property_activity_card.dart';
import 'widget/property_bar.dart';
import 'widget/property_card.dart';
//TODO CLEAN BOTTOM CODES.
@Deprecated("sh*t property_index need to be cleaned.")
class PropertyIndex extends StatefulWidget {
PropertyIndex({Key key}) : super(key: key);
@ -41,6 +41,8 @@ class PropertyIndex extends StatefulWidget {
_PropertyIndexState createState() => _PropertyIndexState();
}
//TODO CLEAN BOTTOM CODES.
@Deprecated("sh*t property_index need to be cleaned.")
class _PropertyIndexState extends State<PropertyIndex>
with AutomaticKeepAliveClientMixin, SingleTickerProviderStateMixin {
List<GridButton> _gridList = [
@ -167,10 +169,7 @@ class _PropertyIndexState extends State<PropertyIndex>
}
void noticeRouter(String theme, imagePath) {
NoticePage(
bundle: Bundle()
..putMap('details', {'title': theme, 'imagePath': imagePath}),
).to;
NoticePage().to;
}
@override
@ -212,19 +211,19 @@ class _PropertyIndexState extends State<PropertyIndex>
SliverToBoxAdapter(
child: PropertyCard(),
),
PropertyBar(
title: '社区活动',
subtitle: '精彩往期',
more: '更多活动',
fun: activityRouter,
),
SliverToBoxAdapter(
child: PropertyActivityCard(fun: activityDetailsRouter),
),
PropertyBar(
title: '社区公告',
subtitle: '看看小区最近发生什么?',
),
// PropertyBar(
// title: '社区活动',
// subtitle: '精彩往期',
// more: '更多活动',
// fun: activityRouter,
// ),
// SliverToBoxAdapter(
// child: PropertyActivityCard(fun: activityDetailsRouter),
// ),
// PropertyBar(
// title: '社区公告',
// subtitle: '看看小区最近发生什么?',
// ),
SliverToBoxAdapter(
child: ListView.builder(
shrinkWrap: true,

@ -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(),
],
),
],
),
),
),
);
}
}

@ -62,10 +62,10 @@ class BeeListView<T> extends StatefulWidget {
final Map<String, dynamic> extraParams;
BeeListView({
Key key,
this.path,
@required this.path,
@required this.controller,
this.convert,
this.builder,
@required this.convert,
@required this.builder,
this.size = 10,
this.extraParams,
}) : super(key: key);

@ -10,7 +10,7 @@ import 'package:akuCommunity/const/resource.dart';
import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/model/common/img_model.dart';
import 'package:akuCommunity/model/community/activity_item_model.dart';
import 'package:akuCommunity/ui/community/activity_detail_page.dart';
import 'package:akuCommunity/ui/community/activity/activity_detail_page.dart';
import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/widget/others/stack_avatar.dart';

@ -12,7 +12,7 @@ import 'package:shimmer/shimmer.dart';
import 'package:akuCommunity/const/resource.dart';
import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/model/community/activity_detail_model.dart';
import 'package:akuCommunity/ui/community/activity_people_list_page.dart';
import 'package:akuCommunity/ui/community/activity/activity_people_list_page.dart';
import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/utils/network/base_model.dart';
import 'package:akuCommunity/utils/network/net_util.dart';

@ -8,7 +8,7 @@ import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/model/community/activity_item_model.dart';
import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart';
import 'package:akuCommunity/ui/community/activity_card.dart';
import 'package:akuCommunity/ui/community/activity/activity_card.dart';
import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart';

@ -1,6 +1,7 @@
// Project imports:
import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/model/community/activity_item_model.dart';
import 'package:akuCommunity/model/community/board_model.dart';
import 'package:akuCommunity/utils/network/base_list_model.dart';
import 'package:akuCommunity/utils/network/net_util.dart';
@ -13,4 +14,13 @@ class CommunityFunc {
if (model.tableList.length == 0) return null;
return ActivityItemModel.fromJson(model.tableList.first);
}
static Future<List<BoardItemModel>> board() async {
BaseListModel model = await NetUtil().getList(
API.community.boardList,
params: {'pageNum': 1, 'size': 5},
);
if (model.tableList.length == 0) return [];
return model.tableList.map((e) => BoardItemModel.fromJson(e)).toList();
}
}

@ -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,
);
},
),
);
}
}

@ -1,4 +1,9 @@
// Flutter imports:
import 'dart:async';
import 'dart:math';
import 'package:akuCommunity/model/community/board_model.dart';
import 'package:akuCommunity/ui/community/notice/notice_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -10,13 +15,35 @@ import 'package:akuCommunity/const/resource.dart';
import 'package:akuCommunity/utils/headers.dart';
class HomeNotification extends StatefulWidget {
HomeNotification({Key key}) : super(key: key);
final List<BoardItemModel> items;
HomeNotification({Key key, @required this.items}) : super(key: key);
@override
_HomeNotificationState createState() => _HomeNotificationState();
}
class _HomeNotificationState extends State<HomeNotification> {
String get randomItem {
if (widget.items.isEmpty) return '';
int index = Random().nextInt(widget.items.length - 1);
return widget.items[index].title ?? '';
}
Timer _timer;
@override
void initState() {
super.initState();
_timer = Timer.periodic(
Duration(milliseconds: 5000), (timer) => setState(() {}));
}
@override
void dispose() {
_timer?.cancel();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Row(
@ -29,12 +56,25 @@ class _HomeNotificationState extends State<HomeNotification> {
width: 40.w,
),
24.wb,
'TTTTTTTTT'.text.size(28.sp).make(),
Spacer(),
widget.items.isEmpty
? Spacer()
: GestureDetector(
onTap: () {},
child: AnimatedSwitcher(
duration: Duration(milliseconds: 1000),
child: Align(
alignment: Alignment.centerLeft,
key: ValueKey(randomItem),
child: Text(randomItem),
),
),
).expand(),
MaterialButton(
shape: StadiumBorder(),
padding: EdgeInsets.symmetric(horizontal: 12.w),
onPressed: () {},
onPressed: () {
NoticePage().to();
},
child: Row(
children: [
'更多公告'.text.size(20.sp).color(Color(0xFF999999)).make(),

Loading…
Cancel
Save