Aus öffentlichen Paketdaten erstellte Orientierung.
Das Layout-Paket fördert eine konsistente Benutzeroberflächengestaltung über Plattformen und Bildschirmgrößen hinweg, indem es einheitliche Abstände und wiederverwendbare Layout-Elemente bereitstellt. Es vereinfacht die responsive Gestaltung in Flutter-Anwendungen und sorgt für visuelle Harmonie auf Android, iOS, Web, macOS, Windows und Linux. Durch die Standardisierung von Abständen und Strukturen wird Boilerplate-Code reduziert und die Wartbarkeit verbessert. Das Paket ist ideal für Teams, die Designkonsistenz ohne Verlust an Flexibilität erreichen möchten.
Anwendungsfälle
Plattformübergreifende App-Entwicklung
Reaktive Benutzeroberflächengestaltung
Design-Konsistenz aufrechterhalten
Wiederholten Layout-Code reduzieren
Implementierung des Design-Systems
Hauptmerkmale
Richtlinien für gleichmäßigen Abstand
Wiederverwendbare Layout-Komponenten
plattformunabhängiger Entwurf
Einfache responsive Layouts
Integration mit bestehenden Flutter-Projekten
Geeignet für
Teams, die Designsysteme verwenden
Entwickler, die Konsistenz priorisieren
Projekte, die mehrere Plattformen ansprechen
Apps mit skalierbaren Layouts
UI-orientierte Flutter-Entwickler
Hinweise
Einhaltung der festgelegten Abstandsvorschriften erforderlich
Möglicherweise ist eine Anpassung für einzigartige Designs erforderlich
Am besten kombiniert mit einem umfassenden Design-System
Beschränkt auf Layoutstruktur, nicht auf Styling
Kein vollständiges UI-Framework
Original-README
Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.
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