From c38dcd6099643031ae6f53c287e7899a8b778155 Mon Sep 17 00:00:00 2001 From: Ezeaku Ifechukwu Stanley <56836874+Stanley-Ezeaku@users.noreply.github.com> Date: Tue, 29 Mar 2022 08:55:20 +0400 Subject: [PATCH] Ability to change OtpTextField cursor color Added the ability to change the cursor color of the OtpTextField. --- lib/otp_field.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/otp_field.dart b/lib/otp_field.dart index 2c86a5d..c9c421f 100644 --- a/lib/otp_field.dart +++ b/lib/otp_field.dart @@ -26,6 +26,10 @@ class OTPTextField extends StatefulWidget { /// The style to use for the text being edited. final double outlineBorderRadius; + + + /// The cursorColor of the text field (Default is set to Blue). + final Color cursorColor; /// Text Field Alignment /// default: MainAxisAlignment.spaceBetween [MainAxisAlignment] @@ -58,6 +62,7 @@ class OTPTextField extends StatefulWidget { this.keyboardType = TextInputType.number, this.style = const TextStyle(), this.outlineBorderRadius: 10, + this.cursorColor = Colors.blue, this.textFieldAlignment = MainAxisAlignment.spaceBetween, this.obscureText = false, this.fieldStyle = FieldStyle.underline, @@ -139,6 +144,7 @@ class _OTPTextFieldState extends State { color: _otpFieldStyle.backgroundColor, borderRadius: BorderRadius.circular(widget.outlineBorderRadius)), child: TextField( + cursorColor: widget.cursorColor, controller: _textControllers[i], keyboardType: widget.keyboardType, textAlign: TextAlign.center,