added removeIndexFromPreviousChain

This commit is contained in:
ramollia
2025-12-04 18:10:25 +01:00
parent d5223c6cd1
commit 75c4e55da6

View File

@@ -59,14 +59,32 @@ public abstract class ViewWidget extends StackWidget {
previous = null; previous = null;
} }
public void replacePrevious(int index) { public void removeIndexFromPreviousChain(int index) {
if (previous == null) { ViewWidget view = previous;
return;
}
while (index > 0 && previous.previous != null) { while (index > 0 && view != null) {
previous = previous.previous;
index--; index--;
if (index == 0) {
if (view.previous != null && view.previous.previous != null) {
view.previous = view.previous.previous;
}
}
view = view.previous;
}
}
public void removeViewFromPreviousChain(ViewWidget view) {
int index = 0;
while (previous != null) {
index++;
if (previous == view) {
removeIndexFromPreviousChain(index);
break;
}
} }
} }