登录验证使用通用函数

hmxc
小赖 4 years ago
parent 487a57ad9e
commit 40c2faa368

@ -1,4 +1,5 @@
// Flutter imports:
import 'package:akuCommunity/utils/login_util.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -33,7 +34,12 @@ class _AllApplicationPageState extends State<AllApplicationPage> {
return MaterialButton(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.w)),
padding: EdgeInsets.zero,
onPressed: editMode ? null : () => Get.to(object.page),
onPressed: editMode
? null
: () {
if (LoginUtil.isNotLogin) return;
Get.to(object.page);
},
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [

@ -1,4 +1,5 @@
// Flutter imports:
import 'package:akuCommunity/utils/login_util.dart';
import 'package:flutter/material.dart';
// Package imports:
@ -40,7 +41,10 @@ class _BeeSearchState extends State<BeeSearch> {
Widget _buildColumnIcon(AO e) {
return MaterialButton(
onPressed: () => Get.to(e.page),
onPressed: () {
if (LoginUtil.isNotLogin) return;
Get.to(e.page);
},
shape: StadiumBorder(),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,

@ -1,4 +1,5 @@
// Flutter imports:
import 'package:akuCommunity/utils/login_util.dart';
import 'package:flutter/material.dart';
// Package imports:
@ -32,17 +33,12 @@ 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: () {
if (userProvider.isLogin)
if (LoginUtil.isNotLogin) return;
Get.to(object.page);
else {
BotToast.showText(text: '请先登陆');
Get.to(SignInPage());
}
},
child: Column(
mainAxisAlignment: MainAxisAlignment.center,

Loading…
Cancel
Save