对接 服务浏览

对接 社区介绍
hmxc
张萌 4 years ago
parent 3a15265753
commit db68667f41

@ -224,6 +224,12 @@ class _Manager {
///appid
String get getPublicInformationDetail => '/user/news/findNewsByNewsId';
///appapp
String get serviceBrowseList => '/user/serviceBrowsing/list';
///app
String get communityIntroduceInfo => '/user/communityIntroduction/findEnable';
}
class _Community {

@ -0,0 +1,36 @@
import 'package:equatable/equatable.dart';
import 'package:aku_community/model/common/img_model.dart';
import 'package:json_annotation/json_annotation.dart';
part 'community_introduce_model.g.dart';
@JsonSerializable()
class CommunityIontroduceModel extends Equatable {
final int id;
final String name;
final String content;
final String createDate;
final List<ImgModel>? imgList;
CommunityIontroduceModel({
required this.id,
required this.name,
required this.content,
required this.createDate,
this.imgList,
});
factory CommunityIontroduceModel.fromJson(Map<String, dynamic> json) =>
_$CommunityIontroduceModelFromJson(json);
factory CommunityIontroduceModel.init() =>
CommunityIontroduceModel(id: -1, name: '', content: '', createDate: '');
@override
List<Object?> get props {
return [
id,
name,
content,
createDate,
imgList,
];
}
}

@ -0,0 +1,20 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'community_introduce_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
CommunityIontroduceModel _$CommunityIontroduceModelFromJson(
Map<String, dynamic> json) {
return CommunityIontroduceModel(
id: json['id'] as int,
name: json['name'] as String,
content: json['content'] as String,
createDate: json['createDate'] as String,
imgList: (json['imgList'] as List<dynamic>?)
?.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
);
}

@ -0,0 +1,21 @@
import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';
part 'service_browse_list_mode.g.dart';
@JsonSerializable()
class ServiceBrowseListModel extends Equatable {
final int id;
final String name;
final String content;
final String createDate;
ServiceBrowseListModel({
required this.id,
required this.name,
required this.content,
required this.createDate,
});
factory ServiceBrowseListModel.fromJson(Map<String, dynamic> json) =>
_$ServiceBrowseListModelFromJson(json);
@override
List<Object> get props => [id, name, content, createDate];
}

@ -0,0 +1,17 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'service_browse_list_mode.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
ServiceBrowseListModel _$ServiceBrowseListModelFromJson(
Map<String, dynamic> json) {
return ServiceBrowseListModel(
id: json['id'] as int,
name: json['name'] as String,
content: json['content'] as String,
createDate: json['createDate'] as String,
);
}

@ -1,7 +1,13 @@
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/model/common/img_model.dart';
import 'package:aku_community/models/community_introduce/community_introduce_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:flutter/material.dart';
import 'package:aku_community/const/resource.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart';
@ -13,33 +19,48 @@ class CommunityIntroducePage extends StatefulWidget {
}
class _CommunityIntroducePageState extends State<CommunityIntroducePage> {
CommunityIontroduceModel _model = CommunityIontroduceModel.init();
bool _onload = false;
@override
Widget build(BuildContext context) {
return BeeScaffold(
bodyColor: Colors.white,
title: '社区介绍',
body: ListView(
body: EasyRefresh(
firstRefresh: true,
header: MaterialHeader(),
onRefresh: () async {
BaseModel baseModel =
await NetUtil().get(API.manager.communityIntroduceInfo);
if (baseModel.status! && baseModel.data != null) {
_model = CommunityIontroduceModel.fromJson(baseModel.data);
}
_onload = false;
setState(() {});
},
child: _onload
? Container()
: ListView(
children: [
SizedBox(
child: Image.asset(
R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
fit: BoxFit.cover,
),
image: API.image(ImgModel.first(_model.imgList))),
width: double.infinity,
height: 424.w,
),
24.w.heightBox,
''' 小区内部环境典雅幽静绿化多通过小区道路的合理组织休闲设施的精心安排提供自然、舒适的居住环境。周边配套齐全设施完备物业管理完善保安24小时值班住户素质高。社区主流健康向上社区风气良好邻里关系和谐。
便
广
线西使
'''
.text
Padding(
padding: EdgeInsets.symmetric(horizontal: 24.w),
child: _model.content.text
.size(28.sp)
.color(ktextPrimary)
.make(),
),
],
),
),
);
}
}

@ -1,10 +1,13 @@
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/models/service_browse/service_browse_list_mode.dart';
import 'package:aku_community/pages/things_page/widget/bee_list_view.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:flustars/flustars.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.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);
@ -14,31 +17,54 @@ class ServiceBrowsePage extends StatefulWidget {
}
class _ServiceBrowsePageState extends State<ServiceBrowsePage> {
late EasyRefreshController _easyRefreshController;
void initState() {
super.initState();
_easyRefreshController = EasyRefreshController();
}
@override
void dispose() {
_easyRefreshController.dispose();
super.dispose();
}
@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),
),
body: BeeListView(
path: API.manager.serviceBrowseList,
controller: _easyRefreshController,
convert: (models) {
return models.tableList!
.map((e) => ServiceBrowseListModel.fromJson(e))
.toList();
},
builder: (items) {
return ListView.separated(
padding: EdgeInsets.symmetric(vertical: 24.w),
itemBuilder: (context, index) {
return _buildCard(items[index]);
},
separatorBuilder: (_, __) {
return 24.w.heightBox;
},
itemCount: items.length);
}),
);
}
Widget _buildCard(String title, String content, String name, String date) {
Widget _buildCard(ServiceBrowseListModel model) {
return Container(
color: Colors.white,
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
width: double.infinity,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
title.text
model.name.text
.size(32.sp)
.color(ktextPrimary)
.maxLines(1)
@ -46,7 +72,7 @@ class _ServiceBrowsePageState extends State<ServiceBrowsePage> {
.bold
.make(),
32.w.heightBox,
content.text
model.content.text
.size(24.sp)
.color(ktextSubColor)
.maxLines(3)
@ -55,9 +81,9 @@ class _ServiceBrowsePageState extends State<ServiceBrowsePage> {
32.w.heightBox,
Row(
children: [
name.text.size(20.sp).color(ktextSubColor).make(),
'南宁人才公寓'.text.size(20.sp).color(ktextSubColor).make(),
Spacer(),
'发布于 ${DateUtil.formatDateStr(date, format: 'MM-dd HH:mm')}'
'发布于 ${DateUtil.formatDateStr(model.createDate, format: 'MM-dd HH:mm')}'
.text
.size(20.sp)
.color(ktextSubColor)

Loading…
Cancel
Save