公告和资讯

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

@ -1,5 +1,6 @@
import 'package:aku_new_community/model/common/img_model.dart';
@Deprecated('弃用')
class HotNewsModel {
int? id;
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;
factory HomeAnnounceModel.fromJson(Map<String, dynamic> 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({
required this.id,
required this.title,
@ -21,4 +24,20 @@ class HomeAnnounceModel {
required this.imgList,
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/material.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.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 {
final ListDateModel modelList;
final int index;
final bool visible;
const AnnounceCard({
Key? key,
required this.modelList,
required this.index,
required this.visible,
}) : super(key: key);
@override
@ -24,12 +27,18 @@ class AnnounceCard extends StatelessWidget {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
!visible
? SizedBox()
: Container(
padding: EdgeInsets.symmetric(horizontal: 32.w),
alignment: Alignment.centerLeft,
width: double.infinity,
height: 98.w,
child: modelList.month.text.size(36.sp).black.make(),
child: '${modelList.year}${modelList.month}'
.text
.size(36.sp)
.black
.make(),
),
...modelList.models
.map((e) => _card(e))
@ -39,7 +48,7 @@ class AnnounceCard extends StatelessWidget {
);
}
Widget _card(AnnounceListModel model) {
Widget _card(HomeAnnounceModel model) {
return Container(
color: Colors.white,
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
@ -47,7 +56,7 @@ class AnnounceCard extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
'${DateUtil.formatDateStr(model.date, format: 'dd日 HH:mm')}'
'${DateUtil.formatDateStr(model.createDate, format: 'dd日 HH:mm')}'
.text
.size(28.sp)
.color(ktextSubColor)
@ -67,13 +76,15 @@ class AnnounceCard extends StatelessWidget {
),
),
child: InkWell(
onTap: () {},
onTap: () {
Get.to(() => NoticeDetailPage(id: model.id));
},
child: Row(
children: [
'查看详情'.text.size(24.w).color(ktextSubColor).make(),
Spacer(),
Icon(
CupertinoIcons.chevron_down,
CupertinoIcons.chevron_right,
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/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.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 {
final String month;
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 {
@ -30,19 +31,35 @@ class _AnnounceViewState extends State<AnnounceView> {
late AutoScrollController _autoScrollController;
List<ListDateModel> _modelLists = [];
List<HomeAnnounceModel> _innerModelList = [];
String _headMonth = '';
void monthListDepart(List<AnnounceListModel> models) {
void monthListDepart(List<HomeAnnounceModel> models) {
for (var item in models) {
var index =
_modelLists.indexWhere((element) => element.month == item.month);
if (index >= 0) {
_modelLists[index].models.add(item.copyWith());
} else {
_modelLists.insert(_modelLists.length,
ListDateModel(item.month, [item.copyWith()], _modelLists.length));
_modelLists.insert(
_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
@ -91,14 +108,35 @@ class _AnnounceViewState extends State<AnnounceView> {
footer: MaterialFooter(),
scrollController: _autoScrollController,
onRefresh: () async {
_page = 1;
_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) {
_headMonth = _modelLists[0].month;
}
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
? Container()
: ListView.separated(
@ -112,6 +150,7 @@ class _AnnounceViewState extends State<AnnounceView> {
child: AnnounceCard(
modelList: _modelLists[index],
index: index,
visible: visible(index),
),
);
},

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

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

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

@ -21,26 +21,25 @@ class NoticeCard extends StatelessWidget {
}) : super(key: key);
bool get sameDay =>
model.createDateString?.year == (preModel?.createDateString?.year ?? 0) &&
model.createDateString?.month ==
(preModel?.createDateString?.month ?? 0) &&
model.createDateString?.day == (preModel?.createDateString?.day ?? 0);
model.createDateDT?.year == (preModel?.createDateDT?.year ?? 0) &&
model.createDateDT?.month == (preModel?.createDateDT?.month ?? 0) &&
model.createDateDT?.day == (preModel?.createDateDT?.day ?? 0);
bool get isYesterday {
DateTime now = DateTime.now();
DateTime yesterday = DateTime(now.year, now.month, now.day - 1);
return yesterday.year == model.createDateString?.year &&
yesterday.month == model.createDateString?.month &&
yesterday.day == model.createDateString?.day;
return yesterday.year == model.createDateDT?.year &&
yesterday.month == model.createDateDT?.month &&
yesterday.day == model.createDateDT?.day;
}
bool get isFirst => preModel == null;
bool get notSameYear =>
model.createDateString?.year != (preModel?.createDateString?.year ?? 0);
model.createDateDT?.year != (preModel?.createDateDT?.year ?? 0);
Widget title() {
if (DateUtil.isToday(model.createDateString?.millisecond))
if (DateUtil.isToday(model.createDateDT?.millisecond))
return '今天'.text.size(52.sp).bold.make();
if (isYesterday)
return '昨天'.text.size(52.sp).bold.make();
@ -48,12 +47,12 @@ class NoticeCard extends StatelessWidget {
return Row(
mainAxisSize: MainAxisSize.min,
children: [
(model.createDateString?.day.toString() ?? '')
(model.createDateDT?.day.toString() ?? '')
.text
.size(52.sp)
.bold
.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,
mainAxisSize: MainAxisSize.min,
children: [
(notSameYear && model.createDateString?.year != DateTime.now().year)
? '${model.createDateString?.year}'
(notSameYear && model.createDateDT?.year != DateTime.now().year)
? '${model.createDateDT?.year}'
.text
.bold
.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/constants/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/models/news/news_item_model.dart';
import 'package:aku_new_community/models/community/information_list_model.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/widget/beeImageNetwork.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class PublicInfomationCard extends StatelessWidget {
final NewsItemModel model;
final InformationListModel model;
const PublicInfomationCard({Key? key, required this.model}) : super(key: key);
@ -47,7 +43,7 @@ class PublicInfomationCard extends StatelessWidget {
// Text('测试'),
Spacer(),
Text('发布于 ${DateUtil.formatDate(
model.create,
model.createDateDT,
format: 'yyyy-MM-dd HH:mm',
)}'),
],
@ -57,12 +53,10 @@ class PublicInfomationCard extends StatelessWidget {
),
),
32.wb,
FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
BeeImageNetwork(
width: 240.w,
height: 200.w,
fit: BoxFit.cover,
image: SARSAPI.image(ImgModel.first(model.imgList)),
imgs: model.imgList,
),
],
),

@ -1,12 +1,11 @@
import 'package:flutter/material.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/ui/home/public_infomation/public_infomation_view.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/tab_bar/bee_tab_bar.dart';
import 'package:flutter/material.dart';
class PublicInfomationPage extends StatefulWidget {
final List<NewsCategoryModel> models;
final List<InformationCategoryListModel> models;
PublicInfomationPage({
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/models/news/news_category_model.dart';
import 'package:aku_new_community/models/news/news_item_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/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/utils/headers.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
class PublicInfomationView extends StatefulWidget {
final NewsCategoryModel model;
final InformationCategoryListModel model;
PublicInfomationView({Key? key, required this.model}) : super(key: key);
@ -27,11 +24,11 @@ class _PublicInfomationViewState extends State<PublicInfomationView>
Widget build(BuildContext context) {
super.build(context);
return BeeListView(
path: API.news.list,
path: SARSAPI.information.list,
controller: _refreshController,
extraParams: {'newsCategoryId': widget.model.id},
extraParams: {'categoryId': widget.model.id},
convert: (model) =>
model.rows.map((e) => NewsItemModel.fromJson(e)).toList(),
model.rows.map((e) => InformationListModel.fromJson(e)).toList(),
builder: (items) {
return ListView.separated(
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/gestures.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_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:url_launcher/url_launcher.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 {
final int id;
@ -139,4 +139,78 @@ class _PublicInformationDetailPageState
Widget _emptyWidget() {
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