Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to change OtpTextField cursor color #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/otp_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -139,6 +144,7 @@ class _OTPTextFieldState extends State<OTPTextField> {
color: _otpFieldStyle.backgroundColor,
borderRadius: BorderRadius.circular(widget.outlineBorderRadius)),
child: TextField(
cursorColor: widget.cursorColor,
controller: _textControllers[i],
keyboardType: widget.keyboardType,
textAlign: TextAlign.center,
Expand Down