Skip to content

Commit 13da6f0

Browse files
committed
Merge branch 'feature/staggered_tile_fit'
2 parents 803ee78 + 021f50d commit 13da6f0

36 files changed

+2961
-818
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.2.0
2+
* Add a way to let the tile's content to define the tile's extent in the main axis.
3+
* Add `fit` constructor to `StaggeredTile`.
4+
15
## 0.1.4
26
* Add `countBuilder` and `extendBuilder` constructors to `SliverStaggeredGrid`
37

README.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
A Flutter staggered grid view which supports multiple columns with rows of varying sizes.
44

55
[![Pub](https://img.shields.io/pub/v/flutter_staggered_grid_view.svg)](https://pub.dartlang.org/packages/flutter_staggered_grid_view)
6+
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QTT34M25RDNL6)
67

78
![Screenshot](https://raw.githubusercontent.com/letsar/flutter_staggered_grid_view/master/doc/images/example_01.PNG)
89

@@ -13,9 +14,10 @@ A Flutter staggered grid view which supports multiple columns with rows of varyi
1314
* Configurable main-axis and cross-axis margins between tiles.
1415
* SliverStaggeredGrid for using in a [CustomScrollView](https://docs.flutter.io/flutter/widgets/CustomScrollView-class.html).
1516
* Staggered and Spannable grid layouts.
16-
1717
![Screenshot](https://raw.githubusercontent.com/letsar/flutter_staggered_grid_view/master/doc/images/staggered_1.gif)
1818
![Screenshot](https://raw.githubusercontent.com/letsar/flutter_staggered_grid_view/master/doc/images/spannable_1.gif)
19+
* Tiles can fit the content in the main axis.
20+
![Screenshot](https://raw.githubusercontent.com/letsar/flutter_staggered_grid_view/master/doc/images/dynamic_tile_sizes.gif)
1921

2022
## Getting started
2123

@@ -24,7 +26,7 @@ In the `pubspec.yaml` of your flutter project, add the following dependency:
2426
```yaml
2527
dependencies:
2628
...
27-
flutter_staggered_grid_view: "^0.1.4"
29+
flutter_staggered_grid_view: "^0.2.0"
2830
```
2931
3032
In your library add the following import:
@@ -65,6 +67,15 @@ You can find more examples in the [Example](https://github.com/letsar/flutter_st
6567
The `StaggeredGridView` follow the same constructors convention than the [GridView](https://docs.flutter.io/flutter/widgets/GridView-class.html).
6668
There are two more constructors: `countBuilder` and `extentBuilder`. These constructors allow you to define a builder for the layout and a builder for the children.
6769

70+
## Tiles
71+
A StaggeredGridView needs to know how to display each tile, and what widget is associated with a tile.
72+
73+
A tile needs to have a fixed number of cell to occupy in the cross axis.
74+
For the extent in the main axis you have 3 options:
75+
* You want a fixed number of cells => use `StaggeredTile.count`.
76+
* You want a fixed extent => use `StaggeredTile.extent`.
77+
* You want a variable extent, defined by the content of the tile itself => use `StaggeredTile.fit`.
78+
6879
## Changelog
6980

7081
Please see the [Changelog](https://github.com/letsar/flutter_staggered_grid_view/blob/master/CHANGELOG.md) page to know what's recently changed.
@@ -74,4 +85,4 @@ Please see the [Changelog](https://github.com/letsar/flutter_staggered_grid_view
7485
Feel free to contribute to this project.
7586

7687
If you find a bug or want a feature, but don't know how to fix/implement it, please fill an [issue](https://github.com/letsar/flutter_staggered_grid_view/issues).
77-
If you fixed a bug or implemented a new feature, please send a [pull request](https://github.com/letsar/flutter_staggered_grid_view/pulls).
88+
If you fixed a bug or implemented a new feature, please send a [pull request](https://github.com/letsar/flutter_staggered_grid_view/pulls).

doc/images/dynamic_tile_sizes.gif

6.07 MB
Loading

example/android/.project

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>android</name>
4+
<comment>Project android created by Buildship.</comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
16+
</natures>
17+
</projectDescription>

example/android/app/.project

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>app</name>
4+
<comment>Project app created by Buildship.</comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>org.eclipse.jdt.core.javanature</nature>
21+
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
22+
</natures>
23+
</projectDescription>

example/android/app/bin/.project

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>app</name>
4+
<comment>Project app created by Buildship.</comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>org.eclipse.jdt.core.javanature</nature>
21+
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
22+
</natures>
23+
</projectDescription>
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
def localProperties = new Properties()
2+
def localPropertiesFile = rootProject.file('local.properties')
3+
if (localPropertiesFile.exists()) {
4+
localPropertiesFile.withReader('UTF-8') { reader ->
5+
localProperties.load(reader)
6+
}
7+
}
8+
9+
def flutterRoot = localProperties.getProperty('flutter.sdk')
10+
if (flutterRoot == null) {
11+
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12+
}
13+
14+
apply plugin: 'com.android.application'
15+
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
16+
17+
android {
18+
compileSdkVersion 27
19+
20+
lintOptions {
21+
disable 'InvalidPackage'
22+
}
23+
24+
defaultConfig {
25+
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
26+
applicationId "com.letsar.example"
27+
minSdkVersion 16
28+
targetSdkVersion 27
29+
versionCode 1
30+
versionName "1.0"
31+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
32+
}
33+
34+
buildTypes {
35+
release {
36+
// TODO: Add your own signing config for the release build.
37+
// Signing with the debug keys for now, so `flutter run --release` works.
38+
signingConfig signingConfigs.debug
39+
}
40+
}
41+
}
42+
43+
flutter {
44+
source '../..'
45+
}
46+
47+
dependencies {
48+
testImplementation 'junit:junit:4.12'
49+
androidTestImplementation 'com.android.support.test:runner:1.0.1'
50+
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
51+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="com.letsar.example">
3+
4+
<!-- The INTERNET permission is required for development. Specifically,
5+
flutter needs it to communicate with the running application
6+
to allow setting breakpoints, to provide hot reload, etc.
7+
-->
8+
<uses-permission android:name="android.permission.INTERNET"/>
9+
10+
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
11+
calls FlutterMain.startInitialization(this); in its onCreate method.
12+
In most cases you can leave this as-is, but you if you want to provide
13+
additional functionality it is fine to subclass or reimplement
14+
FlutterApplication and put your custom class here. -->
15+
<application
16+
android:name="io.flutter.app.FlutterApplication"
17+
android:label="example"
18+
android:icon="@mipmap/ic_launcher">
19+
<activity
20+
android:name=".MainActivity"
21+
android:launchMode="singleTop"
22+
android:theme="@style/LaunchTheme"
23+
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale"
24+
android:hardwareAccelerated="true"
25+
android:windowSoftInputMode="adjustResize">
26+
<!-- This keeps the window background of the activity showing
27+
until Flutter renders its first frame. It can be removed if
28+
there is no splash screen (such as the default splash screen
29+
defined in @style/LaunchTheme). -->
30+
<meta-data
31+
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
32+
android:value="true" />
33+
<intent-filter>
34+
<action android:name="android.intent.action.MAIN"/>
35+
<category android:name="android.intent.category.LAUNCHER"/>
36+
</intent-filter>
37+
</activity>
38+
</application>
39+
</manifest>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Modify this file to customize your launch splash screen -->
3+
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
4+
<item android:drawable="@android:color/white" />
5+
6+
<!-- You can insert your own image assets here -->
7+
<!-- <item>
8+
<bitmap
9+
android:gravity="center"
10+
android:src="@mipmap/launch_image" />
11+
</item> -->
12+
</layer-list>
544 Bytes
Loading

0 commit comments

Comments
 (0)