ResponsiveConfig constructor
const
ResponsiveConfig({})
ResponsiveConfig is used to annotate classes that contains responsive fields. Default breakpoint values are:
mobile= 320; Note: must be bigger than 0.tablet= 768; Note: must be bigger than mobile.laptop= 992; Note: must be bigger than tablet.desktop= 1200; Note: must be bigger than laptop.widescreen= 1920; Note: must be bigger than desktop.
To change the default breakpoints, you can provide them directly in annotation
or specify them in build.yaml file, to enable them globally.
For example:
targets:
$default:
builders:
responsive_config:
enabled: true
options:
widescreen_breakpoint: 2100
desktop_breakpoint: 1024
laptop_breakpoint: 768
Check https://pub.dev/packages/responsive_config for more details.
Implementation
const ResponsiveConfig({
this.widescreenBreakpoint,
this.desktopBreakpoint,
this.laptopBreakpoint,
this.tabletBreakpoint,
this.mobileBreakpoint,
}) : assert(widescreenBreakpoint == null ||
widescreenBreakpoint >
(desktopBreakpoint ?? DefaultBreakpoints.desktop)),
assert(desktopBreakpoint == null ||
desktopBreakpoint >
(laptopBreakpoint ?? DefaultBreakpoints.laptop)),
assert(laptopBreakpoint == null ||
laptopBreakpoint > (tabletBreakpoint ?? DefaultBreakpoints.tablet)),
assert(tabletBreakpoint == null ||
tabletBreakpoint > (mobileBreakpoint ?? DefaultBreakpoints.mobile)),
assert(mobileBreakpoint == null || mobileBreakpoint > 0);