Skip to content

Commit

Permalink
fix: NesRunningTextLines
Browse files Browse the repository at this point in the history
  • Loading branch information
erickzanardo committed Jan 4, 2024
1 parent 8be9d98 commit 20818b6
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion lib/src/widgets/nes_running_text_lines.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@ class _NesRunningTextLinesState extends State<NesRunningTextLines> {
}
}

bool _isArrayEqual(List<String> a, List<String> b) {
if (a.length != b.length) {
return false;
}

for (var i = 0; i < a.length; i++) {
if (a[i] != b[i]) {
return false;
}
}

return true;
}

@override
void didUpdateWidget(NesRunningTextLines oldWidget) {
super.didUpdateWidget(oldWidget);
Expand All @@ -62,7 +76,7 @@ class _NesRunningTextLinesState extends State<NesRunningTextLines> {
}
}

if (widget.texts != oldWidget.texts) {
if (!_isArrayEqual(widget.texts, oldWidget.texts)) {
_initLines();
if (widget.running) {
_start();
Expand Down

0 comments on commit 20818b6

Please sign in to comment.