implementing-responsive-layouts — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited implementing-responsive-layouts (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Implement layout adaptability and responsive UI across varying device screens. This skill provides a decision matrix to choose the right responsiveness package and strict instructions on how to use flutter_screenutil, sizer, and responsive_framework natively.
Before writing layout code, strictly evaluate the project's target platforms and design requirements to select the appropriate library:
flutter_screenutil. (Math-based density scaling)sizer. (Percentage-based viewport scaling)responsive_framework. (Breakpoint-based rendering)flutter_screenutilBest for mathematically scaling a fixed design draft across different physical device sizes.
Setup (`main.dart`): Wrap the MaterialApp in ScreenUtilInit and provide the designSize from the design specs (Figma/AdobeXD).
Widget build(BuildContext context) {
return ScreenUtilInit(
designSize: const Size(375, 812), // The Figma draft size
minTextAdapt: true,
splitScreenMode: true,
builder: (context, child) {
return MaterialApp(
// ...
);
},
);
}Usage Constraints:
.w (e.g., 100.w).h (e.g., 200.h).r (e.g., Radius.circular(16.r)) or 100.w for both width and height to prevent stretching. Do not use `.h` for width..sp (e.g., 16.sp). Note: sp changes with system accessibility font sizes.Container(
width: 50.w,
height: 200.h,
child: Text('Responsive Text', style: TextStyle(fontSize: 14.sp)),
)sizerBest for scenarios where defining UI in viewport percentages is easier than absolute dp conversions.
Setup (`main.dart`): Wrap the MaterialApp in Sizer.
Widget build(BuildContext context) {
return Sizer(
builder: (context, orientation, screenType) {
return MaterialApp(
// ...
);
},
);
}Usage Constraints:
.w and .h as raw screen percentages. 100.w is exactly the full width of the current screen..dp (Density Pixel) instead of .sp if you want text to scale strictly by physical display density rather than user accessibility settings.50.w in sizer means 50% of screen. 50.w in ScreenUtil means 50 logical pixels relative to the 375 Figma draft. Be acutely aware of which package is active.Container(
width: 20.w, // Takes exactly 20% of screen width
height: 30.5.h, // Takes exactly 30.5% of screen height
child: Text('Sizer Text', style: TextStyle(fontSize: 15.dp)),
)responsive_frameworkBest for Tablet/Desktop/Web where components shift layout structures at specific breakpoints.
Setup (`main.dart`): Wrap the router or MaterialApp builder with ResponsiveBreakpoints.builder(). Do NOT use the deprecated ResponsiveWrapper.
return MaterialApp(
builder: (context, child) => ResponsiveBreakpoints.builder(
child: child!,
breakpoints: [
const Breakpoint(start: 0, end: 450, name: MOBILE),
const Breakpoint(start: 451, end: 800, name: TABLET),
const Breakpoint(start: 801, end: 1920, name: DESKTOP),
// Custom breakpoint labels can be added here
const Breakpoint(start: 1921, end: double.infinity, name: '4K'),
],
),
);Usage Constraints (Conditionals): Use ResponsiveBreakpoints.of(context) to query the current environment to determine layout structures.
// Check size logic to conditionally render navigation styles
bool showSideNav = ResponsiveBreakpoints.of(context).largerThan(MOBILE);
if (showSideNav) {
// Render Desktop layout
} else {
// Render Mobile layout
}Usage Constraints (Value Scaling): If you need specific padding or constraints to change per breakpoint, use ResponsiveValue.
double padding = ResponsiveValue(
context,
defaultValue: 10.0,
conditionalValues: [
Condition.equals(name: MOBILE, value: 10.0),
Condition.largerThan(name: MOBILE, value: 30.0),
]
).value;sizer and flutter_screenutil in the same project. They conflict conceptually.flutter_screenutil to blindly scale a mobile UI up to a Desktop screen. A 375-width design scaled to a 1920-width monitor results in cartoonishly massive text and buttons. Use responsive_framework for Desktop/Web.MediaQuery.of(context).size.width * 0.5. Use the library's native syntax (e.g., 50.w in sizer) to keep code declarative and completely eliminate boilerplate.~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.