提交 f78a6fde authored 作者: 祁增奎's avatar 祁增奎

适配小窗模式

上级 e4d3f202
...@@ -99,6 +99,7 @@ class CLXCodeManageLogic extends GetxController { ...@@ -99,6 +99,7 @@ class CLXCodeManageLogic extends GetxController {
return; return;
} }
final result = await getSmsVerificationCode?.call(); final result = await getSmsVerificationCode?.call();
canSend = true;
if (result == true) { if (result == true) {
handleCodeSendType(); handleCodeSendType();
_startCountdown(); _startCountdown();
...@@ -115,6 +116,7 @@ class CLXCodeManageLogic extends GetxController { ...@@ -115,6 +116,7 @@ class CLXCodeManageLogic extends GetxController {
return; return;
} }
final result = await obtainVoiceVerificationCode?.call(); final result = await obtainVoiceVerificationCode?.call();
canSend = true;
if (result == true) { if (result == true) {
handleCodeSendType(isSmsSend: false); handleCodeSendType(isSmsSend: false);
_startCountdown(isSmsSend: false); _startCountdown(isSmsSend: false);
......
...@@ -13,6 +13,9 @@ class LineCodeManageConfig { ...@@ -13,6 +13,9 @@ class LineCodeManageConfig {
/// 输入框是否紧贴 /// 输入框是否紧贴
bool isCollapsed; bool isCollapsed;
/// 是否小窗口模式
bool isSmallWindow;
/// 提示文字 /// 提示文字
String? hintText; String? hintText;
...@@ -51,6 +54,7 @@ class LineCodeManageConfig { ...@@ -51,6 +54,7 @@ class LineCodeManageConfig {
this.margin = const EdgeInsets.symmetric(horizontal: 30), this.margin = const EdgeInsets.symmetric(horizontal: 30),
this.padding = const EdgeInsets.symmetric(horizontal: 30), this.padding = const EdgeInsets.symmetric(horizontal: 30),
this.isCollapsed = false, this.isCollapsed = false,
this.isSmallWindow = false,
this.hintText, this.hintText,
this.hintStyle = const TextStyle( this.hintStyle = const TextStyle(
color: Color(0xffC9CDD4), fontSize: 14, fontWeight: FontWeight.w400), color: Color(0xffC9CDD4), fontSize: 14, fontWeight: FontWeight.w400),
......
...@@ -90,6 +90,7 @@ class CLXLineCodeManageView extends StatelessWidget { ...@@ -90,6 +90,7 @@ class CLXLineCodeManageView extends StatelessWidget {
tipsStyle: config.tipsStyle, tipsStyle: config.tipsStyle,
reSendStyle: config.reSendStyle, reSendStyle: config.reSendStyle,
voiceSendStyle: config.voiceSendStyle, voiceSendStyle: config.voiceSendStyle,
isSmallWindow: config.isSmallWindow,
sendSmsCode: loigc.sendSmsCode, sendSmsCode: loigc.sendSmsCode,
sendVoiceCode: loigc.sendVoiceCode, sendVoiceCode: loigc.sendVoiceCode,
), ),
...@@ -109,6 +110,7 @@ class CLXLineCodeManageView extends StatelessWidget { ...@@ -109,6 +110,7 @@ class CLXLineCodeManageView extends StatelessWidget {
loigc.codeSendType.value == loigc.codeSendType.value ==
CodeSendType.notReceiveResendVoiceCode) CodeSendType.notReceiveResendVoiceCode)
NoReceiveVoiceView( NoReceiveVoiceView(
isSmallWindow: config.isSmallWindow,
tipsStyle: config.tipsStyle, tipsStyle: config.tipsStyle,
reSendStyle: config.reSendStyle, reSendStyle: config.reSendStyle,
contactStyle: config.contactStyle, contactStyle: config.contactStyle,
......
...@@ -64,6 +64,7 @@ class CLXPageCodeManageView extends StatelessWidget { ...@@ -64,6 +64,7 @@ class CLXPageCodeManageView extends StatelessWidget {
tipsStyle: config.tipsStyle, tipsStyle: config.tipsStyle,
reSendStyle: config.reSendStyle, reSendStyle: config.reSendStyle,
voiceSendStyle: config.voiceSendStyle, voiceSendStyle: config.voiceSendStyle,
isSmallWindow: false,
sendSmsCode: loigc.sendSmsCode, sendSmsCode: loigc.sendSmsCode,
sendVoiceCode: loigc.sendVoiceCode, sendVoiceCode: loigc.sendVoiceCode,
), ),
...@@ -86,6 +87,7 @@ class CLXPageCodeManageView extends StatelessWidget { ...@@ -86,6 +87,7 @@ class CLXPageCodeManageView extends StatelessWidget {
tipsStyle: config.tipsStyle, tipsStyle: config.tipsStyle,
reSendStyle: config.reSendStyle, reSendStyle: config.reSendStyle,
contactStyle: config.contactStyle, contactStyle: config.contactStyle,
isSmallWindow: false,
sendVoiceCode: loigc.sendVoiceCode, sendVoiceCode: loigc.sendVoiceCode,
contactService: loigc.contactService, contactService: loigc.contactService,
isShowContact: loigc.codeSendType.value == isShowContact: loigc.codeSendType.value ==
......
import 'package:clx_verification_code/clx_verification_code.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
......
import 'package:clx_verification_code/clx_verification_code.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
class NoReceiveSmsView extends StatelessWidget { class NoReceiveSmsView extends StatelessWidget {
const NoReceiveSmsView({ const NoReceiveSmsView({
super.key, super.key,
required this.isSmallWindow,
this.reSendStyle, this.reSendStyle,
this.tipsStyle, this.tipsStyle,
this.voiceSendStyle, this.voiceSendStyle,
...@@ -21,6 +21,9 @@ class NoReceiveSmsView extends StatelessWidget { ...@@ -21,6 +21,9 @@ class NoReceiveSmsView extends StatelessWidget {
/// 语音发送文字样式 /// 语音发送文字样式
final TextStyle? voiceSendStyle; final TextStyle? voiceSendStyle;
/// 是否小窗模式
final bool isSmallWindow;
/// 发送短信验证码 /// 发送短信验证码
final GestureTapCallback? sendSmsCode; final GestureTapCallback? sendSmsCode;
...@@ -31,34 +34,64 @@ class NoReceiveSmsView extends StatelessWidget { ...@@ -31,34 +34,64 @@ class NoReceiveSmsView extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Padding( return Padding(
padding: const EdgeInsets.symmetric(vertical: 10), padding: const EdgeInsets.symmetric(vertical: 10),
child: Row( child: isSmallWindow
children: [ ? Column(
RichText( crossAxisAlignment: CrossAxisAlignment.start,
text: TextSpan(
children: [ children: [
TextSpan( RichText(
text: '没有收到短信?', text: TextSpan(
style: tipsStyle, children: [
TextSpan(
text: '没有收到短信?',
style: tipsStyle,
),
const WidgetSpan(child: SizedBox(width: 5)),
TextSpan(
text: '重新获取',
style: reSendStyle,
recognizer: TapGestureRecognizer()..onTap = sendSmsCode,
),
],
),
), ),
const WidgetSpan(child: SizedBox(width: 5)), const SizedBox(height: 4),
TextSpan( GestureDetector(
text: '重新获取', onTap: sendVoiceCode,
style: reSendStyle, child: Text(
recognizer: TapGestureRecognizer()..onTap = sendSmsCode, '获取语音验证码',
style: voiceSendStyle,
),
),
],
)
: Row(
children: [
RichText(
text: TextSpan(
children: [
TextSpan(
text: '没有收到短信?',
style: tipsStyle,
),
const WidgetSpan(child: SizedBox(width: 5)),
TextSpan(
text: '重新获取',
style: reSendStyle,
recognizer: TapGestureRecognizer()..onTap = sendSmsCode,
),
],
),
),
const Spacer(),
GestureDetector(
onTap: sendVoiceCode,
child: Text(
'获取语音验证码',
style: voiceSendStyle,
),
), ),
], ],
), ),
),
const Spacer(),
GestureDetector(
onTap: sendVoiceCode,
child: Text(
'获取语音验证码',
style: voiceSendStyle,
),
),
],
),
); );
} }
} }
...@@ -3,14 +3,16 @@ import 'package:flutter/gestures.dart'; ...@@ -3,14 +3,16 @@ import 'package:flutter/gestures.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
class NoReceiveVoiceView extends StatelessWidget { class NoReceiveVoiceView extends StatelessWidget {
const NoReceiveVoiceView( const NoReceiveVoiceView({
{super.key, super.key,
this.reSendStyle, required this.isShowContact,
this.tipsStyle, required this.isSmallWindow,
this.contactStyle, this.reSendStyle,
required this.isShowContact, this.tipsStyle,
this.contactService, this.contactStyle,
this.sendVoiceCode}); this.contactService,
this.sendVoiceCode,
});
/// 重新获取文字样式 /// 重新获取文字样式
final TextStyle? reSendStyle; final TextStyle? reSendStyle;
...@@ -21,6 +23,9 @@ class NoReceiveVoiceView extends StatelessWidget { ...@@ -21,6 +23,9 @@ class NoReceiveVoiceView extends StatelessWidget {
/// 联系客服文字样式 /// 联系客服文字样式
final TextStyle? contactStyle; final TextStyle? contactStyle;
/// 是否小窗模式
final bool isSmallWindow;
/// 是否显示联系客服 /// 是否显示联系客服
final bool isShowContact; final bool isShowContact;
...@@ -34,38 +39,72 @@ class NoReceiveVoiceView extends StatelessWidget { ...@@ -34,38 +39,72 @@ class NoReceiveVoiceView extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Padding( return Padding(
padding: const EdgeInsets.symmetric(vertical: 10), padding: const EdgeInsets.symmetric(vertical: 10),
child: Row( child: isSmallWindow
children: [ ? Column(
Expanded( crossAxisAlignment: CrossAxisAlignment.start,
child: RichText( children: [
text: TextSpan( RichText(
children: [ text: TextSpan(
TextSpan( children: [
text: '没有收到语音?', TextSpan(
style: tipsStyle, text: '没有收到语音?',
style: tipsStyle,
),
const WidgetSpan(child: SizedBox(width: 5)),
TextSpan(
text: '重新获取',
style: reSendStyle,
recognizer: TapGestureRecognizer()
..onTap = sendVoiceCode,
),
],
), ),
const WidgetSpan(child: SizedBox(width: 5)), ),
TextSpan( if (isShowContact) ...[
text: '重新获取', const SizedBox(height: 4),
style: reSendStyle, GestureDetector(
recognizer: TapGestureRecognizer()..onTap = sendVoiceCode, onTap: contactService,
child: Text(
'联系人工服务',
style: contactStyle,
),
), ),
], ],
), ],
), )
), : Row(
if (isShowContact) ...[ children: [
const SizedBox(width: 10), Expanded(
GestureDetector( child: RichText(
onTap: contactService, text: TextSpan(
child: Text( children: [
'联系人工服务', TextSpan(
style: contactStyle, text: '没有收到语音?',
), style: tipsStyle,
),
const WidgetSpan(child: SizedBox(width: 5)),
TextSpan(
text: '重新获取',
style: reSendStyle,
recognizer: TapGestureRecognizer()
..onTap = sendVoiceCode,
),
],
),
),
),
if (isShowContact) ...[
const SizedBox(width: 10),
GestureDetector(
onTap: contactService,
child: Text(
'联系人工服务',
style: contactStyle,
),
),
],
],
), ),
],
],
),
); );
} }
} }
name: clx_verification_code name: clx_verification_code
description: "A new Flutter package project." description: "A new Flutter package project."
version: 0.0.4 version: 0.0.5
homepage: homepage:
environment: environment:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论