diff --git a/example/pubspec.lock b/example/pubspec.lock index 4dc47be..04c88ed 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -7,7 +7,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.2" + version: "2.9.0" boolean_selector: dependency: transitive description: @@ -21,21 +21,14 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.1" + version: "1.2.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: @@ -56,7 +49,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.3.1" flutter: dependency: "direct main" description: flutter @@ -73,21 +66,21 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.11" + version: "0.12.12" material_color_utilities: dependency: transitive description: name: material_color_utilities url: "https://pub.dartlang.org" source: hosted - version: "0.1.4" + version: "0.1.5" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0" otp_text_field: dependency: "direct main" description: @@ -101,7 +94,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.2" sky_engine: dependency: transitive description: flutter @@ -113,7 +106,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.2" + version: "1.9.0" stack_trace: dependency: transitive description: @@ -134,21 +127,21 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.9" + version: "0.4.12" vector_math: dependency: transitive description: diff --git a/lib/otp_field.dart b/lib/otp_field.dart index 279571d..0bca0a9 100644 --- a/lib/otp_field.dart +++ b/lib/otp_field.dart @@ -62,29 +62,33 @@ class OTPTextField extends StatefulWidget { final List? inputFormatter; - const OTPTextField({ - Key? key, - this.length = 4, - this.width = 10, - this.controller, - this.fieldWidth = 30, - this.spaceBetween = 0, - this.otpFieldStyle, - this.hasError = false, - this.keyboardType = TextInputType.number, - this.style = const TextStyle(), - this.outlineBorderRadius: 10, - this.textCapitalization = TextCapitalization.none, - this.textFieldAlignment = MainAxisAlignment.spaceBetween, - this.obscureText = false, - this.fieldStyle = FieldStyle.underline, - this.onChanged, - this.inputFormatter, - this.contentPadding = - const EdgeInsets.symmetric(horizontal: 4, vertical: 8), - this.isDense = false, - this.onCompleted, - }) : assert(length > 1), + /// cursor color + final Color cursorColor; + + const OTPTextField( + {Key? key, + this.length = 4, + this.width = 10, + this.controller, + this.fieldWidth = 30, + this.spaceBetween = 0, + this.otpFieldStyle, + this.hasError = false, + this.keyboardType = TextInputType.number, + this.style = const TextStyle(), + this.outlineBorderRadius: 10, + this.textCapitalization = TextCapitalization.none, + this.textFieldAlignment = MainAxisAlignment.spaceBetween, + this.obscureText = false, + this.fieldStyle = FieldStyle.underline, + this.onChanged, + this.inputFormatter, + this.contentPadding = + const EdgeInsets.symmetric(horizontal: 4, vertical: 8), + this.isDense = false, + this.onCompleted, + this.cursorColor = Colors.black}) + : assert(length > 1), super(key: key); @override @@ -180,6 +184,7 @@ class _OTPTextFieldState extends State { right: isLast ? 0 : widget.spaceBetween, ), child: TextField( + cursorColor: widget.cursorColor, controller: _textControllers[index], keyboardType: widget.keyboardType, textCapitalization: widget.textCapitalization, diff --git a/pubspec.lock b/pubspec.lock index 339983b..4cdda98 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,7 +7,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.2" + version: "2.9.0" boolean_selector: dependency: transitive description: @@ -21,21 +21,14 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.1" + version: "1.2.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: @@ -49,7 +42,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.3.1" flutter: dependency: "direct main" description: flutter @@ -66,28 +59,28 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.11" + version: "0.12.12" material_color_utilities: dependency: transitive description: name: material_color_utilities url: "https://pub.dartlang.org" source: hosted - version: "0.1.4" + version: "0.1.5" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.2" sky_engine: dependency: transitive description: flutter @@ -99,7 +92,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.2" + version: "1.9.0" stack_trace: dependency: transitive description: @@ -120,21 +113,21 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.9" + version: "0.4.12" vector_math: dependency: transitive description: