报事报修新增页面跳转逻辑变更,应用点击跳转登陆逻辑变更

hmxc
小赖 4 years ago
parent 5aef719471
commit 9f91a04934

@ -1,4 +1,5 @@
// Flutter imports:
import 'package:akuCommunity/widget/buttons/bottom_button.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -104,17 +105,13 @@ class _FixedSubmitPageState extends State<FixedSubmitPage> {
padding: EdgeInsets.fromLTRB(24.w, 24.w, 24.w, 0),
child: Row(
children: [
BeeMap
.fixTag[model.type]
.text
BeeMap.fixTag[model.type].text
.color(ktextPrimary)
.bold
.size(32.sp)
.make(),
Spacer(),
BeeMap
.fixState[model.status]
.text
BeeMap.fixState[model.status].text
.color(_getColor(model.status))
.size(24.sp)
.make(),
@ -159,31 +156,31 @@ class _FixedSubmitPageState extends State<FixedSubmitPage> {
Widget _buildCheckBox(FixedSubmitModel model) {
return
// GestureDetector(
// onTap: () {
// if (_selected.contains(model.id)) {
// _selected.remove(model.id);
// } else {
// _selected.add(model.id);
// }
// setState(() {});
// },
// child:
Container(
alignment: Alignment.centerLeft,
constraints: BoxConstraints(minHeight: 384.w, minWidth: 686.w),
child: FixedCheckBox(
key:ValueKey(model.id),
onChanged: (isSelect) {
if (isSelect) {
_selected.add(model.id);
} else {
_selected.remove(model.id);
}
setState(() {});
},
),
// child: BeeRadio(value: model.id, groupValues: _selected),
// GestureDetector(
// onTap: () {
// if (_selected.contains(model.id)) {
// _selected.remove(model.id);
// } else {
// _selected.add(model.id);
// }
// setState(() {});
// },
// child:
Container(
alignment: Alignment.centerLeft,
constraints: BoxConstraints(minHeight: 384.w, minWidth: 686.w),
child: FixedCheckBox(
key: ValueKey(model.id),
onChanged: (isSelect) {
if (isSelect) {
_selected.add(model.id);
} else {
_selected.remove(model.id);
}
setState(() {});
},
),
// child: BeeRadio(value: model.id, groupValues: _selected),
// ),
);
}
@ -233,63 +230,45 @@ class _FixedSubmitPageState extends State<FixedSubmitPage> {
setState(() {});
})
],
body: Column(
children: [
BeeListView(
controller: _easyRefreshController,
path: API.manager.fixedSubmit,
convert: (model) {
return model.tableList
.map((e) => FixedSubmitModel.fromJson(e))
.toList();
},
builder: (items) {
return ListView.separated(
padding: EdgeInsets.all(32.w),
itemBuilder: (context, index) {
return Stack(
children: [
_buildCheckBox(items[index]),
_buildCard(items[index])
],
);
},
separatorBuilder: (context, index) {
return 24.w.heightBox;
},
itemCount: items.length);
},
).expand(),
MaterialButton(
disabledColor: Colors.white.withOpacity(0.5),
disabledTextColor: ktextSubColor.withOpacity(0.8),
textColor: ktextPrimary,
onPressed: _isEdit
? _selected.isEmpty
? null
: () {
Get.dialog(_showDeletDialog());
}
body: BeeListView(
controller: _easyRefreshController,
path: API.manager.fixedSubmit,
convert: (model) {
return model.tableList
.map((e) => FixedSubmitModel.fromJson(e))
.toList();
},
builder: (items) {
return ListView.separated(
padding: EdgeInsets.all(32.w),
itemBuilder: (context, index) {
return Stack(
children: [
_buildCheckBox(items[index]),
_buildCard(items[index])
],
);
},
separatorBuilder: (context, index) {
return 24.w.heightBox;
},
itemCount: items.length);
},
),
bottomNavi: BottomButton(
onPressed: _isEdit
? _selected.isEmpty
? null
: () {
userProvider.isLogin
? AddFixedSubmitPage().to()
: BotToast.showText(text: '请先登录!');
},
child: _isEdit
? '删除订单'.text.bold.size(32.sp).make()
: '新增'.text.bold.size(32.sp).make(),
minWidth: double.infinity,
height: 98.w,
elevation: 0,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
padding: EdgeInsets.zero,
)
.box
.padding(EdgeInsets.only(
bottom: MediaQuery.of(context).padding.bottom))
.color(kPrimaryColor)
.make(),
],
Get.dialog(_showDeletDialog());
}
: () async {
bool needRefresh = await Get.to(AddFixedSubmitPage());
if (needRefresh == null) _easyRefreshController.callRefresh();
},
child: _isEdit
? '删除订单'.text.bold.size(32.sp).make()
: '新增'.text.bold.size(32.sp).make(),
),
);
}

