build method
Builds and returns the appropriate child Widget based on the current device screen width from MediaQuery.
Breakpoints from sizes are sorted ascending, then iterated to find the first matching threshold <= width, falling back to the largest if none match. This ensures efficient, non-rebuilding responsive switching, compatible with LayoutBuilder for nested layouts and ArcaneTheme scaling factors.
Implementation
@override
Widget build(BuildContext context) {
assert(sizes.isNotEmpty, "Sizes map cannot be empty");
double width = MediaQuery.of(context).size.width;
List<double> sk = sizes.keys.toList();
sk.sort((a, b) => a.compareTo(b));
for (double i in sk) {
if (width <= i) {
return sizes[i]!;
}
}
return sizes[sk.last]!;
}