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

Commit

Permalink
Set a max width for home (#706)
Browse files Browse the repository at this point in the history
  • Loading branch information
guidezpl authored May 31, 2022
1 parent ffec7ba commit 468248e
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 81 deletions.
3 changes: 3 additions & 0 deletions lib/layout/adaptive.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import 'package:adaptive_breakpoints/adaptive_breakpoints.dart';
import 'package:dual_screen/dual_screen.dart';
import 'package:flutter/material.dart';

/// The maximum width taken up by the home screen contents.
const maxHomeWidth = 1400.0;

/// Returns a boolean value whether the window is considered medium or large size.
///
/// When running on a desktop device that is also foldable, the display is not
Expand Down
163 changes: 84 additions & 79 deletions lib/pages/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -165,89 +165,94 @@ class HomePage extends StatelessWidget {
];

return Scaffold(
body: ListView(
// Makes integration tests possible.
key: const ValueKey('HomeListView'),
padding: EdgeInsetsDirectional.only(
top: isDesktop ? firstHeaderDesktopTopPadding : 21,
),
children: [
Padding(
padding: const EdgeInsets.symmetric(
horizontal: _horizontalDesktopPadding,
),
child: _GalleryHeader(),
),
SizedBox(
height: carouselHeight,
child: _DesktopCarousel(children: carouselCards),
),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: _horizontalDesktopPadding,
body: Center(
child: Container(
constraints: const BoxConstraints(maxWidth: maxHomeWidth),
child: ListView(
// Makes integration tests possible.
key: const ValueKey('HomeListView'),
padding: EdgeInsetsDirectional.only(
top: isDesktop ? firstHeaderDesktopTopPadding : 21,
),
child: _CategoriesHeader(),
),
Container(
height: 585,
padding: const EdgeInsets.symmetric(
horizontal: _horizontalDesktopPadding,
),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: spaceBetween(28, desktopCategoryItems),
),
),
Padding(
padding: const EdgeInsetsDirectional.only(
start: _horizontalDesktopPadding,
bottom: 81,
end: _horizontalDesktopPadding,
top: 109,
),
child: Row(
children: [
MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
onTap: () async {
final url = Uri.parse('https://flutter.dev');
if (await canLaunchUrl(url)) {
await launchUrl(url);
}
},
child: FadeInImagePlaceholder(
image: Theme.of(context).colorScheme.brightness ==
Brightness.dark
? const AssetImage(
'assets/logo/flutter_logo.png',
package: 'flutter_gallery_assets',
)
: const AssetImage(
'assets/logo/flutter_logo_color.png',
package: 'flutter_gallery_assets',
),
placeholder: const SizedBox.shrink(),
excludeFromSemantics: true,
),
),
children: [
Padding(
padding: const EdgeInsets.symmetric(
horizontal: _horizontalDesktopPadding,
),
Expanded(
child: Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
alignment: WrapAlignment.end,
children: const [
SettingsAbout(),
SettingsFeedback(),
SettingsAttribution(),
],
),
child: _GalleryHeader(),
),
SizedBox(
height: carouselHeight,
child: _DesktopCarousel(children: carouselCards),
),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: _horizontalDesktopPadding,
),
],
),
child: _CategoriesHeader(),
),
Container(
height: 585,
padding: const EdgeInsets.symmetric(
horizontal: _horizontalDesktopPadding,
),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: spaceBetween(28, desktopCategoryItems),
),
),
Padding(
padding: const EdgeInsetsDirectional.only(
start: _horizontalDesktopPadding,
bottom: 81,
end: _horizontalDesktopPadding,
top: 109,
),
child: Row(
children: [
MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
onTap: () async {
final url = Uri.parse('https://flutter.dev');
if (await canLaunchUrl(url)) {
await launchUrl(url);
}
},
child: FadeInImagePlaceholder(
image: Theme.of(context).colorScheme.brightness ==
Brightness.dark
? const AssetImage(
'assets/logo/flutter_logo.png',
package: 'flutter_gallery_assets',
)
: const AssetImage(
'assets/logo/flutter_logo_color.png',
package: 'flutter_gallery_assets',
),
placeholder: const SizedBox.shrink(),
excludeFromSemantics: true,
),
),
),
Expanded(
child: Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
alignment: WrapAlignment.end,
children: const [
SettingsAbout(),
SettingsFeedback(),
SettingsAttribution(),
],
),
),
],
),
),
],
),
],
),
),
);
} else {
Expand Down
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ packages:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
version: "1.7.0"
mime:
dependency: transitive
description:
Expand Down Expand Up @@ -387,7 +387,7 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.2"
version: "1.8.1"
path_provider:
dependency: transitive
description:
Expand Down

0 comments on commit 468248e

Please sign in to comment.