Skip to content

Commit 4edbf62

Browse files
committed
ReadMe Creation #2
*Add animations and tutorial. *Add credits and intro concepts.
1 parent 9bb5b5f commit 4edbf62

File tree

4 files changed

+146
-21
lines changed

4 files changed

+146
-21
lines changed

README.md

Lines changed: 146 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,48 +9,173 @@
99
Responsive Framework adapts your UI to different screen sizes automatically. Create your UI once and have it display pixel perfect on mobile, tablet, and desktop!
1010

1111
### The Problem
12-
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.
12+
Supporting multiple display sizes often means recreating the same layout multiple times. Under the traditional _Bootstrap_ approach, building responsive UI is time consuming, frustrating and repetitive. Furthermore, getting everything pixel perfect is near impossible and simple edits take hours.
13+
14+
![Screenshots](packages/Bad%20Viewport%20Selector%20Animated.gif)
15+
1316
### The Solution
14-
Use Responsive Framework to automatically resize or scale your UI based on _breakpoints_.
17+
Use Responsive Framework to automatically scale your UI.
18+
19+
> ResponsiveBreakpoint(breakpoint: 600, **autoScale: true**);
20+
21+
## Demo
22+
23+
### [Minimal Website](https://gallery.imfast.io/flutterwebsites/minimal/)
24+
25+
A demo website built with the Responsive Framework. [View Code](https://github.com/Codelessly/FlutterMinimalWebsite)
26+
27+
## Quick Start
28+
29+
[![Pub release](https://img.shields.io/pub/v/responsive_framework.svg?style=flat-square)](https://pub.dev/packages/responsive_framework)
30+
31+
Import this library into your project:
32+
33+
```yaml
34+
responsive_framework: ^latest_version
35+
```
36+
37+
Add `ResponsiveWrapper.builder` to your MaterialApp or CupertinoApp.
38+
```dart
39+
class MyApp extends StatelessWidget {
40+
@override
41+
Widget build(BuildContext context) {
42+
return MaterialApp(
43+
builder: (context, widget) => ResponsiveWrapper.builder(
44+
maxWidth: 1200,
45+
minWidth: 450,
46+
defaultScale: true,
47+
breakpoints: [
48+
ResponsiveBreakpoint(breakpoint: 450, name: MOBILE),
49+
ResponsiveBreakpoint(breakpoint: 800, name: TABLET, scale: true),
50+
ResponsiveBreakpoint(breakpoint: 1000, name: TABLET, scale: true),
51+
ResponsiveBreakpoint(breakpoint: 1200, name: DESKTOP),
52+
ResponsiveBreakpoint(breakpoint: 2460, name: "4K", scale: true),
53+
],
54+
background: Container(color: Color(0xFFF5F5F5))),
55+
initialRoute: "/",
56+
);
57+
}
58+
}
59+
```
60+
That's it!
61+
62+
## AutoScale
63+
64+
![Screenshots](packages/Scale%20Resize%20Comparison.gif)
65+
66+
AutoScale shrinks or expands your layout *proportionally*, keeping every element the same.
67+
This eliminates the need to manually adapt layouts to mobile, tablet, and desktop.
68+
69+
```dart
70+
ResponsiveBreakpoint(breakpoint: 600, autoScale: true);
71+
```
72+
73+
Flutter's default behavior is resize so AutoScale is `false` and off by default.
74+
75+
## Breakpoints
76+
77+
![Screenshots](packages/Device%20Preview.gif)
78+
79+
Breakpoints control responsive behavior at different screen sizes.
1580

1681
```dart
1782
ResponsiveWrapper(
1883
child,
1984
breakpoints: [
20-
ResponsiveBreakpoint(breakpoint: 600, name: MOBILE),
21-
ResponsiveBreakpoint(breakpoint: 800, name: TABLET),
22-
ResponsiveBreakpoint(breakpoint: 1200, name: DESKTOP),
85+
ResponsiveBreakpoint(breakpoint: 600, name: MOBILE, autoScale: false),
86+
ResponsiveBreakpoint(breakpoint: 800, name: TABLET, autoScale: true),
87+
ResponsiveBreakpoint(breakpoint: 1200, name: DESKTOP, autoScale: false),
2388
],
2489
)
2590
```
91+
Breakpoints give you fine-grained control over how your UI displays.
2692

93+
## Introductory Concepts
2794

28-
## Resize vs Scale
29-
30-
![Screenshots](packages/Scale%20Resize%20Comparison.gif)
95+
These concepts helps you start using the Responsive Framework and build an responsive app quickly.
3196

32-
To easily adapt to a wide variety of screen sizes, set breakpoints to proportionally scale or resize a layout.
97+
### Scale vs Resize
3398

34-
> ResponsiveBreakpoint(breakpoint: 600, **scale: true**)
35-
36-
This eliminates the need to manually adapt layouts to mobile, tablet, and desktop.
99+
Flutter's default behavior is to resize your layout when the screen dimensions change. Resizing a layout stretches it in the unbounded width or height direction. Any fixed or bounded dimension stays the same which is why a mobile app's UI looks small on a desktop.
37100

38101
To understand the difference between resizing and scaling, take the following example.
39-
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.
102+
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.
40103
Here is what happens with each behavior:
41104
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.
42105
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.
43106

44-
## Breakpoints
107+
When scaled, the AppBar looks correct on desktop, up to a certain size. Once the screen becomes too wide, the AppBar starts to appear too large. This is where breakpoints come in.
45108

46-
![Screenshots](packages/Device%20Preview.gif)
109+
### Breakpoint Configuration
110+
111+
To adapt to a wide variety of screen sizes, set breakpoints to control responsive behavior.
112+
113+
```dart
114+
ResponsiveWrapper(
115+
child,
116+
maxWidth: 1200,
117+
minWidth: 450,
118+
defaultScale: true,
119+
breakpoints: [
120+
ResponsiveBreakpoint(breakpoint: 450, name: MOBILE),
121+
ResponsiveBreakpoint(breakpoint: 800, name: TABLET, scale: true),
122+
ResponsiveBreakpoint(breakpoint: 1000, name: TABLET, scale: true),
123+
ResponsiveBreakpoint(breakpoint: 1200, name: DESKTOP),
124+
ResponsiveBreakpoint(breakpoint: 2460, name: "4K", scale: true),
125+
],
126+
)
127+
```
128+
129+
An arbitrary number of breakpoints can be set. Resizing/scaling behavior can be mixed and matched.
130+
- below 450: resize on small screens to avoid cramp and overflow errors.
131+
- 800-450: resize on phones for native widget sizes.
132+
- 1000-800: scale on tablets to avoid elements appearing too small.
133+
- 1200-1000: resize on desktops to use available space.
134+
- 2460+: scale on extra large 4K displays so text is still legible and widgets are not spaced too far apart.
135+
136+
## About
137+
138+
Responsive Framework was created to provide a better way for people to build responsive apps and websites. The ability to automatically adapt UI to different sizes opens up a world of new possibilities. Here at Codelessly, we're working on #NoCode and code generation automation tools to make those possibilities happen. If you are thinking about building a website builder, drop us a line below 😎
139+
140+
Responsive Framework is licensed under Zero-Clause BSD and released as Emailware. If you like this project or it helped you, please subscribe to updates. Although it is not required, you might miss some important information!
141+
142+
<a href="https://codelessly.com" target="_blank"><img src="packages/Email%20Newsletter%20Signup.png"></a>
143+
144+
## Contributors ❤️
145+
146+
**Design:**
147+
* [Ray Li](https://github.com/searchy2)
148+
149+
**Development:**
150+
* [Ray Li](https://github.com/searchy2)
151+
* *add yourself here by contributing*
152+
153+
**Sponsor:** [Codelessly - No Code Automation Tools](https://codelessly.com)
154+
155+
<a href="mailto:[email protected]">
156+
<img alt="Codelessly Email"
157+
src="https://lh3.googleusercontent.com/yN_m90WN_HSCohXdgC2k91uSTk9dnYfoxTYwG_mv_l5_05dV2CzkQ1B6rEqH4uqdgjA=w96" />
158+
</a>
159+
<a href="https://codelessly.com">
160+
<img alt="Codelessly Website"
161+
src="https://lh3.googleusercontent.com/YmMGcgeO7Km9-J9vFRByov5sb7OUKetnKs8pTi0JZMDj3GVJ61GMTcTlHB7u9uHDHag=w96" />
162+
</a>
163+
<a href="https://twitter.com/codelessly_">
164+
<img alt="Codelessly Twitter"
165+
src="https://lh3.ggpht.com/lSLM0xhCA1RZOwaQcjhlwmsvaIQYaP3c5qbDKCgLALhydrgExnaSKZdGa8S3YtRuVA=w96" />
166+
</a>
167+
<a href="https://github.com/Codelessly">
168+
<img alt="Codelessly GitHub"
169+
src="https://lh3.googleusercontent.com/L15QqmKK7Vl-Ag1ZxaBqNQlXVEw58JT2BDb-ef5t2eboDh0pPSLjDgi3-aQ3Opdhhyk=w96" />
170+
</a>
171+
<br></br>
172+
173+
Flutter is a game-changing technology that will revolutionize not just development, but software itself. A big thank you to the Flutter team for building such an amazing platform and being giants we can stand on.
47174

48-
An arbitrary number of breakpoints can be set. Resizing/scaling behavior can be mixed and matched as below.
49-
- 1400+: scale on extra large 4K displays so text is still legible and widgets are not spaced too far apart.
50-
- 1400-800: resize on desktops to use available space.
51-
- 800-600: scale on tablets to avoid elements appearing too small.
52-
- 600-350: resize on phones for native widget sizes.
53-
- below 350: resize on small screens to avoid cramp and overflow errors.\
175+
<a href="https://github.com/flutter/flutter">
176+
<img alt="Flutter"
177+
src="packages/Flutter%20Logo%20Banner.png" />
178+
</a>
54179

55180
## License
56181

185 KB
Loading
42.1 KB
Loading

packages/Flutter Logo Banner.png

7.68 KB
Loading

0 commit comments

Comments
 (0)