Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
aligator2236 committed Mar 22, 2020
1 parent 58aec2b commit c3012fb
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
33 changes: 28 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,40 @@

A responsive grid view that changes it's cross axis child count based on the available horizontal size.

![](pictures/1.jpg)
![](pictures/2.jpg)
This widget is great for creating responsive designs as the sized of tiles stays about the same across different screen sizes.

### How does it work

Using the width of tiles, `SmartGridview` will calculate the `crossAxisCount` for the underlying `GridView` with `maxWidth ~/ tileWidth`.

The `tileHeight` is used with `tileWidth` to calculate `gridChildRatio`.

# Example

```dart
SmartGridView(
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: Text('Example')),
body: SmartGridView(
tileWidth: 128,
tileHeight: 168,
children: List.generate(80, (index) => Card(
child: GridTile(
child: Text('tile #$index'),
),
)),
)
```
),
),
);
}
}
```

##### Result

![](pictures/1.jpg)
![](pictures/2.jpg)
Binary file modified pictures/1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pictures/2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: smart_grid_view
description: A responsive grid view that changes it's cross axis child count based on the available horizontal size.
version: 0.1.0
homepage:
homepage: https://github.com/ali2236/smart_grid_view

environment:
sdk: ">=2.1.0 <3.0.0"
Expand Down

0 comments on commit c3012fb

Please sign in to comment.