Skip to content

Commit 15ada63

Browse files
committed
fixed deprecated list warning
1 parent 6030284 commit 15ada63

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[6.0.2] - Added fallback color when the cursor color fails to retrive.
2+
13
[6.0.1] - Fixed read-only warning when field is not `enabled` & cursor animation now only triggers if `showCursor = true`
24

35
# [6.0.0]

lib/src/pin_code_fields.dart

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,7 @@ class _PinCodeTextFieldState extends State<PinCodeTextField>
241241
_focusNode.addListener(() {
242242
setState(() {});
243243
}); // Rebuilds on every change to reflect the correct color on each field.
244-
_inputList = List<String>(widget.length);
245-
_initializeValues();
244+
_inputList = List<String>.filled(widget.length, "");
246245

247246
_cursorController = AnimationController(
248247
duration: Duration(milliseconds: 1000), vsync: this);
@@ -376,12 +375,6 @@ class _PinCodeTextFieldState extends State<PinCodeTextField>
376375
super.dispose();
377376
}
378377

379-
void _initializeValues() {
380-
for (int i = 0; i < _inputList.length; i++) {
381-
_inputList[i] = "";
382-
}
383-
}
384-
385378
// selects the right color for the field
386379
Color _getColorFromIndex(int index) {
387380
if (!widget.enabled) {
@@ -718,7 +711,7 @@ class _PinCodeTextFieldState extends State<PinCodeTextField>
718711
}
719712

720713
void _setTextToInput(String data) async {
721-
var replaceInputList = List<String>(widget.length);
714+
var replaceInputList = List<String>.filled(widget.length, "");
722715

723716
for (int i = 0; i < widget.length; i++) {
724717
replaceInputList[i] = data.length > i ? data[i] : "";

0 commit comments

Comments
 (0)