@ -8,6 +8,7 @@ import 'package:flutter/material.dart';
// Package imports:
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'package:velocity_x/velocity_x.dart';
@ -201,7 +202,7 @@ class _AddFixedSubmitPageState extends State<AddFixedSubmitPage> {
}
bool _canSubmit(int seletType, String text) {
if (seletType.isNull) {
if (seletType == null) {
return false;
} else if (text.isEmpty) {
return false;
@ -213,48 +214,54 @@ class _AddFixedSubmitPageState extends State<AddFixedSubmitPage> {
@override
Widget build(BuildContext context) {
UserProvider userProvider = Provider.of<UserProvider>(context);
return BeeScaffold(
title: '报事报修',
body: Column(
children: [
ListView(
children: [
_buildHouseCard(
kEstateName,
userProvider.userDetailModel.estateNames.isEmpty
? ''
: BeeParse.getEstateName(
userProvider.userDetailModel.estateNames[0])),
_getType(),
_buildReportCard(),
_addImages(),
],
).expand(),
],
),
bottomNavi: BottomButton(
onPressed: _canSubmit(_selectType, _textEditingController.text)
? () async {
VoidCallback cancel = BotToast.showLoading();
List<String> urls = await NetUtil()
.uploadFiles(_files, API.upload.uploadRepair);
BaseModel baseModel = await ManagerFunc.reportRepairInsert(
BeeParse.getEstateNameId(
userProvider.userDetailModel.estateNames[0]),
_selectType + 1,
_textEditingController.text,
urls);
if (baseModel.status) {
FinishFixedSubmitPage().to();
} else
BotToast.showText(text: baseModel.message);
cancel();
}
: () {
BotToast.showText(text: '请填写完整报修信息!');
},
child: '确认提交'.text.black.bold.size(32.sp).make(),
return WillPopScope(
child: BeeScaffold(
title: '报事报修',
body: Column(
children: [
ListView(
children: [
_buildHouseCard(
kEstateName,
userProvider.userDetailModel.estateNames.isEmpty
? ''
: BeeParse.getEstateName(
userProvider.userDetailModel.estateNames[0])),
_getType(),
_buildReportCard(),
_addImages(),
],
).expand(),
],
),
bottomNavi: BottomButton(
onPressed: _canSubmit(_selectType, _textEditingController.text)
? () async {
VoidCallback cancel = BotToast.showLoading();
List<String> urls = await NetUtil()
.uploadFiles(_files, API.upload.uploadRepair);
BaseModel baseModel = await ManagerFunc.reportRepairInsert(
BeeParse.getEstateNameId(
userProvider.userDetailModel.estateNames[0]),
_selectType + 1,
_textEditingController.text,
urls);
if (baseModel.status) {
Get.off(FinishFixedSubmitPage());
} else
BotToast.showText(text: baseModel.message);
cancel();
}
: () {
BotToast.showText(text: '请填写完整报修信息!');
},
child: '确认提交'.text.black.bold.size(32.sp).make(),
),
),
onWillPop: () async {
Get.back(result: true);
return false;
},
);
}
}

@ -1,4 +1,7 @@
// Flutter imports:
import 'package:akuCommunity/pages/sign/sign_in_page.dart';
import 'package:akuCommunity/provider/user_provider.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
// Package imports:
@ -29,10 +32,18 @@ class ApplicationView extends StatefulWidget {
class _ApplicationViewState extends State<ApplicationView> {
_buildTile(AO object) {
final userProvider = Provider.of<UserProvider>(context);
return MaterialButton(
shape: StadiumBorder(),
padding: EdgeInsets.zero,
onPressed: () => Get.to(object.page),
onPressed: () {
if (userProvider.isLogin)
Get.to(object.page);
else {
BotToast.showText(text: '请先登陆');
Get.to(SignInPage());
}
},
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [

Loading…
Cancel
Save