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 4c8cf445
authored
2026-06-30 09:34:54 +0800
by
tanghuan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
隐蔽打开开发者模式
1 parent
e9b7f361
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
0 deletions
lib/bloc/setting/account_cubit.dart
lib/ui/pages/setting_v2/account_page_v2.dart
lib/bloc/setting/account_cubit.dart
View file @
4c8cf44
import
'dart:io'
;
import
'package:android_intent_plus/android_intent.dart'
;
import
'package:appframe/config/locator.dart'
;
import
'package:appframe/config/routes.dart'
;
import
'package:appframe/data/repositories/phone_auth_repository.dart'
;
...
...
@@ -81,6 +82,10 @@ class AccountCubit extends Cubit<AccountState> {
late
final
PhoneAuthRepository
_phoneAuthRepository
;
late
final
UserAuthRepository
_userAuthRepository
;
// 连续点击触发开发者模式
int
_devTapCount
=
0
;
DateTime
?
_lastDevTapTime
;
AccountCubit
(
super
.
initialState
)
{
_phoneAuthRepository
=
getIt
.
get
<
PhoneAuthRepository
>();
_userAuthRepository
=
getIt
.
get
<
UserAuthRepository
>();
...
...
@@ -268,4 +273,29 @@ class AccountCubit extends Cubit<AccountState> {
});
router
.
go
(
'/loginMain'
);
}
/// 透明热区连续点击,触发 Android 开发者模式
void
onDevAreaTap
()
{
final
now
=
DateTime
.
now
();
if
(
_lastDevTapTime
==
null
||
now
.
difference
(
_lastDevTapTime
!)
>
const
Duration
(
seconds:
2
))
{
_devTapCount
=
1
;
}
else
{
_devTapCount
++;
}
_lastDevTapTime
=
now
;
debugPrint
(
'onDevAreaTap:
${_devTapCount}
'
);
if
(
_devTapCount
>=
7
)
{
_devTapCount
=
0
;
_lastDevTapTime
=
null
;
if
(
Platform
.
isAndroid
)
{
const
AndroidIntent
(
action:
'android.settings.APPLICATION_DEVELOPMENT_SETTINGS'
,
).
launch
();
}
}
}
}
lib/ui/pages/setting_v2/account_page_v2.dart
View file @
4c8cf44
...
...
@@ -82,6 +82,16 @@ class AccountPageV2 extends StatelessWidget {
],
),
),
Align
(
alignment:
Alignment
.
centerLeft
,
child:
Padding
(
padding:
const
EdgeInsets
.
only
(
left:
15
),
child:
GestureDetector
(
onTap:
()
=>
cubit
.
onDevAreaTap
(),
child:
const
SizedBox
(
width:
80
,
height:
80
,
child:
DecoratedBox
(
decoration:
BoxDecoration
(
color:
Colors
.
white
))),
),
),
),
Padding
(
padding:
const
EdgeInsets
.
only
(
left:
15
,
right:
15
,
bottom:
40
),
child:
SizedBox
(
...
...
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