添加 新版装修管理 对接其接口

hmxc
张萌 4 years ago
parent 1cc4c4d465
commit 222fea9473

@ -258,6 +258,16 @@ class _Manager {
///
String get facilityOrderDateList =>
'/user/facilitiesAppointment/findFacilitiesAppointmentDate';
///
String get newRenovationList => '/user/userDecorationNew/list';
///
String get insertNewRenovation => '/user/userDecorationNew/insert';
///app
String get applyCompleteRenovation =>
'/user/userDecorationNew/applicationCompletion';
}
class _Community {

@ -1,5 +1,6 @@
// import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:aku_community/pages/renovation_manage/new_renovation/new_renovation_page.dart';
import 'package:flutter/material.dart';
import 'package:aku_community/const/resource.dart';
@ -13,7 +14,6 @@ import 'package:aku_community/pages/goods_manage_page/select_borrow_return_page.
import 'package:aku_community/pages/industry_committee/industry_committee_page.dart';
import 'package:aku_community/pages/life_pay/life_pay_page.dart';
import 'package:aku_community/pages/one_alarm/widget/alarm_page.dart';
import 'package:aku_community/pages/renovation_manage/renovation_manage_page.dart';
import 'package:aku_community/pages/service_browse/service_browse_page.dart';
import 'package:aku_community/pages/setting_page/settings_page.dart';
import 'package:aku_community/pages/things_page/fixed_submit_page.dart';
@ -81,7 +81,7 @@ List<AO> appObjects = [
() => AdvicePage(type: AdviceType.COMPLAIN)),
AO('问卷调查', R.ASSETS_APPLICATIONS_QUESTION_PNG, () => QuestionnairePage()),
AO('装修管理', R.ASSETS_APPLICATIONS_DECORATION_PNG,
() => RenovationManagePage()),
() => NewRenovationPage()),
AO('借还管理', R.ASSETS_APPLICATIONS_BORROW_PNG, () => SelectBorrowReturnPage()),
AO('一键报警', R.ASSETS_APPLICATIONS_POLICE_PNG, () => AlarmPage()),
AO('设施预约', R.ASSETS_ICONS_TOOL_FACILITY_PNG, () => FacilityAppointmentPage()),

@ -0,0 +1,197 @@
import 'package:equatable/equatable.dart';
import 'package:flustars/flustars.dart';
import 'package:flutter/material.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:aku_community/base/base_style.dart';
part 'new_renovation_list_model.g.dart';
@JsonSerializable()
class NewRenovationListModel extends Equatable {
final int id;
final String roomName;
final int status;
final String constructionUnit;
final String director;
final String directorTel;
final String expectedBegin;
final String expectedEnd;
final String? actualBegin;
final String? actualEnd;
final String? rejectReason;
final String? reviewerName;
final String? auditDate;
final String? trackerName;
final String? applicationCheckDate;
final int? isQualified;
final String createName;
final String createDate;
final List<CheckVoList?> checkVoList;
NewRenovationListModel({
required this.id,
required this.roomName,
required this.status,
required this.constructionUnit,
required this.director,
required this.directorTel,
required this.expectedBegin,
required this.expectedEnd,
this.actualBegin,
this.actualEnd,
this.rejectReason,
this.reviewerName,
this.auditDate,
this.trackerName,
this.applicationCheckDate,
this.isQualified,
required this.createName,
required this.createDate,
required this.checkVoList,
});
@override
List<Object?> get props {
return [
id,
roomName,
status,
constructionUnit,
director,
directorTel,
expectedBegin,
expectedEnd,
actualBegin,
actualEnd,
rejectReason,
reviewerName,
auditDate,
trackerName,
applicationCheckDate,
isQualified,
createName,
createDate,
checkVoList,
];
}
factory NewRenovationListModel.fromJson(Map<String, dynamic> json) =>
_$NewRenovationListModelFromJson(json);
String get statusString {
switch (this.status) {
case 1:
return '申请中';
case 2:
return '装修中';
case 3:
return '申请驳回';
// case 4:
// return '装修中';
case 5:
return '申请完工检查';
case 6:
return '完工检查中';
case 7:
return '检查通过';
case 8:
return '检查不通过';
default:
return '未知';
}
}
Color get statusColor {
switch (this.status) {
case 1:
return kPrimaryColor;
case 2:
return Colors.green;
case 3:
return Colors.red;
// case 4:
// return ktextPrimary;
case 5:
return kPrimaryColor;
case 6:
return ktextSubColor;
case 7:
return Colors.green;
case 8:
return Colors.red;
default:
return ktextPrimary;
}
}
String get expectBginString =>
DateUtil.formatDateStr(this.expectedBegin, format: 'yyyy-MM-dd HH:mm');
String get expectEndString =>
DateUtil.formatDateStr(this.expectedEnd, format: 'yyyy-MM-dd HH:mm');
String get actualBginString => DateUtil.formatDateStr(this.actualBegin ?? '',
format: 'yyyy-MM-dd HH:mm');
String get actualEndString =>
DateUtil.formatDateStr(this.actualEnd ?? '', format: 'yyyy-MM-dd HH:mm');
String get expectSlot =>
'${expectBginString}-${DateUtil.formatDateStr(this.expectedEnd, format: 'HH:mm')}';
String get actualSlot =>
'${actualBginString}-${DateUtil.formatDateStr(this.actualEnd ?? '', format: 'HH:mm')}';
String get qualitfied {
switch (this.isQualified) {
case 1:
return '合格';
case 2:
return '不合格';
default:
return '未知';
}
}
}
@JsonSerializable()
class CheckVoList extends Equatable {
final int id;
final int decorationNewId;
final String detail;
final int isQualified;
final String createName;
final String createDate;
CheckVoList({
required this.id,
required this.decorationNewId,
required this.detail,
required this.isQualified,
required this.createName,
required this.createDate,
});
@override
List<Object> get props {
return [
id,
decorationNewId,
detail,
isQualified,
createName,
createDate,
];
}
factory CheckVoList.fromJson(Map<String, dynamic> json) =>
_$CheckVoListFromJson(json);
String get qualitfied {
switch (this.isQualified) {
case 1:
return '合格';
case 2:
return '不合格';
default:
return '未知';
}
}
}

@ -0,0 +1,45 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'new_renovation_list_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
NewRenovationListModel _$NewRenovationListModelFromJson(
Map<String, dynamic> json) {
return NewRenovationListModel(
id: json['id'] as int,
roomName: json['roomName'] as String,
status: json['status'] as int,
constructionUnit: json['constructionUnit'] as String,
director: json['director'] as String,
directorTel: json['directorTel'] as String,
expectedBegin: json['expectedBegin'] as String,
expectedEnd: json['expectedEnd'] as String,
actualBegin: json['actualBegin'] as String?,
actualEnd: json['actualEnd'] as String?,
rejectReason: json['rejectReason'] as String?,
reviewerName: json['reviewerName'] as String?,
auditDate: json['auditDate'] as String?,
trackerName: json['trackerName'] as String?,
applicationCheckDate: json['applicationCheckDate'] as String?,
isQualified: json['isQualified'] as int?,
createName: json['createName'] as String,
createDate: json['createDate'] as String,
checkVoList: (json['checkVoList'] as List<dynamic>)
.map((e) => CheckVoList.fromJson(e as Map<String, dynamic>))
.toList(),
);
}
CheckVoList _$CheckVoListFromJson(Map<String, dynamic> json) {
return CheckVoList(
id: json['id'] as int,
decorationNewId: json['decorationNewId'] as int,
detail: json['detail'] as String,
isQualified: json['isQualified'] as int,
createName: json['createName'] as String,
createDate: json['createDate'] as String,
);
}

