|
|
|
@ -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),
|
|
|
|
// );
|
|
|
|
// );
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }}
|
|
|
|
}
|
|
|
|
|
|
|
|
|