公告和资讯

pull/1/head
张萌 3 years ago
parent b013c55984
commit c24905ea5f

@ -1,5 +1,6 @@
import 'package:aku_new_community/model/common/img_model.dart'; import 'package:aku_new_community/model/common/img_model.dart';
@Deprecated('弃用')
class HotNewsModel { class HotNewsModel {
int? id; int? id;
String? title; String? title;

@ -0,0 +1,16 @@
import 'package:json_annotation/json_annotation.dart';
part 'information_category_list_model.g.dart';
@JsonSerializable()
class InformationCategoryListModel {
final int id;
final String name;
factory InformationCategoryListModel.fromJson(Map<String, dynamic> json) =>
_$InformationCategoryListModelFromJson(json);
const InformationCategoryListModel({
required this.id,
required this.name,
});
}

@ -0,0 +1,14 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'information_category_list_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
InformationCategoryListModel _$InformationCategoryListModelFromJson(
Map<String, dynamic> json) =>
InformationCategoryListModel(
id: json['id'] as int,
name: json['name'] as String,
);

@ -0,0 +1,26 @@
import 'package:aku_new_community/model/common/img_model.dart';
import 'package:common_utils/common_utils.dart';
import 'package:json_annotation/json_annotation.dart';
part 'information_list_model.g.dart';
@JsonSerializable()
class InformationListModel {
final int id;
final String title;
final String content;
final int viewsNum;
final String createDate;
final List<ImgModel> imgList;
factory InformationListModel.fromJson(Map<String, dynamic> json) =>
_$InformationListModelFromJson(json);
DateTime? get createDateDT => DateUtil.getDateTime(createDate);
const InformationListModel({
required this.id,
required this.title,
required this.content,
required this.viewsNum,
required this.createDate,
required this.imgList,
});
}

@ -0,0 +1,20 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'information_list_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
InformationListModel _$InformationListModelFromJson(
Map<String, dynamic> json) =>
InformationListModel(
id: json['id'] as int,
title: json['title'] as String,
content: json['content'] as String,
viewsNum: json['viewsNum'] as int,
createDate: json['createDate'] as String,
imgList: (json['imgList'] as List<dynamic>)
.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
);

@ -0,0 +1,26 @@
import 'package:aku_new_community/model/common/img_model.dart';
import 'package:common_utils/common_utils.dart';
import 'package:json_annotation/json_annotation.dart';
part 'recommend_read_model.g.dart';
@JsonSerializable()
class RecommendReadModel {
final int id;
final String title;
final String content;
final int viewsNum;
final String createDate;
final List<ImgModel> imgList;
factory RecommendReadModel.fromJson(Map<String, dynamic> json) =>
_$RecommendReadModelFromJson(json);
DateTime? get createDateDT => DateUtil.getDateTime(createDate);
const RecommendReadModel({
required this.id,
required this.title,
required this.content,
required this.viewsNum,
required this.createDate,
required this.imgList,
});
}

@ -0,0 +1,19 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'recommend_read_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
RecommendReadModel _$RecommendReadModelFromJson(Map<String, dynamic> json) =>
RecommendReadModel(
id: json['id'] as int,
title: json['title'] as String,
content: json['content'] as String,
viewsNum: json['viewsNum'] as int,
createDate: json['createDate'] as String,
imgList: (json['imgList'] as List<dynamic>)
.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
);

@ -13,7 +13,10 @@ class HomeAnnounceModel {
final String createDate; final String createDate;
factory HomeAnnounceModel.fromJson(Map<String, dynamic> json) => factory HomeAnnounceModel.fromJson(Map<String, dynamic> json) =>
_$HomeAnnounceModelFromJson(json); _$HomeAnnounceModelFromJson(json);
DateTime? get createDateString => DateUtil.getDateTime(createDate); DateTime? get createDateDT => DateUtil.getDateTime(createDate);
int? get month => createDateDT?.month;
int? get year => createDateDT?.year;
const HomeAnnounceModel({ const HomeAnnounceModel({
required this.id, required this.id,
required this.title, required this.title,
@ -21,4 +24,20 @@ class HomeAnnounceModel {
required this.imgList, required this.imgList,
required this.createDate, required this.createDate,
}); });
HomeAnnounceModel copyWith({
int? id,
String? title,
String? content,
List<ImgModel>? imgList,
String? createDate,
}) {
return HomeAnnounceModel(
id: id ?? this.id,
title: title ?? this.title,
content: content ?? this.content,
imgList: imgList ?? this.imgList,
createDate: createDate ?? this.createDate,
);
}
} }

@ -0,0 +1,27 @@
import 'package:aku_new_community/model/common/img_model.dart';
import 'package:json_annotation/json_annotation.dart';
part 'thumbs_up_list_model.g.dart';
@JsonSerializable()
class ThumbsUpListModel {
final int id;
final int status;
final int sendId;
final String sendName;
final String sendDate;
final List<ImgModel> avatarImgList;
final List<ImgModel> dynamicImgList;
factory ThumbsUpListModel.fromJson(Map<String, dynamic> json) =>
_$ThumbsUpListModelFromJson(json);
const ThumbsUpListModel({
required this.id,
required this.status,
required this.sendId,
required this.sendName,
required this.sendDate,
required this.avatarImgList,
required this.dynamicImgList,
});
}

@ -0,0 +1,22 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'thumbs_up_list_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
ThumbsUpListModel _$ThumbsUpListModelFromJson(Map<String, dynamic> json) =>
ThumbsUpListModel(
id: json['id'] as int,
status: json['status'] as int,
sendId: json['sendId'] as int,
sendName: json['sendName'] as String,
sendDate: json['sendDate'] as String,
avatarImgList: (json['avatarImgList'] as List<dynamic>)
.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
dynamicImgList: (json['dynamicImgList'] as List<dynamic>)
.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
);

@ -1,22 +1,25 @@
import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/extensions/widget_list_ext.dart';
import 'package:aku_new_community/models/home/home_announce_model.dart';
import 'package:aku_new_community/pages/message_center_page/announce/announce_view.dart';
import 'package:aku_new_community/ui/community/notice/notice_detail_page.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/extensions/widget_list_ext.dart';
import 'package:aku_new_community/models/message/announce_list_model.dart';
import 'package:aku_new_community/pages/message_center_page/announce/announce_view.dart';
class AnnounceCard extends StatelessWidget { class AnnounceCard extends StatelessWidget {
final ListDateModel modelList; final ListDateModel modelList;
final int index; final int index;
final bool visible;
const AnnounceCard({ const AnnounceCard({
Key? key, Key? key,
required this.modelList, required this.modelList,
required this.index, required this.index,
required this.visible,
}) : super(key: key); }) : super(key: key);
@override @override
@ -24,13 +27,19 @@ class AnnounceCard extends StatelessWidget {
return Column( return Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Container( !visible
padding: EdgeInsets.symmetric(horizontal: 32.w), ? SizedBox()
alignment: Alignment.centerLeft, : Container(
width: double.infinity, padding: EdgeInsets.symmetric(horizontal: 32.w),
height: 98.w, alignment: Alignment.centerLeft,
child: modelList.month.text.size(36.sp).black.make(), width: double.infinity,
), height: 98.w,
child: '${modelList.year}${modelList.month}'
.text
.size(36.sp)
.black
.make(),
),
...modelList.models ...modelList.models
.map((e) => _card(e)) .map((e) => _card(e))
.toList() .toList()
@ -39,7 +48,7 @@ class AnnounceCard extends StatelessWidget {
); );
} }
Widget _card(AnnounceListModel model) { Widget _card(HomeAnnounceModel model) {
return Container( return Container(
color: Colors.white, color: Colors.white,
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w), padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
@ -47,7 +56,7 @@ class AnnounceCard extends StatelessWidget {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
'${DateUtil.formatDateStr(model.date, format: 'dd日 HH:mm')}' '${DateUtil.formatDateStr(model.createDate, format: 'dd日 HH:mm')}'
.text .text
.size(28.sp) .size(28.sp)
.color(ktextSubColor) .color(ktextSubColor)
@ -67,13 +76,15 @@ class AnnounceCard extends StatelessWidget {
), ),
), ),
child: InkWell( child: InkWell(
onTap: () {}, onTap: () {
Get.to(() => NoticeDetailPage(id: model.id));
},
child: Row( child: Row(
children: [ children: [
'查看详情'.text.size(24.w).color(ktextSubColor).make(), '查看详情'.text.size(24.w).color(ktextSubColor).make(),
Spacer(), Spacer(),
Icon( Icon(
CupertinoIcons.chevron_down, CupertinoIcons.chevron_right,
size: 20.w, size: 20.w,
) )
], ],

@ -1,19 +1,20 @@
import 'package:aku_new_community/constants/sars_api.dart';
import 'package:aku_new_community/models/home/home_announce_model.dart';
import 'package:aku_new_community/pages/message_center_page/announce/announce_card.dart';
import 'package:aku_new_community/utils/network/net_util.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_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:scroll_to_index/scroll_to_index.dart'; import 'package:scroll_to_index/scroll_to_index.dart';
import 'package:aku_new_community/models/message/announce_list_model.dart';
import 'package:aku_new_community/pages/message_center_page/announce/announce_card.dart';
class ListDateModel { class ListDateModel {
final String month; final String month;
final int index; final int index;
final List<AnnounceListModel> models; final String year;
final List<HomeAnnounceModel> models;
ListDateModel(this.month, this.models, this.index); ListDateModel(this.month, this.models, this.index, this.year);
} }
class AnnounceView extends StatefulWidget { class AnnounceView extends StatefulWidget {
@ -30,21 +31,37 @@ class _AnnounceViewState extends State<AnnounceView> {
late AutoScrollController _autoScrollController; late AutoScrollController _autoScrollController;
List<ListDateModel> _modelLists = []; List<ListDateModel> _modelLists = [];
List<HomeAnnounceModel> _innerModelList = [];
String _headMonth = ''; String _headMonth = '';
void monthListDepart(List<AnnounceListModel> models) { void monthListDepart(List<HomeAnnounceModel> models) {
for (var item in models) { for (var item in models) {
var index = var index =
_modelLists.indexWhere((element) => element.month == item.month); _modelLists.indexWhere((element) => element.month == item.month);
if (index >= 0) { if (index >= 0) {
_modelLists[index].models.add(item.copyWith()); _modelLists[index].models.add(item.copyWith());
} else { } else {
_modelLists.insert(_modelLists.length, _modelLists.insert(
ListDateModel(item.month, [item.copyWith()], _modelLists.length)); _modelLists.length,
ListDateModel(item.month.toString(), [item.copyWith()],
_modelLists.length, item.year.toString()));
} }
} }
} }
int _page = 1;
int _size = 5;
bool visible(int index) {
if (index == 0) {
return true;
} else if (_modelLists[index].month == _modelLists[index - 1].month) {
return false;
} else {
return true;
}
}
@override @override
void initState() { void initState() {
_autoScrollController = AutoScrollController( _autoScrollController = AutoScrollController(
@ -91,14 +108,35 @@ class _AnnounceViewState extends State<AnnounceView> {
footer: MaterialFooter(), footer: MaterialFooter(),
scrollController: _autoScrollController, scrollController: _autoScrollController,
onRefresh: () async { onRefresh: () async {
_page = 1;
_modelLists.clear(); _modelLists.clear();
// monthListDepart(); _innerModelList.clear();
var base =
await NetUtil().getList(SARSAPI.announce.list, params: {
'page': _page,
'size': _size,
});
_innerModelList =
base.rows.map((e) => HomeAnnounceModel.fromJson(e)).toList();
monthListDepart(_innerModelList);
if (_modelLists.isNotEmpty) { if (_modelLists.isNotEmpty) {
_headMonth = _modelLists[0].month; _headMonth = _modelLists[0].month;
} }
setState(() {}); setState(() {});
}, },
onLoad: () async {}, onLoad: () async {
_page++;
var base =
await NetUtil().getList(SARSAPI.announce.list, params: {
'page': _page,
'size': _size,
});
if (base.total > _innerModelList.length) {}
_innerModelList =
base.rows.map((e) => HomeAnnounceModel.fromJson(e)).toList();
monthListDepart(_innerModelList);
},
child: _modelLists.isEmpty child: _modelLists.isEmpty
? Container() ? Container()
: ListView.separated( : ListView.separated(
@ -112,6 +150,7 @@ class _AnnounceViewState extends State<AnnounceView> {
child: AnnounceCard( child: AnnounceCard(
modelList: _modelLists[index], modelList: _modelLists[index],
index: index, index: index,
visible: visible(index),
), ),
); );
}, },

@ -1,7 +1,7 @@
import 'package:aku_new_community/base/base_style.dart'; import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/constants/sars_api.dart';
import 'package:aku_new_community/models/message/reply_list_model.dart'; import 'package:aku_new_community/models/message/reply_list_model.dart';
import 'package:aku_new_community/pages/message_center_page/message_func.dart'; import 'package:aku_new_community/pages/message_center_page/message_func.dart';
import 'package:aku_new_community/widget/beeImageNetwork.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
@ -22,8 +22,8 @@ class ReplyCard extends StatelessWidget {
child: Row( child: Row(
children: [ children: [
ClipOval( ClipOval(
child: Image.network( child: BeeImageNetwork(
SARSAPI.image(model.avatar), urls: [model.avatar],
width: 100.w, width: 100.w,
height: 100.w, height: 100.w,
), ),
@ -32,6 +32,7 @@ class ReplyCard extends StatelessWidget {
SizedBox( SizedBox(
width: 350.w, width: 350.w,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
model.sendName.text.size(26.sp).black.bold.make(), model.sendName.text.size(26.sp).black.bold.make(),
model.content.text model.content.text
@ -44,10 +45,11 @@ class ReplyCard extends StatelessWidget {
], ],
), ),
), ),
Spacer(),
ClipRRect( ClipRRect(
borderRadius: BorderRadius.circular(9.w), borderRadius: BorderRadius.circular(9.w),
child: Image.network( child: BeeImageNetwork(
SARSAPI.image(model.pic), urls: [model.pic],
width: 128.w, width: 128.w,
height: 128.w, height: 128.w,
), ),

@ -1,14 +1,14 @@
import 'package:aku_new_community/base/base_style.dart'; import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/constants/sars_api.dart';
import 'package:aku_new_community/gen/assets.gen.dart'; import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/models/message/reply_list_model.dart'; import 'package:aku_new_community/models/message/thumbs_up_list_model.dart';
import 'package:aku_new_community/pages/message_center_page/message_func.dart'; import 'package:aku_new_community/pages/message_center_page/message_func.dart';
import 'package:aku_new_community/widget/beeImageNetwork.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
class ThumbsUpCard extends StatelessWidget { class ThumbsUpCard extends StatelessWidget {
final ReplyListModel model; final ThumbsUpListModel model;
const ThumbsUpCard({Key? key, required this.model}) : super(key: key); const ThumbsUpCard({Key? key, required this.model}) : super(key: key);
@ -23,8 +23,8 @@ class ThumbsUpCard extends StatelessWidget {
child: Row( child: Row(
children: [ children: [
ClipOval( ClipOval(
child: Image.network( child: BeeImageNetwork(
SARSAPI.image(model.avatar), imgs: model.avatarImgList,
width: 100.w, width: 100.w,
height: 100.w, height: 100.w,
), ),
@ -33,6 +33,7 @@ class ThumbsUpCard extends StatelessWidget {
SizedBox( SizedBox(
width: 350.w, width: 350.w,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
model.sendName.text.size(26.sp).black.bold.make(), model.sendName.text.size(26.sp).black.bold.make(),
Assets.icons.communityLikeIs Assets.icons.communityLikeIs
@ -41,10 +42,11 @@ class ThumbsUpCard extends StatelessWidget {
], ],
), ),
), ),
Spacer(),
ClipRRect( ClipRRect(
borderRadius: BorderRadius.circular(9.w), borderRadius: BorderRadius.circular(9.w),
child: Image.network( child: BeeImageNetwork(
SARSAPI.image(model.pic), imgs: model.dynamicImgList,
width: 128.w, width: 128.w,
height: 128.w, height: 128.w,
), ),

@ -1,8 +1,8 @@
import 'package:aku_new_community/constants/api.dart'; import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/constants/sars_api.dart'; import 'package:aku_new_community/constants/sars_api.dart';
import 'package:aku_new_community/model/community/hot_news_model.dart';
import 'package:aku_new_community/model/good/market_swiper_model.dart'; import 'package:aku_new_community/model/good/market_swiper_model.dart';
import 'package:aku_new_community/models/community/dynamic_my_list_body.dart'; import 'package:aku_new_community/models/community/dynamic_my_list_body.dart';
import 'package:aku_new_community/models/community/information_list_model.dart';
import 'package:aku_new_community/models/community/topic_model.dart'; import 'package:aku_new_community/models/community/topic_model.dart';
import 'package:aku_new_community/models/home/home_activity_model.dart'; import 'package:aku_new_community/models/home/home_activity_model.dart';
import 'package:aku_new_community/models/home/home_announce_model.dart'; import 'package:aku_new_community/models/home/home_announce_model.dart';
@ -38,13 +38,13 @@ class CommunityFunc {
} }
/// ///
static Future<List<HotNewsModel>> getHotNews() async { static Future<List<InformationListModel>> getHotNews() async {
BaseListModel model = await NetUtil().getList( BaseListModel model = await NetUtil().getList(
API.community.findHotNews, SARSAPI.information.list,
params: {'pageNum': 1, 'size': 4}, params: {'pageNum': 1, 'size': 4},
); );
if (model.rows.length == 0) return []; if (model.rows.length == 0) return [];
return model.rows.map((e) => HotNewsModel.fromJson(e)).toList(); return model.rows.map((e) => InformationListModel.fromJson(e)).toList();
} }
/// ///

@ -4,10 +4,10 @@ import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/constants/api.dart'; import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/constants/sars_api.dart'; import 'package:aku_new_community/constants/sars_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/hot_news_model.dart';
import 'package:aku_new_community/models/community/all_dynamic_list_model.dart'; import 'package:aku_new_community/models/community/all_dynamic_list_model.dart';
import 'package:aku_new_community/models/community/information_category_list_model.dart';
import 'package:aku_new_community/models/community/information_list_model.dart';
import 'package:aku_new_community/models/community/topic_model.dart'; import 'package:aku_new_community/models/community/topic_model.dart';
import 'package:aku_new_community/models/news/news_category_model.dart';
import 'package:aku_new_community/provider/app_provider.dart'; import 'package:aku_new_community/provider/app_provider.dart';
import 'package:aku_new_community/provider/user_provider.dart'; import 'package:aku_new_community/provider/user_provider.dart';
import 'package:aku_new_community/ui/community/community_func.dart'; import 'package:aku_new_community/ui/community/community_func.dart';
@ -50,7 +50,7 @@ class _CommunityPageState extends State<CommunityPage>
List<AllDynamicListModel> _newItems = []; List<AllDynamicListModel> _newItems = [];
List<TopicModel> _gambitModels = []; List<TopicModel> _gambitModels = [];
List<HotNewsModel> _hotNewsModels = []; List<InformationListModel> _hotNewsModels = [];
int _pageNum = 1; int _pageNum = 1;
int _size = 4; int _size = 4;
@ -209,15 +209,16 @@ class _CommunityPageState extends State<CommunityPage>
children: [ children: [
_homeTitle('热门资讯', () async { _homeTitle('热门资讯', () async {
final cancel = BotToast.showLoading(); final cancel = BotToast.showLoading();
BaseModel model = await NetUtil().get(API.news.category); BaseModel model =
List<NewsCategoryModel>? category; await NetUtil().get(SARSAPI.information.categoryList);
var category = <InformationCategoryListModel>[];
if (model.success == true && model.data != null) { if (model.success == true && model.data != null) {
category = (model.data as List) category = (model.data as List)
.map((e) => NewsCategoryModel.fromJson(e)) .map((e) => InformationCategoryListModel.fromJson(e))
.toList(); .toList();
} }
cancel(); cancel();
Get.to(() => PublicInfomationPage(models: category ?? [])); Get.to(() => PublicInfomationPage(models: category));
}, '更多'), }, '更多'),
32.hb, 32.hb,
Container( Container(
@ -283,12 +284,12 @@ class _CommunityPageState extends State<CommunityPage>
return result; return result;
} }
_infoCard(HotNewsModel item) { _infoCard(InformationListModel item) {
return GestureDetector( return GestureDetector(
onTap: () async { onTap: () async {
var result = var result =
await Get.to(() => PublicInformationDetailPage(id: item.id!)); await Get.to(() => PublicInformationDetailPage(id: item.id));
CommunityFunc.addViews(item.id!); CommunityFunc.addViews(item.id);
if (result) { if (result) {
_easyRefreshController.callRefresh(); _easyRefreshController.callRefresh();
} }
@ -337,7 +338,7 @@ class _CommunityPageState extends State<CommunityPage>
width: 316.w, width: 316.w,
alignment: Alignment.center, alignment: Alignment.center,
child: Text( child: Text(
item.title ?? '', item.title,
maxLines: 2, maxLines: 2,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
@ -349,7 +350,7 @@ class _CommunityPageState extends State<CommunityPage>
Row( Row(
children: [ children: [
Text( Text(
'${item.views ?? 0}浏览', '${item.viewsNum}浏览',
maxLines: 2, maxLines: 2,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
@ -359,7 +360,7 @@ class _CommunityPageState extends State<CommunityPage>
), ),
Spacer(), Spacer(),
Text( Text(
item.createDate?.substring(0, 10) ?? '', item.createDate,
maxLines: 2, maxLines: 2,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(

@ -21,26 +21,25 @@ class NoticeCard extends StatelessWidget {
}) : super(key: key); }) : super(key: key);
bool get sameDay => bool get sameDay =>
model.createDateString?.year == (preModel?.createDateString?.year ?? 0) && model.createDateDT?.year == (preModel?.createDateDT?.year ?? 0) &&
model.createDateString?.month == model.createDateDT?.month == (preModel?.createDateDT?.month ?? 0) &&
(preModel?.createDateString?.month ?? 0) && model.createDateDT?.day == (preModel?.createDateDT?.day ?? 0);
model.createDateString?.day == (preModel?.createDateString?.day ?? 0);
bool get isYesterday { bool get isYesterday {
DateTime now = DateTime.now(); DateTime now = DateTime.now();
DateTime yesterday = DateTime(now.year, now.month, now.day - 1); DateTime yesterday = DateTime(now.year, now.month, now.day - 1);
return yesterday.year == model.createDateString?.year && return yesterday.year == model.createDateDT?.year &&
yesterday.month == model.createDateString?.month && yesterday.month == model.createDateDT?.month &&
yesterday.day == model.createDateString?.day; yesterday.day == model.createDateDT?.day;
} }
bool get isFirst => preModel == null; bool get isFirst => preModel == null;
bool get notSameYear => bool get notSameYear =>
model.createDateString?.year != (preModel?.createDateString?.year ?? 0); model.createDateDT?.year != (preModel?.createDateDT?.year ?? 0);
Widget title() { Widget title() {
if (DateUtil.isToday(model.createDateString?.millisecond)) if (DateUtil.isToday(model.createDateDT?.millisecond))
return '今天'.text.size(52.sp).bold.make(); return '今天'.text.size(52.sp).bold.make();
if (isYesterday) if (isYesterday)
return '昨天'.text.size(52.sp).bold.make(); return '昨天'.text.size(52.sp).bold.make();
@ -48,12 +47,12 @@ class NoticeCard extends StatelessWidget {
return Row( return Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
(model.createDateString?.day.toString() ?? '') (model.createDateDT?.day.toString() ?? '')
.text .text
.size(52.sp) .size(52.sp)
.bold .bold
.make(), .make(),
'${model.createDateString?.month}'.text.size(36.sp).make(), '${model.createDateDT?.month}'.text.size(36.sp).make(),
], ],
); );
} }
@ -64,8 +63,8 @@ class NoticeCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
(notSameYear && model.createDateString?.year != DateTime.now().year) (notSameYear && model.createDateDT?.year != DateTime.now().year)
? '${model.createDateString?.year}' ? '${model.createDateDT?.year}'
.text .text
.bold .bold
.size(52.sp) .size(52.sp)

@ -1,18 +1,14 @@
import 'package:flutter/material.dart';
import 'package:common_utils/common_utils.dart';
import 'package:get/get.dart';
import 'package:aku_new_community/base/base_style.dart'; import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/constants/api.dart'; import 'package:aku_new_community/models/community/information_list_model.dart';
import 'package:aku_new_community/constants/sars_api.dart';
import 'package:aku_new_community/model/common/img_model.dart';
import 'package:aku_new_community/models/news/news_item_model.dart';
import 'package:aku_new_community/ui/home/public_infomation/public_information_detail_page.dart'; import 'package:aku_new_community/ui/home/public_infomation/public_information_detail_page.dart';
import 'package:aku_new_community/utils/headers.dart'; import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/widget/beeImageNetwork.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class PublicInfomationCard extends StatelessWidget { class PublicInfomationCard extends StatelessWidget {
final NewsItemModel model; final InformationListModel model;
const PublicInfomationCard({Key? key, required this.model}) : super(key: key); const PublicInfomationCard({Key? key, required this.model}) : super(key: key);
@ -47,7 +43,7 @@ class PublicInfomationCard extends StatelessWidget {
// Text('测试'), // Text('测试'),
Spacer(), Spacer(),
Text('发布于 ${DateUtil.formatDate( Text('发布于 ${DateUtil.formatDate(
model.create, model.createDateDT,
format: 'yyyy-MM-dd HH:mm', format: 'yyyy-MM-dd HH:mm',
)}'), )}'),
], ],
@ -57,12 +53,10 @@ class PublicInfomationCard extends StatelessWidget {
), ),
), ),
32.wb, 32.wb,
FadeInImage.assetNetwork( BeeImageNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
width: 240.w, width: 240.w,
height: 200.w, height: 200.w,
fit: BoxFit.cover, imgs: model.imgList,
image: SARSAPI.image(ImgModel.first(model.imgList)),
), ),
], ],
), ),

@ -1,12 +1,11 @@
import 'package:flutter/material.dart'; import 'package:aku_new_community/models/community/information_category_list_model.dart';
import 'package:aku_new_community/models/news/news_category_model.dart';
import 'package:aku_new_community/ui/home/public_infomation/public_infomation_view.dart'; import 'package:aku_new_community/ui/home/public_infomation/public_infomation_view.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/tab_bar/bee_tab_bar.dart'; import 'package:aku_new_community/widget/tab_bar/bee_tab_bar.dart';
import 'package:flutter/material.dart';
class PublicInfomationPage extends StatefulWidget { class PublicInfomationPage extends StatefulWidget {
final List<NewsCategoryModel> models; final List<InformationCategoryListModel> models;
PublicInfomationPage({ PublicInfomationPage({
Key? key, Key? key,

@ -1,17 +1,14 @@
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/constants/sars_api.dart'; import 'package:aku_new_community/constants/sars_api.dart';
import 'package:aku_new_community/models/news/news_category_model.dart'; import 'package:aku_new_community/models/community/information_category_list_model.dart';
import 'package:aku_new_community/models/news/news_item_model.dart'; import 'package:aku_new_community/models/community/information_list_model.dart';
import 'package:aku_new_community/pages/things_page/widget/bee_list_view.dart'; import 'package:aku_new_community/pages/things_page/widget/bee_list_view.dart';
import 'package:aku_new_community/ui/home/public_infomation/public_infomation_card.dart'; import 'package:aku_new_community/ui/home/public_infomation/public_infomation_card.dart';
import 'package:aku_new_community/utils/headers.dart'; import 'package:aku_new_community/utils/headers.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
class PublicInfomationView extends StatefulWidget { class PublicInfomationView extends StatefulWidget {
final NewsCategoryModel model; final InformationCategoryListModel model;
PublicInfomationView({Key? key, required this.model}) : super(key: key); PublicInfomationView({Key? key, required this.model}) : super(key: key);
@ -27,11 +24,11 @@ class _PublicInfomationViewState extends State<PublicInfomationView>
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context); super.build(context);
return BeeListView( return BeeListView(
path: API.news.list, path: SARSAPI.information.list,
controller: _refreshController, controller: _refreshController,
extraParams: {'newsCategoryId': widget.model.id}, extraParams: {'categoryId': widget.model.id},
convert: (model) => convert: (model) =>
model.rows.map((e) => NewsItemModel.fromJson(e)).toList(), model.rows.map((e) => InformationListModel.fromJson(e)).toList(),
builder: (items) { builder: (items) {
return ListView.separated( return ListView.separated(
padding: EdgeInsets.symmetric(vertical: 24.w), padding: EdgeInsets.symmetric(vertical: 24.w),

@ -1,24 +1,24 @@
import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/models/community/recommend_read_model.dart';
import 'package:aku_new_community/models/news/news_detail_model.dart';
import 'package:aku_new_community/utils/bee_date_util.dart';
import 'package:aku_new_community/utils/link_text_parase.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/beeImageNetwork.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/constants/sars_api.dart';
import 'package:aku_new_community/models/news/news_detail_model.dart';
import 'package:aku_new_community/utils/link_text_parase.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_scaffold.dart';
class PublicInformationDetailPage extends StatefulWidget { class PublicInformationDetailPage extends StatefulWidget {
final int id; final int id;
@ -139,4 +139,78 @@ class _PublicInformationDetailPageState
Widget _emptyWidget() { Widget _emptyWidget() {
return Container(); return Container();
} }
Widget _recommendReading() {
var head = Padding(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 36.w),
child: Row(
children: [
Container(
width: 8.w,
color: Colors.amber,
),
24.w.widthBox,
'推荐阅读'.text.size(28.sp).color(Colors.black).bold.make(),
],
),
);
return Container(
decoration: BoxDecoration(color: Colors.white),
width: double.infinity,
child: Column(
children: [
head,
],
),
);
}
Widget _recommendCard(RecommendReadModel model) {
return Padding(
padding: EdgeInsets.all(32.w),
child: Row(
children: [
SizedBox(
width: 420.w,
height: 150.w,
child: Expanded(
child: Column(
children: [
model.title.text.black.bold.maxLines(2).make(),
Spacer(),
Row(
children: [
'${model.viewsNum}浏览'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
Spacer(),
BeeDateUtil(model.createDateDT)
.timeAgo
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
],
)
],
),
),
),
32.w.widthBox,
Container(
width: 240.w,
height: 150.w,
decoration:
BoxDecoration(borderRadius: BorderRadius.circular(16.w)),
clipBehavior: Clip.antiAlias,
child: BeeImageNetwork(
imgs: model.imgList,
),
),
],
),
);
}
} }

Loading…
Cancel
Save