@ -0,0 +1,198 @@
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/constants/api.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_divider.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:aku_community/widget/buttons/bottom_button.dart';
import 'package:aku_community/widget/others/bee_input_row.dart';
import 'package:aku_community/widget/others/user_tool.dart';
import 'package:aku_community/widget/picker/bee_date_picker.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flustars/flustars.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:aku_community/utils/headers.dart';
import 'package:aku_community/extensions/widget_list_ext.dart';
import 'package:get/get.dart';
class NewRenovationAddPage extends StatefulWidget {
NewRenovationAddPage({Key? key}) : super(key: key);
@override
_NewRenovationAddPageState createState() => _NewRenovationAddPageState();
}
class _NewRenovationAddPageState extends State<NewRenovationAddPage> {
late TextEditingController _unitController;
late TextEditingController _directorController;
late TextEditingController _telController;
DateTime? startDate;
DateTime? endDate;
@override
void initState() {
super.initState();
_unitController = TextEditingController();
_directorController = TextEditingController();
_telController = TextEditingController();
}
@override
void dispose() {
_unitController.dispose();
_directorController.dispose();
_telController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '申请装修',
body: ListView(
children: [
32.w.heightBox,
_buildInputCard(),
_datePick(),
],
),
bottomNavi: BottomButton(
onPressed: () async {
if (UserTool.appProveider.selectedHouse?.status == 4) {
BaseModel baseModel =
await NetUtil().post(API.manager.insertNewRenovation,
params: {
"estateId":
UserTool.appProveider.selectedHouse!.estateId,
"constructionUnit": _unitController.text,
"director": _directorController.text,
"directorTel": _telController.text,
"expectedBegin": DateUtil.formatDate(startDate),
"expectedEnd": DateUtil.formatDate(endDate)
},
showMessage: true);
if (baseModel.status ?? false) {
Get.back();
}
} else {
BotToast.showText(text: '您未拥有通过审核的房产!');
}
},
child: '立即申请'.text.size(32.sp).color(ktextPrimary).bold.make()),
);
}
Widget _buildInputCard() {
return Container(
width: double.infinity,
decoration: BoxDecoration(color: Colors.white),
padding: EdgeInsets.all(32.w),
child: Column(
children: <Widget>[
BeeInputRow(
title: '装修公司名称',
controller: _unitController,
hintText: '请输入装修公司名称'),
BeeInputRow(
title: '负责人姓名',
controller: _directorController,
hintText: '请输入负责人姓名'),
BeeInputRow(
title: '负责人电话', controller: _telController, hintText: '请输入联系电话'),
].sepWidget(separate: 40.w.heightBox),
),
);
}
Widget _datePick() {
return Container(
padding: EdgeInsets.symmetric(vertical: 32.w),
width: double.infinity,
color: Colors.white,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'预约时间',
style: TextStyle(fontWeight: FontWeight.bold),
).pSymmetric(h: 32.w),
SizedBox(
height: 120.w,
child: Row(
children: [
MaterialButton(
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
height: 120.w,
onPressed: () async {
DateTime _currentTime = DateTime.now();
DateTime? date = await BeeDatePicker.pick(
_currentTime.add(Duration(minutes: 60)),
mode: CupertinoDatePickerMode.dateAndTime,
min: _currentTime.add(Duration(minutes: 30)),
max: _currentTime.add(Duration(days: 30)),
);
if (date != null) {
startDate = date;
setState(() {});
}
},
child: Text(
startDate == null
? '请选择开始时间'
: DateUtil.formatDate(
startDate,
format: 'yyyy-MM-dd HH:mm',
),
style: TextStyle(
color: ktextSubColor,
),
),
).expand(),
Icon(Icons.arrow_forward),
MaterialButton(
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
height: 120.w,
onPressed: () async {
DateTime? date = await BeeDatePicker.pick(
startDate == null
? DateTime.now().add(Duration(minutes: 90))
: startDate!.add(Duration(minutes: 30)),
min: startDate == null
? DateTime.now().add(Duration(minutes: 60))
: startDate!.add(Duration(minutes: 30)),
max: startDate == null
? DateTime.now().add(Duration(days: 2))
: (startDate!).add(Duration(days: 2)),
mode: CupertinoDatePickerMode.dateAndTime,
);
if (date != null) {
endDate = date;
setState(() {});
}
},
child: Text(
endDate == null
? '请选择结束时间'
: DateUtil.formatDate(
endDate,
format: 'yyyy-MM-dd HH:mm',
),
style: TextStyle(
color: ktextSubColor,
),
),
).expand(),
],
),
),
BeeDivider.horizontal(
indent: 32.w,
endIndent: 32.w,
),
],
),
);
}
}

@ -0,0 +1,169 @@
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/models/new_renovation/new_renovation_list_model.dart';
import 'package:aku_community/pages/renovation_manage/new_renovation/new_renovation_detail_page.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_divider.dart';
import 'package:aku_community/widget/buttons/card_bottom_button.dart';
import 'package:flutter/material.dart';
import 'package:aku_community/utils/headers.dart';
import 'package:get/get.dart';
class NewRenovationCard extends StatefulWidget {
final NewRenovationListModel model;
final VoidCallback callRefresh;
NewRenovationCard({Key? key, required this.model, required this.callRefresh})
: super(key: key);
@override
_NewRenovationCardState createState() => _NewRenovationCardState();
}
class _NewRenovationCardState extends State<NewRenovationCard> {
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
Get.to(() => NewRenovationDetailPage(model: widget.model));
},
child: Container(
width: double.infinity,
padding: EdgeInsets.all(24.w),
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(8.w)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
widget.model.roomName,
style: TextStyle(
fontSize: 32.sp,
fontWeight: FontWeight.bold,
color: ktextPrimary,
),
),
Spacer(),
widget.model.statusString.text
.size(30.sp)
.color(widget.model.statusColor)
.bold
.make(),
],
),
16.w.heightBox,
BeeDivider.horizontal(),
24.w.heightBox,
...<Widget>[
_rowTile(
R.ASSETS_ICONS_APPOINTMENT_CODE_PNG,
'装修公司',
widget.model.constructionUnit.text
.size(24.sp)
.color(ktextSubColor)
.make(),
),
_rowTile(
R.ASSETS_ICONS_APPOINTMENT_CODE_PNG,
'负责人姓名',
widget.model.director.text
.size(24.sp)
.color(ktextSubColor)
.make(),
),
_rowTile(
R.ASSETS_ICONS_APPOINTMENT_CODE_PNG,
'负责人电话',
widget.model.directorTel.text
.size(24.sp)
.color(ktextSubColor)
.make(),
),
_rowTile(
R.ASSETS_ICONS_APPOINTMENT_CODE_PNG,
'预计装修时间',
widget.model.expectSlot.text
.size(24.sp)
.color(ktextSubColor)
.make(),
),
..._nullableRowTile(
widget.model.actualEnd.isEmptyOrNull,
R.ASSETS_ICONS_APPOINTMENT_CODE_PNG,
'实际装修时间',
widget.model.actualSlot.text
.size(24.sp)
.color(ktextSubColor)
.make())
].sepWidget(separate: 12.w.heightBox),
..._bottomWidgets(),
],
),
),
);
}
List<Widget> _bottomWidgets() {
return (widget.model.status != 2)
? []
: [
40.w.heightBox,
Row(
children: [Spacer(), ..._getButtons()],
),
];
}
List<Widget> _getButtons() {
List<CardBottomButton> buttons = [];
switch (widget.model.status) {
case 2:
buttons = [
CardBottomButton.yellow(
text: '申请完工检查',
onPressed: () async {
BaseModel baseModel =
await NetUtil().get(API.manager.applyCompleteRenovation,
params: {
"userDecorationNewId": widget.model.id,
},
showMessage: true);
if (baseModel.status ?? false) {
widget.callRefresh();
}
})
];
break;
default:
buttons = [];
}
return buttons;
}
_nullableRowTile(
bool isNull, String assetPath, String title, Widget content) {
return isNull
? []
: [
_rowTile(assetPath, title, content),
];
}
Widget _rowTile(String assetPath, String titile, Widget content) {
return Row(
children: [
Image.asset(
assetPath,
width: 40.w,
height: 40.w,
),
12.w.widthBox,
titile.text.size(24.sp).color(ktextSubColor).make(),
Spacer(),
content,
],
);
}
}

@ -0,0 +1,224 @@
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/models/new_renovation/new_renovation_list_model.dart';
import 'package:aku_community/widget/bee_divider.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:flutter/material.dart';
import 'package:aku_community/utils/headers.dart';
class NewRenovationDetailPage extends StatefulWidget {
final NewRenovationListModel model;
NewRenovationDetailPage({Key? key, required this.model}) : super(key: key);
@override
_NewRenovationDetailPageState createState() =>
_NewRenovationDetailPageState();
}
class _NewRenovationDetailPageState extends State<NewRenovationDetailPage> {
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '装修详情',
body: ListView(
padding: EdgeInsets.all(32.w),
children: [
_renovationInfo(),
40.w.heightBox,
_contentWidget(),
..._checkWidge(),
],
),
);
}
Widget _contentWidget() {
return Container(
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(8.w)),
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
'装修反馈'.text.size(32.sp).color(ktextPrimary).bold.make(),
Spacer(),
],
),
16.w.heightBox,
BeeDivider.horizontal(),
20.w.heightBox,
(widget.model.rejectReason ?? '')
.text
.size(28.sp)
.color(ktextPrimary)
.make(),
...widget.model.auditDate.isEmptyOrNull
? []
: [
40.w.heightBox,
Row(
children: [
Spacer(),
widget.model.auditDate!.text
.size(24.sp)
.color(ktextSubColor)
.make(),
],
),
],
...widget.model.checkVoList.isEmpty ? [] : [..._checkWidge()]
],
),
);
}
List<Widget> _checkWidge() {
return widget.model.checkVoList
.map((e) => Container(
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8.w)),
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
child: Column(
children: [
16.w.heightBox,
BeeDivider.horizontal(),
20.w.heightBox,
Row(
children: [
'完工检查${widget.model.checkVoList.indexOf(e)}'
.text
.size(32.sp)
.color(ktextPrimary)
.bold
.make(),
Spacer(),
],
),
12.w.heightBox,
e!.qualitfied.text
.size(28.sp)
.color(e.isQualified == 1 ? Colors.green : Colors.red)
.make(),
20.w.heightBox,
Row(
children: [
Spacer(),
(e.createDate)
.text
.size(24.sp)
.color(ktextSubColor)
.make(),
],
),
],
),
))
.toList();
}
Widget _renovationInfo() {
return Container(
width: double.infinity,
padding: EdgeInsets.all(24.w),
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(8.w)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
widget.model.roomName,
style: TextStyle(
fontSize: 32.sp,
fontWeight: FontWeight.bold,
color: ktextPrimary,
),
),
Spacer(),
widget.model.statusString.text
.size(30.sp)
.color(widget.model.statusColor)
.bold
.make(),
],
),
16.w.heightBox,
BeeDivider.horizontal(),
24.w.heightBox,
...<Widget>[
_rowTile(
R.ASSETS_ICONS_APPOINTMENT_CODE_PNG,
'装修公司',
widget.model.constructionUnit.text
.size(24.sp)
.color(ktextSubColor)
.make(),
),
_rowTile(
R.ASSETS_ICONS_APPOINTMENT_CODE_PNG,
'负责人姓名',
widget.model.director.text
.size(24.sp)
.color(ktextSubColor)
.make(),
),
_rowTile(
R.ASSETS_ICONS_APPOINTMENT_CODE_PNG,
'负责人电话',
widget.model.directorTel.text
.size(24.sp)
.color(ktextSubColor)
.make(),
),
_rowTile(
R.ASSETS_ICONS_APPOINTMENT_CODE_PNG,
'预计装修时间',
widget.model.expectSlot.text
.size(24.sp)
.color(ktextSubColor)
.make(),
),
..._nullableRowTile(
widget.model.actualEnd.isEmptyOrNull,
R.ASSETS_ICONS_APPOINTMENT_CODE_PNG,
'实际装修时间',
widget.model.actualSlot.text
.size(24.sp)
.color(ktextSubColor)
.make())
].sepWidget(separate: 12.w.heightBox),
],
),
);
}
_nullableRowTile(
bool isNull, String assetPath, String title, Widget content) {
return isNull
? []
: [
_rowTile(assetPath, title, content),
];
}
Widget _rowTile(String assetPath, String titile, Widget content) {
return Row(
children: [
Image.asset(
assetPath,
width: 40.w,
height: 40.w,
),
12.w.widthBox,
titile.text.size(24.sp).color(ktextSubColor).make(),
Spacer(),
content,
],
);
}
}

