Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
2 changes: 1 addition & 1 deletion examples/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
22 changes: 22 additions & 0 deletions examples/lib/common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,25 @@ class _InteractiveTileState extends State<InteractiveTile> {
);
}
}
class ContainTile extends StatelessWidget {
const ContainTile({
Key? key,
required this.index,
required this.width,
required this.height,
}) : super(key: key);

final int index;
final int width;
final int height;

@override
Widget build(BuildContext context) {
return Container(
color: Colors.blueGrey,
width: width.toDouble(),
height: height.toDouble(),
child: Center(child: Text('$index', style: const TextStyle(fontSize: 50)))
);
}
}
62 changes: 37 additions & 25 deletions examples/lib/pages/staggered.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:collection/collection.dart';
import 'package:examples/common.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
Expand All @@ -9,41 +8,54 @@ class StaggeredPage extends StatelessWidget {
}) : super(key: key);

static const tiles = [
GridTile(2, 2),
GridTile(2, 1),
GridTile(1, 1),
GridTile(1, 4),
GridTile(1, 2),
GridTile(1, 1),
GridTile(1, 4),
GridTile(1, 1),
GridTile(1, 1),
GridTile(1, 1),
GridTile(1, 1),
GridTile(1, 4),
GridTile(1, 1),
GridTile(1, 1),
GridTile(1, 4),
GridTile(1, 2),
GridTile(1, 2),
GridTile(1, 1),
GridTile(1, 1),
GridTile(2, 2),
GridTile(1, 2),
GridTile(1, 1),
GridTile(3, 1),
GridTile(1, 1),
GridTile(4, 1),
GridTile(1, 1),
GridTile(1, 4),
GridTile(1, 2),
GridTile(1, 1),
];

@override
Widget build(BuildContext context) {
return AppScaffold(
title: 'Staggered',
child: SingleChildScrollView(
child: StaggeredGrid.count(
crossAxisCount: 4,
mainAxisSpacing: 4,
crossAxisSpacing: 4,
children: [
...tiles.mapIndexed((index, tile) {
return StaggeredGridTile.count(
crossAxisCellCount: tile.crossAxisCount,
mainAxisCellCount: tile.mainAxisCount,
child: ImageTile(
index: index,
width: tile.crossAxisCount * 100,
height: tile.mainAxisCount * 100,
),
);
}),
],
),
child: StaggeredGridView.countBuilder(
mainAxisSpacing: 9,
crossAxisSpacing: 9,
cacheExtent: 5,
addAutomaticKeepAlives: false,
itemBuilder: (context, index) {
return ContainTile(
index: index,
width: tiles[index].crossAxisCount * 100,
height: tiles[index].mainAxisCount * 100,
);
},
crossAxisCount: 2,
staggeredTileBuilder: (int index) {
return StaggeredTile.count(tiles[index].crossAxisCount,
tiles[index].mainAxisCount.toDouble());
},
itemCount: tiles.length,
),
);
}
Expand Down
11 changes: 6 additions & 5 deletions examples/macos/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 51;
objectVersion = 54;
objects = {

/* Begin PBXAggregateTarget section */
Expand Down Expand Up @@ -182,7 +182,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0920;
LastUpgradeCheck = 0930;
LastUpgradeCheck = 1300;
ORGANIZATIONNAME = "";
TargetAttributes = {
33CC10EC2044A3C60003C045 = {
Expand Down Expand Up @@ -235,6 +235,7 @@
/* Begin PBXShellScriptBuildPhase section */
3399D490228B24CF009A79C7 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down Expand Up @@ -344,7 +345,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
Expand Down Expand Up @@ -423,7 +424,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
Expand Down Expand Up @@ -470,7 +471,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1000"
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
1 change: 1 addition & 0 deletions lib/flutter_staggered_grid_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ export 'src/widgets/sliver_aligned_grid.dart';
export 'src/widgets/sliver_masonry_grid.dart';
export 'src/widgets/staggered_grid.dart';
export 'src/widgets/staggered_grid_tile.dart';
export 'src/widgets/staggered_grid_view.dart';
Loading