diff --git a/lib/saas_model/information/information_detail_model.dart b/lib/saas_model/information/information_detail_model.dart new file mode 100644 index 00000000..af75c551 --- /dev/null +++ b/lib/saas_model/information/information_detail_model.dart @@ -0,0 +1,37 @@ +import 'package:aku_new_community/model/common/img_model.dart'; +import 'package:equatable/equatable.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'information_detail_model.g.dart'; + +@JsonSerializable() +class InformationDetailModel extends Equatable { + final int id; + final String title; + final String content; + final int viewsNum; + final String createDate; + final List imgList; + + factory InformationDetailModel.fromJson(Map json) => + _$InformationDetailModelFromJson(json); + + @override + List get props => [ + id, + title, + content, + viewsNum, + createDate, + imgList, + ]; + + const InformationDetailModel({ + required this.id, + required this.title, + required this.content, + required this.viewsNum, + required this.createDate, + required this.imgList, + }); +} diff --git a/lib/saas_model/information/information_detail_model.g.dart b/lib/saas_model/information/information_detail_model.g.dart new file mode 100644 index 00000000..cad6965f --- /dev/null +++ b/lib/saas_model/information/information_detail_model.g.dart @@ -0,0 +1,20 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'information_detail_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +InformationDetailModel _$InformationDetailModelFromJson( + Map json) => + InformationDetailModel( + 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) + .map((e) => ImgModel.fromJson(e as Map)) + .toList(), + ); diff --git a/lib/ui/home/public_infomation/public_infomation_page.dart b/lib/ui/home/public_infomation/public_infomation_page.dart index c2d4a220..fea8968c 100644 --- a/lib/ui/home/public_infomation/public_infomation_page.dart +++ b/lib/ui/home/public_infomation/public_infomation_page.dart @@ -30,10 +30,16 @@ class _PublicInfomationPageState extends State Widget build(BuildContext context) { return BeeScaffold( title: '公共资讯', - appBarBottom: BeeTabBar( - controller: _tabController, - tabs: widget.models.map((e) => e.name).toList(), - scrollable: true, + appBarBottom: PreferredSize( + preferredSize: Size.fromHeight(MediaQuery.of(context).padding.top), + child: Container( + alignment: Alignment.centerLeft, + child: BeeTabBar( + controller: _tabController, + tabs: widget.models.map((e) => e.name).toList(), + scrollable: true, + ), + ), ), body: TabBarView( children: diff --git a/lib/ui/home/public_infomation/public_information_detail_page.dart b/lib/ui/home/public_infomation/public_information_detail_page.dart index 017b124c..adf8084b 100644 --- a/lib/ui/home/public_infomation/public_information_detail_page.dart +++ b/lib/ui/home/public_infomation/public_information_detail_page.dart @@ -1,7 +1,7 @@ import 'package:aku_new_community/base/base_style.dart'; import 'package:aku_new_community/constants/saas_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/saas_model/information/information_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'; @@ -33,7 +33,7 @@ class _PublicInformationDetailPageState extends State { late EasyRefreshController _easyRefreshController; bool _onload = true; - late NewsDetailModel _detailModel; + late InformationDetailModel _detailModel; late List _parasedText; late TapGestureRecognizer _tapLinkUrlLancher; //设置单击手势识别器 @override @@ -62,7 +62,7 @@ class _PublicInformationDetailPageState ), ) : SizedBox(), - title: _onload ? '' : _detailModel.newsCategoryName, + title: '文章详情', bodyColor: Colors.white, body: EasyRefresh( firstRefresh: true, @@ -73,7 +73,7 @@ class _PublicInformationDetailPageState "informationId": widget.id, }); if (baseModel.success && baseModel.data != null) { - _detailModel = NewsDetailModel.fromJson(baseModel.data); + _detailModel = InformationDetailModel.fromJson(baseModel.data); _parasedText = LinkTextParase.stringParase(_detailModel.content); _onload = false; } else {