ResponsiveSpacing는 화면 크기에 따라 간격, 여백, 패딩, 간격, 본문 크기 및 열 레이아웃을 동적으로 조정함으로써 적응형 및 반응형 사용자 인터페이스를 생성할 수 있도록 해주는 Flutter/Dart 패키지입니다. Android, iOS, Web, macOS, Windows, Linux 등 여러 플랫폼에서 반응형 디자인을 단순화합니다. 내장된 반응형 단위와 브레이크포인트를 사용하여 기기의 크기와 관계없이 일관된 UI 외관을 보장합니다. 반복적인 미디어 쿼리 로직을 작성하지 않고도 유연한 레이아웃이 필요한 앱에 이상적입니다.
사용 사례
크로스 플랫폼 반응형 레이아웃 구축
다른 화면 크기에 맞춰 UI 적응
유동 그리드 시스템 만들기
패딩 및 마진 조정 자동화
확장 가능한 모바일 및 웹 인터페이스 설계
주요 기능
화면 크기에 기반한 동적 간격
내장된 반응형 브레이크포인트
여백, 패딩 및 간격 지원
크로스 플랫폼 호환성
기존 Flutter 위젯과의 간편한 통합
유연한 열과 본문 크기 조절
적합한 대상
반응형 Flutter 앱을 개발하는 개발자
다중 플랫폼을 대상으로 하는 팀
적응성에 중점을 둔 UI 디자이너
확장 가능한 레이아웃 시스템을 필요로 하는 프로젝트
복잡한 반응형 요구 사항을 가진 앱
고려 사항
새 사용자에게는 초기 학습 곡선이 필요할 수 있습니다
매우 큰 위젯 트리에서의 성능 영향
정확한 화면 크기 감지에 의존합니다
일관된 디자인 시스템과 함께 사용하는 것이 가장 좋습니다
제공된 반응형 단위를 초과한 사용자 정의는 제한적입니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
This plugin helps to design and develop beautiful responsive and adaptive flutter apps.
Lightweight, Responsive Spacing
All design principles have roughly the same elements. For example, Material Design works with margin, gutter, body and has a responsive 12 column system.
Our default values are set by the Material Design Guidelines, but you can also easily set your own breakpoints, margins, and spacing.
You can find spacings everywhere in your Project, don't use Magic Numbers, use the context-oriented spacing class instead.
We have developed this plugin so that you can easily make your app adaptive and responsive.
Simple Spacing
Access your own Spacing-System:
// Example values for a Pixel 7 Pro
context.spacing.xs; // default 2
context.spacing.s; // default 8
context.spacing.m; // default 12
context.spacing.l; // default 16
context.spacing.xl; // default 32
context.spacing.xxl; // default 56// Example:// Instead of SizedBox(height: 8);
// useSizedBox(height: context.spacing.s); // Wow!
And whenever your design guru wants to modify the values, you only have to modify it in a single file.
Giga Spacing for all design chads that need more power
Design Gurus are around the world and you will maybe find one in your own company. If you have such a mysterious creature, use the Giga Spacing class for even more fine tuning.
In the previous Example, we used the any override, this will ignore the layout width. If you want to make the spacings responsive, override the values for xl, lg, md, sm2, sm1 & xs
And in your Widget, access the Spacing class with Spacing.of(context) or context.spacingConfig which returns an object of ResponsiveData. The object has all necessary spacings.
context.spacingConfig.margin;
context.spacingConfig.padding;
context.spacingConfig.gutter;
context.spacingConfig.body;
context.spacingConfig.layoutColumns;
// You are now good to use these properties in your layout.
For example with a Card:
Card(
// use margin
margin: context.spacingConfig.margin.horizontalEdgeInsets,
child: Padding(
// use padding
padding: context.spacingConfig.padding.allEdgeInsets,
child: Column(
children: [
Text("This is a Title"),
Text("This is the subtitle, usually you explain something")
],
),
),
)
Columns, Gutters & Margins
The responsive layout grid is made up of three elements: columns, gutters, and margins. Read everything about Columns, Gutters & Margins on the material guidelines responsive layout page.
Example: Access global padding setting in your widget:
Spacing.of(context).padding
// or
context.spacingConfig.padding
Just like the custom breakpoints, you can also set your own spacing, spaces, and margins. Create your own gutter class by extending ResponsiveCollection:
There are two types of widgets, the data widgets that create the spacing context and widgets that use the spacing context.
Data Widgets
Data widgets create the spacing context and provide responsive values to all widgets created in the tree below. if there are multiple data widgets in the tree, the closest one is taken.