diff --git a/web/gallery/.gitignore b/web/gallery/.gitignore deleted file mode 100644 index 2ddde2a5e..000000000 --- a/web/gallery/.gitignore +++ /dev/null @@ -1,73 +0,0 @@ -# Miscellaneous -*.class -*.log -*.pyc -*.swp -.DS_Store -.atom/ -.buildlog/ -.history -.svn/ - -# IntelliJ related -*.iml -*.ipr -*.iws -.idea/ - -# The .vscode folder contains launch configuration and tasks you configure in -# VS Code which you may wish to be included in version control, so this line -# is commented out by default. -#.vscode/ - -# Flutter/Dart/Pub related -**/doc/api/ -.dart_tool/ -.flutter-plugins -.packages -.pub-cache/ -.pub/ -/build/ - -# Android related -**/android/**/gradle-wrapper.jar -**/android/.gradle -**/android/captures/ -**/android/gradlew -**/android/gradlew.bat -**/android/local.properties -**/android/**/GeneratedPluginRegistrant.java - -# iOS/XCode related -**/ios/**/*.mode1v3 -**/ios/**/*.mode2v3 -**/ios/**/*.moved-aside -**/ios/**/*.pbxuser -**/ios/**/*.perspectivev3 -**/ios/**/*sync/ -**/ios/**/.sconsign.dblite -**/ios/**/.tags* -**/ios/**/.vagrant/ -**/ios/**/DerivedData/ -**/ios/**/Icon? -**/ios/**/Pods/ -**/ios/**/.symlinks/ -**/ios/**/profile -**/ios/**/xcuserdata -**/ios/.generated/ -**/ios/Flutter/App.framework -**/ios/Flutter/Flutter.framework -**/ios/Flutter/Generated.xcconfig -**/ios/Flutter/app.flx -**/ios/Flutter/app.zip -**/ios/Flutter/flutter_assets/ -**/ios/Flutter/flutter_export_environment.sh -**/ios/ServiceDefinitions.json -**/ios/Runner/GeneratedPluginRegistrant.* - -# Exceptions to above rules. -!**/ios/**/default.mode1v3 -!**/ios/**/default.mode2v3 -!**/ios/**/default.pbxuser -!**/ios/**/default.perspectivev3 -!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages diff --git a/web/gallery/.metadata b/web/gallery/.metadata deleted file mode 100644 index 412f5adaf..000000000 --- a/web/gallery/.metadata +++ /dev/null @@ -1,10 +0,0 @@ -# This file tracks properties of this Flutter project. -# Used by Flutter tool to assess capabilities and perform upgrades etc. -# -# This file should be version controlled and should not be manually edited. - -version: - revision: 393106fbf58124aef777fc12e97a20e237842f99 - channel: master - -project_type: app diff --git a/web/gallery/README.md b/web/gallery/README.md index 7d47cdc89..dd7014f05 100644 --- a/web/gallery/README.md +++ b/web/gallery/README.md @@ -1,5 +1,28 @@ -A gallery of Flutter widgets and UX studies. +# Flutter gallery -Original source on [GitHub][gallery]. +This is a copy of the [Flutter gallery] hosted at +[flutter.github.io/samples][hosted url]. -[gallery]: https://github.com/flutter/flutter/tree/master/examples/flutter_gallery +## Updating + +To update, copy the contents of the gallery directory, and remove the following +files and directories: + +```bash +rm BUILD.gn +rm -rf tool/ +rm -rf test/ +rm -rf android/ +rm -rf ios/ +``` + +If you changed the `pubspec.yaml` file, make sure to use Google Sans instead of +San Francisco (which is not available on the web) by copy-pasting the `fonts` +section from Google Sans: +- Use "GoogleSans" for ".SF Pro Text". +- Use "GoogleSansDisplay" for ".SF Pro Display" +- Use "GoogleSans" for ".SF UI Text" +- Use "GoogleSansDisplay" for ".SF UI Display". + +[Flutter gallery]: https://github.com/flutter/flutter/tree/master/examples/flutter_gallery +[hosted url]: https://flutter.github.io/samples/gallery/#/ diff --git a/web/gallery/analysis_options.yaml b/web/gallery/analysis_options.yaml new file mode 100644 index 000000000..44fbe83c0 --- /dev/null +++ b/web/gallery/analysis_options.yaml @@ -0,0 +1,8 @@ +# Take our settings from the repo's main analysis_options.yaml file, but add +# an exclude for the build directory. + +include: ../../analysis_options.yaml + +analyzer: + exclude: + - build/** diff --git a/web/gallery/assets/preview.png b/web/gallery/assets/preview.png deleted file mode 100644 index a70b50cf9..000000000 Binary files a/web/gallery/assets/preview.png and /dev/null differ diff --git a/web/gallery/lib/demo/calculator/logic.dart b/web/gallery/lib/demo/calculator/logic.dart index 121b1ae99..43ddf6598 100644 --- a/web/gallery/lib/demo/calculator/logic.dart +++ b/web/gallery/lib/demo/calculator/logic.dart @@ -302,8 +302,9 @@ class CalcExpression { assert(false); } } - final List outList = []; - outList.add(ResultToken(currentTermValue)); + final List outList = [ + ResultToken(currentTermValue), + ]; return CalcExpression(outList, ExpressionState.Result); } diff --git a/web/gallery/lib/demo/colors_demo.dart b/web/gallery/lib/demo/colors_demo.dart index d27e70490..85d7b8170 100644 --- a/web/gallery/lib/demo/colors_demo.dart +++ b/web/gallery/lib/demo/colors_demo.dart @@ -117,7 +117,7 @@ class PaletteTabView extends StatelessWidget { ); }), ], - ) + ), ); } } diff --git a/web/gallery/lib/demo/contacts_demo.dart b/web/gallery/lib/demo/contacts_demo.dart index 3dc5e5cd6..76753c4ae 100644 --- a/web/gallery/lib/demo/contacts_demo.dart +++ b/web/gallery/lib/demo/contacts_demo.dart @@ -54,33 +54,31 @@ class _ContactItem extends StatelessWidget { @override Widget build(BuildContext context) { final ThemeData themeData = Theme.of(context); - final List columnChildren = lines.sublist(0, lines.length - 1).map((String line) => Text(line)).toList(); - columnChildren.add(Text(lines.last, style: themeData.textTheme.caption)); - - final List rowChildren = [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: columnChildren, - ), - ), - ]; - if (icon != null) { - rowChildren.add(SizedBox( - width: 72.0, - child: IconButton( - icon: Icon(icon), - color: themeData.primaryColor, - onPressed: onPressed, - ), - )); - } return MergeSemantics( child: Padding( padding: const EdgeInsets.symmetric(vertical: 16.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: rowChildren, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ...lines.sublist(0, lines.length - 1).map((String line) => Text(line)), + Text(lines.last, style: themeData.textTheme.caption), + ], + ), + ), + if (icon != null) + SizedBox( + width: 72.0, + child: IconButton( + icon: Icon(icon), + color: themeData.primaryColor, + onPressed: onPressed, + ), + ), + ], ), ), ); diff --git a/web/gallery/lib/demo/cupertino/cupertino_alert_demo.dart b/web/gallery/lib/demo/cupertino/cupertino_alert_demo.dart index ce0d749fd..7fbfb0e89 100644 --- a/web/gallery/lib/demo/cupertino/cupertino_alert_demo.dart +++ b/web/gallery/lib/demo/cupertino/cupertino_alert_demo.dart @@ -53,159 +53,146 @@ class _CupertinoAlertDemoState extends State { style: CupertinoTheme.of(context).textTheme.textStyle, child: Builder( builder: (BuildContext context) { - final List stackChildren = [ - CupertinoScrollbar( - child: ListView( - // Add more padding to the normal safe area. - padding: const EdgeInsets.symmetric(vertical: 24.0, horizontal: 72.0) - + MediaQuery.of(context).padding, - children: [ - CupertinoButton.filled( - child: const Text('Alert'), - onPressed: () { - showDemoDialog( - context: context, - child: CupertinoAlertDialog( - title: const Text('Discard draft?'), - actions: [ - CupertinoDialogAction( - child: const Text('Discard'), - isDestructiveAction: true, - onPressed: () { - Navigator.pop(context, 'Discard'); - }, - ), - CupertinoDialogAction( - child: const Text('Cancel'), - isDefaultAction: true, - onPressed: () { - Navigator.pop(context, 'Cancel'); - }, - ), - ], - ), - ); - }, - ), - const Padding(padding: EdgeInsets.all(8.0)), - CupertinoButton.filled( - child: const Text('Alert with Title'), - padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 36.0), - onPressed: () { - showDemoDialog( - context: context, - child: CupertinoAlertDialog( - title: const Text('Allow "Maps" to access your location while you are using the app?'), - content: const Text('Your current location will be displayed on the map and used ' - 'for directions, nearby search results, and estimated travel times.'), - actions: [ - CupertinoDialogAction( - child: const Text('Don\'t Allow'), - onPressed: () { - Navigator.pop(context, 'Disallow'); - }, - ), - CupertinoDialogAction( - child: const Text('Allow'), - onPressed: () { - Navigator.pop(context, 'Allow'); - }, - ), - ], - ), - ); - }, - ), - const Padding(padding: EdgeInsets.all(8.0)), - CupertinoButton.filled( - child: const Text('Alert with Buttons'), - padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 36.0), - onPressed: () { - showDemoDialog( - context: context, - child: const CupertinoDessertDialog( - title: Text('Select Favorite Dessert'), - content: Text('Please select your favorite type of dessert from the ' - 'list below. Your selection will be used to customize the suggested ' - 'list of eateries in your area.'), - ), - ); - }, - ), - const Padding(padding: EdgeInsets.all(8.0)), - CupertinoButton.filled( - child: const Text('Alert Buttons Only'), - padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 36.0), - onPressed: () { - showDemoDialog( - context: context, - child: const CupertinoDessertDialog(), - ); - }, - ), - const Padding(padding: EdgeInsets.all(8.0)), - CupertinoButton.filled( - child: const Text('Action Sheet'), - padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 36.0), - onPressed: () { - showDemoActionSheet( - context: context, - child: CupertinoActionSheet( - title: const Text('Favorite Dessert'), - message: const Text('Please select the best dessert from the options below.'), - actions: [ - CupertinoActionSheetAction( - child: const Text('Profiteroles'), - onPressed: () { - Navigator.pop(context, 'Profiteroles'); - }, - ), - CupertinoActionSheetAction( - child: const Text('Cannolis'), - onPressed: () { - Navigator.pop(context, 'Cannolis'); - }, - ), - CupertinoActionSheetAction( - child: const Text('Trifle'), - onPressed: () { - Navigator.pop(context, 'Trifle'); - }, - ), - ], - cancelButton: CupertinoActionSheetAction( - child: const Text('Cancel'), - isDefaultAction: true, - onPressed: () { - Navigator.pop(context, 'Cancel'); - }, - ), - ), - ); - }, - ), - ], - ), - ), - ]; - - if (lastSelectedValue != null) { - stackChildren.add( - Positioned( - bottom: 32.0, - child: Text('You selected: $lastSelectedValue'), - ), - ); - } return Stack( alignment: Alignment.center, - children: stackChildren, + children: [ + CupertinoScrollbar( + child: ListView( + // Add more padding to the normal safe area. + padding: const EdgeInsets.symmetric(vertical: 24.0, horizontal: 72.0) + + MediaQuery.of(context).padding, + children: [ + CupertinoButton.filled( + child: const Text('Alert'), + onPressed: () => _onAlertPress(context), + ), + const Padding(padding: EdgeInsets.all(8.0)), + CupertinoButton.filled( + child: const Text('Alert with Title'), + padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 36.0), + onPressed: () => _onAlertWithTitlePress(context), + ), + const Padding(padding: EdgeInsets.all(8.0)), + CupertinoButton.filled( + child: const Text('Alert with Buttons'), + padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 36.0), + onPressed: () => _onAlertWithButtonsPress(context), + ), + const Padding(padding: EdgeInsets.all(8.0)), + CupertinoButton.filled( + child: const Text('Alert Buttons Only'), + padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 36.0), + onPressed: () { + showDemoDialog( + context: context, + child: const CupertinoDessertDialog(), + ); + }, + ), + const Padding(padding: EdgeInsets.all(8.0)), + CupertinoButton.filled( + child: const Text('Action Sheet'), + padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 36.0), + onPressed: () => _onActionSheetPress(context), + ), + ], + ), + ), + if (lastSelectedValue != null) + Positioned( + bottom: 32.0, + child: Text('You selected: $lastSelectedValue'), + ), + ], ); }, ), ), ); } + + void _onAlertPress(BuildContext context) { + showDemoDialog( + context: context, + child: CupertinoAlertDialog( + title: const Text('Discard draft?'), + actions: [ + CupertinoDialogAction( + child: const Text('Discard'), + isDestructiveAction: true, + onPressed: () => Navigator.pop(context, 'Discard'), + ), + CupertinoDialogAction( + child: const Text('Cancel'), + isDefaultAction: true, + onPressed: () => Navigator.pop(context, 'Cancel'), + ), + ], + ), + ); + } + + void _onAlertWithTitlePress(BuildContext context) { + showDemoDialog( + context: context, + child: CupertinoAlertDialog( + title: const Text('Allow "Maps" to access your location while you are using the app?'), + content: const Text('Your current location will be displayed on the map and used ' + 'for directions, nearby search results, and estimated travel times.'), + actions: [ + CupertinoDialogAction( + child: const Text('Don\'t Allow'), + onPressed: () => Navigator.pop(context, 'Disallow'), + ), + CupertinoDialogAction( + child: const Text('Allow'), + onPressed: () => Navigator.pop(context, 'Allow'), + ), + ], + ), + ); + } + + void _onAlertWithButtonsPress(BuildContext context) { + showDemoDialog( + context: context, + child: const CupertinoDessertDialog( + title: Text('Select Favorite Dessert'), + content: Text('Please select your favorite type of dessert from the ' + 'list below. Your selection will be used to customize the suggested ' + 'list of eateries in your area.'), + ), + ); + } + + void _onActionSheetPress(BuildContext context) { + showDemoActionSheet( + context: context, + child: CupertinoActionSheet( + title: const Text('Favorite Dessert'), + message: const Text('Please select the best dessert from the options below.'), + actions: [ + CupertinoActionSheetAction( + child: const Text('Profiteroles'), + onPressed: () => Navigator.pop(context, 'Profiteroles'), + ), + CupertinoActionSheetAction( + child: const Text('Cannolis'), + onPressed: () => Navigator.pop(context, 'Cannolis'), + ), + CupertinoActionSheetAction( + child: const Text('Trifle'), + onPressed: () => Navigator.pop(context, 'Trifle'), + ), + ], + cancelButton: CupertinoActionSheetAction( + child: const Text('Cancel'), + isDefaultAction: true, + onPressed: () => Navigator.pop(context, 'Cancel'), + ), + ), + ); + } } class CupertinoDessertDialog extends StatelessWidget { diff --git a/web/gallery/lib/demo/cupertino/cupertino_navigation_demo.dart b/web/gallery/lib/demo/cupertino/cupertino_navigation_demo.dart index 5f842a0f7..5730c43ad 100644 --- a/web/gallery/lib/demo/cupertino/cupertino_navigation_demo.dart +++ b/web/gallery/lib/demo/cupertino/cupertino_navigation_demo.dart @@ -647,25 +647,21 @@ class Tab2ConversationRow extends StatelessWidget { @override Widget build(BuildContext context) { - final List children = []; - if (avatar != null) - children.add(avatar); - final bool isSelf = avatar == null; - children.add( - Tab2ConversationBubble( - text: text, - color: isSelf - ? Tab2ConversationBubbleColor.blue - : Tab2ConversationBubbleColor.gray, - ), - ); return SafeArea( child: Row( mainAxisAlignment: isSelf ? MainAxisAlignment.end : MainAxisAlignment.start, mainAxisSize: MainAxisSize.min, crossAxisAlignment: isSelf ? CrossAxisAlignment.center : CrossAxisAlignment.end, - children: children, + children: [ + if (avatar != null) avatar, + Tab2ConversationBubble( + text: text, + color: isSelf + ? Tab2ConversationBubbleColor.blue + : Tab2ConversationBubbleColor.gray, + ), + ], ), ); } diff --git a/web/gallery/lib/demo/fortnightly/fortnightly.dart b/web/gallery/lib/demo/fortnightly/fortnightly.dart index f8dcde8a9..1e0209e73 100644 --- a/web/gallery/lib/demo/fortnightly/fortnightly.dart +++ b/web/gallery/lib/demo/fortnightly/fortnightly.dart @@ -139,7 +139,7 @@ class FruitPage extends StatelessWidget { padding: const EdgeInsets.symmetric(vertical: 16), child: Row( children: [ - CircleAvatar( + const CircleAvatar( backgroundImage: ExactAssetImage( 'people/square/trevor.png', package: 'flutter_gallery_assets', diff --git a/web/gallery/lib/demo/material/backdrop_demo.dart b/web/gallery/lib/demo/material/backdrop_demo.dart index 0d2c785c4..89fb9fb27 100644 --- a/web/gallery/lib/demo/material/backdrop_demo.dart +++ b/web/gallery/lib/demo/material/backdrop_demo.dart @@ -140,7 +140,7 @@ class CategoryView extends StatelessWidget { ], ); }).toList(), - ) + ), ); } } diff --git a/web/gallery/lib/demo/material/banner_demo.dart b/web/gallery/lib/demo/material/banner_demo.dart index 68af50df3..d555a092b 100644 --- a/web/gallery/lib/demo/material/banner_demo.dart +++ b/web/gallery/lib/demo/material/banner_demo.dart @@ -57,7 +57,7 @@ class _BannerDemoState extends State { setState(() { _displayBanner = false; }); - } + }, ), if (_showMultipleActions) FlatButton( @@ -66,7 +66,7 @@ class _BannerDemoState extends State { setState(() { _displayBanner = false; }); - } + }, ), ], ); diff --git a/web/gallery/lib/demo/material/bottom_navigation_demo.dart b/web/gallery/lib/demo/material/bottom_navigation_demo.dart index 6efefa3cc..b94a402c6 100644 --- a/web/gallery/lib/demo/material/bottom_navigation_demo.dart +++ b/web/gallery/lib/demo/material/bottom_navigation_demo.dart @@ -164,10 +164,9 @@ class _BottomNavigationDemoState extends State } Widget _buildTransitionsStack() { - final List transitions = []; - - for (NavigationIconView view in _navigationViews) - transitions.add(view.transition(_type, context)); + final List transitions = [ + for (NavigationIconView view in _navigationViews) view.transition(_type, context), + ]; // We want to have the newly animating (fading in) views on top. transitions.sort((FadeTransition a, FadeTransition b) { diff --git a/web/gallery/lib/demo/material/cards_demo.dart b/web/gallery/lib/demo/material/cards_demo.dart index 39c110695..fe7e29971 100644 --- a/web/gallery/lib/demo/material/cards_demo.dart +++ b/web/gallery/lib/demo/material/cards_demo.dart @@ -262,89 +262,83 @@ class TravelDestinationContent extends StatelessWidget { final TextStyle titleStyle = theme.textTheme.headline.copyWith(color: Colors.white); final TextStyle descriptionStyle = theme.textTheme.subhead; - final List children = [ - // Photo and title. - SizedBox( - height: 184.0, - child: Stack( - children: [ - Positioned.fill( - // In order to have the ink splash appear above the image, you - // must use Ink.image. This allows the image to be painted as part - // of the Material and display ink effects above it. Using a - // standard Image will obscure the ink splash. - child: Ink.image( - image: AssetImage(destination.assetName, package: destination.assetPackage), - fit: BoxFit.cover, - child: Container(), - ), - ), - Positioned( - bottom: 16.0, - left: 16.0, - right: 16.0, - child: FittedBox( - fit: BoxFit.scaleDown, - alignment: Alignment.centerLeft, - child: Text( - destination.title, - style: titleStyle, + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Photo and title. + SizedBox( + height: 184.0, + child: Stack( + children: [ + Positioned.fill( + // In order to have the ink splash appear above the image, you + // must use Ink.image. This allows the image to be painted as part + // of the Material and display ink effects above it. Using a + // standard Image will obscure the ink splash. + child: Ink.image( + image: AssetImage(destination.assetName, package: destination.assetPackage), + fit: BoxFit.cover, + child: Container(), ), ), - ), - ], - ), - ), - // Description and share/explore buttons. - Padding( - padding: const EdgeInsets.fromLTRB(16.0, 16.0, 16.0, 0.0), - child: DefaultTextStyle( - softWrap: false, - overflow: TextOverflow.ellipsis, - style: descriptionStyle, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // three line description - Padding( - padding: const EdgeInsets.only(bottom: 8.0), - child: Text( - destination.description, - style: descriptionStyle.copyWith(color: Colors.black54), + Positioned( + bottom: 16.0, + left: 16.0, + right: 16.0, + child: FittedBox( + fit: BoxFit.scaleDown, + alignment: Alignment.centerLeft, + child: Text( + destination.title, + style: titleStyle, + ), ), ), - Text(destination.city), - Text(destination.location), ], ), ), - ), - ]; - - if (destination.type == CardDemoType.standard) { - children.add( - // share, explore buttons - ButtonBar( - alignment: MainAxisAlignment.start, - children: [ - FlatButton( - child: Text('SHARE', semanticsLabel: 'Share ${destination.title}'), - textColor: Colors.amber.shade500, - onPressed: () { print('pressed'); }, - ), - FlatButton( - child: Text('EXPLORE', semanticsLabel: 'Explore ${destination.title}'), - textColor: Colors.amber.shade500, - onPressed: () { print('pressed'); }, + // Description and share/explore buttons. + Padding( + padding: const EdgeInsets.fromLTRB(16.0, 16.0, 16.0, 0.0), + child: DefaultTextStyle( + softWrap: false, + overflow: TextOverflow.ellipsis, + style: descriptionStyle, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // three line description + Padding( + padding: const EdgeInsets.only(bottom: 8.0), + child: Text( + destination.description, + style: descriptionStyle.copyWith(color: Colors.black54), + ), + ), + Text(destination.city), + Text(destination.location), + ], ), - ], + ), ), - ); - } - - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: children, + if (destination.type == CardDemoType.standard) + // share, explore buttons + ButtonBar( + alignment: MainAxisAlignment.start, + children: [ + FlatButton( + child: Text('SHARE', semanticsLabel: 'Share ${destination.title}'), + textColor: Colors.amber.shade500, + onPressed: () { print('pressed'); }, + ), + FlatButton( + child: Text('EXPLORE', semanticsLabel: 'Explore ${destination.title}'), + textColor: Colors.amber.shade500, + onPressed: () { print('pressed'); }, + ), + ], + ), + ], ); } } diff --git a/web/gallery/lib/demo/material/chip_demo.dart b/web/gallery/lib/demo/material/chip_demo.dart index 6c464db70..8528bd1a4 100644 --- a/web/gallery/lib/demo/material/chip_demo.dart +++ b/web/gallery/lib/demo/material/chip_demo.dart @@ -83,40 +83,36 @@ class _ChipsTile extends StatelessWidget { // Wraps a list of chips into a ListTile for display as a section in the demo. @override Widget build(BuildContext context) { - final List cardChildren = [ - Container( - padding: const EdgeInsets.only(top: 16.0, bottom: 4.0), - alignment: Alignment.center, - child: Text(label, textAlign: TextAlign.start), - ), - ]; - if (children.isNotEmpty) { - cardChildren.add(Wrap( - children: children.map((Widget chip) { - return Padding( - padding: const EdgeInsets.all(2.0), - child: chip, - ); - }).toList())); - } else { - final TextStyle textStyle = Theme.of(context).textTheme.caption.copyWith(fontStyle: FontStyle.italic); - cardChildren.add( - Semantics( - container: true, - child: Container( - alignment: Alignment.center, - constraints: const BoxConstraints(minWidth: 48.0, minHeight: 48.0), - padding: const EdgeInsets.all(8.0), - child: Text('None', style: textStyle), - ), - )); - } - return Card( semanticContainer: false, child: Column( mainAxisSize: MainAxisSize.min, - children: cardChildren, + children: [ + Container( + padding: const EdgeInsets.only(top: 16.0, bottom: 4.0), + alignment: Alignment.center, + child: Text(label, textAlign: TextAlign.start), + ), + if (children.isNotEmpty) + Wrap( + children: children.map((Widget chip) { + return Padding( + padding: const EdgeInsets.all(2.0), + child: chip, + ); + }).toList(), + ) + else + Semantics( + container: true, + child: Container( + alignment: Alignment.center, + constraints: const BoxConstraints(minWidth: 48.0, minHeight: 48.0), + padding: const EdgeInsets.all(8.0), + child: Text('None', style: Theme.of(context).textTheme.caption.copyWith(fontStyle: FontStyle.italic)), + ), + ), + ], ), ); } diff --git a/web/gallery/lib/demo/material/leave_behind_demo.dart b/web/gallery/lib/demo/material/leave_behind_demo.dart index 4ab956253..87e8d3eca 100644 --- a/web/gallery/lib/demo/material/leave_behind_demo.dart +++ b/web/gallery/lib/demo/material/leave_behind_demo.dart @@ -245,14 +245,18 @@ class _LeaveBehindListItem extends StatelessWidget { }, background: Container( color: theme.primaryColor, - child: const ListTile( - leading: Icon(Icons.delete, color: Colors.white, size: 36.0), + child: const Center( + child: ListTile( + leading: Icon(Icons.delete, color: Colors.white, size: 36.0), + ), ), ), secondaryBackground: Container( color: theme.primaryColor, - child: const ListTile( - trailing: Icon(Icons.archive, color: Colors.white, size: 36.0), + child: const Center( + child: ListTile( + trailing: Icon(Icons.archive, color: Colors.white, size: 36.0), + ), ), ), child: Container( diff --git a/web/gallery/lib/demo/material/search_demo.dart b/web/gallery/lib/demo/material/search_demo.dart index d497bdd7d..bf3357363 100644 --- a/web/gallery/lib/demo/material/search_demo.dart +++ b/web/gallery/lib/demo/material/search_demo.dart @@ -204,22 +204,23 @@ class _SearchDemoSearchDelegate extends SearchDelegate { @override List buildActions(BuildContext context) { return [ - query.isEmpty - ? IconButton( - tooltip: 'Voice Search', - icon: const Icon(Icons.mic), - onPressed: () { - query = 'TODO: implement voice input'; - }, - ) - : IconButton( - tooltip: 'Clear', - icon: const Icon(Icons.clear), - onPressed: () { - query = ''; - showSuggestions(context); - }, - ), + if (query.isEmpty) + IconButton( + tooltip: 'Voice Search', + icon: const Icon(Icons.mic), + onPressed: () { + query = 'TODO: implement voice input'; + }, + ) + else + IconButton( + tooltip: 'Clear', + icon: const Icon(Icons.clear), + onPressed: () { + query = ''; + showSuggestions(context); + }, + ), ]; } } diff --git a/web/gallery/lib/demo/material/snack_bar_demo.dart b/web/gallery/lib/demo/material/snack_bar_demo.dart index 011203d6f..891d8d757 100644 --- a/web/gallery/lib/demo/material/snack_bar_demo.dart +++ b/web/gallery/lib/demo/material/snack_bar_demo.dart @@ -88,7 +88,7 @@ class _SnackBarDemoState extends State { tooltip: 'Create', onPressed: () { print('Floating Action Button was pressed'); - } + }, ), ); } diff --git a/web/gallery/lib/demo/shrine/backdrop.dart b/web/gallery/lib/demo/shrine/backdrop.dart index b041301d0..6336b873a 100644 --- a/web/gallery/lib/demo/shrine/backdrop.dart +++ b/web/gallery/lib/demo/shrine/backdrop.dart @@ -22,6 +22,65 @@ const Cubic _kDecelerateCurve = Cubic(0.23, 0.94, 0.41, 1.0); const double _kPeakVelocityTime = 0.248210; const double _kPeakVelocityProgress = 0.379146; +class _TappableWhileStatusIs extends StatefulWidget { + const _TappableWhileStatusIs( + this.status, { + Key key, + this.controller, + this.child, + }) : super(key: key); + + final AnimationController controller; + final AnimationStatus status; + final Widget child; + + @override + _TappableWhileStatusIsState createState() => _TappableWhileStatusIsState(); +} + +class _TappableWhileStatusIsState extends State<_TappableWhileStatusIs> { + bool _active; + + @override + void initState() { + super.initState(); + widget.controller.addStatusListener(_handleStatusChange); + _active = widget.controller.status == widget.status; + } + + @override + void dispose() { + widget.controller.removeStatusListener(_handleStatusChange); + super.dispose(); + } + + void _handleStatusChange(AnimationStatus status) { + final bool value = widget.controller.status == widget.status; + if (_active != value) { + setState(() { + _active = value; + }); + } + } + + @override + Widget build(BuildContext context) { + Widget child = AbsorbPointer( + absorbing: !_active, + child: widget.child, + ); + + if (!_active) { + child = FocusScope( + canRequestFocus: false, + debugLabel: '$_TappableWhileStatusIs', + child: child, + ); + } + return child; + } +} + class _FrontLayer extends StatelessWidget { const _FrontLayer({ Key key, @@ -275,12 +334,20 @@ class _BackdropState extends State with SingleTickerProviderStateMixin return Stack( key: _backdropKey, children: [ - widget.backLayer, + _TappableWhileStatusIs( + AnimationStatus.dismissed, + controller: _controller, + child: widget.backLayer, + ), PositionedTransition( rect: _layerAnimation, child: _FrontLayer( onTap: _toggleBackdropLayerVisibility, - child: widget.frontLayer, + child: _TappableWhileStatusIs( + AnimationStatus.completed, + controller: _controller, + child: widget.frontLayer, + ), ), ), ], diff --git a/web/gallery/lib/demo/typography_demo.dart b/web/gallery/lib/demo/typography_demo.dart index 18c3e3a96..b974be556 100644 --- a/web/gallery/lib/demo/typography_demo.dart +++ b/web/gallery/lib/demo/typography_demo.dart @@ -48,6 +48,8 @@ class TypographyDemo extends StatelessWidget { Widget build(BuildContext context) { final TextTheme textTheme = Theme.of(context).textTheme; final List styleItems = [ + if (MediaQuery.of(context).size.width > 500.0) + TextStyleItem(name: 'Display 4', style: textTheme.display4, text: 'Light 112sp'), TextStyleItem(name: 'Display 3', style: textTheme.display3, text: 'Regular 56sp'), TextStyleItem(name: 'Display 2', style: textTheme.display2, text: 'Regular 45sp'), TextStyleItem(name: 'Display 1', style: textTheme.display1, text: 'Regular 34sp'), @@ -60,14 +62,6 @@ class TypographyDemo extends StatelessWidget { TextStyleItem(name: 'Button', style: textTheme.button, text: 'MEDIUM (ALL CAPS) 14sp'), ]; - if (MediaQuery.of(context).size.width > 500.0) { - styleItems.insert(0, TextStyleItem( - name: 'Display 4', - style: textTheme.display4, - text: 'Light 112sp', - )); - } - return Scaffold( appBar: AppBar(title: const Text('Typography')), body: SafeArea( diff --git a/web/gallery/lib/gallery/backdrop.dart b/web/gallery/lib/gallery/backdrop.dart index 974e6afee..609f3a405 100644 --- a/web/gallery/lib/gallery/backdrop.dart +++ b/web/gallery/lib/gallery/backdrop.dart @@ -66,10 +66,19 @@ class _TappableWhileStatusIsState extends State<_TappableWhileStatusIs> { @override Widget build(BuildContext context) { - return AbsorbPointer( + Widget child = AbsorbPointer( absorbing: !_active, child: widget.child, ); + + if (!_active) { + child = FocusScope( + canRequestFocus: false, + debugLabel: '$_TappableWhileStatusIs', + child: child, + ); + } + return child; } } @@ -138,36 +147,31 @@ class _BackAppBar extends StatelessWidget { @override Widget build(BuildContext context) { - final List children = [ - Container( - alignment: Alignment.center, - width: 56.0, - child: leading, - ), - Expanded( - child: title, - ), - ]; - - if (trailing != null) { - children.add( - Container( - alignment: Alignment.center, - width: 56.0, - child: trailing, - ), - ); - } - final ThemeData theme = Theme.of(context); - return IconTheme.merge( data: theme.primaryIconTheme, child: DefaultTextStyle( style: theme.primaryTextTheme.title, child: SizedBox( height: _kBackAppBarHeight, - child: Row(children: children), + child: Row( + children: [ + Container( + alignment: Alignment.center, + width: 56.0, + child: leading, + ), + Expanded( + child: title, + ), + if (trailing != null) + Container( + alignment: Alignment.center, + width: 56.0, + child: trailing, + ), + ], + ), ), ), ); @@ -255,95 +259,92 @@ class _BackdropState extends State with SingleTickerProviderStateMixin begin: RelativeRect.fromLTRB(0.0, constraints.biggest.height - _kFrontClosedHeight, 0.0, 0.0), end: const RelativeRect.fromLTRB(0.0, _kBackAppBarHeight, 0.0, 0.0), )); - - final List layers = [ - // Back layer - Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - _BackAppBar( - leading: widget.frontAction, - title: _CrossFadeTransition( - progress: _controller, - alignment: AlignmentDirectional.centerStart, - child0: Semantics(namesRoute: true, child: widget.frontTitle), - child1: Semantics(namesRoute: true, child: widget.backTitle), - ), - trailing: IconButton( - onPressed: _toggleFrontLayer, - tooltip: 'Toggle options page', - icon: AnimatedIcon( - icon: AnimatedIcons.close_menu, + return Stack( + key: _backdropKey, + children: [ + // Back layer + Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + _BackAppBar( + leading: widget.frontAction, + title: _CrossFadeTransition( progress: _controller, + alignment: AlignmentDirectional.centerStart, + child0: Semantics(namesRoute: true, child: widget.frontTitle), + child1: Semantics(namesRoute: true, child: widget.backTitle), + ), + trailing: IconButton( + onPressed: _toggleFrontLayer, + tooltip: 'Toggle options page', + icon: AnimatedIcon( + icon: AnimatedIcons.close_menu, + progress: _controller, + ), ), ), - ), - Expanded( - child: Visibility( - child: widget.backLayer, - visible: _controller.status != AnimationStatus.completed, - maintainState: true, - ), - ), - ], - ), - // Front layer - PositionedTransition( - rect: frontRelativeRect, - child: AnimatedBuilder( - animation: _controller, - builder: (BuildContext context, Widget child) { - return PhysicalShape( - elevation: 12.0, - color: Theme.of(context).canvasColor, - clipper: ShapeBorderClipper( - shape: BeveledRectangleBorder( - borderRadius: _kFrontHeadingBevelRadius.transform(_controller.value), + Expanded( + child: _TappableWhileStatusIs( + AnimationStatus.dismissed, + controller: _controller, + child: Visibility( + child: widget.backLayer, + visible: _controller.status != AnimationStatus.completed, + maintainState: true, ), ), - clipBehavior: Clip.antiAlias, - child: child, - ); - }, - child: _TappableWhileStatusIs( - AnimationStatus.completed, - controller: _controller, - child: FadeTransition( - opacity: _frontOpacity, - child: widget.frontLayer, ), - ), + ], ), - ), - ]; - - // The front "heading" is a (typically transparent) widget that's stacked on - // top of, and at the top of, the front layer. It adds support for dragging - // the front layer up and down and for opening and closing the front layer - // with a tap. It may obscure part of the front layer's topmost child. - if (widget.frontHeading != null) { - layers.add( + // Front layer PositionedTransition( rect: frontRelativeRect, - child: ExcludeSemantics( - child: Container( - alignment: Alignment.topLeft, - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: _toggleFrontLayer, - onVerticalDragUpdate: _handleDragUpdate, - onVerticalDragEnd: _handleDragEnd, - child: widget.frontHeading, + child: AnimatedBuilder( + animation: _controller, + builder: (BuildContext context, Widget child) { + return PhysicalShape( + elevation: 12.0, + color: Theme.of(context).canvasColor, + clipper: ShapeBorderClipper( + shape: BeveledRectangleBorder( + borderRadius: _kFrontHeadingBevelRadius.transform(_controller.value), + ), + ), + clipBehavior: Clip.antiAlias, + child: child, + ); + }, + child: _TappableWhileStatusIs( + AnimationStatus.completed, + controller: _controller, + child: FadeTransition( + opacity: _frontOpacity, + child: widget.frontLayer, ), ), ), ), - ); - } - - return Stack( - key: _backdropKey, - children: layers, + // The front "heading" is a (typically transparent) widget that's stacked on + // top of, and at the top of, the front layer. It adds support for dragging + // the front layer up and down and for opening and closing the front layer + // with a tap. It may obscure part of the front layer's topmost child. + if (widget.frontHeading != null) + PositionedTransition( + rect: frontRelativeRect, + child: ExcludeSemantics( + child: Container( + alignment: Alignment.topLeft, + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: _toggleFrontLayer, + onVerticalDragUpdate: _handleDragUpdate, + onVerticalDragEnd: _handleDragEnd, + child: widget.frontHeading, + ), + ), + ), + ), + ], ); } diff --git a/web/gallery/lib/gallery/home.dart b/web/gallery/lib/gallery/home.dart index 38810876c..ec785383c 100644 --- a/web/gallery/lib/gallery/home.dart +++ b/web/gallery/lib/gallery/home.dart @@ -184,26 +184,6 @@ class _DemoItem extends StatelessWidget { final ThemeData theme = Theme.of(context); final bool isDark = theme.brightness == Brightness.dark; final double textScaleFactor = MediaQuery.textScaleFactorOf(context); - - final List titleChildren = [ - Text( - demo.title, - style: theme.textTheme.subhead.copyWith( - color: isDark ? Colors.white : const Color(0xFF202124), - ), - ), - ]; - if (demo.subtitle != null) { - titleChildren.add( - Text( - demo.subtitle, - style: theme.textTheme.body1.copyWith( - color: isDark ? Colors.white : const Color(0xFF60646B) - ), - ), - ); - } - return RawMaterialButton( padding: EdgeInsets.zero, splashColor: theme.primaryColor.withOpacity(0.12), @@ -229,7 +209,21 @@ class _DemoItem extends StatelessWidget { child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.stretch, - children: titleChildren, + children: [ + Text( + demo.title, + style: theme.textTheme.subhead.copyWith( + color: isDark ? Colors.white : const Color(0xFF202124), + ), + ), + if (demo.subtitle != null) + Text( + demo.subtitle, + style: theme.textTheme.body1.copyWith( + color: isDark ? Colors.white : const Color(0xFF60646B) + ), + ), + ], ), ), const SizedBox(width: 44.0), @@ -294,11 +288,11 @@ class _GalleryHomeState extends State with SingleTickerProviderStat GalleryDemoCategory _category; static Widget _topHomeLayout(Widget currentChild, List previousChildren) { - List children = previousChildren; - if (currentChild != null) - children = children.toList()..add(currentChild); return Stack( - children: children, + children: [ + ...previousChildren, + if (currentChild != null) currentChild, + ], alignment: Alignment.topCenter, ); } diff --git a/web/gallery/lib/gallery/options.dart b/web/gallery/lib/gallery/options.dart index 6076d0108..865e19f9f 100644 --- a/web/gallery/lib/gallery/options.dart +++ b/web/gallery/lib/gallery/options.dart @@ -425,13 +425,10 @@ class GalleryOptionsPage extends StatelessWidget { options.showPerformanceOverlay == null) return const []; - final List items = [ + return [ const Divider(), const _Heading('Diagnostics'), - ]; - - if (options.showOffscreenLayersCheckerboard != null) { - items.add( + if (options.showOffscreenLayersCheckerboard != null) _BooleanItem( 'Highlight offscreen layers', options.showOffscreenLayersCheckerboard, @@ -439,10 +436,7 @@ class GalleryOptionsPage extends StatelessWidget { onOptionsChanged(options.copyWith(showOffscreenLayersCheckerboard: value)); }, ), - ); - } - if (options.showRasterCacheImagesCheckerboard != null) { - items.add( + if (options.showRasterCacheImagesCheckerboard != null) _BooleanItem( 'Highlight raster cache images', options.showRasterCacheImagesCheckerboard, @@ -450,10 +444,7 @@ class GalleryOptionsPage extends StatelessWidget { onOptionsChanged(options.copyWith(showRasterCacheImagesCheckerboard: value)); }, ), - ); - } - if (options.showPerformanceOverlay != null) { - items.add( + if (options.showPerformanceOverlay != null) _BooleanItem( 'Show performance overlay', options.showPerformanceOverlay, @@ -461,10 +452,7 @@ class GalleryOptionsPage extends StatelessWidget { onOptionsChanged(options.copyWith(showPerformanceOverlay: value)); }, ), - ); - } - - return items; + ]; } @override diff --git a/web/gallery/pubspec.lock b/web/gallery/pubspec.lock index 691da9a03..7b326d3cd 100644 --- a/web/gallery/pubspec.lock +++ b/web/gallery/pubspec.lock @@ -56,7 +56,7 @@ packages: name: connectivity url: "https://pub.dartlang.org" source: hosted - version: "0.4.3+7" + version: "0.4.5+1" convert: dependency: "direct dev" description: @@ -70,7 +70,7 @@ packages: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "2.1.3" csslib: dependency: "direct dev" description: @@ -91,19 +91,24 @@ packages: name: device_info url: "https://pub.dartlang.org" source: hosted - version: "0.4.0+2" + version: "0.4.1" file: dependency: "direct dev" description: name: file url: "https://pub.dartlang.org" source: hosted - version: "5.0.8+1" + version: "5.1.0" flutter: dependency: "direct main" description: flutter source: sdk version: "0.0.0" + flutter_driver: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" flutter_gallery_assets: dependency: "direct main" description: @@ -111,6 +116,18 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.1.9+2" + flutter_goldens: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_goldens_client: + dependency: transitive + description: + path: "../../../flutter/packages/flutter_goldens_client" + relative: true + source: path + version: "0.0.0" flutter_test: dependency: "direct dev" description: flutter @@ -123,20 +140,25 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.1.19" + fuchsia_remote_debug_protocol: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" glob: dependency: "direct dev" description: name: glob url: "https://pub.dartlang.org" source: hosted - version: "1.1.7" + version: "1.2.0" html: dependency: "direct dev" description: name: html url: "https://pub.dartlang.org" source: hosted - version: "0.14.0+2" + version: "0.14.0+3" http: dependency: "direct dev" description: @@ -171,7 +193,7 @@ packages: name: intl url: "https://pub.dartlang.org" source: hosted - version: "0.15.8" + version: "0.16.0" io: dependency: "direct dev" description: @@ -228,13 +250,27 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.2" + node_interop: + dependency: "direct dev" + description: + name: node_interop + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.3" + node_io: + dependency: "direct dev" + description: + name: node_io + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1+2" node_preamble: dependency: "direct dev" description: name: node_preamble url: "https://pub.dartlang.org" source: hosted - version: "1.4.6" + version: "1.4.8" package_config: dependency: "direct dev" description: @@ -290,7 +326,7 @@ packages: name: process url: "https://pub.dartlang.org" source: hosted - version: "3.0.11" + version: "3.0.12" pub_semver: dependency: "direct dev" description: @@ -435,7 +471,7 @@ packages: name: url_launcher url: "https://pub.dartlang.org" source: hosted - version: "5.1.2" + version: "5.2.3" vector_math: dependency: "direct main" description: @@ -449,7 +485,7 @@ packages: name: video_player url: "https://pub.dartlang.org" source: hosted - version: "0.10.1+6" + version: "0.10.2+5" vm_service_client: dependency: "direct dev" description: @@ -470,7 +506,7 @@ packages: name: web_socket_channel url: "https://pub.dartlang.org" source: hosted - version: "1.0.15" + version: "1.1.0" xml: dependency: "direct dev" description: @@ -484,7 +520,7 @@ packages: name: yaml url: "https://pub.dartlang.org" source: hosted - version: "2.1.16" + version: "2.2.0" sdks: dart: ">=2.4.0 <3.0.0" - flutter: ">=1.5.0 <2.0.0" + flutter: ">=1.9.1+hotfix.4 <2.0.0" diff --git a/web/gallery/pubspec.yaml b/web/gallery/pubspec.yaml index f255482c2..5e9d94f9b 100644 --- a/web/gallery/pubspec.yaml +++ b/web/gallery/pubspec.yaml @@ -8,13 +8,13 @@ dependencies: flutter: sdk: flutter collection: 1.14.11 - device_info: 0.4.0+2 - intl: 0.15.8 - connectivity: 0.4.3+7 + device_info: 0.4.1 + intl: 0.16.0 + connectivity: 0.4.5+1 string_scanner: 1.0.5 - url_launcher: 5.1.2 + url_launcher: 5.2.3 cupertino_icons: 0.1.2 - video_player: 0.10.1+6 + video_player: 0.10.2+5 scoped_model: 1.0.1 shrine_images: 1.1.2 @@ -32,6 +32,10 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter + flutter_driver: + sdk: flutter + flutter_goldens: + sdk: flutter test: 1.6.3 analyzer: 0.36.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" @@ -40,12 +44,12 @@ dev_dependencies: async: 2.3.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" boolean_selector: 1.0.5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" convert: 2.1.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" - crypto: 2.1.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" + crypto: 2.1.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" csslib: 0.16.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" - file: 5.0.8+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" + file: 5.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" front_end: 0.1.19 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" - glob: 1.1.7 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" - html: 0.14.0+2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" + glob: 1.2.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" + html: 0.14.0+3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" http: 0.12.0+2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" http_multi_server: 2.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" http_parser: 3.1.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" @@ -57,14 +61,16 @@ dev_dependencies: matcher: 0.12.5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" mime: 0.9.6+3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" multi_server_socket: 1.0.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" - node_preamble: 1.4.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" + node_interop: 1.0.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" + node_io: 1.0.1+2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" + node_preamble: 1.4.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" package_config: 1.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" package_resolver: 1.0.10 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" pedantic: 1.8.0+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" petitparser: 2.4.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" platform: 2.2.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" pool: 1.4.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" - process: 3.0.11 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" + process: 3.0.12 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" pub_semver: 1.4.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" quiver: 2.0.5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" shelf: 0.7.5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" @@ -79,9 +85,9 @@ dev_dependencies: test_core: 0.2.5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" vm_service_client: 0.2.6+2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" watcher: 0.9.7+12 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" - web_socket_channel: 1.0.15 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" + web_socket_channel: 1.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" xml: 3.5.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" - yaml: 2.1.16 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" + yaml: 2.2.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" flutter: uses-material-design: true @@ -192,7 +198,6 @@ flutter: - packages/shrine_images/35-0.jpg - packages/shrine_images/36-0.jpg - packages/shrine_images/37-0.jpg - - preview.png fonts: - family: Raleway @@ -244,15 +249,85 @@ flutter: weight: 400 - family: LibreFranklin fonts: - - asset: packages/flutter_gallery_assets/fonts/librefranklin/LibreFranklin-Bold.ttf - - asset: packages/flutter_gallery_assets/fonts/librefranklin/LibreFranklin-Light.ttf - - asset: packages/flutter_gallery_assets/fonts/librefranklin/LibreFranklin-Medium.ttf - - asset: packages/flutter_gallery_assets/fonts/librefranklin/LibreFranklin-Regular.ttf + - asset: packages/flutter_gallery_assets/fonts/librefranklin/LibreFranklin-Bold.ttf + - asset: packages/flutter_gallery_assets/fonts/librefranklin/LibreFranklin-Light.ttf + - asset: packages/flutter_gallery_assets/fonts/librefranklin/LibreFranklin-Medium.ttf + - asset: packages/flutter_gallery_assets/fonts/librefranklin/LibreFranklin-Regular.ttf - family: Merriweather fonts: - - asset: packages/flutter_gallery_assets/fonts/merriweather/Merriweather-BlackItalic.ttf - - asset: packages/flutter_gallery_assets/fonts/merriweather/Merriweather-Italic.ttf - - asset: packages/flutter_gallery_assets/fonts/merriweather/Merriweather-Regular.ttf - - asset: packages/flutter_gallery_assets/fonts/merriweather/Merriweather-Light.ttf + - asset: packages/flutter_gallery_assets/fonts/merriweather/Merriweather-BlackItalic.ttf + - asset: packages/flutter_gallery_assets/fonts/merriweather/Merriweather-Italic.ttf + - asset: packages/flutter_gallery_assets/fonts/merriweather/Merriweather-Regular.ttf + - asset: packages/flutter_gallery_assets/fonts/merriweather/Merriweather-Light.ttf + # TODO (ryjohn): Find a way to get Cupertino fonts working + - family: .SF Pro Text + fonts: + - asset: packages/flutter_gallery_assets/fonts/private/googlesans/GoogleSans-BoldItalic.ttf + weight: 700 + style: italic + - asset: packages/flutter_gallery_assets/fonts/private/googlesans/GoogleSans-Bold.ttf + weight: 700 + - asset: packages/flutter_gallery_assets/fonts/private/googlesans/GoogleSans-Italic.ttf + weight: 400 + style: italic + - asset: packages/flutter_gallery_assets/fonts/private/googlesans/GoogleSans-MediumItalic.ttf + weight: 500 + style: italic + - asset: packages/flutter_gallery_assets/fonts/private/googlesans/GoogleSans-Medium.ttf + weight: 500 + - asset: packages/flutter_gallery_assets/fonts/private/googlesans/GoogleSans-Regular.ttf + weight: 400 + - family: .SF Pro Display + fonts: + - asset: packages/flutter_gallery_assets/fonts/private/googlesans/GoogleSansDisplay-BoldItalic.ttf + weight: 700 + style: italic + - asset: packages/flutter_gallery_assets/fonts/private/googlesans/GoogleSansDisplay-Bold.ttf + weight: 700 + - asset: packages/flutter_gallery_assets/fonts/private/googlesans/GoogleSansDisplay-Italic.ttf + weight: 400 + style: italic + - asset: packages/flutter_gallery_assets/fonts/private/googlesans/GoogleSansDisplay-MediumItalic.ttf + style: italic + weight: 500 + - asset: packages/flutter_gallery_assets/fonts/private/googlesans/GoogleSansDisplay-Medium.ttf + weight: 500 + - asset: packages/flutter_gallery_assets/fonts/private/googlesans/GoogleSansDisplay-Regular.ttf + weight: 400 + - family: .SF UI Text + fonts: + - asset: packages/flutter_gallery_assets/fonts/private/googlesans/GoogleSans-BoldItalic.ttf + weight: 700 + style: italic + - asset: packages/flutter_gallery_assets/fonts/private/googlesans/GoogleSans-Bold.ttf + weight: 700 + - asset: packages/flutter_gallery_assets/fonts/private/googlesans/GoogleSans-Italic.ttf + weight: 400 + style: italic + - asset: packages/flutter_gallery_assets/fonts/private/googlesans/GoogleSans-MediumItalic.ttf + weight: 500 + style: italic + - asset: packages/flutter_gallery_assets/fonts/private/googlesans/GoogleSans-Medium.ttf + weight: 500 + - asset: packages/flutter_gallery_assets/fonts/private/googlesans/GoogleSans-Regular.ttf + weight: 400 + - family: .SF UI Display + fonts: + - asset: packages/flutter_gallery_assets/fonts/private/googlesans/GoogleSansDisplay-BoldItalic.ttf + weight: 700 + style: italic + - asset: packages/flutter_gallery_assets/fonts/private/googlesans/GoogleSansDisplay-Bold.ttf + weight: 700 + - asset: packages/flutter_gallery_assets/fonts/private/googlesans/GoogleSansDisplay-Italic.ttf + weight: 400 + style: italic + - asset: packages/flutter_gallery_assets/fonts/private/googlesans/GoogleSansDisplay-MediumItalic.ttf + style: italic + weight: 500 + - asset: packages/flutter_gallery_assets/fonts/private/googlesans/GoogleSansDisplay-Medium.ttf + weight: 500 + - asset: packages/flutter_gallery_assets/fonts/private/googlesans/GoogleSansDisplay-Regular.ttf + weight: 400 + -# PUBSPEC CHECKSUM: ba0e +# PUBSPEC CHECKSUM: 76b5 diff --git a/web/gallery/test/demo/material/text_form_field_demo_test.dart b/web/gallery/test/demo/material/text_form_field_demo_test.dart deleted file mode 100644 index 27594e85d..000000000 --- a/web/gallery/test/demo/material/text_form_field_demo_test.dart +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'package:flutter/material.dart'; -import 'package:flutter_gallery/demo/material/text_form_field_demo.dart'; -import 'package:flutter_test/flutter_test.dart'; - -void main() { - testWidgets('validates name field correctly', (WidgetTester tester) async { - await tester.pumpWidget(const MaterialApp(home: TextFormFieldDemo())); - - final Finder submitButton = find.widgetWithText(RaisedButton, 'SUBMIT'); - expect(submitButton, findsOneWidget); - - final Finder nameField = find.widgetWithText(TextFormField, 'Name * '); - expect(nameField, findsOneWidget); - - final Finder passwordField = - find.widgetWithText(TextFormField, 'Password *'); - expect(passwordField, findsOneWidget); - - await tester.enterText(nameField, ''); - await tester.pumpAndSettle(); - // The submit button isn't initially visible. Drag it into view so that - // it will see the tap. - await tester.drag(nameField, const Offset(0.0, -1200.0)); - await tester.pumpAndSettle(); - await tester.tap(submitButton); - await tester.pumpAndSettle(); - - // Now drag the password field (the submit button will be obscured by - // the snackbar) and expose the name field again. - await tester.drag(passwordField, const Offset(0.0, 1200.0)); - await tester.pumpAndSettle(); - expect(find.text('Name is required.'), findsOneWidget); - expect( - find.text('Please enter only alphabetical characters.'), findsNothing); - await tester.enterText(nameField, '#'); - await tester.pumpAndSettle(); - - // Make the submit button visible again (by dragging the name field), so - // it will see the tap. - await tester.drag(nameField, const Offset(0.0, -1200.0)); - await tester.tap(submitButton); - await tester.pumpAndSettle(); - expect(find.text('Name is required.'), findsNothing); - expect(find.text('Please enter only alphabetical characters.'), - findsOneWidget); - - await tester.enterText(nameField, 'Jane Doe'); - // TODO(b/123539399): Why does it pass in Flutter without this `drag`? - await tester.drag(nameField, const Offset(0.0, -1200.0)); - await tester.tap(submitButton); - await tester.pumpAndSettle(); - expect(find.text('Name is required.'), findsNothing); - expect( - find.text('Please enter only alphabetical characters.'), findsNothing); - }); -} diff --git a/web/gallery/test/gallery_test.dart b/web/gallery/test/gallery_test.dart deleted file mode 100644 index 2204418e9..000000000 --- a/web/gallery/test/gallery_test.dart +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'package:flutter_test/flutter_test.dart'; -import 'package:flutter_gallery/gallery/app.dart'; - -void main() { - testWidgets('Gallery starts', (WidgetTester tester) async { - await tester.pumpWidget(GalleryApp()); - }); -} diff --git a/web/gallery/web/index.html b/web/gallery/web/index.html index bee334924..ba232943d 100644 --- a/web/gallery/web/index.html +++ b/web/gallery/web/index.html @@ -1,10 +1,12 @@ + - - - gallery - - - - - + + Flutter Gallery + + + + + \ No newline at end of file