레이아웃 패키지는 일관된 간격과 재사용 가능한 레이아웃 요소를 제공함으로써 플랫폼 및 화면 크기 간에 일관된 UI 디자인을 촉진합니다. Flutter 애플리케이션에서 반응형 디자인을 단순화하여 Android, iOS, 웹, macOS, Windows, Linux에서 시각적 조화를 보장합니다. 간격과 구조를 표준화함으로써 반복 코드를 줄이고 유지보수성을 향상시킵니다. 이 패키지는 유연성을 희생하지 않고 디자인 일관성을 강제하고자 하는 팀에게 이상적입니다.
사용 사례
크로스 플랫폼 앱 개발
반응형 UI 디자인
디자인 일관성 유지
반복적인 레이아웃 코드 줄이기
디자인 시스템 구현
주요 기능
균일한 간격 지침
재사용 가능한 레이아웃 구성 요소
플랫폼에 관계없는 설계
간단한 반응형 레이아웃
기존 Flutter 프로젝트와의 통합
적합한 대상
디자인 시스템을 사용하는 팀
일관성 우선 고려하는 개발자
다중 플랫폼을 대상으로 하는 프로젝트
확장 가능한 레이아웃을 필요로 하는 앱
UI 중심의 플러터 개발자
고려 사항
정의된 간격 규칙을 준수해야 합니다
유니크한 디자인을 위해 맞춤 설정이 필요할 수 있습니다
포괄적인 디자인 시스템과 가장 잘 어울림
레이아웃 구조에 한정되며 스타일링은 제외
완전한 UI 프레임워크가 아님
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
Layout
Following the Material Design Guidelines, Layout encourage consistency across platforms, environments, and screen sizes by using uniform elements and spacing.
This package aims to provide the tools to implement a responsive layout in an easy and consistent way.
If you want to learn more in detail about layout in Material Design I recommend you the official website.
Let's get started!
Everything starts with the Layout widget. Usually added at the top of your widget tree, but you can place it wherever you need it.
It uses its widget constraints to calculate its breakpoint, columns, gutters, and margins.
A breakpoint is the range of predetermined screen sizes that have specific layout requirements. At a given breakpoint range, the layout adjusts to suit the screen size and orientation.
Each breakpoint range determines the number of columns, and recommended margins and gutters, for each display size.
The most important layout values are the ones relative to the breakpoint. These are the most common and useful as you can define a value for different breakpoint sizes. If a breakpoint is not provided, its value will correspond to the first previous/smaller breakpoint.
finaldouble padding = context.layout.value(
xs: 0.0, // sm value will be like xs 0.0
md: 24.0, // lg value will be like md 24.0
xl: 48.0
);
Layout values can be reused in different parts of the app with even different Layout widgets. For that they need to be created as
Margin widths are defined as fixed values at each breakpoint range. To better adapt to the screen, the margin width can change at different breakpoints. Wider margins are more appropriate for larger screens, as they create more whitespace around the perimeter of content.
By default the margin values are the ones from the Material Design Guidelines. 16dp for screens with a width less than 720dp and 24 for bigger screens.
You can override these values in any moment by providing the margin param.
Fluid Margins
Some times you want to have a fixed width that stays the same across screen sizes.
Fluid margins are dynamically updated to keep a fixed size of its inner child. These fixed sizes are by default the ones from the Material Design Guidelines but can also easily customizable.
AdaptiveBuilder
A widget that allows easily to build responsive layouts