rebuild method
Rebuilds the element.
Implementation
@override
void rebuild() {
final sl = widget as SafeLayout;
final fallbackWidget =
sl.fallback ??
Center(
child: Text(
'Screen too small!',
style: const Style(
foreground: Colors.red,
modifiers: Modifier.bold,
),
),
);
if (fallbackElement != null &&
Widget.canUpdate(fallbackElement!.widget, fallbackWidget)) {
fallbackElement!.update(fallbackWidget);
} else {
fallbackElement?.unmount();
fallbackElement = fallbackWidget.createElement();
fallbackElement!.mount(this);
}
if (childElement != null &&
Widget.canUpdate(childElement!.widget, sl.child)) {
childElement!.update(sl.child);
} else {
childElement?.unmount();
childElement = sl.child.createElement();
childElement!.mount(this);
}
}