parent
920f2724a0
commit
3a15265753
@ -0,0 +1,37 @@
|
|||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:json_annotation/json_annotation.dart';
|
||||||
|
part 'news_detail_model.g.dart';
|
||||||
|
|
||||||
|
@JsonSerializable()
|
||||||
|
class NewsDetailModel extends Equatable {
|
||||||
|
final int id;
|
||||||
|
final String code;
|
||||||
|
final String title;
|
||||||
|
final String content;
|
||||||
|
final String newsCategoryName;
|
||||||
|
final String createName;
|
||||||
|
final String createDate;
|
||||||
|
NewsDetailModel({
|
||||||
|
required this.id,
|
||||||
|
required this.code,
|
||||||
|
required this.title,
|
||||||
|
required this.content,
|
||||||
|
required this.newsCategoryName,
|
||||||
|
required this.createName,
|
||||||
|
required this.createDate,
|
||||||
|
});
|
||||||
|
factory NewsDetailModel.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$NewsDetailModelFromJson(json);
|
||||||
|
@override
|
||||||
|
List<Object> get props {
|
||||||
|
return [
|
||||||
|
id,
|
||||||
|
code,
|
||||||
|
title,
|
||||||
|
content,
|
||||||
|
newsCategoryName,
|
||||||
|
createName,
|
||||||
|
createDate,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'news_detail_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
NewsDetailModel _$NewsDetailModelFromJson(Map<String, dynamic> json) {
|
||||||
|
return NewsDetailModel(
|
||||||
|
id: json['id'] as int,
|
||||||
|
code: json['code'] as String,
|
||||||
|
title: json['title'] as String,
|
||||||
|
content: json['content'] as String,
|
||||||
|
newsCategoryName: json['newsCategoryName'] as String,
|
||||||
|
createName: json['createName'] as String,
|
||||||
|
createDate: json['createDate'] as String,
|
||||||
|
);
|
||||||
|
}
|
@ -0,0 +1,70 @@
|
|||||||
|
import 'package:aku_community/base/base_style.dart';
|
||||||
|
import 'package:aku_community/widget/bee_scaffold.dart';
|
||||||
|
import 'package:flustars/flustars.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:velocity_x/velocity_x.dart';
|
||||||
|
import 'package:aku_community/extensions/widget_list_ext.dart';
|
||||||
|
|
||||||
|
class ServiceBrowsePage extends StatefulWidget {
|
||||||
|
ServiceBrowsePage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_ServiceBrowsePageState createState() => _ServiceBrowsePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ServiceBrowsePageState extends State<ServiceBrowsePage> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BeeScaffold(
|
||||||
|
title: '服务浏览',
|
||||||
|
body: ListView(
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 12.w),
|
||||||
|
children: [
|
||||||
|
_buildCard(
|
||||||
|
'小区绿化服务范围及工作范畴',
|
||||||
|
'随着城市建设的发展,人们对生活环境的要求越来越高,越来越重视小区的园林绿化建设,绿化养护作为一项长期性工作,需要有科学的计划和正确的实施方法,同时要求园林人扎实做好......',
|
||||||
|
'南宁人才公寓',
|
||||||
|
' 04-13 09:46'),
|
||||||
|
].sepWidget(separate: 12.w.heightBox),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildCard(String title, String content, String name, String date) {
|
||||||
|
return Container(
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
|
||||||
|
width: double.infinity,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
title.text
|
||||||
|
.size(32.sp)
|
||||||
|
.color(ktextPrimary)
|
||||||
|
.maxLines(1)
|
||||||
|
.overflow(TextOverflow.ellipsis)
|
||||||
|
.bold
|
||||||
|
.make(),
|
||||||
|
32.w.heightBox,
|
||||||
|
content.text
|
||||||
|
.size(24.sp)
|
||||||
|
.color(ktextSubColor)
|
||||||
|
.maxLines(3)
|
||||||
|
.overflow(TextOverflow.ellipsis)
|
||||||
|
.make(),
|
||||||
|
32.w.heightBox,
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
name.text.size(20.sp).color(ktextSubColor).make(),
|
||||||
|
Spacer(),
|
||||||
|
'发布于 ${DateUtil.formatDateStr(date, format: 'MM-dd HH:mm')}'
|
||||||
|
.text
|
||||||
|
.size(20.sp)
|
||||||
|
.color(ktextSubColor)
|
||||||
|
.make(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,100 @@
|
|||||||
|
import 'package:aku_community/base/base_style.dart';
|
||||||
|
import 'package:aku_community/constants/api.dart';
|
||||||
|
import 'package:aku_community/models/news/news_detail_model.dart';
|
||||||
|
import 'package:aku_community/utils/network/base_model.dart';
|
||||||
|
import 'package:aku_community/utils/network/net_util.dart';
|
||||||
|
import 'package:aku_community/widget/bee_scaffold.dart';
|
||||||
|
import 'package:bot_toast/bot_toast.dart';
|
||||||
|
import 'package:flustars/flustars.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
||||||
|
import 'package:velocity_x/velocity_x.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
|
||||||
|
class PublicInformationDetailPage extends StatefulWidget {
|
||||||
|
final int id;
|
||||||
|
PublicInformationDetailPage({Key? key, required this.id}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_PublicInformationDetailPageState createState() =>
|
||||||
|
_PublicInformationDetailPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PublicInformationDetailPageState
|
||||||
|
extends State<PublicInformationDetailPage> {
|
||||||
|
late EasyRefreshController _easyRefreshController;
|
||||||
|
bool _onload = true;
|
||||||
|
late NewsDetailModel _detailModel;
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_easyRefreshController = EasyRefreshController();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_easyRefreshController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BeeScaffold(
|
||||||
|
title: '公共资讯',
|
||||||
|
bodyColor: Colors.white,
|
||||||
|
body: EasyRefresh(
|
||||||
|
firstRefresh: true,
|
||||||
|
header: MaterialHeader(),
|
||||||
|
onRefresh: () async {
|
||||||
|
BaseModel baseModel = await NetUtil()
|
||||||
|
.get(API.manager.getPublicInformationDetail, params: {
|
||||||
|
"newsId": widget.id,
|
||||||
|
});
|
||||||
|
if (baseModel.status! && baseModel.data != null) {
|
||||||
|
_detailModel = NewsDetailModel.fromJson(baseModel.data);
|
||||||
|
} else {
|
||||||
|
BotToast.showText(text: '无法获取信息');
|
||||||
|
}
|
||||||
|
_onload = false;
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
child: _onload
|
||||||
|
? _emptyWidget()
|
||||||
|
: ListView(
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
|
||||||
|
children: [
|
||||||
|
_detailModel.title.text
|
||||||
|
.size(36.sp)
|
||||||
|
.color(ktextPrimary)
|
||||||
|
.bold
|
||||||
|
.align(TextAlign.center)
|
||||||
|
.make(),
|
||||||
|
24.w.heightBox,
|
||||||
|
SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
child: _detailModel.content.text
|
||||||
|
.size(28.sp)
|
||||||
|
.color(ktextPrimary)
|
||||||
|
.make(),
|
||||||
|
),
|
||||||
|
40.w.heightBox,
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Spacer(),
|
||||||
|
'发布于 ${DateUtil.formatDateStr(_detailModel.createDate, format: 'MM-dd HH:mm')}'
|
||||||
|
.text
|
||||||
|
.size(24.sp)
|
||||||
|
.color(ktextSubColor)
|
||||||
|
.make(),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _emptyWidget() {
|
||||||
|
return Container();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue