Skip to content

Commit 24e705d

Browse files
committed
README
1 parent acb3b3e commit 24e705d

File tree

5 files changed

+107
-9
lines changed

5 files changed

+107
-9
lines changed

README.md

+107-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,112 @@
11
# responsive_grid
22

3-
Responsive Grid Layout for Flutter
3+
Responsive Grid Layout and List for Flutter
44

5-
## Getting Started
5+
### Responsive Grid Layout
66

7-
This project is a starting point for a Dart
8-
[package](https://flutter.dev/developing-packages/),
9-
a library module containing code that can be shared easily across
10-
multiple Flutter or Dart projects.
7+
With `ResponsiveGridRow` and `ResponsiveGridCol` you can get the same behavior of [bootstrap](https://getbootstrap.com) Grid System
118

12-
For help getting started with Flutter, view our
13-
[online documentation](https://flutter.dev/docs), which offers tutorials,
14-
samples, guidance on mobile development, and a full API reference.
9+
Give every col the width it shall occupy at every size category assuming the total width is 12
10+
11+
```dart
12+
ResponsiveGridRow(
13+
children: [
14+
ResponsiveGridCol(
15+
lg: 12,
16+
child: Container(
17+
height: 100,
18+
alignment: Alignment(0, 0),
19+
color: Colors.purple,
20+
child: Text("lg : 12"),
21+
),
22+
),
23+
ResponsiveGridCol(
24+
xs: 6,
25+
md: 3,
26+
child: Container(
27+
height: 100,
28+
alignment: Alignment(0, 0),
29+
color: Colors.green,
30+
child: Text("xs : 6 \r\nmd : 3"),
31+
),
32+
),
33+
ResponsiveGridCol(
34+
xs: 6,
35+
md: 3,
36+
child: Container(
37+
height: 100,
38+
alignment: Alignment(0, 0),
39+
color: Colors.orange,
40+
child: Text("xs : 6 \r\nmd : 3"),
41+
),
42+
),
43+
ResponsiveGridCol(
44+
xs: 6,
45+
md: 3,
46+
child: Container(
47+
height: 100,
48+
alignment: Alignment(0, 0),
49+
color: Colors.red,
50+
child: Text("xs : 6 \r\nmd : 3"),
51+
),
52+
),
53+
ResponsiveGridCol(
54+
xs: 6,
55+
md: 3,
56+
child: Container(
57+
height: 100,
58+
alignment: Alignment(0, 0),
59+
color: Colors.blue,
60+
child: Text("xs : 6 \r\nmd : 3"),
61+
),
62+
),
63+
)
64+
65+
```
66+
67+
<img src="images\1.jpg" width="300"> <img src="images\2.jpg" height="300">
68+
69+
70+
### Responsive Grid List
71+
72+
`ResponsiveGridList` works differently in that you only specify a desired width for the items and spacing, and it will decide how many items shall fit in a line, and the width of the item and spacing will change (only small change) to fill the entire width
73+
74+
```dart
75+
ResponsiveGridList(
76+
desiredItemWidth: 100,
77+
minSpacing: 10,
78+
children: [
79+
1,
80+
2,
81+
3,
82+
4,
83+
5,
84+
6,
85+
7,
86+
8,
87+
9,
88+
10,
89+
11,
90+
12,
91+
13,
92+
14,
93+
15,
94+
16,
95+
17,
96+
18,
97+
19,
98+
20
99+
].map((i) {
100+
return Container(
101+
height: 100,
102+
alignment: Alignment(0, 0),
103+
color: Colors.cyan,
104+
child: Text(i.toString()),
105+
);
106+
}).toList()
107+
)
108+
109+
```
110+
111+
112+
<img src="images\3.jpg" width="300"> <img src="images\4.jpg" height="300">
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)