diff --git a/lib/layout/adaptive.dart b/lib/layout/adaptive.dart index 11ac1d3bff..59fd9de762 100644 --- a/lib/layout/adaptive.dart +++ b/lib/layout/adaptive.dart @@ -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 diff --git a/lib/pages/home.dart b/lib/pages/home.dart index 825ebbb649..6a8777b05a 100644 --- a/lib/pages/home.dart +++ b/lib/pages/home.dart @@ -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 { diff --git a/pubspec.lock b/pubspec.lock index 5dbf4a2392..e0b6cd1628 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -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: @@ -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: