useScreen method
void
useScreen(
- BuildContext context, {
- T base(
- T
- T xs(
- T
- T sm(
- T
- T md(
- T
- T lg(
- T
- T xl(
- T
void useScreen({
// > 568px
Widget Function(Niku)? base,
// 568 - 640px
Widget Function(Niku)? xs,
// 640 - 768px
Widget Function(Niku)? sm,
// 768 - 920px
Widget Function(Niku)? md,
// 920 - 1024px
Widget Function(Niku)? lg,
// > 1024px
Widget Function(Niku)? xl,
})
Implementation
void useScreen(
BuildContext context, {
// > 568px
T Function(T)? base,
// 568 - 640px
T Function(T)? xs,
// 640 - 768px
T Function(T)? sm,
// 768 - 920px
T Function(T)? md,
// 920 - 1024px
T Function(T)? lg,
// > 1024px
T Function(T)? xl,
}) {
final width = MediaQuery.of(context).size.width;
if (width < 568) {
if (base != null) apply = base(copied);
return;
}
if (width < 640) {
if (xs != null)
apply = xs(self);
else if (base != null) apply = base(self);
return;
}
if (width < 720) {
if (sm != null)
apply = sm(self);
else if (xs != null)
apply = xs(self);
else if (base != null) apply = base(self);
return;
}
if (width < 920) {
if (md != null)
apply = md(self);
else if (sm != null)
apply = sm(self);
else if (xs != null)
apply = xs(self);
else if (base != null) apply = base(self);
return;
}
if (width < 1024) {
if (lg != null)
apply = lg(self);
else if (md != null)
apply = md(self);
else if (sm != null)
apply = sm(self);
else if (xs != null)
apply = xs(self);
else if (base != null) apply = base(self);
}
if (xl != null)
apply = xl(self);
else if (lg != null)
apply = lg(self);
else if (md != null)
apply = md(self);
else if (sm != null)
apply = sm(self);
else if (xs != null)
apply = xs(self);
else if (base != null) apply = base(self);
}