添加权限验证

hmxc
小赖 4 years ago
parent c678e66eee
commit 9d2c156998

@ -9,7 +9,6 @@ const kForeGroundColor = Color(0xFFFFFFFF);
const kPrimaryColor = Color(0xFFFFC40C);
const kDarkPrimaryColor = Color(0xFFFF8200);
const kDangerColor = Color(0xFFFF3B30);
const kEstateName = '宁波华悦茂峰';
const kDarkSubColor = Color(0xFF979797);
class BaseStyle {

@ -1,7 +1,10 @@
import 'package:akuCommunity/constants/app_values.dart';
import 'package:akuCommunity/provider/app_provider.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_icons/flutter_icons.dart';
import 'package:provider/provider.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:akuCommunity/base/base_style.dart';
@ -22,7 +25,7 @@ class DetoCodePage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
kEstateName,
AppValues.plotName,
style: TextStyle(fontSize: 40.sp, color: Color(0xffffffff)),
),
SizedBox(height: 10.w),
@ -140,6 +143,7 @@ class DetoCodePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final AppProvider appProvider = Provider.of<AppProvider>(context);
return BeeScaffold(
title: '出户二维码',
body: Container(
@ -149,7 +153,7 @@ class DetoCodePage extends StatelessWidget {
Column(
children: [
SizedBox(height: 192.w - kToolbarHeight),
_header(model.appArticleOutQRCodeVo.roomName),
_header(appProvider.selectedHouse.roomName),
SizedBox(height: 32.w),
_card(model.appArticleOutQRCodeVo.applicantName,
model.appArticleOutQRCodeVo.effectiveTime),

@ -2,6 +2,8 @@
import 'dart:io';
import 'package:akuCommunity/constants/app_values.dart';
import 'package:akuCommunity/provider/app_provider.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -106,7 +108,7 @@ class _DetoCreatePageState extends State<DetoCreatePage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
kEstateName,
AppValues.plotName,
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 32.sp,
@ -268,11 +270,13 @@ class _DetoCreatePageState extends State<DetoCreatePage> {
onTap: onTap,
child: Row(
children: [
(select.isEmptyOrNull ? '请选择' : select)
((select?.isEmptyOrNull ?? true) ? '请选择' : select)
.text
.color(select.isEmptyOrNull ? ktextSubColor : ktextPrimary)
.color((select?.isEmptyOrNull ?? true)
? ktextSubColor
: ktextPrimary)
.size(36.sp)
.fontWeight(select.isEmptyOrNull
.fontWeight((select?.isEmptyOrNull ?? true)
? FontWeight.normal
: FontWeight.bold)
.make(),
@ -399,12 +403,13 @@ class _DetoCreatePageState extends State<DetoCreatePage> {
@override
Widget build(BuildContext context) {
UserProvider userProvider = Provider.of<UserProvider>(context);
AppProvider appProvider = Provider.of<AppProvider>(context);
return BeeScaffold(
title: '物品出户',
body: ListView(
padding: EdgeInsets.all(32.w),
children: [
_houseAddress(userProvider.currentHouse),
_houseAddress(appProvider.selectedHouse.roomName),
_getWeight(),
_itemPicker('出户时间', datetime, () async {
_date = await BeeDatePicker.timePicker(DateTime.now());

@ -1,3 +1,4 @@
import 'package:akuCommunity/constants/app_values.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -79,7 +80,7 @@ class _LifePayPageState extends State<LifePayPage> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
kEstateName.text.black.size(32.sp).bold.make(),
AppValues.plotName.text.black.size(32.sp).bold.make(),
10.w.heightBox,
userProvider.currentHouse.text.black
.size(32.sp)

@ -1,3 +1,4 @@
import 'package:akuCommunity/constants/app_values.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -93,7 +94,7 @@ class _LifePayDetailPageState extends State<LifePayDetailPage> {
children: [
model.name.text.black.size(30.sp).bold.make(),
Spacer(),
'$kEstateName ${userProvider.currentHouse}'
'${AppValues.plotName} ${userProvider.currentHouse}'
.text
.color(ktextSubColor)
.size(24.sp)

@ -1,3 +1,5 @@
import 'package:akuCommunity/constants/app_values.dart';
import 'package:akuCommunity/provider/app_provider.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
@ -65,6 +67,7 @@ class _MyHousePageState extends State<MyHousePage> {
Widget _buildCard(int currentHouseId, String estateName, int index,
{bool paid = false}) {
UserProvider userProvider = Provider.of<UserProvider>(context);
AppProvider appProvider = Provider.of<AppProvider>(context);
return Container(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 32.w),
child: GestureDetector(
@ -84,10 +87,13 @@ class _MyHousePageState extends State<MyHousePage> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
kEstateName.text.size(24.sp).color(ktextSubColor).bold.make(),
AppValues.plotName.text
.size(24.sp)
.color(ktextSubColor)
.bold
.make(),
16.w.heightBox,
BeeParse.getEstateName(estateName)
.text
appProvider.selectedHouse.roomName.text
.color(ktextPrimary)
.size(28.sp)
.bold

@ -1,5 +1,6 @@
import 'dart:io';
import 'package:akuCommunity/constants/app_values.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -218,7 +219,7 @@ class _AddFixedSubmitPageState extends State<AddFixedSubmitPage> {
ListView(
children: [
_buildHouseCard(
kEstateName,
AppValues.plotName,
userProvider.userDetailModel.estateNames.isEmpty
? ''
: BeeParse.getEstateName(

@ -1,3 +1,5 @@
import 'package:akuCommunity/constants/app_values.dart';
import 'package:akuCommunity/ui/profile/house/pick_my_house_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -45,7 +47,7 @@ class _VisitorAccessPageState extends State<VisitorAccessPage> {
32.w.heightBox,
GestureDetector(
onTap: () {
MyHousePage().to();
Get.to(() => PickMyHousePage());
},
child: Row(
children: [
@ -302,7 +304,7 @@ class _VisitorAccessPageState extends State<VisitorAccessPage> {
child: Column(
children: [
_buildHouseCard(
kEstateName,
AppValues.plotName,
userProvider.userDetailModel.estateNames.isEmpty
? ''
: BeeParse.getEstateName(

@ -35,6 +35,7 @@ class _AllApplicationPageState extends State<AllApplicationPage> {
? null
: () {
if (LoginUtil.isNotLogin) return;
if (!LoginUtil.haveRoom(object.title)) return;
Get.to(object.page);
},
child: Column(

@ -109,7 +109,7 @@ class HouseCard extends StatelessWidget {
),
),
onPressed: () {
Get.to(PickMyHousePage());
Get.to(()=>PickMyHousePage());
},
shape: RoundedRectangleBorder(
borderRadius:

@ -110,9 +110,14 @@ class _HouseCard extends StatelessWidget {
final bool highlight;
const _HouseCard({Key key, @required this.model, this.highlight = false})
: super(key: key);
bool get canTapSlide => model.status == 4 || model.status == 3 && !highlight;
bool get canTapSlide {
if (model == null) return false;
return model.status == 4 || model.status == 3 && !highlight;
}
@override
Widget build(BuildContext context) {
if (model == null) return SizedBox();
return Slidable(
actionPane: SlidableDrawerActionPane(),
actionExtentRatio: 0.2,
@ -165,10 +170,10 @@ class _HouseCard extends StatelessWidget {
children: [
Container(
child: Text(
model.houseStatus,
model?.houseStatus ?? '',
style: Theme.of(context).textTheme.subtitle2.copyWith(
fontWeight: FontWeight.bold,
color: model.houseStatusColor,
color: model?.houseStatusColor ?? Colors.white,
),
),
alignment: Alignment.center,

@ -40,6 +40,7 @@ class _BeeSearchState extends State<BeeSearch> {
return MaterialButton(
onPressed: () {
if (LoginUtil.isNotLogin) return;
if (!LoginUtil.haveRoom(e.title)) return;
Get.to(e.page);
},
shape: StadiumBorder(),

@ -1,3 +1,6 @@
import 'package:akuCommunity/provider/app_provider.dart';
import 'package:akuCommunity/ui/profile/house/add_house_page.dart';
import 'package:akuCommunity/ui/profile/house/house_owners_page.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
@ -27,4 +30,20 @@ class LoginUtil {
///
///
static bool get isNotLogin => !isLogin;
static bool haveRoom(String name) {
if (!name.contains(RegExp('访客邀请|报事报修|建议咨询|生活缴费|物品出门|投诉表扬'))) return true;
final appProvider = Provider.of<AppProvider>(Get.context, listen: false);
if (appProvider.selectedHouse == null) {
BotToast.showText(text: '请先添加房屋');
Get.to(() => AddHousePage());
return false;
}
if (appProvider.selectedHouse.status != 4) {
BotToast.showText(text: '房屋审核中或审核失败');
Get.to(() => HouseOwnersPage());
return false;
}
return true;
}
}

@ -1,3 +1,4 @@
import 'package:akuCommunity/constants/app_values.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -48,7 +49,7 @@ class _BeeHeaderHouseState extends State<BeeHeaderHouse> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
kEstateName.text.black.size(32.sp).bold.make(),
AppValues.plotName.text.black.size(32.sp).bold.make(),
10.w.heightBox,
userProvider.currentHouse.text.black
.size(32.sp)

@ -32,6 +32,7 @@ class _ApplicationViewState extends State<ApplicationView> {
padding: EdgeInsets.zero,
onPressed: () {
if (LoginUtil.isNotLogin) return;
if (!LoginUtil.haveRoom(object.title)) return;
Get.to(object.page);
},
child: Column(

Loading…
Cancel
Save