From 89f5f58acc75cf743250758ca95a080487bf719e Mon Sep 17 00:00:00 2001 From: huixiang_app <953969641@qq.com> Date: Tue, 12 Sep 2023 14:27:21 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9F=AD=E4=BF=A1=E9=AA=8C=E8=AF=81=E7=A0=81?= =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/login/captcha/block_puzzle_captcha.dart | 47 +++++++++++---------- lib/login/captcha/click_word_captcha.dart | 5 ++- lib/login/new_login_page.dart | 6 +-- lib/setting/logout_ing.dart | 6 +-- 4 files changed, 33 insertions(+), 31 deletions(-) diff --git a/lib/login/captcha/block_puzzle_captcha.dart b/lib/login/captcha/block_puzzle_captcha.dart index 3966b625..78143f70 100644 --- a/lib/login/captcha/block_puzzle_captcha.dart +++ b/lib/login/captcha/block_puzzle_captcha.dart @@ -3,6 +3,7 @@ import 'dart:math'; import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; import '../../retrofit/retrofit_api.dart'; import '../../utils/captcha_util.dart'; @@ -58,7 +59,7 @@ class _BlockPuzzleCaptchaPageState extends State //滑块 GlobalKey _slideImageKey = new GlobalKey(); - double _bottomSliderSize = 60; + double _bottomSliderSize = 60.h; //------------动画------------ @@ -293,7 +294,7 @@ class _BlockPuzzleCaptchaPageState extends State child: Container( key: _containerKey, width: dialogWidth, - height: 340, + height: 340.h, color: Colors.white, child: Column( mainAxisAlignment: MainAxisAlignment.start, @@ -312,10 +313,10 @@ class _BlockPuzzleCaptchaPageState extends State ///顶部,提示+关闭 _topContainer() { return Container( - height: 50, - padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 50.h, + padding: EdgeInsets.fromLTRB(10.w, 0, 10.w, 0), decoration: BoxDecoration( - border: Border(bottom: BorderSide(width: 1, color: Color(0xffe5e5e5))), + border: Border(bottom: BorderSide(width: 1.w, color: Color(0xffe5e5e5))), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -340,7 +341,7 @@ class _BlockPuzzleCaptchaPageState extends State _middleContainer() { ////显示验证码 return Container( - margin: EdgeInsets.symmetric(vertical: 10), + margin: EdgeInsets.symmetric(vertical: 10.h), child: Stack( children: [ ///底图 310*155 @@ -352,14 +353,14 @@ class _BlockPuzzleCaptchaPageState extends State gaplessPlayback: true, ) : Container( - width: 310, - height: 155, + width: 310.w, + height: 155.h, alignment: Alignment.center, child: CircularProgressIndicator(), ), ///滑块图 - slideImageBase64.length > 0 + (baseImageBase64.length > 0 && slideImageBase64.length > 0) ? Container( margin: EdgeInsets.fromLTRB(sliderXMoved, 0, 0, 0), child: Image.memory( @@ -386,15 +387,15 @@ class _BlockPuzzleCaptchaPageState extends State ), Positioned( bottom: 0, - left: -10, - right: -10, + left: -10.w, + right: -10.w, child: Offstage( offstage: !_showTimeLine, child: FractionalTranslation( translation: Offset(0, offsetAnimation.value), child: Container( - margin: EdgeInsets.only(left: 10, right: 10), - height: 40, + margin: EdgeInsets.only(left: 10.w, right: 10.w), + height: 40.h, color: _checkSuccess ? Color(0x7F66BB6A) : Color.fromRGBO(200, 100, 100, 0.4), @@ -409,14 +410,14 @@ class _BlockPuzzleCaptchaPageState extends State ), )), Positioned( - bottom: -20, + bottom: -20.h, left: 0, right: 0, child: Offstage( offstage: !_showTimeLine, child: Container( - margin: EdgeInsets.only(left: 10, right: 10), - height: 20, + margin: EdgeInsets.only(left: 10.w, right: 10.w), + height: 20.h, color: Colors.white, ), )) @@ -429,7 +430,7 @@ class _BlockPuzzleCaptchaPageState extends State _bottomContainer() { return baseSize.width > 0 ? Container( - height: 70, + height: 70.h, width: baseSize.width, // color: Colors.cyanAccent, child: Stack( @@ -439,7 +440,7 @@ class _BlockPuzzleCaptchaPageState extends State height: _bottomSliderSize, decoration: BoxDecoration( border: Border.all( - width: 1, + width: 1.w, color: Color(0xffe5e5e5), ), color: Color(0xfff8f9fb), @@ -449,12 +450,12 @@ class _BlockPuzzleCaptchaPageState extends State alignment: Alignment.center, child: Text( '向右拖动滑块填充拼图', - style: TextStyle(fontSize: 16), + style: TextStyle(fontSize: 16.sp), ), ), Container( width: sliderXMoved, - height: _bottomSliderSize - 2, + height: _bottomSliderSize - 2.h, decoration: BoxDecoration( border: Border.all( width: sliderXMoved > 0 ? 1 : 0, @@ -506,15 +507,15 @@ class _BlockPuzzleCaptchaPageState extends State decoration: BoxDecoration( border: Border( top: BorderSide( - width: 1, + width: 1.w, color: Color(0xffe5e5e5), ), right: BorderSide( - width: 1, + width: 1.w, color: Color(0xffe5e5e5), ), bottom: BorderSide( - width: 1, + width: 1.w, color: Color(0xffe5e5e5), ), ), diff --git a/lib/login/captcha/click_word_captcha.dart b/lib/login/captcha/click_word_captcha.dart index eb0d3fb6..1afba266 100644 --- a/lib/login/captcha/click_word_captcha.dart +++ b/lib/login/captcha/click_word_captcha.dart @@ -2,6 +2,7 @@ import 'dart:convert'; import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; import '../../retrofit/retrofit_api.dart'; import '../../utils/captcha_util.dart'; @@ -178,7 +179,7 @@ class _ClickWordCaptchaState extends State { body: Center( child: Container( width: dialogWidth, - height: 320, + height: 320.h, color: Colors.white, child: Column( children: [ @@ -264,7 +265,7 @@ class _ClickWordCaptchaState extends State { //底部提示部件 _bottomContainer() { return Container( - height: 50, + height: 50.h, margin: EdgeInsets.only(top: 10), alignment: Alignment.center, width: baseSize.width, diff --git a/lib/login/new_login_page.dart b/lib/login/new_login_page.dart index c08fe0dc..47f2d32b 100644 --- a/lib/login/new_login_page.dart +++ b/lib/login/new_login_page.dart @@ -961,7 +961,7 @@ class _NewLoginPage extends State { builder: (BuildContext context) { return BlockPuzzleCaptchaPage( onSuccess: (v) { - sendSms(); + sendSms(v); }, onFail: () { print("onFail"); @@ -971,8 +971,8 @@ class _NewLoginPage extends State { ); } - sendSms() async{ - BaseData baseData = await apiService.sendVerify({"areaCode":area, "mobile": mobile, "verification": ""}).catchError((onError) { + sendSms(v) async{ + BaseData baseData = await apiService.sendVerify({"areaCode":area, "mobile": mobile, "verification": v}).catchError((onError) { SmartDialog.showToast(AppUtils.dioErrorTypeToString(onError.type), alignment: Alignment.center);}); if (baseData != null && baseData.isSuccess) { diff --git a/lib/setting/logout_ing.dart b/lib/setting/logout_ing.dart index b4e096b4..0a9f2bdf 100644 --- a/lib/setting/logout_ing.dart +++ b/lib/setting/logout_ing.dart @@ -77,7 +77,7 @@ class _LogoutIng extends State { loadingBlockPuzzle(context); } - sendProving() async{ + sendProving(v) async{ if (apiService == null) { SharedPreferences value = await SharedPreferences.getInstance(); apiService = ApiService( @@ -87,7 +87,7 @@ class _LogoutIng extends State { showLoading: true ); } - BaseData baseData = await apiService.sendVerify({"areaCode": "+86", "mobile": phoneController.text, "verification": ""}).catchError((onError) {}); + BaseData baseData = await apiService.sendVerify({"areaCode": "+86", "mobile": phoneController.text, "verification": v}).catchError((onError) {}); if (baseData != null && baseData.isSuccess) { countdown(); SmartDialog.showToast(baseData.data, @@ -512,7 +512,7 @@ class _LogoutIng extends State { builder: (BuildContext context) { return BlockPuzzleCaptchaPage( onSuccess: (v) { - sendProving(); + sendProving(v); }, onFail: () { print("onFail");