Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ethan
/
appframe
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit 63830387
authored
2025-12-08 14:52:33 +0800
by
tanghuan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
未安装微信App时,选择微信登录、或跳转小程序时,进行相应提醒。
1 parent
b3d52116
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
1 deletions
lib/data/repositories/message/open_weapp_handler.dart
lib/ui/pages/login_main_page.dart
lib/data/repositories/message/open_weapp_handler.dart
View file @
6383038
...
...
@@ -7,6 +7,10 @@ class OpenWeappHandler extends MessageHandler {
@override
Future
<
bool
>
handleMessage
(
params
)
async
{
if
(!
await
_fluwx
.
isWeChatInstalled
)
{
throw
Exception
(
'设备上未安装微信App,不支持跳转打开微信小程序'
);
}
if
(
params
is
!
Map
<
String
,
dynamic
>)
{
throw
Exception
(
'参数错误'
);
}
...
...
lib/ui/pages/login_main_page.dart
View file @
6383038
import
'package:appframe/bloc/login_main_cubit.dart'
;
import
'package:appframe/config/locator.dart'
;
import
'package:appframe/ui/widgets/login/login_page_agreed_widget.dart'
;
import
'package:appframe/ui/widgets/login/login_page_header_widget.dart'
;
import
'package:appframe/ui/widgets/login/login_page_image_widget.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:fluwx/fluwx.dart'
;
class
LoginMainPage
extends
StatelessWidget
{
const
LoginMainPage
({
super
.
key
});
...
...
@@ -86,8 +88,12 @@ class LoginMainPage extends StatelessWidget {
width:
double
.
infinity
,
height:
47
,
child:
ElevatedButton
(
onPressed:
()
{
onPressed:
()
async
{
if
(
await
getIt
.
get
<
Fluwx
>().
isWeChatInstalled
)
{
loginMainCubit
.
wechatAuth
();
}
else
{
_noWechatLogin
(
context
);
}
},
style:
ElevatedButton
.
styleFrom
(
backgroundColor:
Color
(
0xFF00CB60
),
...
...
@@ -301,4 +307,25 @@ class LoginMainPage extends StatelessWidget {
loginMainCubit
.
cancelAgreed
();
}
}
void
_noWechatLogin
(
BuildContext
ctx
)
{
showDialog
(
context:
ctx
,
barrierDismissible:
false
,
builder:
(
BuildContext
context
)
{
return
AlertDialog
(
title:
Text
(
'温馨提示'
),
content:
Text
(
'设备上未安装微信App,请选择其它登录方式'
),
actions:
<
Widget
>[
TextButton
(
child:
Text
(
'关闭'
),
onPressed:
()
{
Navigator
.
of
(
context
).
pop
();
},
),
],
);
},
);
}
}
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment