Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

Update flutter_staggered_grid_view and fix layout #658

Merged
merged 4 commits into from Apr 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
58 changes: 29 additions & 29 deletions lib/studies/crane/backdrop.dart
Expand Up @@ -55,14 +55,17 @@ class _FrontLayerState extends State<_FrontLayer> {
}

Widget _header() {
return Padding(
padding: const EdgeInsets.only(
top: 20,
bottom: 22,
),
child: SelectableText(
widget.title,
style: Theme.of(context).textTheme.subtitle2,
return Align(
alignment: AlignmentDirectional.centerStart,
child: Padding(
padding: const EdgeInsets.only(
top: 20,
bottom: 22,
),
child: SelectableText(
widget.title,
style: Theme.of(context).textTheme.subtitle2,
),
),
);
}
Expand All @@ -71,11 +74,7 @@ class _FrontLayerState extends State<_FrontLayer> {
Widget build(BuildContext context) {
final isDesktop = isDisplayDesktop(context);
final isSmallDesktop = isDisplaySmallDesktop(context);
final crossAxisCount = isSmallDesktop
? 2
: isDesktop
? 4
: 1;
final crossAxisCount = isDesktop ? 4 : 1;
pennzht marked this conversation as resolved.
Show resolved Hide resolved

return FocusTraversalGroup(
policy: ReadingOrderTraversalPolicy(),
Expand All @@ -94,28 +93,29 @@ class _FrontLayerState extends State<_FrontLayer> {
),
),
),
child: StaggeredGridView.countBuilder(
key: ValueKey('CraneListView-${widget.index}'),
restorationId: widget.restorationId,
crossAxisCount: crossAxisCount,
crossAxisSpacing: 16.0,
child: Padding(
padding: isDesktop
? EdgeInsets.symmetric(
horizontal:
isSmallDesktop ? appPaddingSmall : appPaddingLarge)
.add(bottomPadding)
: const EdgeInsets.symmetric(horizontal: 20).add(bottomPadding),
itemBuilder: (context, index) {
if (index == 0) {
return _header();
} else {
return DestinationCard(destination: destinations![index]);
}
},
staggeredTileBuilder: (index) => index == 0
? StaggeredTile.fit(crossAxisCount)
: const StaggeredTile.fit(1),
itemCount: destinations!.length,
child: Column(
children: [
_header(),
Expanded(
child: MasonryGridView.count(
key: ValueKey('CraneListView-${widget.index}'),
restorationId: widget.restorationId,
crossAxisCount: crossAxisCount,
crossAxisSpacing: 16.0,
itemBuilder: (context, index) =>
DestinationCard(destination: destinations![index]),
itemCount: destinations!.length,
),
),
],
),
),
),
),
Expand Down
26 changes: 13 additions & 13 deletions pubspec.lock
Expand Up @@ -7,7 +7,7 @@ packages:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "38.0.0"
version: "39.0.0"
adaptive_breakpoints:
dependency: "direct main"
description:
Expand All @@ -21,7 +21,7 @@ packages:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "3.4.1"
version: "4.0.0"
animations:
dependency: "direct main"
description:
Expand Down Expand Up @@ -49,7 +49,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.8.2"
version: "2.9.0"
boolean_selector:
dependency: transitive
description:
Expand Down Expand Up @@ -164,7 +164,7 @@ packages:
name: flutter_lints
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.0.1"
flutter_localizations:
dependency: "direct main"
description: flutter
Expand All @@ -183,7 +183,7 @@ packages:
name: flutter_staggered_grid_view
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.1"
version: "0.6.1"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down Expand Up @@ -226,7 +226,7 @@ packages:
name: grinder
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.0"
version: "0.9.1"
http:
dependency: transitive
description:
Expand Down Expand Up @@ -338,14 +338,14 @@ packages:
name: package_info_plus
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.0"
version: "1.4.2"
package_info_plus_linux:
dependency: transitive
description:
name: package_info_plus_linux
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
version: "1.0.5"
package_info_plus_macos:
dependency: transitive
description:
Expand All @@ -366,14 +366,14 @@ packages:
name: package_info_plus_web
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
version: "1.0.5"
package_info_plus_windows:
dependency: transitive
description:
name: package_info_plus_windows
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
version: "1.0.5"
path:
dependency: "direct dev"
description:
Expand Down Expand Up @@ -644,7 +644,7 @@ packages:
name: test
url: "https://pub.dartlang.org"
source: hosted
version: "1.20.2"
version: "1.21.0"
test_api:
dependency: transitive
description:
Expand All @@ -658,7 +658,7 @@ packages:
name: test_core
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.11"
version: "0.4.13"
typed_data:
dependency: transitive
description:
Expand Down Expand Up @@ -777,7 +777,7 @@ packages:
name: win32
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.0"
version: "2.5.1"
xdg_directories:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Expand Up @@ -18,7 +18,7 @@ dependencies:
cupertino_icons: ^1.0.2
flutter_gallery_assets: ^1.0.2
flutter_localized_locales: ^2.0.1
flutter_staggered_grid_view: ^0.4.0
flutter_staggered_grid_view: ^0.6.1
google_fonts: ^2.0.0
intl: ^0.17.0
meta: ^1.3.0
Expand Down