对接 资讯详情

解决tabbar 没有左对齐的问题
pull/1/head
张萌 3 years ago
parent c278340717
commit 6550a40a4a

@ -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<ImgModel> imgList;
factory InformationDetailModel.fromJson(Map<String, dynamic> json) =>
_$InformationDetailModelFromJson(json);
@override
List<Object?> 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,
});
}

@ -0,0 +1,20 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'information_detail_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
InformationDetailModel _$InformationDetailModelFromJson(
Map<String, dynamic> 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<dynamic>)
.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
);

@ -30,11 +30,17 @@ class _PublicInfomationPageState extends State<PublicInfomationPage>
Widget build(BuildContext context) {
return BeeScaffold(
title: '公共资讯',
appBarBottom: BeeTabBar(
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:
widget.models.map((e) => PublicInfomationView(model: e)).toList(),

@ -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<PublicInformationDetailPage> {
late EasyRefreshController _easyRefreshController;
bool _onload = true;
late NewsDetailModel _detailModel;
late InformationDetailModel _detailModel;
late List<String> _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 {

Loading…
Cancel
Save