Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx_verification_code
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
openSourceLibrary
clx_verification_code
Commits
e4d3f202
提交
e4d3f202
authored
4月 28, 2025
作者:
祁增奎
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加发送验证码重复点击拦截
上级
6fc25665
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
24 行增加
和
115 行删除
+24
-115
clx_verification_code.dart
lib/clx_verification_code.dart
+0
-1
clx_code_manage_logic.dart
lib/code_manage/clx_code_manage_logic.dart
+16
-0
clx_line_code_manage_view.dart
lib/views/clx_line_code_manage_view.dart
+1
-2
clx_interval_button.dart
lib/widgets/button/clx_interval_button.dart
+0
-105
no_receive_resend_sms_view.dart
lib/widgets/tips_widget/no_receive_resend_sms_view.dart
+1
-1
no_receive_sms_view.dart
lib/widgets/tips_widget/no_receive_sms_view.dart
+2
-2
no_receive_voice_view.dart
lib/widgets/tips_widget/no_receive_voice_view.dart
+3
-3
pubspec.yaml
pubspec.yaml
+1
-1
没有找到文件。
lib/clx_verification_code.dart
浏览文件 @
e4d3f202
...
...
@@ -17,7 +17,6 @@ export 'widgets/input_widget/code_input_view.dart';
export
'widgets/tips_widget/no_receive_resend_sms_view.dart'
;
export
'widgets/tips_widget/no_receive_sms_view.dart'
;
export
'widgets/tips_widget/no_receive_voice_view.dart'
;
export
'widgets/button/clx_interval_button.dart'
;
/// -------公共Utils---------
export
'utils/line_code_manage_config.dart'
;
...
...
lib/code_manage/clx_code_manage_logic.dart
浏览文件 @
e4d3f202
...
...
@@ -53,6 +53,9 @@ class CLXCodeManageLogic extends GetxController {
/// 刷新页面需要
RxString
refreshPage
=
''
.
obs
;
/// 是否允许发送验证码
bool
canSend
=
true
;
@override
void
onInit
()
{
super
.
onInit
();
...
...
@@ -78,12 +81,20 @@ class CLXCodeManageLogic extends GetxController {
/// 外部调用开启定时器
startTimerAndChangeType
()
{
if
(!
canSend
)
{
return
;
}
canSend
=
false
;
_startCountdown
();
handleCodeSendType
();
}
/// 发送短信验证码
sendSmsCode
()
async
{
if
(!
canSend
)
{
return
;
}
canSend
=
false
;
if
(
countdown
.
value
!=
60
)
{
return
;
}
...
...
@@ -96,6 +107,10 @@ class CLXCodeManageLogic extends GetxController {
/// 发送语音验证码
sendVoiceCode
()
async
{
if
(!
canSend
)
{
return
;
}
canSend
=
false
;
if
(
countdown
.
value
!=
60
)
{
return
;
}
...
...
@@ -127,6 +142,7 @@ class CLXCodeManageLogic extends GetxController {
timer
.
cancel
();
codeSendBtn
.
value
=
''
;
countdown
.
value
=
60
;
canSend
=
true
;
handleCodeSendType
(
isSmsSend:
isSmsSend
);
handleTipInfo
();
}
else
{
...
...
lib/views/clx_line_code_manage_view.dart
浏览文件 @
e4d3f202
import
'package:clx_verification_code/utils/code_send_enum.dart'
;
import
'package:flutter/material.dart'
;
import
'../clx_verification_code.dart'
;
...
...
@@ -52,7 +51,7 @@ class CLXLineCodeManageView extends StatelessWidget {
Obx
(
()
=>
Visibility
(
visible:
loigc
.
codeSendBtn
.
value
.
isNotEmpty
,
child:
CLXIntervalBtn
(
child:
GestureDetector
(
onTap:
loigc
.
sendSmsCode
,
child:
Text
(
loigc
.
codeSendBtn
.
value
,
...
...
lib/widgets/button/clx_interval_button.dart
deleted
100644 → 0
浏览文件 @
6fc25665
import
'package:flutter/gestures.dart'
;
import
'package:flutter/widgets.dart'
;
class
CLXIntervalBtn
extends
StatelessWidget
with
WidgetInterval
{
CLXIntervalBtn
(
{
super
.
key
,
required
this
.
child
,
interval
=
const
Duration
(
seconds:
1
),
this
.
disabled
=
false
,
this
.
onTap
});
final
Widget
?
child
;
final
bool
disabled
;
final
Function
?
onTap
;
@override
Widget
build
(
BuildContext
context
)
{
return
GestureDetector
(
key:
key
,
onTap:
_onTap
,
child:
child
,
);
}
void
_onTap
()
{
if
(
disabled
)
{
return
;
}
if
(
lastTap
==
null
||
lastTap
?.
add
(
interval
).
compareTo
(
DateTime
.
now
())
==
-
1
)
{
lastTap
=
DateTime
.
now
();
onTap
?.
call
();
}
}
}
class
CLXTapGestureRecognizer
extends
TapGestureRecognizer
with
TapGestureRecognizerInterval
{
@protected
@override
void
handleTapUp
(
{
required
PointerDownEvent
down
,
required
PointerUpEvent
up
})
{
final
TapUpDetails
details
=
TapUpDetails
(
kind:
up
.
kind
,
globalPosition:
up
.
position
,
localPosition:
up
.
localPosition
,
);
final
canTouch
=
lastTap
==
null
||
lastTap
?.
add
(
interval
).
compareTo
(
DateTime
.
now
())
==
-
1
;
if
(!
canTouch
)
{
return
;
}
lastTap
=
DateTime
.
now
();
switch
(
down
.
buttons
)
{
case
kPrimaryButton:
if
(
onTapUp
!=
null
)
{
invokeCallback
<
void
>(
'onTapUp'
,
()
=>
onTapUp
!(
details
));
}
if
(
onTap
!=
null
)
{
invokeCallback
<
void
>(
'onTap'
,
onTap
!);
}
case
kSecondaryButton:
if
(
onSecondaryTapUp
!=
null
)
{
invokeCallback
<
void
>(
'onSecondaryTapUp'
,
()
=>
onSecondaryTapUp
!(
details
));
}
if
(
onSecondaryTap
!=
null
)
{
invokeCallback
<
void
>(
'onSecondaryTap'
,
()
=>
onSecondaryTap
!());
}
case
kTertiaryButton:
if
(
onTertiaryTapUp
!=
null
)
{
invokeCallback
<
void
>(
'onTertiaryTapUp'
,
()
=>
onTertiaryTapUp
!(
details
));
}
default
:
}
}
}
mixin
WidgetInterval
on
Widget
{
Duration
get
interval
=>
_interval
;
Duration
_interval
=
Duration
.
zero
;
DateTime
?
lastTap
;
set
interval
(
Duration
duration
)
{
_interval
=
duration
;
}
}
mixin
TapGestureRecognizerInterval
on
TapGestureRecognizer
{
Duration
get
interval
=>
_interval
;
Duration
_interval
=
const
Duration
(
seconds:
1
);
DateTime
?
lastTap
;
set
interval
(
Duration
duration
)
{
_interval
=
duration
;
}
}
lib/widgets/tips_widget/no_receive_resend_sms_view.dart
浏览文件 @
e4d3f202
...
...
@@ -34,7 +34,7 @@ class NoReceiveResendSmsView extends StatelessWidget {
TextSpan
(
text:
'获取语音验证码'
,
style:
reSendStyle
,
recognizer:
CLX
TapGestureRecognizer
()..
onTap
=
sendVoiceCode
,
recognizer:
TapGestureRecognizer
()..
onTap
=
sendVoiceCode
,
),
],
),
...
...
lib/widgets/tips_widget/no_receive_sms_view.dart
浏览文件 @
e4d3f202
...
...
@@ -44,13 +44,13 @@ class NoReceiveSmsView extends StatelessWidget {
TextSpan
(
text:
'重新获取'
,
style:
reSendStyle
,
recognizer:
CLX
TapGestureRecognizer
()..
onTap
=
sendSmsCode
,
recognizer:
TapGestureRecognizer
()..
onTap
=
sendSmsCode
,
),
],
),
),
const
Spacer
(),
CLXIntervalBtn
(
GestureDetector
(
onTap:
sendVoiceCode
,
child:
Text
(
'获取语音验证码'
,
...
...
lib/widgets/tips_widget/no_receive_voice_view.dart
浏览文件 @
e4d3f202
import
'package:
clx_verification_code/clx_verification_code
.dart'
;
import
'package:
flutter/cupertino
.dart'
;
import
'package:flutter/gestures.dart'
;
import
'package:flutter/widgets.dart'
;
...
...
@@ -48,7 +48,7 @@ class NoReceiveVoiceView extends StatelessWidget {
TextSpan
(
text:
'重新获取'
,
style:
reSendStyle
,
recognizer:
CLX
TapGestureRecognizer
()..
onTap
=
sendVoiceCode
,
recognizer:
TapGestureRecognizer
()..
onTap
=
sendVoiceCode
,
),
],
),
...
...
@@ -56,7 +56,7 @@ class NoReceiveVoiceView extends StatelessWidget {
),
if
(
isShowContact
)
...[
const
SizedBox
(
width:
10
),
CLXIntervalBtn
(
GestureDetector
(
onTap:
contactService
,
child:
Text
(
'联系人工服务'
,
...
...
pubspec.yaml
浏览文件 @
e4d3f202
name
:
clx_verification_code
description
:
"
A
new
Flutter
package
project."
version
:
0.0.
3
version
:
0.0.
4
homepage
:
environment
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论