All Projects → jamesblasco → Layout

jamesblasco / Layout

Licence: mit
Flutter | Create responsive layouts for mobile, web and desktop

Programming Languages

dart
5743 projects

Projects that are alternatives of or similar to Layout

React Native Responsive Grid
Bringing the Web's Responsive Design to React Native
Stars: ✭ 369 (+18.27%)
Mutual labels:  responsive, responsive-design, responsive-layout
science-fiction-magazines-blog
Blog template (concept) is inspired by stylish science fiction magazines of the 80-90s.
Stars: ✭ 24 (-92.31%)
Mutual labels:  responsive, responsive-design, responsive-layout
Minwiz
Minimal starter kit for under 2 KB sites
Stars: ✭ 228 (-26.92%)
Mutual labels:  responsive, responsive-design
React Native Responsive Dimensions
Resposive fontSize, height and width for react-native components, that automatically adjusts itself based on screen-size of the device.
Stars: ✭ 243 (-22.12%)
Mutual labels:  responsive, responsive-design
responsivebootstrap
This is the repository for my course, Bootstrap Layouts: Responsive Single-Page Design on LinkedIn Learning and Lynda.com.
Stars: ✭ 49 (-84.29%)
Mutual labels:  responsive, responsive-design
Container Query
A PostCSS plugin and Javascript runtime combination, which allows you to write container queries in your CSS the same way you would write media queries.
Stars: ✭ 119 (-61.86%)
Mutual labels:  responsive, responsive-design
Paper Kit 2 Angular
Free Bootstrap 4 UI Kit for Angular 2+
Stars: ✭ 133 (-57.37%)
Mutual labels:  responsive, responsive-design
pichichi
Simple one page responsive portfolio template
Stars: ✭ 54 (-82.69%)
Mutual labels:  responsive, responsive-design
Rocssti
RÖCSSTI : pour démarrer vos CSS avec la patate !
Stars: ✭ 46 (-85.26%)
Mutual labels:  responsive, responsive-design
react-timeline
The easiest way to add a responsive and customizable timeline to React apps
Stars: ✭ 68 (-78.21%)
Mutual labels:  responsive, responsive-layout
breaking-point
BREAKING-POINT lets you quickly define and subscribe to screen (i.e. window) breakpoints in your re-frame application
Stars: ✭ 36 (-88.46%)
Mutual labels:  responsive, responsive-design
bootstrap-grid-ms
Missing grid range in Bootstrap 3, micro-small from 480-767px.
Stars: ✭ 34 (-89.1%)
Mutual labels:  responsive, responsive-layout
Vue Responsive
A plugin for responsive handling with vue.js
Stars: ✭ 86 (-72.44%)
Mutual labels:  responsive, responsive-design
Easygrid
EasyGrid - VanillaJS Responsive Grid
Stars: ✭ 77 (-75.32%)
Mutual labels:  responsive, responsive-design
Argon Design System
Argon - Design System for Bootstrap 4 by Creative Tim
Stars: ✭ 2,307 (+639.42%)
Mutual labels:  responsive, responsive-design
Flutterwebsite
The flutter.dev website recreated in Flutter. https://gallery.codelessly.com/flutterwebsites/flutterwebsite
Stars: ✭ 76 (-75.64%)
Mutual labels:  responsive, responsive-design
just-responsive-images
WordPress Plugin to support better responsive images with <picture> tag, backgrounds, retina support etc.
Stars: ✭ 47 (-84.94%)
Mutual labels:  responsive, responsive-design
Textblock
Continuously responsive typesetting — Demo:
Stars: ✭ 536 (+71.79%)
Mutual labels:  responsive, responsive-design
React Container Query
📦 Modular responsive component
Stars: ✭ 788 (+152.56%)
Mutual labels:  responsive, responsive-layout
ionic-login-component
Free sample of Premium Ionic Login Component
Stars: ✭ 17 (-94.55%)
Mutual labels:  responsive, responsive-design

IMPORTANT! This package is in a beta preview and built with Dart null-safety.

Layout

pub package

Following the Material Design Guidelines, Layout encourage consistency across platforms, environments, and screen sizes by using uniform elements and spacing.

Install

Follow the instructions to install it here

Getting started

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.

  @override
  Widget build(BuildContext context) {
    return Layout(
      child: MaterialApp(
      ....
      ),
    );
  }

Breakpoints

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.

By default the breakpoints are defined as:

  • xs: 0 – 599
  • sm: 600 – 1023
  • md: 1024 – 1439
  • lg: 1440 – 1919
  • xl: 1920 +
 @override
 Widget build(BuildContext context) {
   if(context.breakpoint > LayoutBreakpoint.md)
     return TabletView();
   else
     return MobileView();
 }

LayoutValues

A layout value is relative to the width of the screen. This way you can define responsive variable, reuse them and apply them when needed.

final double padding = context.layout.value(xs: 0.0, sm: 12.0, md: 24.0, lg: 32.0, xl: 48.0);

The most important layout values are the ones relative to the breakpoint. This are the most common an useful as you can define a value for a different breakpoint sizes. If a breakpoint is not provided, its value will correspond to the first previous/smaller breakpoint.

final double 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

final displaySidebar = LayoutValue.breakpoint(xs: false, md: true);
or
const displaySidebar = const BreakpointValue(xs: false, md: true);

Then it can be used in any widget that as some Layout up in the tree as:

return Column(
  children: [
    child,
    if(displaySidebar.resolve(context))
      SideBar();
  ]
);

You can also create values relative to the layout width like.

final displaySidebar = LayoutValue.widthBuilder((width) => width > 600);

Margins

Margins are the space between content and the left and right edges of the screen.

  @override
  Widget build(BuildContext context) {
    return Margin(
      child: Text('This text),
    );
  }

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 this values in any moment by providing the margin param.

Contributing

If you want to take the time to make this project better, you can open an new issue, of a pull request.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].