updare-to-3.32.sultan
Aamir Muhammad 6 months ago
parent e6dad37ca3
commit bd4400e32f

@ -1,3 +1,5 @@
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
@ -53,6 +55,8 @@ class _GenericBottomSheetState extends State<GenericBottomSheet> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SafeArea( return SafeArea(
top: false,
bottom: Platform.isIOS ? false : true,
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
FocusScope.of(context).unfocus(); // Dismiss the keyboard when tapping outside FocusScope.of(context).unfocus(); // Dismiss the keyboard when tapping outside

@ -924,7 +924,7 @@ class _RegisterNew extends State<RegisterNew> {
type: type, type: type,
skipRegistration: skipRegistration, skipRegistration: skipRegistration,
onWrongActivationCode: (String? message, bool? isReroute) { onWrongActivationCode: (String? message, bool? isReroute) {
if (isReroute== true) { if (isReroute == true) {
context.showBottomSheet( context.showBottomSheet(
child: ExceptionBottomSheet( child: ExceptionBottomSheet(
message: message.toString(), message: message.toString(),
@ -935,6 +935,7 @@ class _RegisterNew extends State<RegisterNew> {
), ),
); );
} else { } else {
smsOtp.clearOTPInput();
context.showBottomSheet( context.showBottomSheet(
child: ExceptionBottomSheet( child: ExceptionBottomSheet(
message: message.toString(), message: message.toString(),

@ -342,17 +342,15 @@ class _WelcomeLogin extends State<WelcomeLogin> {
.catchError((err) { .catchError((err) {
print(err); print(err);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
ConfirmDialog dialog = new ConfirmDialog( context.showBottomSheet(
context: context, child: ExceptionBottomSheet(
confirmMessage: err, message: err.toString(),
okText: TranslationBase.of(context).confirm, showCancel: true,
cancelText: TranslationBase.of(context).cancel_nocaps, onOkPressed: () {
okFunction: () => { Navigator.of(context).pop();
ConfirmDialog.closeAlertDialog(context), Navigator.of(context).push(FadePage(page: RegisterNew()));
Navigator.of(context).push(FadePage(page: RegisterNew())), },
}, ));
cancelFunction: () => {});
dialog.showAlertDialog(context);
projectViewModel.analytics.loginRegistration.login_fail(error: err.toString()); projectViewModel.analytics.loginRegistration.login_fail(error: err.toString());
}); });
} }
@ -509,7 +507,7 @@ class _WelcomeLogin extends State<WelcomeLogin> {
checkActivationCode( checkActivationCode(
value: code, value: code,
onWrongActivationCode: (String? message) { onWrongActivationCode: (String? message) {
// smsOtp.pauseTimer(); smsOtp.clearOTPInput(); // Clear the SMS code when wrong
context.showBottomSheet( context.showBottomSheet(
child: ExceptionBottomSheet( child: ExceptionBottomSheet(
message: message.toString(), message: message.toString(),
@ -641,13 +639,13 @@ class _WelcomeLogin extends State<WelcomeLogin> {
} }
}).catchError((err) { }).catchError((err) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
context.showBottomSheet( // context.showBottomSheet(
child: ExceptionBottomSheet( // child: ExceptionBottomSheet(
message: err.toString(), // message: err.toString(),
onOkPressed: () { // onOkPressed: () {
Navigator.of(context).pop(); // Navigator.of(context).pop();
}, // },
)); // ));
// print(err); // print(err);
}); });
} else { } else {
@ -683,13 +681,13 @@ class _WelcomeLogin extends State<WelcomeLogin> {
} }
insertIMEI(); insertIMEI();
}).catchError((error) { }).catchError((error) {
context.showBottomSheet( // context.showBottomSheet(
child: ExceptionBottomSheet( // child: ExceptionBottomSheet(
message: error.toString(), // message: error.toString(),
onOkPressed: () { // onOkPressed: () {
Navigator.of(context).pop(); // Navigator.of(context).pop();
}, // },
)); // ));
}); });
} }
@ -709,13 +707,13 @@ class _WelcomeLogin extends State<WelcomeLogin> {
insertIMEI() { insertIMEI() {
authService.insertDeviceImei(selectedOption).then((value) => {}).catchError((err) { authService.insertDeviceImei(selectedOption).then((value) => {}).catchError((err) {
context.showBottomSheet( // context.showBottomSheet(
child: ExceptionBottomSheet( // child: ExceptionBottomSheet(
message: err.toString(), // message: err.toString(),
onOkPressed: () { // onOkPressed: () {
Navigator.of(context).pop(); // Navigator.of(context).pop();
}, // },
)); // ));
// print(err); // print(err);
}); });
} }

@ -136,7 +136,7 @@ class SMSOTP {
child: OTPWidget( child: OTPWidget(
autoFocus: true, autoFocus: true,
controller: _pinPutController, controller: _pinPutController,
defaultBorderColor: Color(0xffffffff), defaultBorderColor: Color(0xffE0E0E0), // Changed from white to light gray
maxLength: 4, maxLength: 4,
onTextChanged: (text) {}, onTextChanged: (text) {},
pinBoxColor: Colors.white, pinBoxColor: Colors.white,
@ -315,6 +315,15 @@ class SMSOTP {
return remainingTime; return remainingTime;
} }
// Method to clear the OTP input
void clearOTPInput() {
_pinPutController.clear();
digit1.clear();
digit2.clear();
digit3.clear();
digit4.clear();
}
checkSignature() async { checkSignature() async {
SmsVerification.startListeningSms().then((message) { SmsVerification.startListeningSms().then((message) {
// setState(() { // setState(() {

@ -208,19 +208,19 @@ class OTPWidgetState extends State<OTPWidget> with SingleTickerProviderStateMixi
return widget.hideDefaultKeyboard return widget.hideDefaultKeyboard
? _pinBoxRow(context) ? _pinBoxRow(context)
: GestureDetector( : GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
if (hasFocus) { if (hasFocus) {
FocusScope.of(context).requestFocus(FocusNode()); FocusScope.of(context).requestFocus(FocusNode());
Future.delayed(Duration(milliseconds: 100), () { Future.delayed(Duration(milliseconds: 100), () {
FocusScope.of(context).requestFocus(focusNode); FocusScope.of(context).requestFocus(focusNode);
}); });
} else { } else {
FocusScope.of(context).requestFocus(focusNode); FocusScope.of(context).requestFocus(focusNode);
} }
}, },
child: _pinBoxRow(context), child: _pinBoxRow(context),
); );
} }
Widget _otpTextInput() { Widget _otpTextInput() {
@ -318,13 +318,13 @@ class OTPWidgetState extends State<OTPWidget> with SingleTickerProviderStateMixi
// } // }
Widget _buildPinCode(int i, BuildContext context) { Widget _buildPinCode(int i, BuildContext context) {
final bool isFilled = i < text.length; final bool isFilled = i < text.length && strList[i].isNotEmpty; // Check both conditions
final bool isCurrent = i == currentIndex; final bool isCurrent = i == currentIndex;
final bool isFocused = hasFocus && isCurrent; final bool isFocused = hasFocus && isCurrent;
// Colors based on state // Colors based on state
Color bgColor = Colors.white; Color bgColor = Colors.white;
Color borderColor = widget.defaultBorderColor; Color borderColor = Colors.white;
Color textColor = Colors.black; Color textColor = Colors.black;
if (widget.hasError) { if (widget.hasError) {
@ -333,12 +333,13 @@ class OTPWidgetState extends State<OTPWidget> with SingleTickerProviderStateMixi
} else if (isFocused) { } else if (isFocused) {
borderColor = Colors.transparent; borderColor = Colors.transparent;
bgColor = Colors.white; bgColor = Colors.white;
textColor = Colors.white; textColor = Colors.black; // Changed from white to black for better visibility
} else if (isFilled) { } else if (isFilled) {
borderColor = Colors.green; borderColor = Colors.green;
bgColor = Colors.green; bgColor = Colors.green;
textColor = Colors.white; textColor = Colors.white;
} }
// When cleared/empty, colors remain as default initialized above
return Container( return Container(
key: ValueKey<String>("container$i"), key: ValueKey<String>("container$i"),
@ -448,7 +449,7 @@ class OTPWidgetState extends State<OTPWidget> with SingleTickerProviderStateMixi
softWrap: true, softWrap: true,
key: ValueKey<String>("$text$i"), key: ValueKey<String>("$text$i"),
style: widget.pinTextStyle?.copyWith(color: textColor, fontSize: fontSize, fontWeight: fontWeight, fontFamily: context.fontFamily) ?? style: widget.pinTextStyle?.copyWith(color: textColor, fontSize: fontSize, fontWeight: fontWeight, fontFamily: context.fontFamily) ??
TextStyle(color: textColor, fontSize: fontSize, fontWeight: fontWeight, fontFamily: context.fontFamily, ), TextStyle(color: textColor, fontSize: fontSize, fontWeight: fontWeight, fontFamily: context.fontFamily,),
), ),
); );
} else { } else {
@ -461,6 +462,7 @@ class OTPWidgetState extends State<OTPWidget> with SingleTickerProviderStateMixi
); );
} }
} }
}
// //
// Widget _animatedTextBox(String text, int i, Color textColor) { // Widget _animatedTextBox(String text, int i, Color textColor) {
@ -483,5 +485,4 @@ class OTPWidgetState extends State<OTPWidget> with SingleTickerProviderStateMixi
// TextStyle(color: textColor, fontSize: 24, fontWeight: FontWeight.bold), // TextStyle(color: textColor, fontSize: 24, fontWeight: FontWeight.bold),
// ); // );
// } // }
// } // }}
}

@ -91,7 +91,6 @@ class _QuickLoginBottomSheet extends State<QuickLoginBottomSheet> {
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
Expanded(child: Expanded(child:
CustomButton( CustomButton(
text:TranslationBase.of(context).enableQuickLogin, text:TranslationBase.of(context).enableQuickLogin,
onPressed:widget.onPressed, onPressed:widget.onPressed,

Loading…
Cancel
Save