@ -0,0 +1,81 @@
import 'package:aku_community/pages/renovation_manage/new_renovation/new_renovation_add_page.dart';
import 'package:aku_community/pages/renovation_manage/new_renovation/new_renovation_view.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:aku_community/widget/tab_bar/bee_tab_bar.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:aku_community/utils/headers.dart';
import 'package:get/get.dart';
class NewRenovationPage extends StatefulWidget {
NewRenovationPage({Key? key}) : super(key: key);
@override
_NewRenovationPageState createState() => _NewRenovationPageState();
}
class _NewRenovationPageState extends State<NewRenovationPage>
with TickerProviderStateMixin {
List<String> _tabs = [
'申请中',
'装修中',
'申请驳回',
'申请完工检查',
'完工检查中',
'检查通过',
'检查未通过'
];
late TabController _tabController;
@override
void initState() {
super.initState();
_tabController = TabController(length: _tabs.length, vsync: this);
}
@override
void dispose() {
_tabController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '装修管理',
appBarBottom: PreferredSize(
preferredSize: Size.fromHeight(88.w),
child: BeeTabBar(
controller: _tabController,
tabs: _tabs,
scrollable: true,
),
),
actions: [
IconButton(
icon: Icon(
CupertinoIcons.plus_circle,
color: Colors.black,
),
onPressed: () {
Get.to(() => NewRenovationAddPage());
}),
],
body: TabBarView(
children: List.generate(_tabs.length, (index) => _getViews(index)),
controller: _tabController,
),
);
}
_getViews(index) {
if (index > 2) {
return NewRenovationView(
index: index + 1,
);
} else {
return NewRenovationView(
index: index,
);
}
}
}

@ -0,0 +1,65 @@
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/models/new_renovation/new_renovation_list_model.dart';
import 'package:aku_community/pages/renovation_manage/new_renovation/new_renovation_card.dart';
import 'package:aku_community/pages/things_page/widget/bee_list_view.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:aku_community/utils/headers.dart';
class NewRenovationView extends StatefulWidget {
final int index;
NewRenovationView({Key? key, required this.index}) : super(key: key);
@override
_NewRenovationViewState createState() => _NewRenovationViewState();
}
class _NewRenovationViewState extends State<NewRenovationView>
with AutomaticKeepAliveClientMixin {
late EasyRefreshController _refreshController;
@override
void initState() {
super.initState();
_refreshController = EasyRefreshController();
}
@override
void dispose() {
_refreshController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return BeeListView(
path: API.manager.newRenovationList,
extraParams: {
"userDecorationNewStatus": widget.index + 1,
},
controller: _refreshController,
convert: (models) {
return models.tableList!
.map((e) => NewRenovationListModel.fromJson(e))
.toList();
},
builder: (items) {
return ListView.separated(
padding: EdgeInsets.all(32.w),
itemBuilder: (context, index) {
return NewRenovationCard(
model: items[index],
callRefresh: () {
_refreshController.callRefresh();
},
);
},
separatorBuilder: (_, __) {
return 24.w.heightBox;
},
itemCount: items.length);
});
}
@override
bool get wantKeepAlive => true;
}

@ -0,0 +1,58 @@
import 'package:aku_community/base/base_style.dart';
import 'package:flutter/material.dart';
import 'package:aku_community/utils/headers.dart';
import 'package:flutter/services.dart';
class BeeInputRow extends StatefulWidget {
final String title;
final TextEditingController controller;
final List<TextInputFormatter>? formatters;
final String? hintText;
BeeInputRow(
{Key? key,
required this.title,
required this.controller,
this.formatters,
required this.hintText})
: super(key: key);
@override
_BeeInputRowState createState() => _BeeInputRowState();
}
class _BeeInputRowState extends State<BeeInputRow> {
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
widget.title.text.size(28.sp).color(ktextPrimary).make(),
32.w.heightBox,
TextField(
inputFormatters: widget.formatters,
controller: widget.controller,
textAlign: TextAlign.start,
onChanged: (value) {
setState(() {});
},
decoration: InputDecoration(
hintText: widget.hintText ?? '',
isDense: true,
contentPadding: EdgeInsets.zero,
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Color(0xFFE8E8E8), width: 2.w),
),
),
style: TextStyle(
fontSize: 36.sp,
fontWeight: FontWeight.bold,
color: ktextPrimary,
),
),
],
),
);
}
}

@ -0,0 +1,10 @@
import 'package:aku_community/provider/app_provider.dart';
import 'package:aku_community/provider/user_provider.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
class UserTool {
static UserProvider get userProvider =>
Provider.of<UserProvider>(Get.context!, listen: false);
static AppProvider get appProveider => Provider.of<AppProvider>(Get.context!,listen: false);
}
Loading…
Cancel
Save