Skip to content

Commit 90466ca

Browse files
committed
ReadMe Creation #1
1 parent e1447e6 commit 90466ca

File tree

3 files changed

+45
-2
lines changed

3 files changed

+45
-2
lines changed

README.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,44 @@
1-
# Responsive Wrapper
1+
![Screenshots](images/Responsive Cover.png)
2+
# Responsive Framework
3+
[![Pub release](https://img.shields.io/badge/flutter-responsive-brightgreen.svg?style=flat-square)](https://github.com/Codelessly/ResponsiveFramework) [![Pub release](https://img.shields.io/pub/v/responsive_Framework.svg?style=flat-square)](https://pub.dev/packages/responsive_Framework) [![GitHub Release Date](https://img.shields.io/github/release-date/Codelessly/ResponsiveFramework.svg?style=flat-square)](https://github.com/Codelessly/ResponsiveFramework) [![GitHub issues](https://img.shields.io/github/issues/Codelessly/ResponsiveFramework.svg?style=flat-square)](https://github.com/Codelessly/ResponsiveFramework/issues) [![GitHub top language](https://img.shields.io/github/languages/top/Codelessly/ResponsiveFramework.svg?style=flat-square)](https://github.com/Codelessly/ResponsiveFramework)
4+
5+
Responsive Framework adapts your UI to different screen sizes automatically. Create your UI once and have it display correctly on mobile, tablet, and desktop!
6+
### The Problem
7+
Supporting multiple display sizes often means recreating the same layout multiple times with the traditional _Bootstrap_ approach. This is time consuming, frustrating and repetitive work. Furthermore, getting your designs pixel perfect is near impossible and editing becomes a nightmare.
8+
### The Solution
9+
Use Responsive Framework to automatically resize or scale your UI based on _breakpoints_.
10+
11+
```dart
12+
ResponsiveWrapper(
13+
child,
14+
breakpoints: [
15+
ResponsiveBreakpoint(breakpoint: 600, name: MOBILE),
16+
ResponsiveBreakpoint(breakpoint: 800, name: TABLET),
17+
ResponsiveBreakpoint(breakpoint: 1200, name: DESKTOP),
18+
],
19+
)
20+
```
21+
22+
23+
## Resize vs Scale
24+
25+
To easily adapt to a wide variety of screen sizes, set breakpoints to proportionally scale or resize a layout.
26+
27+
> ResponsiveBreakpoint(breakpoint: 600, **scale: true**)
28+
29+
This eliminates the need to manually adapt layouts to mobile, tablet, and desktop.
30+
31+
To understand the difference between resizing and scaling, take the following example.
32+
An AppBar widget looks correct on a phone. When viewed on a desktop however, the AppBar is too short and the title looks too small. This is because Flutter does not scale widgets by default.
33+
Here is what happens with each behavior:
34+
1. Resizing (default) - the AppBar's width is double.infinity so it stretches to fill the available width. The Toolbar height is fixed and stays 56dp.
35+
2. Scaling - the AppBar's width stretches to fill the available width. The height scales proportionally using an aspect ratio automatically calculated from the nearest `ResponsiveBreakpoint`. As the width increases, the height increases proportionally.
36+
37+
## Setting Breakpoints
38+
39+
An arbitrary number of breakpoints can be set. Resizing/scaling behavior can be mixed and matched as below.
40+
- 1400+: scale on extra large 4K displays so text is still legible and widgets are not spaced too far apart.
41+
- 1400-800: resize on desktops to use available space.
42+
- 800-600: scale on tablets to avoid elements appearing too small.
43+
- 600-350: resize on phones for native widget sizes.
44+
- below 350: resize on small screens to avoid cramp and overflow errors.

images/Responsive Cover.png

-70.6 KB
Loading

lib/responsive_wrapper.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import 'package:flutter/material.dart';
3333
/// the available width. The height scales proportionally
3434
/// using an aspect ratio automatically calculated
3535
/// from the nearest [ResponsiveBreakpoint]. As the
36-
/// width increases, the height increases too.
36+
/// width increases, the height increases proportionally.
3737
///
3838
/// An arbitrary number of breakpoints can be set.
3939
/// Resizing/scaling behavior can be mixed and

0 commit comments

Comments
 (0)