From 6550a40a4ae3bc3dda26d52561c8ba9190a0d338 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Tue, 29 Mar 2022 10:28:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=20=E8=B5=84=E8=AE=AF?= =?UTF-8?q?=E8=AF=A6=E6=83=85=20=E8=A7=A3=E5=86=B3tabbar=20=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E5=B7=A6=E5=AF=B9=E9=BD=90=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../information/information_detail_model.dart | 37 +++++++++++++++++++ .../information_detail_model.g.dart | 20 ++++++++++ .../public_infomation_page.dart | 14 +++++-- .../public_information_detail_page.dart | 8 ++-- 4 files changed, 71 insertions(+), 8 deletions(-) create mode 100644 lib/saas_model/information/information_detail_model.dart create mode 100644 lib/saas_model/information/information_detail_model.g.dart 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 {