diff --git a/engine/src/flutter/lib/ui/painting.dart b/engine/src/flutter/lib/ui/painting.dart index bf63e347e93..db3009e50fe 100644 --- a/engine/src/flutter/lib/ui/painting.dart +++ b/engine/src/flutter/lib/ui/painting.dart @@ -5519,10 +5519,10 @@ base class FragmentShader extends Shader { /// shader.setFloat(2, 83); // uMagnitude y /// /// // Convert color to premultiplied opacity. - /// shader.setFloat(3, color.red / 255 * color.opacity); // uColor r - /// shader.setFloat(4, color.green / 255 * color.opacity); // uColor g - /// shader.setFloat(5, color.blue / 255 * color.opacity); // uColor b - /// shader.setFloat(6, color.opacity); // uColor a + /// shader.setFloat(3, color.r * color.a); // uColor r + /// shader.setFloat(4, color.g * color.a); // uColor g + /// shader.setFloat(5, color.b * color.a); // uColor b + /// shader.setFloat(6, color.a); // uColor a /// /// // initialize sampler uniform. /// shader.setImageSampler(0, image); diff --git a/examples/api/analysis_options.yaml b/examples/api/analysis_options.yaml index 51190f69ca1..ca26f0d08d7 100644 --- a/examples/api/analysis_options.yaml +++ b/examples/api/analysis_options.yaml @@ -1,11 +1,8 @@ # This file is also used by dev/bots/analyze_snippet_code.dart to analyze code snippets (`{@tool snippet}` sections). -# include: ../../analysis_options.yaml #TODO(Piinks): Replace with flutter_lints - separate change. - -analyzer: - errors: - # We have some clean up to do here. Landing examples/api update separately. - deprecated_member_use: ignore +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml linter: rules: diff --git a/examples/api/lib/animation/animation_controller/animated_digit.0.dart b/examples/api/lib/animation/animation_controller/animated_digit.0.dart index a05c1edcc63..d8076781225 100644 --- a/examples/api/lib/animation/animation_controller/animated_digit.0.dart +++ b/examples/api/lib/animation/animation_controller/animated_digit.0.dart @@ -23,13 +23,15 @@ class _PlaceholderDigit extends StatelessWidget { context, ).textTheme.displayLarge!.copyWith(fontWeight: FontWeight.w500); - final Iterable placeholderDigits = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map(( - int n, - ) { - return Text('$n', style: textStyle); - }); + final Iterable placeholderDigits = + [0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map((int n) { + return Text('$n', style: textStyle); + }); - return Opacity(opacity: 0, child: Stack(children: placeholderDigits.toList())); + return Opacity( + opacity: 0, + child: Stack(children: placeholderDigits.toList()), + ); } } @@ -46,14 +48,15 @@ class AnimatedDigit extends StatefulWidget { State createState() => _AnimatedDigitState(); } -class _AnimatedDigitState extends State with SingleTickerProviderStateMixin { +class _AnimatedDigitState extends State + with SingleTickerProviderStateMixin { static const Duration defaultDuration = Duration(milliseconds: 300); late final AnimationController controller; late int incomingValue; late int outgoingValue; - List pendingValues = - []; // widget.value updates that occurred while the animation is underway + // widget.value updates that occurred while the animation is underway. + List pendingValues = []; Duration duration = defaultDuration; @override @@ -109,7 +112,8 @@ class _AnimatedDigitState extends State with SingleTickerProvider // will show the pending values. pendingValues.add(widget.value); final double percentRemaining = 1 - controller.value; - duration = defaultDuration * (1 / (percentRemaining + pendingValues.length)); + duration = + defaultDuration * (1 / (percentRemaining + pendingValues.length)); controller.animateTo(1.0, duration: duration * percentRemaining); } else { animateValueUpdate(incomingValue, widget.value); @@ -134,7 +138,11 @@ class _AnimatedDigitState extends State with SingleTickerProvider end: const Offset(0, -1), // Out of view above the top. ), ), - child: Text(key: ValueKey(outgoingValue), '$outgoingValue', style: textStyle), + child: Text( + key: ValueKey(outgoingValue), + '$outgoingValue', + style: textStyle, + ), ), SlideTransition( position: controller.drive( @@ -143,7 +151,11 @@ class _AnimatedDigitState extends State with SingleTickerProvider end: Offset.zero, ), ), - child: Text(key: ValueKey(incomingValue), '$incomingValue', style: textStyle), + child: Text( + key: ValueKey(incomingValue), + '$incomingValue', + style: textStyle, + ), ), ], ), diff --git a/examples/api/lib/animation/curves/curve2_d.0.dart b/examples/api/lib/animation/curves/curve2_d.0.dart index 803bf3016b4..4a66b5103c5 100644 --- a/examples/api/lib/animation/curves/curve2_d.0.dart +++ b/examples/api/lib/animation/curves/curve2_d.0.dart @@ -54,7 +54,8 @@ class FollowCurve2D extends StatefulWidget { State createState() => _FollowCurve2DState(); } -class _FollowCurve2DState extends State with TickerProviderStateMixin { +class _FollowCurve2DState extends State + with TickerProviderStateMixin { // The animation controller for this animation. late AnimationController controller; // The animation that will be used to apply the widget's animation curve. @@ -81,8 +82,12 @@ class _FollowCurve2DState extends State with TickerProviderStateM @override Widget build(BuildContext context) { // Scale the path values to match the -1.0 to 1.0 domain of the Alignment widget. - final Offset position = widget.path.transform(animation.value) * 2.0 - const Offset(1.0, 1.0); - return Align(alignment: Alignment(position.dx, position.dy), child: widget.child); + final Offset position = + widget.path.transform(animation.value) * 2.0 - const Offset(1.0, 1.0); + return Align( + alignment: Alignment(position.dx, position.dy), + child: widget.child, + ); } } diff --git a/examples/api/lib/cupertino/activity_indicator/cupertino_activity_indicator.0.dart b/examples/api/lib/cupertino/activity_indicator/cupertino_activity_indicator.0.dart index 6f014f55925..bb95904472d 100644 --- a/examples/api/lib/cupertino/activity_indicator/cupertino_activity_indicator.0.dart +++ b/examples/api/lib/cupertino/activity_indicator/cupertino_activity_indicator.0.dart @@ -26,7 +26,9 @@ class CupertinoIndicatorExample extends StatelessWidget { @override Widget build(BuildContext context) { return const CupertinoPageScaffold( - navigationBar: CupertinoNavigationBar(middle: Text('CupertinoActivityIndicator Sample')), + navigationBar: CupertinoNavigationBar( + middle: Text('CupertinoActivityIndicator Sample'), + ), child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, @@ -44,7 +46,10 @@ class CupertinoIndicatorExample extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ // Cupertino activity indicator with custom radius and color. - CupertinoActivityIndicator(radius: 20.0, color: CupertinoColors.activeBlue), + CupertinoActivityIndicator( + radius: 20.0, + color: CupertinoColors.activeBlue, + ), SizedBox(height: 10), Text( 'radius: 20.0\ncolor: CupertinoColors.activeBlue', @@ -59,7 +64,10 @@ class CupertinoIndicatorExample extends StatelessWidget { // animation. CupertinoActivityIndicator(radius: 20.0, animating: false), SizedBox(height: 10), - Text('radius: 20.0\nanimating: false', textAlign: TextAlign.center), + Text( + 'radius: 20.0\nanimating: false', + textAlign: TextAlign.center, + ), ], ), ], diff --git a/examples/api/lib/cupertino/activity_indicator/cupertino_linear_activity_indicator.0.dart b/examples/api/lib/cupertino/activity_indicator/cupertino_linear_activity_indicator.0.dart index ef8a47e6923..57e50d4a639 100644 --- a/examples/api/lib/cupertino/activity_indicator/cupertino_linear_activity_indicator.0.dart +++ b/examples/api/lib/cupertino/activity_indicator/cupertino_linear_activity_indicator.0.dart @@ -61,7 +61,10 @@ class CupertinoIndicatorExample extends StatelessWidget { Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - CupertinoLinearActivityIndicator(progress: 0.6, color: CupertinoColors.activeGreen), + CupertinoLinearActivityIndicator( + progress: 0.6, + color: CupertinoColors.activeGreen, + ), SizedBox(height: 10), Text('Color: green', textAlign: TextAlign.center), ], diff --git a/examples/api/lib/cupertino/bottom_tab_bar/cupertino_tab_bar.0.dart b/examples/api/lib/cupertino/bottom_tab_bar/cupertino_tab_bar.0.dart index b30a99ce56b..5c5be482e34 100644 --- a/examples/api/lib/cupertino/bottom_tab_bar/cupertino_tab_bar.0.dart +++ b/examples/api/lib/cupertino/bottom_tab_bar/cupertino_tab_bar.0.dart @@ -28,13 +28,22 @@ class CupertinoTabBarExample extends StatelessWidget { return CupertinoTabScaffold( tabBar: CupertinoTabBar( items: const [ - BottomNavigationBarItem(icon: Icon(CupertinoIcons.star_fill), label: 'Favorites'), - BottomNavigationBarItem(icon: Icon(CupertinoIcons.clock_solid), label: 'Recents'), + BottomNavigationBarItem( + icon: Icon(CupertinoIcons.star_fill), + label: 'Favorites', + ), + BottomNavigationBarItem( + icon: Icon(CupertinoIcons.clock_solid), + label: 'Recents', + ), BottomNavigationBarItem( icon: Icon(CupertinoIcons.person_alt_circle_fill), label: 'Contacts', ), - BottomNavigationBarItem(icon: Icon(CupertinoIcons.circle_grid_3x3_fill), label: 'Keypad'), + BottomNavigationBarItem( + icon: Icon(CupertinoIcons.circle_grid_3x3_fill), + label: 'Keypad', + ), ], ), tabBuilder: (BuildContext context, int index) { diff --git a/examples/api/lib/cupertino/button/cupertino_button.0.dart b/examples/api/lib/cupertino/button/cupertino_button.0.dart index 3039922b461..1b10cc528a6 100644 --- a/examples/api/lib/cupertino/button/cupertino_button.0.dart +++ b/examples/api/lib/cupertino/button/cupertino_button.0.dart @@ -26,18 +26,26 @@ class CupertinoButtonExample extends StatelessWidget { @override Widget build(BuildContext context) { return CupertinoPageScaffold( - navigationBar: const CupertinoNavigationBar(middle: Text('CupertinoButton Sample')), + navigationBar: const CupertinoNavigationBar( + middle: Text('CupertinoButton Sample'), + ), child: Center( child: Column( mainAxisSize: MainAxisSize.min, children: [ const CupertinoButton(onPressed: null, child: Text('Disabled')), const SizedBox(height: 30), - const CupertinoButton.filled(onPressed: null, child: Text('Disabled')), + const CupertinoButton.filled( + onPressed: null, + child: Text('Disabled'), + ), const SizedBox(height: 30), CupertinoButton(onPressed: () {}, child: const Text('Enabled')), const SizedBox(height: 30), - CupertinoButton.filled(onPressed: () {}, child: const Text('Enabled')), + CupertinoButton.filled( + onPressed: () {}, + child: const Text('Enabled'), + ), ], ), ), diff --git a/examples/api/lib/cupertino/checkbox/cupertino_checkbox.0.dart b/examples/api/lib/cupertino/checkbox/cupertino_checkbox.0.dart index ad14ce070e6..e671d8e0321 100644 --- a/examples/api/lib/cupertino/checkbox/cupertino_checkbox.0.dart +++ b/examples/api/lib/cupertino/checkbox/cupertino_checkbox.0.dart @@ -16,7 +16,9 @@ class CupertinoCheckboxApp extends StatelessWidget { return const CupertinoApp( theme: CupertinoThemeData(brightness: Brightness.light), home: CupertinoPageScaffold( - navigationBar: CupertinoNavigationBar(middle: Text('CupertinoCheckbox Example')), + navigationBar: CupertinoNavigationBar( + middle: Text('CupertinoCheckbox Example'), + ), child: SafeArea(child: CupertinoCheckboxExample()), ), ); @@ -27,7 +29,8 @@ class CupertinoCheckboxExample extends StatefulWidget { const CupertinoCheckboxExample({super.key}); @override - State createState() => _CupertinoCheckboxExampleState(); + State createState() => + _CupertinoCheckboxExampleState(); } class _CupertinoCheckboxExampleState extends State { diff --git a/examples/api/lib/cupertino/context_menu/cupertino_context_menu.0.dart b/examples/api/lib/cupertino/context_menu/cupertino_context_menu.0.dart index 6da5e83f466..31fb3558623 100644 --- a/examples/api/lib/cupertino/context_menu/cupertino_context_menu.0.dart +++ b/examples/api/lib/cupertino/context_menu/cupertino_context_menu.0.dart @@ -26,7 +26,9 @@ class ContextMenuExample extends StatelessWidget { @override Widget build(BuildContext context) { return CupertinoPageScaffold( - navigationBar: const CupertinoNavigationBar(middle: Text('CupertinoContextMenu Sample')), + navigationBar: const CupertinoNavigationBar( + middle: Text('CupertinoContextMenu Sample'), + ), child: Center( child: SizedBox( width: 100, diff --git a/examples/api/lib/cupertino/context_menu/cupertino_context_menu.1.dart b/examples/api/lib/cupertino/context_menu/cupertino_context_menu.1.dart index e842969613e..e13f831aefe 100644 --- a/examples/api/lib/cupertino/context_menu/cupertino_context_menu.1.dart +++ b/examples/api/lib/cupertino/context_menu/cupertino_context_menu.1.dart @@ -37,7 +37,9 @@ class ContextMenuExample extends StatelessWidget { const ContextMenuExample({super.key}); // Or just do this inline in the builder below? - static Animation _boxDecorationAnimation(Animation animation) { + static Animation _boxDecorationAnimation( + Animation animation, + ) { return _tween.animate( CurvedAnimation( parent: animation, @@ -49,7 +51,9 @@ class ContextMenuExample extends StatelessWidget { @override Widget build(BuildContext context) { return CupertinoPageScaffold( - navigationBar: const CupertinoNavigationBar(middle: Text('CupertinoContextMenu Sample')), + navigationBar: const CupertinoNavigationBar( + middle: Text('CupertinoContextMenu Sample'), + ), child: Center( child: SizedBox( width: 100, @@ -88,12 +92,12 @@ class ContextMenuExample extends StatelessWidget { ), ], builder: (BuildContext context, Animation animation) { - final Animation boxDecorationAnimation = _boxDecorationAnimation( - animation, - ); + final Animation boxDecorationAnimation = + _boxDecorationAnimation(animation); return Container( - decoration: animation.value < CupertinoContextMenu.animationOpensAt + decoration: + animation.value < CupertinoContextMenu.animationOpensAt ? boxDecorationAnimation.value : null, child: Container( diff --git a/examples/api/lib/cupertino/date_picker/cupertino_date_picker.0.dart b/examples/api/lib/cupertino/date_picker/cupertino_date_picker.0.dart index 09bc3c1fea3..a34d50502a9 100644 --- a/examples/api/lib/cupertino/date_picker/cupertino_date_picker.0.dart +++ b/examples/api/lib/cupertino/date_picker/cupertino_date_picker.0.dart @@ -42,7 +42,9 @@ class _DatePickerExampleState extends State { padding: const EdgeInsets.only(top: 6.0), // The Bottom margin is provided to align the popup above the system // navigation bar. - margin: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), + margin: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom, + ), // Provide a background color for the popup. color: CupertinoColors.systemBackground.resolveFrom(context), // Use a SafeArea widget to avoid system overlaps. @@ -54,9 +56,14 @@ class _DatePickerExampleState extends State { @override Widget build(BuildContext context) { return CupertinoPageScaffold( - navigationBar: const CupertinoNavigationBar(middle: Text('CupertinoDatePicker Sample')), + navigationBar: const CupertinoNavigationBar( + middle: Text('CupertinoDatePicker Sample'), + ), child: DefaultTextStyle( - style: TextStyle(color: CupertinoColors.label.resolveFrom(context), fontSize: 22.0), + style: TextStyle( + color: CupertinoColors.label.resolveFrom(context), + fontSize: 22.0, + ), child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -165,7 +172,10 @@ class _DatePickerItem extends StatelessWidget { ), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 16.0), - child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: children), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: children, + ), ), ); } diff --git a/examples/api/lib/cupertino/date_picker/cupertino_timer_picker.0.dart b/examples/api/lib/cupertino/date_picker/cupertino_timer_picker.0.dart index 5c9fccbc896..0b10196bd57 100644 --- a/examples/api/lib/cupertino/date_picker/cupertino_timer_picker.0.dart +++ b/examples/api/lib/cupertino/date_picker/cupertino_timer_picker.0.dart @@ -40,7 +40,9 @@ class _TimerPickerExampleState extends State { padding: const EdgeInsets.only(top: 6.0), // The bottom margin is provided to align the popup above the system // navigation bar. - margin: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), + margin: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom, + ), // Provide a background color for the popup. color: CupertinoColors.systemBackground.resolveFrom(context), // Use a SafeArea widget to avoid system overlaps. @@ -52,9 +54,14 @@ class _TimerPickerExampleState extends State { @override Widget build(BuildContext context) { return CupertinoPageScaffold( - navigationBar: const CupertinoNavigationBar(middle: Text('CupertinoTimerPicker Sample')), + navigationBar: const CupertinoNavigationBar( + middle: Text('CupertinoTimerPicker Sample'), + ), child: DefaultTextStyle( - style: TextStyle(color: CupertinoColors.label.resolveFrom(context), fontSize: 22.0), + style: TextStyle( + color: CupertinoColors.label.resolveFrom(context), + fontSize: 22.0, + ), child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -78,7 +85,10 @@ class _TimerPickerExampleState extends State { // In this example, the timer's value is formatted manually. // You can use the intl package to format the value based on // the user's locale settings. - child: Text('$duration', style: const TextStyle(fontSize: 22.0)), + child: Text( + '$duration', + style: const TextStyle(fontSize: 22.0), + ), ), ], ), @@ -107,7 +117,10 @@ class _TimerPickerItem extends StatelessWidget { ), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 16.0), - child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: children), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: children, + ), ), ); } diff --git a/examples/api/lib/cupertino/dialog/cupertino_action_sheet.0.dart b/examples/api/lib/cupertino/dialog/cupertino_action_sheet.0.dart index 1f44142dc55..f215bd283b6 100644 --- a/examples/api/lib/cupertino/dialog/cupertino_action_sheet.0.dart +++ b/examples/api/lib/cupertino/dialog/cupertino_action_sheet.0.dart @@ -64,7 +64,9 @@ class ActionSheetExample extends StatelessWidget { @override Widget build(BuildContext context) { return CupertinoPageScaffold( - navigationBar: const CupertinoNavigationBar(middle: Text('CupertinoActionSheet Sample')), + navigationBar: const CupertinoNavigationBar( + middle: Text('CupertinoActionSheet Sample'), + ), child: Center( child: CupertinoButton( onPressed: () => _showActionSheet(context), diff --git a/examples/api/lib/cupertino/dialog/cupertino_alert_dialog.0.dart b/examples/api/lib/cupertino/dialog/cupertino_alert_dialog.0.dart index 2693206d2c3..eea116cda89 100644 --- a/examples/api/lib/cupertino/dialog/cupertino_alert_dialog.0.dart +++ b/examples/api/lib/cupertino/dialog/cupertino_alert_dialog.0.dart @@ -57,7 +57,9 @@ class AlertDialogExample extends StatelessWidget { @override Widget build(BuildContext context) { return CupertinoPageScaffold( - navigationBar: const CupertinoNavigationBar(middle: Text('CupertinoAlertDialog Sample')), + navigationBar: const CupertinoNavigationBar( + middle: Text('CupertinoAlertDialog Sample'), + ), child: Center( child: CupertinoButton( onPressed: () => _showAlertDialog(context), diff --git a/examples/api/lib/cupertino/dialog/cupertino_popup_surface.0.dart b/examples/api/lib/cupertino/dialog/cupertino_popup_surface.0.dart index 61931603e53..a182ab9ca35 100644 --- a/examples/api/lib/cupertino/dialog/cupertino_popup_surface.0.dart +++ b/examples/api/lib/cupertino/dialog/cupertino_popup_surface.0.dart @@ -42,7 +42,8 @@ class _PopupSurfaceExampleState extends State { const SizedBox(width: 16.0), CupertinoSwitch( value: _shouldPaintSurface, - onChanged: (bool value) => setState(() => _shouldPaintSurface = value), + onChanged: (bool value) => + setState(() => _shouldPaintSurface = value), ), ], ), @@ -73,7 +74,9 @@ class _PopupSurfaceExampleState extends State { decoration: _shouldPaintSurface ? null : BoxDecoration( - color: CupertinoTheme.of(context).scaffoldBackgroundColor, + color: CupertinoTheme.of( + context, + ).scaffoldBackgroundColor, borderRadius: BorderRadius.circular(8.0), ), child: const Text('This is a popup surface.'), @@ -87,7 +90,10 @@ class _PopupSurfaceExampleState extends State { ? null : CupertinoTheme.of(context).scaffoldBackgroundColor, onPressed: () => Navigator.pop(context), - child: const Text('Close', style: TextStyle(color: CupertinoColors.systemBlue)), + child: const Text( + 'Close', + style: TextStyle(color: CupertinoColors.systemBlue), + ), ), ), ], diff --git a/examples/api/lib/cupertino/expansion_tile/cupertino_expansion_tile.0.dart b/examples/api/lib/cupertino/expansion_tile/cupertino_expansion_tile.0.dart index 663f1529d1e..e73f6a8e97f 100644 --- a/examples/api/lib/cupertino/expansion_tile/cupertino_expansion_tile.0.dart +++ b/examples/api/lib/cupertino/expansion_tile/cupertino_expansion_tile.0.dart @@ -16,7 +16,9 @@ class CupertinoExpansionTileApp extends StatelessWidget { Widget build(BuildContext context) { return const CupertinoApp( home: CupertinoPageScaffold( - navigationBar: CupertinoNavigationBar(middle: Text('Cupertino Expansion Tile')), + navigationBar: CupertinoNavigationBar( + middle: Text('Cupertino Expansion Tile'), + ), backgroundColor: CupertinoColors.systemGroupedBackground, child: SafeArea(child: ExpansionTileExamples()), ), @@ -46,7 +48,11 @@ class ExpansionTileExamples extends StatelessWidget { } class TransitionTileSection extends StatefulWidget { - const TransitionTileSection({super.key, required this.title, required this.transitionMode}); + const TransitionTileSection({ + super.key, + required this.title, + required this.transitionMode, + }); final String title; final ExpansionTileTransitionMode transitionMode; @@ -90,17 +96,26 @@ class _TransitionTileSectionState extends State { CupertinoListTile( leading: Icon(CupertinoIcons.person), backgroundColor: CupertinoColors.white, - title: Text('Profile', style: TextStyle(color: CupertinoColors.black)), + title: Text( + 'Profile', + style: TextStyle(color: CupertinoColors.black), + ), ), CupertinoListTile( leading: Icon(CupertinoIcons.mail), backgroundColor: CupertinoColors.white, - title: Text('Messages', style: TextStyle(color: CupertinoColors.black)), + title: Text( + 'Messages', + style: TextStyle(color: CupertinoColors.black), + ), ), CupertinoListTile( leading: Icon(CupertinoIcons.settings), backgroundColor: CupertinoColors.white, - title: Text('Settings', style: TextStyle(color: CupertinoColors.black)), + title: Text( + 'Settings', + style: TextStyle(color: CupertinoColors.black), + ), ), ], ), diff --git a/examples/api/lib/cupertino/form_row/cupertino_form_row.0.dart b/examples/api/lib/cupertino/form_row/cupertino_form_row.0.dart index 6f6370857ee..14f454acb05 100644 --- a/examples/api/lib/cupertino/form_row/cupertino_form_row.0.dart +++ b/examples/api/lib/cupertino/form_row/cupertino_form_row.0.dart @@ -24,7 +24,8 @@ class CupertinoFormRowExample extends StatefulWidget { const CupertinoFormRowExample({super.key}); @override - State createState() => _CupertinoFormRowExampleState(); + State createState() => + _CupertinoFormRowExampleState(); } class _CupertinoFormRowExampleState extends State { @@ -33,7 +34,9 @@ class _CupertinoFormRowExampleState extends State { @override Widget build(BuildContext context) { return CupertinoPageScaffold( - navigationBar: const CupertinoNavigationBar(middle: Text('CupertinoFormSection Sample')), + navigationBar: const CupertinoNavigationBar( + middle: Text('CupertinoFormSection Sample'), + ), // Add safe area widget to place the CupertinoFormSection below the navigation bar. child: SafeArea( child: CupertinoFormSection( @@ -85,7 +88,11 @@ class _CupertinoFormRowExampleState extends State { ), child: Row( mainAxisAlignment: MainAxisAlignment.end, - children: [Text('On'), SizedBox(width: 5), Icon(CupertinoIcons.forward)], + children: [ + Text('On'), + SizedBox(width: 5), + Icon(CupertinoIcons.forward), + ], ), ), const CupertinoFormRow( @@ -104,7 +111,12 @@ class _CupertinoFormRowExampleState extends State { } class PrefixWidget extends StatelessWidget { - const PrefixWidget({super.key, required this.icon, required this.title, required this.color}); + const PrefixWidget({ + super.key, + required this.icon, + required this.title, + required this.color, + }); final IconData icon; final String title; @@ -116,7 +128,10 @@ class PrefixWidget extends StatelessWidget { children: [ Container( padding: const EdgeInsets.all(4.0), - decoration: BoxDecoration(color: color, borderRadius: BorderRadius.circular(4.0)), + decoration: BoxDecoration( + color: color, + borderRadius: BorderRadius.circular(4.0), + ), child: Icon(icon, color: CupertinoColors.white), ), const SizedBox(width: 15), diff --git a/examples/api/lib/cupertino/list_tile/cupertino_list_tile.0.dart b/examples/api/lib/cupertino/list_tile/cupertino_list_tile.0.dart index fe23e6ded0c..a13d1d034cb 100644 --- a/examples/api/lib/cupertino/list_tile/cupertino_list_tile.0.dart +++ b/examples/api/lib/cupertino/list_tile/cupertino_list_tile.0.dart @@ -24,11 +24,16 @@ class CupertinoListTileExample extends StatelessWidget { @override Widget build(BuildContext context) { return CupertinoPageScaffold( - navigationBar: const CupertinoNavigationBar(middle: Text('CupertinoListTile Sample')), + navigationBar: const CupertinoNavigationBar( + middle: Text('CupertinoListTile Sample'), + ), child: ListView( children: const [ CupertinoListTile(title: Text('One-line CupertinoListTile')), - CupertinoListTile(leading: FlutterLogo(), title: Text('One-line with leading widget')), + CupertinoListTile( + leading: FlutterLogo(), + title: Text('One-line with leading widget'), + ), CupertinoListTile( title: Text('One-line with trailing widget'), trailing: Icon(Icons.more_vert), diff --git a/examples/api/lib/cupertino/nav_bar/cupertino_navigation_bar.1.dart b/examples/api/lib/cupertino/nav_bar/cupertino_navigation_bar.1.dart index 2eb362ce091..a4a91460d37 100644 --- a/examples/api/lib/cupertino/nav_bar/cupertino_navigation_bar.1.dart +++ b/examples/api/lib/cupertino/nav_bar/cupertino_navigation_bar.1.dart @@ -49,7 +49,8 @@ class _NavBarExampleState extends State { } } -class _NavigationBarSearchField extends StatelessWidget implements PreferredSizeWidget { +class _NavigationBarSearchField extends StatelessWidget + implements PreferredSizeWidget { const _NavigationBarSearchField(); static const double padding = 8.0; @@ -59,10 +60,14 @@ class _NavigationBarSearchField extends StatelessWidget implements PreferredSize Widget build(BuildContext context) { return const Padding( padding: EdgeInsets.symmetric(horizontal: padding, vertical: padding), - child: SizedBox(height: searchFieldHeight, child: CupertinoSearchTextField()), + child: SizedBox( + height: searchFieldHeight, + child: CupertinoSearchTextField(), + ), ); } @override - Size get preferredSize => const Size.fromHeight(searchFieldHeight + padding * 2); + Size get preferredSize => + const Size.fromHeight(searchFieldHeight + padding * 2); } diff --git a/examples/api/lib/cupertino/nav_bar/cupertino_navigation_bar.2.dart b/examples/api/lib/cupertino/nav_bar/cupertino_navigation_bar.2.dart index 5bdf9d5f408..34bdbf6e9b9 100644 --- a/examples/api/lib/cupertino/nav_bar/cupertino_navigation_bar.2.dart +++ b/examples/api/lib/cupertino/nav_bar/cupertino_navigation_bar.2.dart @@ -33,14 +33,21 @@ class _NavBarExampleState extends State { @override Widget build(BuildContext context) { return CupertinoPageScaffold( - navigationBar: const CupertinoNavigationBar.large(largeTitle: Text('Large Sample')), + navigationBar: const CupertinoNavigationBar.large( + largeTitle: Text('Large Sample'), + ), child: SafeArea( child: Center( child: Column( children: [ const Spacer(), const Text('You have pushed the button this many times:'), - Text('$_count', style: CupertinoTheme.of(context).textTheme.navLargeTitleTextStyle), + Text( + '$_count', + style: CupertinoTheme.of( + context, + ).textTheme.navLargeTitleTextStyle, + ), const Spacer(), Padding( padding: const EdgeInsets.all(15.0), diff --git a/examples/api/lib/cupertino/nav_bar/cupertino_sliver_nav_bar.0.dart b/examples/api/lib/cupertino/nav_bar/cupertino_sliver_nav_bar.0.dart index b8f5779a665..060cf2e0ba6 100644 --- a/examples/api/lib/cupertino/nav_bar/cupertino_sliver_nav_bar.0.dart +++ b/examples/api/lib/cupertino/nav_bar/cupertino_sliver_nav_bar.0.dart @@ -98,7 +98,10 @@ class NextPage extends StatelessWidget { Text('Drag me up', textAlign: TextAlign.center), // When the "leading" parameter is omitted on a route that has a previous page, // the back button is automatically added to the leading position. - Text('Tap on the leading button to navigate back', textAlign: TextAlign.center), + Text( + 'Tap on the leading button to navigate back', + textAlign: TextAlign.center, + ), ], ), ), diff --git a/examples/api/lib/cupertino/nav_bar/cupertino_sliver_nav_bar.1.dart b/examples/api/lib/cupertino/nav_bar/cupertino_sliver_nav_bar.1.dart index 66eb3fd147e..35fec8ccd5b 100644 --- a/examples/api/lib/cupertino/nav_bar/cupertino_sliver_nav_bar.1.dart +++ b/examples/api/lib/cupertino/nav_bar/cupertino_sliver_nav_bar.1.dart @@ -59,7 +59,9 @@ class SliverNavBarExample extends StatelessWidget { context, CupertinoPageRoute( builder: (BuildContext context) { - return const NextPage(bottomMode: NavigationBarBottomMode.always); + return const NextPage( + bottomMode: NavigationBarBottomMode.always, + ); }, ), ); @@ -77,7 +79,10 @@ class SliverNavBarExample extends StatelessWidget { } class NextPage extends StatefulWidget { - const NextPage({super.key, this.bottomMode = NavigationBarBottomMode.automatic}); + const NextPage({ + super.key, + this.bottomMode = NavigationBarBottomMode.automatic, + }); final NavigationBarBottomMode bottomMode; @@ -132,7 +137,9 @@ class _NextPageState extends State { child: searchIsActive ? ColoredBox( color: CupertinoColors.extraLightBackgroundGray, - child: Center(child: Text(text, textAlign: TextAlign.center)), + child: Center( + child: Text(text, textAlign: TextAlign.center), + ), ) : const Padding( padding: EdgeInsets.symmetric(horizontal: 16.0), diff --git a/examples/api/lib/cupertino/nav_bar/cupertino_sliver_nav_bar.2.dart b/examples/api/lib/cupertino/nav_bar/cupertino_sliver_nav_bar.2.dart index 14c0da9f3b7..2015fbd3f03 100644 --- a/examples/api/lib/cupertino/nav_bar/cupertino_sliver_nav_bar.2.dart +++ b/examples/api/lib/cupertino/nav_bar/cupertino_sliver_nav_bar.2.dart @@ -38,7 +38,10 @@ class SliverNavBarExample extends StatelessWidget { largeTitle: Text('Contacts'), bottom: PreferredSize( preferredSize: Size.fromHeight(100), - child: ColoredBox(color: Color(0xff191970), child: Text('Bottom Widget')), + child: ColoredBox( + color: Color(0xff191970), + child: Text('Bottom Widget'), + ), ), trailing: Icon(CupertinoIcons.add_circled), ), @@ -102,7 +105,10 @@ class NextPage extends StatelessWidget { Text('Drag me up', textAlign: TextAlign.center), // When the "leading" parameter is omitted on a route that has a previous page, // the back button is automatically added to the leading position. - Text('Tap on the leading button to navigate back', textAlign: TextAlign.center), + Text( + 'Tap on the leading button to navigate back', + textAlign: TextAlign.center, + ), ], ), ), diff --git a/examples/api/lib/cupertino/page_scaffold/cupertino_page_scaffold.0.dart b/examples/api/lib/cupertino/page_scaffold/cupertino_page_scaffold.0.dart index ee1ca518015..0b94224f138 100644 --- a/examples/api/lib/cupertino/page_scaffold/cupertino_page_scaffold.0.dart +++ b/examples/api/lib/cupertino/page_scaffold/cupertino_page_scaffold.0.dart @@ -35,7 +35,9 @@ class _PageScaffoldExampleState extends State { return CupertinoPageScaffold( // Uncomment to change the background color // backgroundColor: CupertinoColors.systemPink, - navigationBar: const CupertinoNavigationBar(middle: Text('CupertinoPageScaffold Sample')), + navigationBar: const CupertinoNavigationBar( + middle: Text('CupertinoPageScaffold Sample'), + ), child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, diff --git a/examples/api/lib/cupertino/picker/cupertino_picker.0.dart b/examples/api/lib/cupertino/picker/cupertino_picker.0.dart index f64037d6680..ef02bfedcb0 100644 --- a/examples/api/lib/cupertino/picker/cupertino_picker.0.dart +++ b/examples/api/lib/cupertino/picker/cupertino_picker.0.dart @@ -48,7 +48,9 @@ class _CupertinoPickerExampleState extends State { height: 216, padding: const EdgeInsets.only(top: 6.0), // The Bottom margin is provided to align the popup above the system navigation bar. - margin: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), + margin: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom, + ), // Provide a background color for the popup. color: CupertinoColors.systemBackground.resolveFrom(context), // Use a SafeArea widget to avoid system overlaps. @@ -60,9 +62,14 @@ class _CupertinoPickerExampleState extends State { @override Widget build(BuildContext context) { return CupertinoPageScaffold( - navigationBar: const CupertinoNavigationBar(middle: Text('CupertinoPicker Sample')), + navigationBar: const CupertinoNavigationBar( + middle: Text('CupertinoPicker Sample'), + ), child: DefaultTextStyle( - style: TextStyle(color: CupertinoColors.label.resolveFrom(context), fontSize: 22.0), + style: TextStyle( + color: CupertinoColors.label.resolveFrom(context), + fontSize: 22.0, + ), child: Center( child: Row( mainAxisAlignment: MainAxisAlignment.center, @@ -78,20 +85,26 @@ class _CupertinoPickerExampleState extends State { useMagnifier: true, itemExtent: _kItemExtent, // This sets the initial item. - scrollController: FixedExtentScrollController(initialItem: _selectedFruit), + scrollController: FixedExtentScrollController( + initialItem: _selectedFruit, + ), // This is called when selected item is changed. onSelectedItemChanged: (int selectedItem) { setState(() { _selectedFruit = selectedItem; }); }, - children: List.generate(_fruitNames.length, (int index) { - return Center(child: Text(_fruitNames[index])); - }), + children: [ + for (final String fruitName in _fruitNames) + Center(child: Text(fruitName)), + ], ), ), // This displays the selected fruit name. - child: Text(_fruitNames[_selectedFruit], style: const TextStyle(fontSize: 22.0)), + child: Text( + _fruitNames[_selectedFruit], + style: const TextStyle(fontSize: 22.0), + ), ), ], ), diff --git a/examples/api/lib/cupertino/radio/cupertino_radio.0.dart b/examples/api/lib/cupertino/radio/cupertino_radio.0.dart index a01b199d95d..62671d86e92 100644 --- a/examples/api/lib/cupertino/radio/cupertino_radio.0.dart +++ b/examples/api/lib/cupertino/radio/cupertino_radio.0.dart @@ -16,7 +16,9 @@ class CupertinoRadioApp extends StatelessWidget { return const CupertinoApp( theme: CupertinoThemeData(brightness: Brightness.light), home: CupertinoPageScaffold( - navigationBar: CupertinoNavigationBar(middle: Text('CupertinoRadio Example')), + navigationBar: CupertinoNavigationBar( + middle: Text('CupertinoRadio Example'), + ), child: SafeArea(child: CupertinoRadioExample()), ), ); @@ -48,11 +50,15 @@ class _CupertinoRadioExampleState extends State { children: const [ CupertinoListTile( title: Text('Lafayette'), - leading: CupertinoRadio(value: SingingCharacter.lafayette), + leading: CupertinoRadio( + value: SingingCharacter.lafayette, + ), ), CupertinoListTile( title: Text('Thomas Jefferson'), - leading: CupertinoRadio(value: SingingCharacter.jefferson), + leading: CupertinoRadio( + value: SingingCharacter.jefferson, + ), ), ], ), diff --git a/examples/api/lib/cupertino/radio/cupertino_radio.toggleable.0.dart b/examples/api/lib/cupertino/radio/cupertino_radio.toggleable.0.dart index 3bcd3d39199..af833dbc42d 100644 --- a/examples/api/lib/cupertino/radio/cupertino_radio.toggleable.0.dart +++ b/examples/api/lib/cupertino/radio/cupertino_radio.toggleable.0.dart @@ -15,7 +15,9 @@ class CupertinoRadioApp extends StatelessWidget { Widget build(BuildContext context) { return const CupertinoApp( home: CupertinoPageScaffold( - navigationBar: CupertinoNavigationBar(middle: Text('CupertinoRadio Toggleable Example')), + navigationBar: CupertinoNavigationBar( + middle: Text('CupertinoRadio Toggleable Example'), + ), child: SafeArea(child: CupertinoRadioExample()), ), ); diff --git a/examples/api/lib/cupertino/refresh/cupertino_sliver_refresh_control.0.dart b/examples/api/lib/cupertino/refresh/cupertino_sliver_refresh_control.0.dart index 7d053a3ca08..1294bafd837 100644 --- a/examples/api/lib/cupertino/refresh/cupertino_sliver_refresh_control.0.dart +++ b/examples/api/lib/cupertino/refresh/cupertino_sliver_refresh_control.0.dart @@ -46,14 +46,19 @@ class _RefreshControlExampleState extends State { middle: Text('CupertinoSliverRefreshControl Sample'), ), child: CustomScrollView( - physics: const BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics()), + physics: const BouncingScrollPhysics( + parent: AlwaysScrollableScrollPhysics(), + ), slivers: [ const CupertinoSliverNavigationBar(largeTitle: Text('Scroll down')), CupertinoSliverRefreshControl( onRefresh: () async { await Future.delayed(const Duration(milliseconds: 1000)); setState(() { - items.insert(0, Container(color: colors[items.length % 3], height: 100.0)); + items.insert( + 0, + Container(color: colors[items.length % 3], height: 100.0), + ); }); }, ), diff --git a/examples/api/lib/cupertino/route/show_cupertino_dialog.0.dart b/examples/api/lib/cupertino/route/show_cupertino_dialog.0.dart index 48d39a0e9d9..555df06d0cf 100644 --- a/examples/api/lib/cupertino/route/show_cupertino_dialog.0.dart +++ b/examples/api/lib/cupertino/route/show_cupertino_dialog.0.dart @@ -40,7 +40,10 @@ class CupertinoDialogExample extends StatelessWidget { } @pragma('vm:entry-point') - static Route _dialogBuilder(BuildContext context, Object? arguments) { + static Route _dialogBuilder( + BuildContext context, + Object? arguments, + ) { return CupertinoDialogRoute( context: context, builder: (BuildContext context) { diff --git a/examples/api/lib/cupertino/scrollbar/cupertino_scrollbar.0.dart b/examples/api/lib/cupertino/scrollbar/cupertino_scrollbar.0.dart index 758040c591e..8f5855e0871 100644 --- a/examples/api/lib/cupertino/scrollbar/cupertino_scrollbar.0.dart +++ b/examples/api/lib/cupertino/scrollbar/cupertino_scrollbar.0.dart @@ -26,7 +26,9 @@ class ScrollbarExample extends StatelessWidget { @override Widget build(BuildContext context) { return CupertinoPageScaffold( - navigationBar: const CupertinoNavigationBar(middle: Text('CupertinoScrollbar Sample')), + navigationBar: const CupertinoNavigationBar( + middle: Text('CupertinoScrollbar Sample'), + ), child: CupertinoScrollbar( thickness: 6.0, thicknessWhileDragging: 10.0, @@ -36,7 +38,10 @@ class ScrollbarExample extends StatelessWidget { itemCount: 120, itemBuilder: (BuildContext context, int index) { return Center( - child: Padding(padding: const EdgeInsets.all(8.0), child: Text('Item $index')), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text('Item $index'), + ), ); }, ), diff --git a/examples/api/lib/cupertino/scrollbar/cupertino_scrollbar.1.dart b/examples/api/lib/cupertino/scrollbar/cupertino_scrollbar.1.dart index 18cb174770c..f8b1462e306 100644 --- a/examples/api/lib/cupertino/scrollbar/cupertino_scrollbar.1.dart +++ b/examples/api/lib/cupertino/scrollbar/cupertino_scrollbar.1.dart @@ -33,7 +33,9 @@ class _ScrollbarExampleState extends State { @override Widget build(BuildContext context) { return CupertinoPageScaffold( - navigationBar: const CupertinoNavigationBar(middle: Text('CupertinoScrollbar Sample')), + navigationBar: const CupertinoNavigationBar( + middle: Text('CupertinoScrollbar Sample'), + ), child: CupertinoScrollbar( thickness: 6.0, thicknessWhileDragging: 10.0, @@ -46,7 +48,10 @@ class _ScrollbarExampleState extends State { itemCount: 120, itemBuilder: (BuildContext context, int index) { return Center( - child: Padding(padding: const EdgeInsets.all(8.0), child: Text('Item $index')), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text('Item $index'), + ), ); }, ), diff --git a/examples/api/lib/cupertino/search_field/cupertino_search_field.0.dart b/examples/api/lib/cupertino/search_field/cupertino_search_field.0.dart index 199a6992d9b..01c956eacdd 100644 --- a/examples/api/lib/cupertino/search_field/cupertino_search_field.0.dart +++ b/examples/api/lib/cupertino/search_field/cupertino_search_field.0.dart @@ -45,11 +45,16 @@ class _SearchTextFieldExampleState extends State { @override Widget build(BuildContext context) { return CupertinoPageScaffold( - navigationBar: const CupertinoNavigationBar(middle: Text('CupertinoSearchTextField Sample')), + navigationBar: const CupertinoNavigationBar( + middle: Text('CupertinoSearchTextField Sample'), + ), child: Center( child: Padding( padding: const EdgeInsets.all(16.0), - child: CupertinoSearchTextField(controller: textController, placeholder: 'Search'), + child: CupertinoSearchTextField( + controller: textController, + placeholder: 'Search', + ), ), ), ); diff --git a/examples/api/lib/cupertino/search_field/cupertino_search_field.1.dart b/examples/api/lib/cupertino/search_field/cupertino_search_field.1.dart index 2a468d44949..409a7162e9a 100644 --- a/examples/api/lib/cupertino/search_field/cupertino_search_field.1.dart +++ b/examples/api/lib/cupertino/search_field/cupertino_search_field.1.dart @@ -33,7 +33,9 @@ class _SearchTextFieldExampleState extends State { @override Widget build(BuildContext context) { return CupertinoPageScaffold( - navigationBar: const CupertinoNavigationBar(middle: Text('CupertinoSearchTextField Sample')), + navigationBar: const CupertinoNavigationBar( + middle: Text('CupertinoSearchTextField Sample'), + ), child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, diff --git a/examples/api/lib/cupertino/segmented_control/cupertino_segmented_control.0.dart b/examples/api/lib/cupertino/segmented_control/cupertino_segmented_control.0.dart index 72bb2dacaee..7d13b00ff13 100644 --- a/examples/api/lib/cupertino/segmented_control/cupertino_segmented_control.0.dart +++ b/examples/api/lib/cupertino/segmented_control/cupertino_segmented_control.0.dart @@ -32,7 +32,8 @@ class SegmentedControlExample extends StatefulWidget { const SegmentedControlExample({super.key}); @override - State createState() => _SegmentedControlExampleState(); + State createState() => + _SegmentedControlExampleState(); } class _SegmentedControlExampleState extends State { @@ -88,7 +89,10 @@ class _SegmentedControlExampleState extends State { Row( mainAxisSize: MainAxisSize.min, children: [ - const Text('Disable one segment', style: TextStyle(color: CupertinoColors.white)), + const Text( + 'Disable one segment', + style: TextStyle(color: CupertinoColors.white), + ), CupertinoSwitch( value: _toggleOne, onChanged: (bool value) { @@ -109,7 +113,10 @@ class _SegmentedControlExampleState extends State { Row( mainAxisSize: MainAxisSize.min, children: [ - const Text('Toggle all segments', style: TextStyle(color: CupertinoColors.white)), + const Text( + 'Toggle all segments', + style: TextStyle(color: CupertinoColors.white), + ), CupertinoSwitch( value: _toggleAll, onChanged: (bool value) { @@ -119,7 +126,11 @@ class _SegmentedControlExampleState extends State { _toggleOne = false; _disabledChildren = {}; } else { - _disabledChildren = {Sky.midnight, Sky.viridian, Sky.cerulean}; + _disabledChildren = { + Sky.midnight, + Sky.viridian, + Sky.cerulean, + }; } }); }, diff --git a/examples/api/lib/cupertino/segmented_control/cupertino_sliding_segmented_control.0.dart b/examples/api/lib/cupertino/segmented_control/cupertino_sliding_segmented_control.0.dart index dde83c56e79..66423f1f3d7 100644 --- a/examples/api/lib/cupertino/segmented_control/cupertino_sliding_segmented_control.0.dart +++ b/examples/api/lib/cupertino/segmented_control/cupertino_sliding_segmented_control.0.dart @@ -32,7 +32,8 @@ class SegmentedControlExample extends StatefulWidget { const SegmentedControlExample({super.key}); @override - State createState() => _SegmentedControlExampleState(); + State createState() => + _SegmentedControlExampleState(); } class _SegmentedControlExampleState extends State { @@ -62,15 +63,24 @@ class _SegmentedControlExampleState extends State { children: const { Sky.midnight: Padding( padding: EdgeInsets.symmetric(horizontal: 20), - child: Text('Midnight', style: TextStyle(color: CupertinoColors.white)), + child: Text( + 'Midnight', + style: TextStyle(color: CupertinoColors.white), + ), ), Sky.viridian: Padding( padding: EdgeInsets.symmetric(horizontal: 20), - child: Text('Viridian', style: TextStyle(color: CupertinoColors.white)), + child: Text( + 'Viridian', + style: TextStyle(color: CupertinoColors.white), + ), ), Sky.cerulean: Padding( padding: EdgeInsets.symmetric(horizontal: 20), - child: Text('Cerulean', style: TextStyle(color: CupertinoColors.white)), + child: Text( + 'Cerulean', + style: TextStyle(color: CupertinoColors.white), + ), ), }, ), @@ -87,7 +97,10 @@ class _SegmentedControlExampleState extends State { Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - const Text('Momentary mode: ', style: TextStyle(color: CupertinoColors.white)), + const Text( + 'Momentary mode: ', + style: TextStyle(color: CupertinoColors.white), + ), CupertinoSwitch( value: _isMomentary, onChanged: (bool value) { diff --git a/examples/api/lib/cupertino/sheet/cupertino_sheet.1.dart b/examples/api/lib/cupertino/sheet/cupertino_sheet.1.dart index 31c50995876..5692933e7df 100644 --- a/examples/api/lib/cupertino/sheet/cupertino_sheet.1.dart +++ b/examples/api/lib/cupertino/sheet/cupertino_sheet.1.dart @@ -38,7 +38,7 @@ class HomePage extends StatelessWidget { showCupertinoSheet( context: context, useNestedNavigation: true, - pageBuilder: (BuildContext context) => const _SheetScaffold(), + builder: (BuildContext context) => const _SheetScaffold(), ); }, child: const Text('Open Bottom Sheet'), @@ -55,7 +55,9 @@ class _SheetScaffold extends StatelessWidget { @override Widget build(BuildContext context) { - return const CupertinoPageScaffold(child: _SheetBody(title: 'CupertinoSheetRoute')); + return const CupertinoPageScaffold( + child: _SheetBody(title: 'CupertinoSheetRoute'), + ); } } @@ -86,7 +88,9 @@ class _SheetBody extends StatelessWidget { CupertinoButton.filled( onPressed: () { Navigator.of(context).push( - CupertinoPageRoute(builder: (BuildContext context) => const _SheetNextPage()), + CupertinoPageRoute( + builder: (BuildContext context) => const _SheetNextPage(), + ), ); }, child: const Text('Push Nested Page'), @@ -96,7 +100,7 @@ class _SheetBody extends StatelessWidget { showCupertinoSheet( context: context, useNestedNavigation: true, - pageBuilder: (BuildContext context) => const _SheetScaffold(), + builder: (BuildContext context) => const _SheetScaffold(), ); }, child: const Text('Push Another Sheet'), diff --git a/examples/api/lib/cupertino/sheet/cupertino_sheet.2.dart b/examples/api/lib/cupertino/sheet/cupertino_sheet.2.dart index 399a00cbecc..0bbd85a91a1 100644 --- a/examples/api/lib/cupertino/sheet/cupertino_sheet.2.dart +++ b/examples/api/lib/cupertino/sheet/cupertino_sheet.2.dart @@ -31,7 +31,8 @@ class RestorableSheet extends StatefulWidget { } @pragma('vm:entry-point') -class _RestorableSheetState extends State with RestorationMixin { +class _RestorableSheetState extends State + with RestorationMixin { final RestorableInt _counter = RestorableInt(0); late RestorableRouteFuture _restorableSheetRouteFuture; @@ -41,7 +42,10 @@ class _RestorableSheetState extends State with RestorationMixin _restorableSheetRouteFuture = RestorableRouteFuture( onComplete: _changeCounter, onPresent: (NavigatorState navigator, Object? arguments) { - return navigator.restorablePush(_counterSheetBuilder, arguments: _counter.value); + return navigator.restorablePush( + _counterSheetBuilder, + arguments: _counter.value, + ); }, ); } @@ -62,7 +66,10 @@ class _RestorableSheetState extends State with RestorationMixin } @pragma('vm:entry-point') - static Route _counterSheetBuilder(BuildContext context, Object? arguments) { + static Route _counterSheetBuilder( + BuildContext context, + Object? arguments, + ) { return CupertinoSheetRoute( builder: (BuildContext context) { return Navigator( @@ -132,7 +139,8 @@ class CounterSheetScaffold extends StatefulWidget { State createState() => _CounterSheetScaffoldState(); } -class _CounterSheetScaffoldState extends State with RestorationMixin { +class _CounterSheetScaffoldState extends State + with RestorationMixin { late RestorableInt _counter; late RestorableRouteFuture _multiplicationRouteFuture; @@ -143,13 +151,19 @@ class _CounterSheetScaffoldState extends State with Restor _multiplicationRouteFuture = RestorableRouteFuture( onComplete: _changeCounter, onPresent: (NavigatorState navigator, Object? arguments) { - return navigator.restorablePush(_multiplicationRouteBuilder, arguments: _counter.value); + return navigator.restorablePush( + _multiplicationRouteBuilder, + arguments: _counter.value, + ); }, ); } @pragma('vm:entry-point') - static Route _multiplicationRouteBuilder(BuildContext context, Object? arguments) { + static Route _multiplicationRouteBuilder( + BuildContext context, + Object? arguments, + ) { return CupertinoPageRoute( settings: const RouteSettings(name: '/multiplication'), builder: (BuildContext context) { @@ -215,7 +229,10 @@ class _CounterSheetScaffoldState extends State with Restor child: const Text('Go to Multiplication Page'), ), CupertinoButton( - onPressed: () => Navigator.of(context, rootNavigator: true).pop(_counter.value), + onPressed: () => Navigator.of( + context, + rootNavigator: true, + ).pop(_counter.value), child: const Text('Pop Sheet'), ), ], @@ -234,7 +251,8 @@ class MultiplicationPage extends StatefulWidget { State createState() => _MultiplicationPageState(); } -class _MultiplicationPageState extends State with RestorationMixin { +class _MultiplicationPageState extends State + with RestorationMixin { late final RestorableInt _counter = RestorableInt(widget.counter); @override diff --git a/examples/api/lib/cupertino/slider/cupertino_slider.0.dart b/examples/api/lib/cupertino/slider/cupertino_slider.0.dart index 5cf94f3468d..727c72e87bb 100644 --- a/examples/api/lib/cupertino/slider/cupertino_slider.0.dart +++ b/examples/api/lib/cupertino/slider/cupertino_slider.0.dart @@ -34,7 +34,9 @@ class _CupertinoSliderExampleState extends State { @override Widget build(BuildContext context) { return CupertinoPageScaffold( - navigationBar: const CupertinoNavigationBar(middle: Text('CupertinoSlider Sample')), + navigationBar: const CupertinoNavigationBar( + middle: Text('CupertinoSlider Sample'), + ), child: Center( child: Column( mainAxisSize: MainAxisSize.min, @@ -72,7 +74,9 @@ class _CupertinoSliderExampleState extends State { ), Text( _sliderStatus ?? '', - style: CupertinoTheme.of(context).textTheme.textStyle.copyWith(fontSize: 12), + style: CupertinoTheme.of( + context, + ).textTheme.textStyle.copyWith(fontSize: 12), ), ], ), diff --git a/examples/api/lib/cupertino/switch/cupertino_switch.0.dart b/examples/api/lib/cupertino/switch/cupertino_switch.0.dart index a3ec8d54137..c2b18fc4d92 100644 --- a/examples/api/lib/cupertino/switch/cupertino_switch.0.dart +++ b/examples/api/lib/cupertino/switch/cupertino_switch.0.dart @@ -33,7 +33,9 @@ class _CupertinoSwitchExampleState extends State { @override Widget build(BuildContext context) { return CupertinoPageScaffold( - navigationBar: const CupertinoNavigationBar(middle: Text('CupertinoSwitch Sample')), + navigationBar: const CupertinoNavigationBar( + middle: Text('CupertinoSwitch Sample'), + ), child: Center( child: CupertinoSwitch( // This bool value toggles the switch. diff --git a/examples/api/lib/cupertino/tab_scaffold/cupertino_tab_controller.0.dart b/examples/api/lib/cupertino/tab_scaffold/cupertino_tab_controller.0.dart index 1d983ff9eb5..0c67f83f001 100644 --- a/examples/api/lib/cupertino/tab_scaffold/cupertino_tab_controller.0.dart +++ b/examples/api/lib/cupertino/tab_scaffold/cupertino_tab_controller.0.dart @@ -42,8 +42,14 @@ class _TabControllerExampleState extends State { controller: controller, tabBar: CupertinoTabBar( items: const [ - BottomNavigationBarItem(icon: Icon(CupertinoIcons.square_grid_2x2_fill), label: 'Browse'), - BottomNavigationBarItem(icon: Icon(CupertinoIcons.star_circle_fill), label: 'Starred'), + BottomNavigationBarItem( + icon: Icon(CupertinoIcons.square_grid_2x2_fill), + label: 'Browse', + ), + BottomNavigationBarItem( + icon: Icon(CupertinoIcons.star_circle_fill), + label: 'Starred', + ), ], ), tabBuilder: (BuildContext context, int index) { diff --git a/examples/api/lib/cupertino/tab_scaffold/cupertino_tab_scaffold.0.dart b/examples/api/lib/cupertino/tab_scaffold/cupertino_tab_scaffold.0.dart index 5baf1580ab3..e69049c3131 100644 --- a/examples/api/lib/cupertino/tab_scaffold/cupertino_tab_scaffold.0.dart +++ b/examples/api/lib/cupertino/tab_scaffold/cupertino_tab_scaffold.0.dart @@ -33,15 +33,23 @@ class _TabScaffoldExampleState extends State { return CupertinoTabScaffold( tabBar: CupertinoTabBar( items: const [ - BottomNavigationBarItem(icon: Icon(CupertinoIcons.home), label: 'Home'), - BottomNavigationBarItem(icon: Icon(CupertinoIcons.search_circle_fill), label: 'Explore'), + BottomNavigationBarItem( + icon: Icon(CupertinoIcons.home), + label: 'Home', + ), + BottomNavigationBarItem( + icon: Icon(CupertinoIcons.search_circle_fill), + label: 'Explore', + ), ], ), tabBuilder: (BuildContext context, int index) { return CupertinoTabView( builder: (BuildContext context) { return CupertinoPageScaffold( - navigationBar: CupertinoNavigationBar(middle: Text('Page 1 of tab $index')), + navigationBar: CupertinoNavigationBar( + middle: Text('Page 1 of tab $index'), + ), child: Center( child: CupertinoButton( child: const Text('Next page'), diff --git a/examples/api/lib/cupertino/text_field/cupertino_text_field.0.dart b/examples/api/lib/cupertino/text_field/cupertino_text_field.0.dart index 48d5d830fd1..08315cd90c3 100644 --- a/examples/api/lib/cupertino/text_field/cupertino_text_field.0.dart +++ b/examples/api/lib/cupertino/text_field/cupertino_text_field.0.dart @@ -24,7 +24,8 @@ class CupertinoTextFieldExample extends StatefulWidget { const CupertinoTextFieldExample({super.key}); @override - State createState() => _CupertinoTextFieldExampleState(); + State createState() => + _CupertinoTextFieldExampleState(); } class _CupertinoTextFieldExampleState extends State { @@ -45,7 +46,9 @@ class _CupertinoTextFieldExampleState extends State { @override Widget build(BuildContext context) { return CupertinoPageScaffold( - navigationBar: const CupertinoNavigationBar(middle: Text('CupertinoTextField Sample')), + navigationBar: const CupertinoNavigationBar( + middle: Text('CupertinoTextField Sample'), + ), child: Center(child: CupertinoTextField(controller: _textController)), ); } diff --git a/examples/api/lib/cupertino/text_form_field_row/cupertino_text_form_field_row.1.dart b/examples/api/lib/cupertino/text_form_field_row/cupertino_text_form_field_row.1.dart index a8ce5da4416..4506b60b77f 100644 --- a/examples/api/lib/cupertino/text_form_field_row/cupertino_text_form_field_row.1.dart +++ b/examples/api/lib/cupertino/text_form_field_row/cupertino_text_form_field_row.1.dart @@ -26,7 +26,9 @@ class FromSectionExample extends StatelessWidget { @override Widget build(BuildContext context) { return CupertinoPageScaffold( - navigationBar: const CupertinoNavigationBar(middle: Text('CupertinoFormSection Sample')), + navigationBar: const CupertinoNavigationBar( + middle: Text('CupertinoFormSection Sample'), + ), // Add safe area widget to place the CupertinoFormSection below the navigation bar. child: SafeArea( child: Form( diff --git a/examples/api/lib/gestures/pointer_signal_resolver/pointer_signal_resolver.0.dart b/examples/api/lib/gestures/pointer_signal_resolver/pointer_signal_resolver.0.dart index 76164031f77..b4b9de0edf4 100644 --- a/examples/api/lib/gestures/pointer_signal_resolver/pointer_signal_resolver.0.dart +++ b/examples/api/lib/gestures/pointer_signal_resolver/pointer_signal_resolver.0.dart @@ -71,7 +71,10 @@ class _ColorChangerState extends State { }, child: Stack( fit: StackFit.expand, - children: [const AbsorbPointer(), if (widget.child != null) widget.child!], + children: [ + const AbsorbPointer(), + if (widget.child != null) widget.child!, + ], ), ), ); @@ -82,10 +85,12 @@ class PointerSignalResolverExample extends StatefulWidget { const PointerSignalResolverExample({super.key}); @override - State createState() => _PointerSignalResolverExampleState(); + State createState() => + _PointerSignalResolverExampleState(); } -class _PointerSignalResolverExampleState extends State { +class _PointerSignalResolverExampleState + extends State { bool useResolver = false; @override diff --git a/examples/api/lib/gestures/tap_and_drag/tap_and_drag.0.dart b/examples/api/lib/gestures/tap_and_drag/tap_and_drag.0.dart index ee7e51e54eb..62cd24473d5 100644 --- a/examples/api/lib/gestures/tap_and_drag/tap_and_drag.0.dart +++ b/examples/api/lib/gestures/tap_and_drag/tap_and_drag.0.dart @@ -64,8 +64,10 @@ class _TapAndDragToZoomWidgetState extends State { } void _zoomLogic(Offset currentDragPosition) { - final double dx = (_previousDragPosition!.dx - currentDragPosition.dx).abs(); - final double dy = (_previousDragPosition!.dy - currentDragPosition.dy).abs(); + final double dx = (_previousDragPosition!.dx - currentDragPosition.dx) + .abs(); + final double dy = (_previousDragPosition!.dy - currentDragPosition.dy) + .abs(); if (dx > dy) { // Ignore horizontal drags. diff --git a/examples/api/lib/material/action_buttons/action_icon_theme.0.dart b/examples/api/lib/material/action_buttons/action_icon_theme.0.dart index 68cb0504590..163c7acc5d0 100644 --- a/examples/api/lib/material/action_buttons/action_icon_theme.0.dart +++ b/examples/api/lib/material/action_buttons/action_icon_theme.0.dart @@ -15,8 +15,13 @@ class _CustomEndDrawerIcon extends StatelessWidget { @override Widget build(BuildContext context) { - final MaterialLocalizations localization = MaterialLocalizations.of(context); - return Icon(Icons.more_horiz, semanticLabel: localization.openAppDrawerTooltip); + final MaterialLocalizations localization = MaterialLocalizations.of( + context, + ); + return Icon( + Icons.more_horiz, + semanticLabel: localization.openAppDrawerTooltip, + ); } } @@ -25,8 +30,13 @@ class _CustomDrawerIcon extends StatelessWidget { @override Widget build(BuildContext context) { - final MaterialLocalizations localization = MaterialLocalizations.of(context); - return Icon(Icons.segment, semanticLabel: localization.openAppDrawerTooltip); + final MaterialLocalizations localization = MaterialLocalizations.of( + context, + ); + return Icon( + Icons.segment, + semanticLabel: localization.openAppDrawerTooltip, + ); } } @@ -66,7 +76,9 @@ class MyHomePage extends StatelessWidget { appBar: AppBar(title: Text(title)), drawer: Drawer( child: Column( - children: [TextButton(child: const Text('Drawer Item'), onPressed: () {})], + children: [ + TextButton(child: const Text('Drawer Item'), onPressed: () {}), + ], ), ), body: const Center(child: NextPageButton()), diff --git a/examples/api/lib/material/animated_icon/animated_icon.0.dart b/examples/api/lib/material/animated_icon/animated_icon.0.dart index 8adc92f5293..d096df1d6e0 100644 --- a/examples/api/lib/material/animated_icon/animated_icon.0.dart +++ b/examples/api/lib/material/animated_icon/animated_icon.0.dart @@ -37,9 +37,10 @@ class _AnimatedIconExampleState extends State @override void initState() { super.initState(); - controller = AnimationController(vsync: this, duration: const Duration(seconds: 2)) - ..forward() - ..repeat(reverse: true); + controller = + AnimationController(vsync: this, duration: const Duration(seconds: 2)) + ..forward() + ..repeat(reverse: true); animation = Tween(begin: 0.0, end: 1.0).animate(controller); } diff --git a/examples/api/lib/material/animated_icon/animated_icons_data.0.dart b/examples/api/lib/material/animated_icon/animated_icons_data.0.dart index 3b9fbaef080..43bc3c32fed 100644 --- a/examples/api/lib/material/animated_icon/animated_icons_data.0.dart +++ b/examples/api/lib/material/animated_icon/animated_icons_data.0.dart @@ -54,9 +54,10 @@ class _AnimatedIconExampleState extends State @override void initState() { super.initState(); - controller = AnimationController(vsync: this, duration: const Duration(seconds: 2)) - ..forward() - ..repeat(reverse: true); + controller = + AnimationController(vsync: this, duration: const Duration(seconds: 2)) + ..forward() + ..repeat(reverse: true); animation = Tween(begin: 0.0, end: 1.0).animate(controller); } @@ -70,8 +71,12 @@ class _AnimatedIconExampleState extends State Widget build(BuildContext context) { return Scaffold( body: GridView( - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 4), - children: iconsList.entries.map((MapEntry entry) { + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 4, + ), + children: iconsList.entries.map(( + MapEntry entry, + ) { return Card( child: Center( child: Column( diff --git a/examples/api/lib/material/app/app.0.dart b/examples/api/lib/material/app/app.0.dart index 6c10aa8e097..ca662b93479 100644 --- a/examples/api/lib/material/app/app.0.dart +++ b/examples/api/lib/material/app/app.0.dart @@ -12,11 +12,12 @@ void main() { enum AnimationStyles { defaultStyle, custom, none } -const List<(AnimationStyles, String)> animationStyleSegments = <(AnimationStyles, String)>[ - (AnimationStyles.defaultStyle, 'Default'), - (AnimationStyles.custom, 'Custom'), - (AnimationStyles.none, 'None'), -]; +const List<(AnimationStyles, String)> animationStyleSegments = + <(AnimationStyles, String)>[ + (AnimationStyles.defaultStyle, 'Default'), + (AnimationStyles.custom, 'Custom'), + (AnimationStyles.none, 'None'), + ]; class MaterialAppExample extends StatefulWidget { const MaterialAppExample({super.key}); @@ -26,7 +27,9 @@ class MaterialAppExample extends StatefulWidget { } class _MaterialAppExampleState extends State { - Set _animationStyleSelection = {AnimationStyles.defaultStyle}; + Set _animationStyleSelection = { + AnimationStyles.defaultStyle, + }; AnimationStyle? _animationStyle; bool isDarkTheme = false; @@ -36,7 +39,10 @@ class _MaterialAppExampleState extends State { themeAnimationStyle: _animationStyle, themeMode: isDarkTheme ? ThemeMode.dark : ThemeMode.light, theme: ThemeData(colorSchemeSeed: Colors.green), - darkTheme: ThemeData(colorSchemeSeed: Colors.green, brightness: Brightness.dark), + darkTheme: ThemeData( + colorSchemeSeed: Colors.green, + brightness: Brightness.dark, + ), home: Scaffold( body: Center( child: Column( @@ -60,11 +66,16 @@ class _MaterialAppExampleState extends State { } }); }, - segments: animationStyleSegments.map>(( - (AnimationStyles, String) shirt, - ) { - return ButtonSegment(value: shirt.$1, label: Text(shirt.$2)); - }).toList(), + segments: animationStyleSegments + .map>(( + (AnimationStyles, String) shirt, + ) { + return ButtonSegment( + value: shirt.$1, + label: Text(shirt.$2), + ); + }) + .toList(), ), const SizedBox(height: 10), OutlinedButton.icon( @@ -73,7 +84,9 @@ class _MaterialAppExampleState extends State { isDarkTheme = !isDarkTheme; }); }, - icon: Icon(isDarkTheme ? Icons.wb_sunny : Icons.nightlight_round), + icon: Icon( + isDarkTheme ? Icons.wb_sunny : Icons.nightlight_round, + ), label: const Text('Switch Theme Mode'), ), ], diff --git a/examples/api/lib/material/app_bar/app_bar.0.dart b/examples/api/lib/material/app_bar/app_bar.0.dart index b5585bdf01f..8f2b6b9cb9a 100644 --- a/examples/api/lib/material/app_bar/app_bar.0.dart +++ b/examples/api/lib/material/app_bar/app_bar.0.dart @@ -30,9 +30,9 @@ class AppBarExample extends StatelessWidget { icon: const Icon(Icons.add_alert), tooltip: 'Show Snackbar', onPressed: () { - ScaffoldMessenger.of( - context, - ).showSnackBar(const SnackBar(content: Text('This is a snackbar'))); + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar(content: Text('This is a snackbar')), + ); }, ), IconButton( @@ -46,7 +46,10 @@ class AppBarExample extends StatelessWidget { return Scaffold( appBar: AppBar(title: const Text('Next page')), body: const Center( - child: Text('This is the next page', style: TextStyle(fontSize: 24)), + child: Text( + 'This is the next page', + style: TextStyle(fontSize: 24), + ), ), ); }, @@ -56,7 +59,9 @@ class AppBarExample extends StatelessWidget { ), ], ), - body: const Center(child: Text('This is the home page', style: TextStyle(fontSize: 24))), + body: const Center( + child: Text('This is the home page', style: TextStyle(fontSize: 24)), + ), ); } } diff --git a/examples/api/lib/material/app_bar/app_bar.1.dart b/examples/api/lib/material/app_bar/app_bar.1.dart index c1167f4f737..c63d292fb11 100644 --- a/examples/api/lib/material/app_bar/app_bar.1.dart +++ b/examples/api/lib/material/app_bar/app_bar.1.dart @@ -36,8 +36,8 @@ class _AppBarExampleState extends State { @override Widget build(BuildContext context) { final ColorScheme colorScheme = Theme.of(context).colorScheme; - final Color oddItemColor = colorScheme.primary.withOpacity(0.05); - final Color evenItemColor = colorScheme.primary.withOpacity(0.15); + final Color oddItemColor = colorScheme.primary.withValues(alpha: 0.05); + final Color evenItemColor = colorScheme.primary.withValues(alpha: 0.15); return Scaffold( appBar: AppBar( @@ -89,7 +89,9 @@ class _AppBarExampleState extends State { shadowColor = !shadowColor; }); }, - icon: Icon(shadowColor ? Icons.visibility_off : Icons.visibility), + icon: Icon( + shadowColor ? Icons.visibility_off : Icons.visibility, + ), label: const Text('shadow color'), ), const SizedBox(width: 5), @@ -106,7 +108,9 @@ class _AppBarExampleState extends State { }); } }, - child: Text('scrolledUnderElevation: ${scrolledUnderElevation ?? 'default'}'), + child: Text( + 'scrolledUnderElevation: ${scrolledUnderElevation ?? 'default'}', + ), ), ], ), diff --git a/examples/api/lib/material/app_bar/app_bar.2.dart b/examples/api/lib/material/app_bar/app_bar.2.dart index f2871314d5d..07ff4fa726a 100644 --- a/examples/api/lib/material/app_bar/app_bar.2.dart +++ b/examples/api/lib/material/app_bar/app_bar.2.dart @@ -28,8 +28,16 @@ class AppBarExample extends StatelessWidget { return Scaffold( appBar: AppBar( actions: [ - TextButton(style: style, onPressed: () {}, child: const Text('Action 1')), - TextButton(style: style, onPressed: () {}, child: const Text('Action 2')), + TextButton( + style: style, + onPressed: () {}, + child: const Text('Action 1'), + ), + TextButton( + style: style, + onPressed: () {}, + child: const Text('Action 2'), + ), ], ), ); diff --git a/examples/api/lib/material/app_bar/app_bar.3.dart b/examples/api/lib/material/app_bar/app_bar.3.dart index 61c46ab04f5..4bb4655919c 100644 --- a/examples/api/lib/material/app_bar/app_bar.3.dart +++ b/examples/api/lib/material/app_bar/app_bar.3.dart @@ -28,8 +28,8 @@ class AppBarExample extends StatelessWidget { @override Widget build(BuildContext context) { final ColorScheme colorScheme = Theme.of(context).colorScheme; - final Color oddItemColor = colorScheme.primary.withOpacity(0.05); - final Color evenItemColor = colorScheme.primary.withOpacity(0.15); + final Color oddItemColor = colorScheme.primary.withValues(alpha: 0.05); + final Color evenItemColor = colorScheme.primary.withValues(alpha: 0.15); const int tabsCount = 3; return DefaultTabController( diff --git a/examples/api/lib/material/app_bar/app_bar.4.dart b/examples/api/lib/material/app_bar/app_bar.4.dart index 72ecdbf155c..085c33d0cc9 100644 --- a/examples/api/lib/material/app_bar/app_bar.4.dart +++ b/examples/api/lib/material/app_bar/app_bar.4.dart @@ -35,15 +35,23 @@ class AppBarExample extends StatelessWidget { padding: const EdgeInsets.symmetric(horizontal: 16.0), child: TextField( decoration: InputDecoration( - border: OutlineInputBorder(borderSide: BorderSide(color: colorScheme.primary)), + border: OutlineInputBorder( + borderSide: BorderSide(color: colorScheme.primary), + ), enabledBorder: OutlineInputBorder( borderSide: BorderSide(color: colorScheme.onPrimaryContainer), ), filled: true, hintText: 'Enter a search term', fillColor: colorScheme.surface, - prefixIcon: Icon(Icons.search_rounded, color: colorScheme.primary), - suffixIcon: Icon(Icons.tune_rounded, color: colorScheme.primary), + prefixIcon: Icon( + Icons.search_rounded, + color: colorScheme.primary, + ), + suffixIcon: Icon( + Icons.tune_rounded, + color: colorScheme.primary, + ), ), ), ), @@ -74,7 +82,12 @@ class CustomAppBarShape extends OutlinedBorder { final Offset controlPoint = Offset(size.width * 0.4, size.height); final Offset endPoint = Offset(size.width, size.height / 2); - path.quadraticBezierTo(controlPoint.dx, controlPoint.dy, endPoint.dx, endPoint.dy); + path.quadraticBezierTo( + controlPoint.dx, + controlPoint.dy, + endPoint.dx, + endPoint.dy, + ); path.lineTo(size.width, 0.0); path.close(); @@ -97,7 +110,10 @@ class CustomAppBarShape extends OutlinedBorder { if (rect.isEmpty) { return; } - canvas.drawPath(getOuterPath(rect, textDirection: textDirection), side.toPaint()); + canvas.drawPath( + getOuterPath(rect, textDirection: textDirection), + side.toPaint(), + ); } @override diff --git a/examples/api/lib/material/app_bar/sliver_app_bar.1.dart b/examples/api/lib/material/app_bar/sliver_app_bar.1.dart index b37dd4fa62d..689cba2140d 100644 --- a/examples/api/lib/material/app_bar/sliver_app_bar.1.dart +++ b/examples/api/lib/material/app_bar/sliver_app_bar.1.dart @@ -49,7 +49,9 @@ class _SliverAppBarExampleState extends State { const SliverToBoxAdapter( child: SizedBox( height: 20, - child: Center(child: Text('Scroll to see the SliverAppBar in effect.')), + child: Center( + child: Text('Scroll to see the SliverAppBar in effect.'), + ), ), ), SliverList.builder( @@ -58,7 +60,9 @@ class _SliverAppBarExampleState extends State { return Container( color: index.isOdd ? Colors.white : Colors.black12, height: 100.0, - child: Center(child: Text('$index', textScaler: const TextScaler.linear(5))), + child: Center( + child: Text('$index', textScaler: const TextScaler.linear(5)), + ), ); }, ), diff --git a/examples/api/lib/material/app_bar/sliver_app_bar.2.dart b/examples/api/lib/material/app_bar/sliver_app_bar.2.dart index 8caf3e2808f..253d991090c 100644 --- a/examples/api/lib/material/app_bar/sliver_app_bar.2.dart +++ b/examples/api/lib/material/app_bar/sliver_app_bar.2.dart @@ -21,9 +21,14 @@ class AppBarMediumApp extends StatelessWidget { child: CustomScrollView( slivers: [ SliverAppBar.medium( - leading: IconButton(icon: const Icon(Icons.menu), onPressed: () {}), + leading: IconButton( + icon: const Icon(Icons.menu), + onPressed: () {}, + ), title: const Text('Medium App Bar'), - actions: [IconButton(icon: const Icon(Icons.more_vert), onPressed: () {})], + actions: [ + IconButton(icon: const Icon(Icons.more_vert), onPressed: () {}), + ], ), // Just some content big enough to have something to scroll. SliverToBoxAdapter( diff --git a/examples/api/lib/material/app_bar/sliver_app_bar.3.dart b/examples/api/lib/material/app_bar/sliver_app_bar.3.dart index 47ffb651bb0..e3569c32f52 100644 --- a/examples/api/lib/material/app_bar/sliver_app_bar.3.dart +++ b/examples/api/lib/material/app_bar/sliver_app_bar.3.dart @@ -21,9 +21,14 @@ class AppBarLargeApp extends StatelessWidget { child: CustomScrollView( slivers: [ SliverAppBar.large( - leading: IconButton(icon: const Icon(Icons.menu), onPressed: () {}), + leading: IconButton( + icon: const Icon(Icons.menu), + onPressed: () {}, + ), title: const Text('Large App Bar'), - actions: [IconButton(icon: const Icon(Icons.more_vert), onPressed: () {})], + actions: [ + IconButton(icon: const Icon(Icons.more_vert), onPressed: () {}), + ], ), // Just some content big enough to have something to scroll. SliverToBoxAdapter( diff --git a/examples/api/lib/material/app_bar/sliver_app_bar.4.dart b/examples/api/lib/material/app_bar/sliver_app_bar.4.dart index 9338f827db5..c8cfb0c0a6a 100644 --- a/examples/api/lib/material/app_bar/sliver_app_bar.4.dart +++ b/examples/api/lib/material/app_bar/sliver_app_bar.4.dart @@ -14,7 +14,8 @@ class StretchableSliverAppBar extends StatefulWidget { const StretchableSliverAppBar({super.key}); @override - State createState() => _StretchableSliverAppBarState(); + State createState() => + _StretchableSliverAppBarState(); } class _StretchableSliverAppBarState extends State { @@ -49,7 +50,12 @@ class _StretchableSliverAppBarState extends State { return Container( color: index.isOdd ? Colors.white : Colors.black12, height: 100.0, - child: Center(child: Text('$index', textScaler: const TextScaler.linear(5.0))), + child: Center( + child: Text( + '$index', + textScaler: const TextScaler.linear(5.0), + ), + ), ); }, ), diff --git a/examples/api/lib/material/autocomplete/autocomplete.0.dart b/examples/api/lib/material/autocomplete/autocomplete.0.dart index 0d4c3c21f8c..d7d183ae1b7 100644 --- a/examples/api/lib/material/autocomplete/autocomplete.0.dart +++ b/examples/api/lib/material/autocomplete/autocomplete.0.dart @@ -35,7 +35,11 @@ class AutocompleteExampleApp extends StatelessWidget { class AutocompleteBasicExample extends StatelessWidget { const AutocompleteBasicExample({super.key}); - static const List _kOptions = ['aardvark', 'bobcat', 'chameleon']; + static const List _kOptions = [ + 'aardvark', + 'bobcat', + 'chameleon', + ]; @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/autocomplete/autocomplete.1.dart b/examples/api/lib/material/autocomplete/autocomplete.1.dart index adb5d5a16c6..be1e07d2228 100644 --- a/examples/api/lib/material/autocomplete/autocomplete.1.dart +++ b/examples/api/lib/material/autocomplete/autocomplete.1.dart @@ -76,7 +76,9 @@ class AutocompleteBasicUserExample extends StatelessWidget { return const Iterable.empty(); } return _userOptions.where((User option) { - return option.toString().contains(textEditingValue.text.toLowerCase()); + return option.toString().contains( + textEditingValue.text.toLowerCase(), + ); }); }, onSelected: (User selection) { diff --git a/examples/api/lib/material/autocomplete/autocomplete.2.dart b/examples/api/lib/material/autocomplete/autocomplete.2.dart index 6aa048e0d6d..96b1321d26f 100644 --- a/examples/api/lib/material/autocomplete/autocomplete.2.dart +++ b/examples/api/lib/material/autocomplete/autocomplete.2.dart @@ -55,7 +55,9 @@ class _AsyncAutocompleteState extends State<_AsyncAutocomplete> { return Autocomplete( optionsBuilder: (TextEditingValue textEditingValue) async { _searchingWithQuery = textEditingValue.text; - final Iterable options = await _FakeAPI.search(_searchingWithQuery!); + final Iterable options = await _FakeAPI.search( + _searchingWithQuery!, + ); // If another search happened after this one, throw away these options. // Use the previous options instead and wait for the newer request to @@ -76,7 +78,11 @@ class _AsyncAutocompleteState extends State<_AsyncAutocomplete> { // Mimics a remote API. class _FakeAPI { - static const List _kOptions = ['aardvark', 'bobcat', 'chameleon']; + static const List _kOptions = [ + 'aardvark', + 'bobcat', + 'chameleon', + ]; // Searches the options, but injects a fake "network" delay. static Future> search(String query) async { diff --git a/examples/api/lib/material/autocomplete/autocomplete.3.dart b/examples/api/lib/material/autocomplete/autocomplete.3.dart index 28e063bc74f..5f92ad5d3d5 100644 --- a/examples/api/lib/material/autocomplete/autocomplete.3.dart +++ b/examples/api/lib/material/autocomplete/autocomplete.3.dart @@ -21,7 +21,9 @@ class AutocompleteExampleApp extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( home: Scaffold( - appBar: AppBar(title: const Text('Autocomplete - async and debouncing')), + appBar: AppBar( + title: const Text('Autocomplete - async and debouncing'), + ), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -82,7 +84,9 @@ class _AsyncAutocompleteState extends State<_AsyncAutocomplete> { Widget build(BuildContext context) { return Autocomplete( optionsBuilder: (TextEditingValue textEditingValue) async { - final Iterable? options = await _debouncedSearch(textEditingValue.text); + final Iterable? options = await _debouncedSearch( + textEditingValue.text, + ); if (options == null) { return _lastOptions; } @@ -98,7 +102,11 @@ class _AsyncAutocompleteState extends State<_AsyncAutocomplete> { // Mimics a remote API. class _FakeAPI { - static const List _kOptions = ['aardvark', 'bobcat', 'chameleon']; + static const List _kOptions = [ + 'aardvark', + 'bobcat', + 'chameleon', + ]; // Searches the options, but injects a fake "network" delay. static Future> search(String query) async { diff --git a/examples/api/lib/material/autocomplete/autocomplete.4.dart b/examples/api/lib/material/autocomplete/autocomplete.4.dart index aef5dbfebcf..09f7af8fe1f 100644 --- a/examples/api/lib/material/autocomplete/autocomplete.4.dart +++ b/examples/api/lib/material/autocomplete/autocomplete.4.dart @@ -22,7 +22,11 @@ class AutocompleteExampleApp extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( home: Scaffold( - appBar: AppBar(title: const Text('Autocomplete - async, debouncing, and network errors')), + appBar: AppBar( + title: const Text( + 'Autocomplete - async, debouncing, and network errors', + ), + ), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -124,7 +128,9 @@ class _AsyncAutocompleteState extends State<_AsyncAutocomplete> { ) { return TextFormField( decoration: InputDecoration( - errorText: _networkError ? 'Network error, please try again.' : null, + errorText: _networkError + ? 'Network error, please try again.' + : null, ), controller: controller, focusNode: focusNode, @@ -137,7 +143,9 @@ class _AsyncAutocompleteState extends State<_AsyncAutocomplete> { setState(() { _networkError = false; }); - final Iterable? options = await _debouncedSearch(textEditingValue.text); + final Iterable? options = await _debouncedSearch( + textEditingValue.text, + ); if (options == null) { return _lastOptions; } @@ -155,10 +163,17 @@ class _AsyncAutocompleteState extends State<_AsyncAutocomplete> { // Mimics a remote API. class _FakeAPI { - static const List _kOptions = ['aardvark', 'bobcat', 'chameleon']; + static const List _kOptions = [ + 'aardvark', + 'bobcat', + 'chameleon', + ]; // Searches the options, but injects a fake "network" delay. - static Future> search(String query, bool networkEnabled) async { + static Future> search( + String query, + bool networkEnabled, + ) async { await Future.delayed(fakeAPIDuration); // Fake 1 second delay. if (!networkEnabled) { throw const _NetworkException(); diff --git a/examples/api/lib/material/badge/badge.0.dart b/examples/api/lib/material/badge/badge.0.dart index 4a138188fc1..bf0e177baa2 100644 --- a/examples/api/lib/material/badge/badge.0.dart +++ b/examples/api/lib/material/badge/badge.0.dart @@ -41,7 +41,10 @@ class BadgeExample extends StatelessWidget { ), const SizedBox(height: 20), IconButton( - icon: Badge.count(count: 9999, child: const Icon(Icons.notifications)), + icon: Badge.count( + count: 9999, + child: const Icon(Icons.notifications), + ), onPressed: () {}, ), ], diff --git a/examples/api/lib/material/banner/material_banner.1.dart b/examples/api/lib/material/banner/material_banner.1.dart index 98e5bfb8791..597dc2061f8 100644 --- a/examples/api/lib/material/banner/material_banner.1.dart +++ b/examples/api/lib/material/banner/material_banner.1.dart @@ -33,7 +33,9 @@ class MaterialBannerExample extends StatelessWidget { content: Text('Hello, I am a Material Banner'), leading: Icon(Icons.agriculture_outlined), backgroundColor: Colors.green, - actions: [TextButton(onPressed: null, child: Text('DISMISS'))], + actions: [ + TextButton(onPressed: null, child: Text('DISMISS')), + ], ), ), ), diff --git a/examples/api/lib/material/bottom_app_bar/bottom_app_bar.1.dart b/examples/api/lib/material/bottom_app_bar/bottom_app_bar.1.dart index 335010ce39f..21b104b99cd 100644 --- a/examples/api/lib/material/bottom_app_bar/bottom_app_bar.1.dart +++ b/examples/api/lib/material/bottom_app_bar/bottom_app_bar.1.dart @@ -20,7 +20,8 @@ class BottomAppBarDemo extends StatefulWidget { class _BottomAppBarDemoState extends State { bool _showFab = true; bool _showNotch = true; - FloatingActionButtonLocation _fabLocation = FloatingActionButtonLocation.endDocked; + FloatingActionButtonLocation _fabLocation = + FloatingActionButtonLocation.endDocked; void _onShowNotchChanged(bool value) { setState(() { @@ -44,10 +45,14 @@ class _BottomAppBarDemoState extends State { Widget build(BuildContext context) { return MaterialApp( home: Scaffold( - appBar: AppBar(automaticallyImplyLeading: false, title: const Text('Bottom App Bar Demo')), + appBar: AppBar( + automaticallyImplyLeading: false, + title: const Text('Bottom App Bar Demo'), + ), body: RadioGroup( groupValue: _fabLocation, - onChanged: (FloatingActionButtonLocation? value) => _onFabLocationChanged(value), + onChanged: (FloatingActionButtonLocation? value) => + _onFabLocationChanged(value), child: ListView( padding: const EdgeInsets.only(bottom: 88), children: [ @@ -110,10 +115,11 @@ class _DemoBottomAppBar extends StatelessWidget { final FloatingActionButtonLocation fabLocation; final NotchedShape? shape; - static final List centerLocations = [ - FloatingActionButtonLocation.centerDocked, - FloatingActionButtonLocation.centerFloat, - ]; + static final List centerLocations = + [ + FloatingActionButtonLocation.centerDocked, + FloatingActionButtonLocation.centerFloat, + ]; @override Widget build(BuildContext context) { @@ -130,8 +136,16 @@ class _DemoBottomAppBar extends StatelessWidget { onPressed: () {}, ), if (centerLocations.contains(fabLocation)) const Spacer(), - IconButton(tooltip: 'Search', icon: const Icon(Icons.search), onPressed: () {}), - IconButton(tooltip: 'Favorite', icon: const Icon(Icons.favorite), onPressed: () {}), + IconButton( + tooltip: 'Search', + icon: const Icon(Icons.search), + onPressed: () {}, + ), + IconButton( + tooltip: 'Favorite', + icon: const Icon(Icons.favorite), + onPressed: () {}, + ), ], ), ), diff --git a/examples/api/lib/material/bottom_app_bar/bottom_app_bar.2.dart b/examples/api/lib/material/bottom_app_bar/bottom_app_bar.2.dart index a8d856bd0a1..4abc79aee5b 100644 --- a/examples/api/lib/material/bottom_app_bar/bottom_app_bar.2.dart +++ b/examples/api/lib/material/bottom_app_bar/bottom_app_bar.2.dart @@ -78,7 +78,10 @@ class _BottomAppBarDemoState extends State { void _addNewItem() { setState(() { - items.insert(0, Container(color: colors[items.length % 5], height: 150.0)); + items.insert( + 0, + Container(color: colors[items.length % 5], height: 150.0), + ); }); } @@ -114,7 +117,10 @@ class _BottomAppBarDemoState extends State { onChanged: _onElevatedChanged, ), Expanded( - child: ListView(controller: _controller, children: items.toList()), + child: ListView( + controller: _controller, + children: items.toList(), + ), ), ], ), @@ -127,7 +133,10 @@ class _BottomAppBarDemoState extends State { ) : null, floatingActionButtonLocation: _fabLocation, - bottomNavigationBar: _DemoBottomAppBar(isElevated: _isElevated, isVisible: _isVisible), + bottomNavigationBar: _DemoBottomAppBar( + isElevated: _isElevated, + isVisible: _isVisible, + ), ), ); } @@ -162,8 +171,16 @@ class _DemoBottomAppBar extends StatelessWidget { ScaffoldMessenger.of(context).showSnackBar(snackBar); }, ), - IconButton(tooltip: 'Search', icon: const Icon(Icons.search), onPressed: () {}), - IconButton(tooltip: 'Favorite', icon: const Icon(Icons.favorite), onPressed: () {}), + IconButton( + tooltip: 'Search', + icon: const Icon(Icons.search), + onPressed: () {}, + ), + IconButton( + tooltip: 'Favorite', + icon: const Icon(Icons.favorite), + onPressed: () {}, + ), ], ), ), diff --git a/examples/api/lib/material/bottom_navigation_bar/bottom_navigation_bar.0.dart b/examples/api/lib/material/bottom_navigation_bar/bottom_navigation_bar.0.dart index 4b8df37b8aa..e5bb83fefbf 100644 --- a/examples/api/lib/material/bottom_navigation_bar/bottom_navigation_bar.0.dart +++ b/examples/api/lib/material/bottom_navigation_bar/bottom_navigation_bar.0.dart @@ -21,12 +21,17 @@ class BottomNavigationBarExample extends StatefulWidget { const BottomNavigationBarExample({super.key}); @override - State createState() => _BottomNavigationBarExampleState(); + State createState() => + _BottomNavigationBarExampleState(); } -class _BottomNavigationBarExampleState extends State { +class _BottomNavigationBarExampleState + extends State { int _selectedIndex = 0; - static const TextStyle optionStyle = TextStyle(fontSize: 30, fontWeight: FontWeight.bold); + static const TextStyle optionStyle = TextStyle( + fontSize: 30, + fontWeight: FontWeight.bold, + ); static const List _widgetOptions = [ Text('Index 0: Home', style: optionStyle), Text('Index 1: Business', style: optionStyle), @@ -47,7 +52,10 @@ class _BottomNavigationBarExampleState extends State bottomNavigationBar: BottomNavigationBar( items: const [ BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Home'), - BottomNavigationBarItem(icon: Icon(Icons.business), label: 'Business'), + BottomNavigationBarItem( + icon: Icon(Icons.business), + label: 'Business', + ), BottomNavigationBarItem(icon: Icon(Icons.school), label: 'School'), ], currentIndex: _selectedIndex, diff --git a/examples/api/lib/material/bottom_navigation_bar/bottom_navigation_bar.1.dart b/examples/api/lib/material/bottom_navigation_bar/bottom_navigation_bar.1.dart index 88806661367..379036239fa 100644 --- a/examples/api/lib/material/bottom_navigation_bar/bottom_navigation_bar.1.dart +++ b/examples/api/lib/material/bottom_navigation_bar/bottom_navigation_bar.1.dart @@ -21,12 +21,17 @@ class BottomNavigationBarExample extends StatefulWidget { const BottomNavigationBarExample({super.key}); @override - State createState() => _BottomNavigationBarExampleState(); + State createState() => + _BottomNavigationBarExampleState(); } -class _BottomNavigationBarExampleState extends State { +class _BottomNavigationBarExampleState + extends State { int _selectedIndex = 0; - static const TextStyle optionStyle = TextStyle(fontSize: 30, fontWeight: FontWeight.bold); + static const TextStyle optionStyle = TextStyle( + fontSize: 30, + fontWeight: FontWeight.bold, + ); static const List _widgetOptions = [ Text('Index 0: Home', style: optionStyle), Text('Index 1: Business', style: optionStyle), diff --git a/examples/api/lib/material/bottom_navigation_bar/bottom_navigation_bar.2.dart b/examples/api/lib/material/bottom_navigation_bar/bottom_navigation_bar.2.dart index 350eeed2a65..5f507aa384b 100644 --- a/examples/api/lib/material/bottom_navigation_bar/bottom_navigation_bar.2.dart +++ b/examples/api/lib/material/bottom_navigation_bar/bottom_navigation_bar.2.dart @@ -21,10 +21,12 @@ class BottomNavigationBarExample extends StatefulWidget { const BottomNavigationBarExample({super.key}); @override - State createState() => _BottomNavigationBarExampleState(); + State createState() => + _BottomNavigationBarExampleState(); } -class _BottomNavigationBarExampleState extends State { +class _BottomNavigationBarExampleState + extends State { int _selectedIndex = 0; final ScrollController _homeController = ScrollController(); @@ -34,7 +36,8 @@ class _BottomNavigationBarExampleState extends State itemBuilder: (BuildContext context, int index) { return Center(child: Text('Item $index')); }, - separatorBuilder: (BuildContext context, int index) => const Divider(thickness: 1), + separatorBuilder: (BuildContext context, int index) => + const Divider(thickness: 1), itemCount: 50, ); } @@ -47,7 +50,10 @@ class _BottomNavigationBarExampleState extends State bottomNavigationBar: BottomNavigationBar( items: const [ BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Home'), - BottomNavigationBarItem(icon: Icon(Icons.open_in_new_rounded), label: 'Open Dialog'), + BottomNavigationBarItem( + icon: Icon(Icons.open_in_new_rounded), + label: 'Open Dialog', + ), ], currentIndex: _selectedIndex, selectedItemColor: Colors.amber[800], diff --git a/examples/api/lib/material/bottom_sheet/show_bottom_sheet.0.dart b/examples/api/lib/material/bottom_sheet/show_bottom_sheet.0.dart index 9afc2d1ed55..8df1a4d74b0 100644 --- a/examples/api/lib/material/bottom_sheet/show_bottom_sheet.0.dart +++ b/examples/api/lib/material/bottom_sheet/show_bottom_sheet.0.dart @@ -24,11 +24,12 @@ class BottomSheetExampleApp extends StatelessWidget { enum AnimationStyles { defaultStyle, custom, none } -const List<(AnimationStyles, String)> animationStyleSegments = <(AnimationStyles, String)>[ - (AnimationStyles.defaultStyle, 'Default'), - (AnimationStyles.custom, 'Custom'), - (AnimationStyles.none, 'None'), -]; +const List<(AnimationStyles, String)> animationStyleSegments = + <(AnimationStyles, String)>[ + (AnimationStyles.defaultStyle, 'Default'), + (AnimationStyles.custom, 'Custom'), + (AnimationStyles.none, 'None'), + ]; class BottomSheetExample extends StatefulWidget { const BottomSheetExample({super.key}); @@ -38,7 +39,9 @@ class BottomSheetExample extends StatefulWidget { } class _BottomSheetExampleState extends State { - Set _animationStyleSelection = {AnimationStyles.defaultStyle}; + Set _animationStyleSelection = { + AnimationStyles.defaultStyle, + }; AnimationStyle? _animationStyle; @override @@ -62,11 +65,16 @@ class _BottomSheetExampleState extends State { _animationStyleSelection = styles; }); }, - segments: animationStyleSegments.map>(( - (AnimationStyles, String) shirt, - ) { - return ButtonSegment(value: shirt.$1, label: Text(shirt.$2)); - }).toList(), + segments: animationStyleSegments + .map>(( + (AnimationStyles, String) shirt, + ) { + return ButtonSegment( + value: shirt.$1, + label: Text(shirt.$2), + ); + }) + .toList(), ), const SizedBox(height: 10), ElevatedButton( diff --git a/examples/api/lib/material/bottom_sheet/show_modal_bottom_sheet.2.dart b/examples/api/lib/material/bottom_sheet/show_modal_bottom_sheet.2.dart index 80f6a9f61d0..1ad29417fa4 100644 --- a/examples/api/lib/material/bottom_sheet/show_modal_bottom_sheet.2.dart +++ b/examples/api/lib/material/bottom_sheet/show_modal_bottom_sheet.2.dart @@ -24,21 +24,25 @@ class ModalBottomSheetApp extends StatelessWidget { enum AnimationStyles { defaultStyle, custom, none } -const List<(AnimationStyles, String)> animationStyleSegments = <(AnimationStyles, String)>[ - (AnimationStyles.defaultStyle, 'Default'), - (AnimationStyles.custom, 'Custom'), - (AnimationStyles.none, 'None'), -]; +const List<(AnimationStyles, String)> animationStyleSegments = + <(AnimationStyles, String)>[ + (AnimationStyles.defaultStyle, 'Default'), + (AnimationStyles.custom, 'Custom'), + (AnimationStyles.none, 'None'), + ]; class ModalBottomSheetExample extends StatefulWidget { const ModalBottomSheetExample({super.key}); @override - State createState() => _ModalBottomSheetExampleState(); + State createState() => + _ModalBottomSheetExampleState(); } class _ModalBottomSheetExampleState extends State { - Set _animationStyleSelection = {AnimationStyles.defaultStyle}; + Set _animationStyleSelection = { + AnimationStyles.defaultStyle, + }; AnimationStyle? _animationStyle; @override @@ -62,11 +66,16 @@ class _ModalBottomSheetExampleState extends State { _animationStyleSelection = styles; }); }, - segments: animationStyleSegments.map>(( - (AnimationStyles, String) shirt, - ) { - return ButtonSegment(value: shirt.$1, label: Text(shirt.$2)); - }).toList(), + segments: animationStyleSegments + .map>(( + (AnimationStyles, String) shirt, + ) { + return ButtonSegment( + value: shirt.$1, + label: Text(shirt.$2), + ); + }) + .toList(), ), const SizedBox(height: 10), ElevatedButton( diff --git a/examples/api/lib/material/button_style/button_style.0.dart b/examples/api/lib/material/button_style/button_style.0.dart index fbba8cc87a6..f658ced2b7b 100644 --- a/examples/api/lib/material/button_style/button_style.0.dart +++ b/examples/api/lib/material/button_style/button_style.0.dart @@ -57,7 +57,10 @@ class ButtonTypesGroup extends StatelessWidget { children: [ ElevatedButton(onPressed: onPressed, child: const Text('Elevated')), FilledButton(onPressed: onPressed, child: const Text('Filled')), - FilledButton.tonal(onPressed: onPressed, child: const Text('Filled Tonal')), + FilledButton.tonal( + onPressed: onPressed, + child: const Text('Filled Tonal'), + ), OutlinedButton(onPressed: onPressed, child: const Text('Outlined')), TextButton(onPressed: onPressed, child: const Text('Text')), ], diff --git a/examples/api/lib/material/button_style_button/button_style_button.icon_alignment.0.dart b/examples/api/lib/material/button_style_button/button_style_button.icon_alignment.0.dart index feb2bc0c9fc..e343906dc03 100644 --- a/examples/api/lib/material/button_style_button/button_style_button.icon_alignment.0.dart +++ b/examples/api/lib/material/button_style_button/button_style_button.icon_alignment.0.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; +// ignore: deprecated_member_use /// Flutter code sample for using [ButtonStyleButton.iconAlignment] parameter. void main() { @@ -15,7 +16,9 @@ class ButtonStyleButtonIconAlignmentApp extends StatelessWidget { @override Widget build(BuildContext context) { - return const MaterialApp(home: Scaffold(body: ButtonStyleButtonIconAlignmentExample())); + return const MaterialApp( + home: Scaffold(body: ButtonStyleButtonIconAlignmentExample()), + ); } } @@ -100,7 +103,9 @@ class _ButtonStyleButtonIconAlignmentExampleState }); }, selected: {_iconAlignment}, - segments: IconAlignment.values.map((IconAlignment iconAlignment) { + segments: IconAlignment.values.map(( + IconAlignment iconAlignment, + ) { return ButtonSegment( value: iconAlignment, label: Text(iconAlignment.name), diff --git a/examples/api/lib/material/card/card.1.dart b/examples/api/lib/material/card/card.1.dart index 8ad5aad4933..3be967d815e 100644 --- a/examples/api/lib/material/card/card.1.dart +++ b/examples/api/lib/material/card/card.1.dart @@ -39,7 +39,11 @@ class CardExample extends StatelessWidget { onTap: () { debugPrint('Card tapped.'); }, - child: const SizedBox(width: 300, height: 100, child: Text('A card that can be tapped')), + child: const SizedBox( + width: 300, + height: 100, + child: Text('A card that can be tapped'), + ), ), ), ); diff --git a/examples/api/lib/material/card/card.2.dart b/examples/api/lib/material/card/card.2.dart index 2d09b39e868..89958726c85 100644 --- a/examples/api/lib/material/card/card.2.dart +++ b/examples/api/lib/material/card/card.2.dart @@ -39,6 +39,10 @@ class _SampleCard extends StatelessWidget { @override Widget build(BuildContext context) { - return SizedBox(width: 300, height: 100, child: Center(child: Text(cardName))); + return SizedBox( + width: 300, + height: 100, + child: Center(child: Text(cardName)), + ); } } diff --git a/examples/api/lib/material/carousel/carousel.0.dart b/examples/api/lib/material/carousel/carousel.0.dart index b4867282e5f..6e395ab029a 100644 --- a/examples/api/lib/material/carousel/carousel.0.dart +++ b/examples/api/lib/material/carousel/carousel.0.dart @@ -77,7 +77,8 @@ class _CarouselExampleState extends State { consumeMaxWeight: false, children: List.generate(20, (int index) { return ColoredBox( - color: Colors.primaries[index % Colors.primaries.length].withOpacity(0.8), + color: Colors.primaries[index % Colors.primaries.length] + .withValues(alpha: 0.8), child: const SizedBox.expand(), ); }), @@ -163,14 +164,18 @@ class HeroLayoutCard extends StatelessWidget { imageInfo.title, overflow: TextOverflow.clip, softWrap: false, - style: Theme.of(context).textTheme.headlineLarge?.copyWith(color: Colors.white), + style: Theme.of( + context, + ).textTheme.headlineLarge?.copyWith(color: Colors.white), ), const SizedBox(height: 10), Text( imageInfo.subtitle, overflow: TextOverflow.clip, softWrap: false, - style: Theme.of(context).textTheme.bodyMedium?.copyWith(color: Colors.white), + style: Theme.of( + context, + ).textTheme.bodyMedium?.copyWith(color: Colors.white), ), ], ), @@ -181,7 +186,11 @@ class HeroLayoutCard extends StatelessWidget { } class UncontainedLayoutCard extends StatelessWidget { - const UncontainedLayoutCard({super.key, required this.index, required this.label}); + const UncontainedLayoutCard({ + super.key, + required this.index, + required this.label, + }); final int index; final String label; @@ -189,7 +198,9 @@ class UncontainedLayoutCard extends StatelessWidget { @override Widget build(BuildContext context) { return ColoredBox( - color: Colors.primaries[index % Colors.primaries.length].withOpacity(0.5), + color: Colors.primaries[index % Colors.primaries.length].withValues( + alpha: 0.5, + ), child: Center( child: Text( label, @@ -208,8 +219,18 @@ enum CardInfo { climate('Climate', Icons.thermostat, Color(0xffA44D2A), Color(0xffFAEDE7)), wifi('Wifi', Icons.wifi, Color(0xff417345), Color(0xffE5F4E0)), media('Media', Icons.library_music, Color(0xff2556C8), Color(0xffECEFFD)), - security('Security', Icons.crisis_alert, Color(0xff794C01), Color(0xffFAEEDF)), - safety('Safety', Icons.medical_services, Color(0xff2251C5), Color(0xffECEFFD)), + security( + 'Security', + Icons.crisis_alert, + Color(0xff794C01), + Color(0xffFAEEDF), + ), + safety( + 'Safety', + Icons.medical_services, + Color(0xff2251C5), + Color(0xffECEFFD), + ), more('', Icons.add, Color(0xff201D1C), Color(0xffE3DFD8)); const CardInfo(this.label, this.icon, this.color, this.backgroundColor); @@ -220,16 +241,36 @@ enum CardInfo { } enum ImageInfo { - image0('The Flow', 'Sponsored | Season 1 Now Streaming', 'content_based_color_scheme_1.png'), + image0( + 'The Flow', + 'Sponsored | Season 1 Now Streaming', + 'content_based_color_scheme_1.png', + ), image1( 'Through the Pane', 'Sponsored | Season 1 Now Streaming', 'content_based_color_scheme_2.png', ), - image2('Iridescence', 'Sponsored | Season 1 Now Streaming', 'content_based_color_scheme_3.png'), - image3('Sea Change', 'Sponsored | Season 1 Now Streaming', 'content_based_color_scheme_4.png'), - image4('Blue Symphony', 'Sponsored | Season 1 Now Streaming', 'content_based_color_scheme_5.png'), - image5('When It Rains', 'Sponsored | Season 1 Now Streaming', 'content_based_color_scheme_6.png'); + image2( + 'Iridescence', + 'Sponsored | Season 1 Now Streaming', + 'content_based_color_scheme_3.png', + ), + image3( + 'Sea Change', + 'Sponsored | Season 1 Now Streaming', + 'content_based_color_scheme_4.png', + ), + image4( + 'Blue Symphony', + 'Sponsored | Season 1 Now Streaming', + 'content_based_color_scheme_5.png', + ), + image5( + 'When It Rains', + 'Sponsored | Season 1 Now Streaming', + 'content_based_color_scheme_6.png', + ); const ImageInfo(this.title, this.subtitle, this.url); final String title; diff --git a/examples/api/lib/material/checkbox/checkbox.1.dart b/examples/api/lib/material/checkbox/checkbox.1.dart index b98438e3430..6ee3aaa9bc0 100644 --- a/examples/api/lib/material/checkbox/checkbox.1.dart +++ b/examples/api/lib/material/checkbox/checkbox.1.dart @@ -58,7 +58,12 @@ class _CheckboxExampleState extends State { }); }, ), - Checkbox(isError: true, tristate: true, value: isChecked, onChanged: null), + Checkbox( + isError: true, + tristate: true, + value: isChecked, + onChanged: null, + ), ], ); } diff --git a/examples/api/lib/material/checkbox_list_tile/checkbox_list_tile.0.dart b/examples/api/lib/material/checkbox_list_tile/checkbox_list_tile.0.dart index 5807415a134..c746a7b4cbc 100644 --- a/examples/api/lib/material/checkbox_list_tile/checkbox_list_tile.0.dart +++ b/examples/api/lib/material/checkbox_list_tile/checkbox_list_tile.0.dart @@ -22,7 +22,8 @@ class CheckboxListTileExample extends StatefulWidget { const CheckboxListTileExample({super.key}); @override - State createState() => _CheckboxListTileExampleState(); + State createState() => + _CheckboxListTileExampleState(); } class _CheckboxListTileExampleState extends State { diff --git a/examples/api/lib/material/checkbox_list_tile/checkbox_list_tile.1.dart b/examples/api/lib/material/checkbox_list_tile/checkbox_list_tile.1.dart index 251ceec0e44..4fbd4be3155 100644 --- a/examples/api/lib/material/checkbox_list_tile/checkbox_list_tile.1.dart +++ b/examples/api/lib/material/checkbox_list_tile/checkbox_list_tile.1.dart @@ -21,7 +21,8 @@ class CheckboxListTileExample extends StatefulWidget { const CheckboxListTileExample({super.key}); @override - State createState() => _CheckboxListTileExampleState(); + State createState() => + _CheckboxListTileExampleState(); } class _CheckboxListTileExampleState extends State { diff --git a/examples/api/lib/material/chip/chip_attributes.avatar_box_constraints.0.dart b/examples/api/lib/material/chip/chip_attributes.avatar_box_constraints.0.dart index 597fab744ef..039a7b30af4 100644 --- a/examples/api/lib/material/chip/chip_attributes.avatar_box_constraints.0.dart +++ b/examples/api/lib/material/chip/chip_attributes.avatar_box_constraints.0.dart @@ -32,7 +32,11 @@ class AvatarBoxConstraintsExample extends StatelessWidget { avatar: Icon(Icons.star), label: SizedBox( width: 150, - child: Text('One line text.', maxLines: 3, overflow: TextOverflow.ellipsis), + child: Text( + 'One line text.', + maxLines: 3, + overflow: TextOverflow.ellipsis, + ), ), ), SizedBox(height: 10), diff --git a/examples/api/lib/material/chip/chip_attributes.chip_animation_style.0.dart b/examples/api/lib/material/chip/chip_attributes.chip_animation_style.0.dart index 9deb762e7d5..5b136a61faf 100644 --- a/examples/api/lib/material/chip/chip_attributes.chip_animation_style.0.dart +++ b/examples/api/lib/material/chip/chip_attributes.chip_animation_style.0.dart @@ -23,7 +23,8 @@ class ChipAnimationStyleExample extends StatefulWidget { const ChipAnimationStyleExample({super.key}); @override - State createState() => _ChipAnimationStyleExampleState(); + State createState() => + _ChipAnimationStyleExampleState(); } class _ChipAnimationStyleExampleState extends State { @@ -120,7 +121,9 @@ class _ChipAnimationStyleExampleState extends State { showCheckmark = !showCheckmark; }); }, - child: Text(showCheckmark ? 'Hide checkmark' : 'Show checkmark'), + child: Text( + showCheckmark ? 'Hide checkmark' : 'Show checkmark', + ), ), ], ), @@ -145,7 +148,9 @@ class _ChipAnimationStyleExampleState extends State { showDeleteIcon = !showDeleteIcon; }); }, - child: Text(showDeleteIcon ? 'Hide delete icon' : 'Show delete icon'), + child: Text( + showDeleteIcon ? 'Hide delete icon' : 'Show delete icon', + ), ), ], ), diff --git a/examples/api/lib/material/chip/deletable_chip_attributes.delete_icon_box_constraints.0.dart b/examples/api/lib/material/chip/deletable_chip_attributes.delete_icon_box_constraints.0.dart index 9a95de271af..fd22e069f36 100644 --- a/examples/api/lib/material/chip/deletable_chip_attributes.delete_icon_box_constraints.0.dart +++ b/examples/api/lib/material/chip/deletable_chip_attributes.delete_icon_box_constraints.0.dart @@ -32,7 +32,11 @@ class DeleteIconBoxConstraintsExample extends StatelessWidget { onDeleted: () {}, label: const SizedBox( width: 150, - child: Text('One line text.', maxLines: 3, overflow: TextOverflow.ellipsis), + child: Text( + 'One line text.', + maxLines: 3, + overflow: TextOverflow.ellipsis, + ), ), ), const SizedBox(height: 10), diff --git a/examples/api/lib/material/chip/deletable_chip_attributes.on_deleted.0.dart b/examples/api/lib/material/chip/deletable_chip_attributes.on_deleted.0.dart index 170af120ace..0a515966a6c 100644 --- a/examples/api/lib/material/chip/deletable_chip_attributes.on_deleted.0.dart +++ b/examples/api/lib/material/chip/deletable_chip_attributes.on_deleted.0.dart @@ -15,7 +15,9 @@ class OnDeletedExampleApp extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( home: Scaffold( - appBar: AppBar(title: const Text('DeletableChipAttributes.onDeleted Sample')), + appBar: AppBar( + title: const Text('DeletableChipAttributes.onDeleted Sample'), + ), body: const Center(child: OnDeletedExample()), ), ); diff --git a/examples/api/lib/material/color_scheme/color_scheme.0.dart b/examples/api/lib/material/color_scheme/color_scheme.0.dart index f73bfd9d7a6..6f3d09157cd 100644 --- a/examples/api/lib/material/color_scheme/color_scheme.0.dart +++ b/examples/api/lib/material/color_scheme/color_scheme.0.dart @@ -21,7 +21,8 @@ class _ColorSchemeExampleState extends State { Color selectedColor = ColorSeed.baseColor.color; Brightness selectedBrightness = Brightness.light; double selectedContrast = 0.0; - static const List schemeVariants = DynamicSchemeVariant.values; + static const List schemeVariants = + DynamicSchemeVariant.values; void updateTheme(Brightness brightness, Color color, double contrastLevel) { setState(() { @@ -63,7 +64,9 @@ class _ColorSchemeExampleState extends State { SingleChildScrollView( scrollDirection: Axis.horizontal, child: Row( - children: List.generate(schemeVariants.length, (int index) { + children: List.generate(schemeVariants.length, ( + int index, + ) { return ColorSchemeVariantColumn( selectedColor: selectedColor, brightness: selectedBrightness, @@ -122,7 +125,12 @@ class _SettingsState extends State { padding: const EdgeInsets.all(20.0), child: ListView( children: [ - Center(child: Text('Settings', style: Theme.of(context).textTheme.titleLarge)), + Center( + child: Text( + 'Settings', + style: Theme.of(context).textTheme.titleLarge, + ), + ), Row( children: [ const Text('Brightness: '), @@ -130,9 +138,15 @@ class _SettingsState extends State { value: selectedBrightness == Brightness.light, onChanged: (bool value) { setState(() { - selectedBrightness = value ? Brightness.light : Brightness.dark; + selectedBrightness = value + ? Brightness.light + : Brightness.dark; }); - widget.updateTheme(selectedBrightness, selectedColor, selectedContrast); + widget.updateTheme( + selectedBrightness, + selectedColor, + selectedContrast, + ); }, ), ], @@ -141,7 +155,9 @@ class _SettingsState extends State { crossAxisAlignment: WrapCrossAlignment.center, children: [ const Text('Seed color: '), - ...List.generate(ColorSeed.values.length, (int index) { + ...List.generate(ColorSeed.values.length, ( + int index, + ) { final Color itemColor = ColorSeed.values[index].color; return IconButton( icon: selectedColor == ColorSeed.values[index].color @@ -151,7 +167,11 @@ class _SettingsState extends State { setState(() { selectedColor = itemColor; }); - widget.updateTheme(selectedBrightness, selectedColor, selectedContrast); + widget.updateTheme( + selectedBrightness, + selectedColor, + selectedContrast, + ); }, ); }), @@ -170,7 +190,11 @@ class _SettingsState extends State { setState(() { selectedContrast = value; }); - widget.updateTheme(selectedBrightness, selectedColor, selectedContrast); + widget.updateTheme( + selectedBrightness, + selectedColor, + selectedContrast, + ); }, ), ), @@ -258,8 +282,16 @@ class ColorSchemeView extends StatelessWidget { divider, ColorGroup( children: [ - ColorChip('primaryFixed', colorScheme.primaryFixed, colorScheme.onPrimaryFixed), - ColorChip('onPrimaryFixed', colorScheme.onPrimaryFixed, colorScheme.primaryFixed), + ColorChip( + 'primaryFixed', + colorScheme.primaryFixed, + colorScheme.onPrimaryFixed, + ), + ColorChip( + 'onPrimaryFixed', + colorScheme.onPrimaryFixed, + colorScheme.primaryFixed, + ), ColorChip( 'primaryFixedDim', colorScheme.primaryFixedDim, @@ -275,8 +307,16 @@ class ColorSchemeView extends StatelessWidget { divider, ColorGroup( children: [ - ColorChip('secondary', colorScheme.secondary, colorScheme.onSecondary), - ColorChip('onSecondary', colorScheme.onSecondary, colorScheme.secondary), + ColorChip( + 'secondary', + colorScheme.secondary, + colorScheme.onSecondary, + ), + ColorChip( + 'onSecondary', + colorScheme.onSecondary, + colorScheme.secondary, + ), ColorChip( 'secondaryContainer', colorScheme.secondaryContainer, @@ -292,8 +332,16 @@ class ColorSchemeView extends StatelessWidget { divider, ColorGroup( children: [ - ColorChip('secondaryFixed', colorScheme.secondaryFixed, colorScheme.onSecondaryFixed), - ColorChip('onSecondaryFixed', colorScheme.onSecondaryFixed, colorScheme.secondaryFixed), + ColorChip( + 'secondaryFixed', + colorScheme.secondaryFixed, + colorScheme.onSecondaryFixed, + ), + ColorChip( + 'onSecondaryFixed', + colorScheme.onSecondaryFixed, + colorScheme.secondaryFixed, + ), ColorChip( 'secondaryFixedDim', colorScheme.secondaryFixedDim, @@ -310,7 +358,11 @@ class ColorSchemeView extends StatelessWidget { ColorGroup( children: [ ColorChip('tertiary', colorScheme.tertiary, colorScheme.onTertiary), - ColorChip('onTertiary', colorScheme.onTertiary, colorScheme.tertiary), + ColorChip( + 'onTertiary', + colorScheme.onTertiary, + colorScheme.tertiary, + ), ColorChip( 'tertiaryContainer', colorScheme.tertiaryContainer, @@ -326,8 +378,16 @@ class ColorSchemeView extends StatelessWidget { divider, ColorGroup( children: [ - ColorChip('tertiaryFixed', colorScheme.tertiaryFixed, colorScheme.onTertiaryFixed), - ColorChip('onTertiaryFixed', colorScheme.onTertiaryFixed, colorScheme.tertiaryFixed), + ColorChip( + 'tertiaryFixed', + colorScheme.tertiaryFixed, + colorScheme.onTertiaryFixed, + ), + ColorChip( + 'onTertiaryFixed', + colorScheme.onTertiaryFixed, + colorScheme.tertiaryFixed, + ), ColorChip( 'tertiaryFixedDim', colorScheme.tertiaryFixedDim, @@ -345,16 +405,32 @@ class ColorSchemeView extends StatelessWidget { children: [ ColorChip('error', colorScheme.error, colorScheme.onError), ColorChip('onError', colorScheme.onError, colorScheme.error), - ColorChip('errorContainer', colorScheme.errorContainer, colorScheme.onErrorContainer), - ColorChip('onErrorContainer', colorScheme.onErrorContainer, colorScheme.errorContainer), + ColorChip( + 'errorContainer', + colorScheme.errorContainer, + colorScheme.onErrorContainer, + ), + ColorChip( + 'onErrorContainer', + colorScheme.onErrorContainer, + colorScheme.errorContainer, + ), ], ), divider, ColorGroup( children: [ - ColorChip('surfaceDim', colorScheme.surfaceDim, colorScheme.onSurface), + ColorChip( + 'surfaceDim', + colorScheme.surfaceDim, + colorScheme.onSurface, + ), ColorChip('surface', colorScheme.surface, colorScheme.onSurface), - ColorChip('surfaceBright', colorScheme.surfaceBright, colorScheme.onSurface), + ColorChip( + 'surfaceBright', + colorScheme.surfaceBright, + colorScheme.onSurface, + ), ColorChip( 'surfaceContainerLowest', colorScheme.surfaceContainerLowest, @@ -365,7 +441,11 @@ class ColorSchemeView extends StatelessWidget { colorScheme.surfaceContainerLow, colorScheme.onSurface, ), - ColorChip('surfaceContainer', colorScheme.surfaceContainer, colorScheme.onSurface), + ColorChip( + 'surfaceContainer', + colorScheme.surfaceContainer, + colorScheme.onSurface, + ), ColorChip( 'surfaceContainerHigh', colorScheme.surfaceContainerHigh, @@ -389,9 +469,21 @@ class ColorSchemeView extends StatelessWidget { children: [ ColorChip('outline', colorScheme.outline, null), ColorChip('shadow', colorScheme.shadow, null), - ColorChip('inverseSurface', colorScheme.inverseSurface, colorScheme.onInverseSurface), - ColorChip('onInverseSurface', colorScheme.onInverseSurface, colorScheme.inverseSurface), - ColorChip('inversePrimary', colorScheme.inversePrimary, colorScheme.primary), + ColorChip( + 'inverseSurface', + colorScheme.inverseSurface, + colorScheme.onInverseSurface, + ), + ColorChip( + 'onInverseSurface', + colorScheme.onInverseSurface, + colorScheme.inverseSurface, + ), + ColorChip( + 'inversePrimary', + colorScheme.inversePrimary, + colorScheme.primary, + ), ], ), ], diff --git a/examples/api/lib/material/color_scheme/dynamic_content_color.0.dart b/examples/api/lib/material/color_scheme/dynamic_content_color.0.dart index 3d8447533e6..f4540f9b733 100644 --- a/examples/api/lib/material/color_scheme/dynamic_content_color.0.dart +++ b/examples/api/lib/material/color_scheme/dynamic_content_color.0.dart @@ -35,7 +35,10 @@ class DynamicColorExample extends StatefulWidget { ), ]; - final Future Function(ImageProvider provider, Brightness brightness)? + final Future Function( + ImageProvider provider, + Brightness brightness, + )? loadColorScheme; @override @@ -83,7 +86,10 @@ class _DynamicColorExampleState extends State { padding: const EdgeInsets.symmetric(vertical: 15), child: Text( brightness, - style: TextStyle(fontWeight: FontWeight.bold, color: colorScheme.onSecondaryContainer), + style: TextStyle( + fontWeight: FontWeight.bold, + color: colorScheme.onSecondaryContainer, + ), ), ); } @@ -107,7 +113,7 @@ class _DynamicColorExampleState extends State { actions: [ const Icon(Icons.light_mode), Switch( - activeColor: colorScheme.primary, + activeThumbColor: colorScheme.primary, activeTrackColor: colorScheme.surface, inactiveTrackColor: colorScheme.onSecondary, value: isLight, @@ -128,59 +134,82 @@ class _DynamicColorExampleState extends State { child: Column( children: [ divider, - _imagesRow(context, DynamicColorExample.images, colorScheme), + _imagesRow( + context, + DynamicColorExample.images, + colorScheme, + ), divider, Expanded( child: ColoredBox( color: colorScheme.surface, child: LayoutBuilder( - builder: (BuildContext context, BoxConstraints constraints) { - if (constraints.maxWidth < narrowScreenWidthThreshold) { - return SingleChildScrollView( - child: Column( - children: [ - divider, - schemeLabel('Light ColorScheme', colorScheme), - schemeView(lightTheme), - divider, - divider, - schemeLabel('Dark ColorScheme', colorScheme), - schemeView(darkTheme), - ], - ), - ); - } else { - return SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.only(top: 5), - child: Column( - children: [ - Row( + builder: + ( + BuildContext context, + BoxConstraints constraints, + ) { + if (constraints.maxWidth < + narrowScreenWidthThreshold) { + return SingleChildScrollView( + child: Column( + children: [ + divider, + schemeLabel( + 'Light ColorScheme', + colorScheme, + ), + schemeView(lightTheme), + divider, + divider, + schemeLabel( + 'Dark ColorScheme', + colorScheme, + ), + schemeView(darkTheme), + ], + ), + ); + } else { + return SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.only( + top: 5, + ), + child: Column( children: [ - Expanded( - child: Column( - children: [ - schemeLabel('Light ColorScheme', colorScheme), - schemeView(lightTheme), - ], - ), - ), - Expanded( - child: Column( - children: [ - schemeLabel('Dark ColorScheme', colorScheme), - schemeView(darkTheme), - ], - ), + Row( + children: [ + Expanded( + child: Column( + children: [ + schemeLabel( + 'Light ColorScheme', + colorScheme, + ), + schemeView(lightTheme), + ], + ), + ), + Expanded( + child: Column( + children: [ + schemeLabel( + 'Dark ColorScheme', + colorScheme, + ), + schemeView(darkTheme), + ], + ), + ), + ], ), ], ), - ], - ), - ), - ); - } - }, + ), + ); + } + }, ), ), ), @@ -217,7 +246,11 @@ class _DynamicColorExampleState extends State { // For small screens, have two rows of image selection. For wide screens, // fit them onto one row. - Widget _imagesRow(BuildContext context, List images, ColorScheme colorScheme) { + Widget _imagesRow( + BuildContext context, + List images, + ColorScheme colorScheme, + ) { final double windowHeight = MediaQuery.of(context).size.height; final double windowWidth = MediaQuery.of(context).size.width; return Padding( @@ -229,8 +262,16 @@ class _DynamicColorExampleState extends State { } else { return Column( children: [ - _adaptiveLayoutImagesRow(images.sublist(0, 3), colorScheme, windowWidth), - _adaptiveLayoutImagesRow(images.sublist(3), colorScheme, windowWidth), + _adaptiveLayoutImagesRow( + images.sublist(0, 3), + colorScheme, + windowWidth, + ), + _adaptiveLayoutImagesRow( + images.sublist(3), + colorScheme, + windowWidth, + ), ], ); } @@ -253,7 +294,8 @@ class _DynamicColorExampleState extends State { child: GestureDetector( onTap: () => _updateImage(image), child: Card( - color: DynamicColorExample.images.indexOf(image) == selectedImage + color: + DynamicColorExample.images.indexOf(image) == selectedImage ? colorScheme.primaryContainer : colorScheme.surface, child: Padding( @@ -286,7 +328,11 @@ class ColorSchemeView extends StatelessWidget { children: [ ColorGroup( children: [ - ColorChip(label: 'primary', color: colorScheme.primary, onColor: colorScheme.onPrimary), + ColorChip( + label: 'primary', + color: colorScheme.primary, + onColor: colorScheme.onPrimary, + ), ColorChip( label: 'onPrimary', color: colorScheme.onPrimary, @@ -357,8 +403,16 @@ class ColorSchemeView extends StatelessWidget { divider, ColorGroup( children: [ - ColorChip(label: 'error', color: colorScheme.error, onColor: colorScheme.onError), - ColorChip(label: 'onError', color: colorScheme.onError, onColor: colorScheme.error), + ColorChip( + label: 'error', + color: colorScheme.error, + onColor: colorScheme.onError, + ), + ColorChip( + label: 'onError', + color: colorScheme.onError, + onColor: colorScheme.error, + ), ColorChip( label: 'errorContainer', color: colorScheme.errorContainer, @@ -374,7 +428,11 @@ class ColorSchemeView extends StatelessWidget { divider, ColorGroup( children: [ - ColorChip(label: 'surface', color: colorScheme.surface, onColor: colorScheme.onSurface), + ColorChip( + label: 'surface', + color: colorScheme.surface, + onColor: colorScheme.onSurface, + ), ColorChip( label: 'onSurface', color: colorScheme.onSurface, @@ -431,7 +489,12 @@ class ColorGroup extends StatelessWidget { } class ColorChip extends StatelessWidget { - const ColorChip({super.key, required this.color, required this.label, this.onColor}); + const ColorChip({ + super.key, + required this.color, + required this.label, + this.onColor, + }); final Color color; final Color? onColor; diff --git a/examples/api/lib/material/context_menu/context_menu_controller.0.dart b/examples/api/lib/material/context_menu/context_menu_controller.0.dart index c77be5d2473..c5fa6cb9fe4 100644 --- a/examples/api/lib/material/context_menu/context_menu_controller.0.dart +++ b/examples/api/lib/material/context_menu/context_menu_controller.0.dart @@ -12,21 +12,25 @@ import 'package:flutter/services.dart'; void main() => runApp(const ContextMenuControllerExampleApp()); /// A builder that includes an Offset to draw the context menu at. -typedef ContextMenuBuilder = Widget Function(BuildContext context, Offset offset); +typedef ContextMenuBuilder = + Widget Function(BuildContext context, Offset offset); class ContextMenuControllerExampleApp extends StatefulWidget { const ContextMenuControllerExampleApp({super.key}); @override - State createState() => _ContextMenuControllerExampleAppState(); + State createState() => + _ContextMenuControllerExampleAppState(); } -class _ContextMenuControllerExampleAppState extends State { +class _ContextMenuControllerExampleAppState + extends State { void _showDialog(BuildContext context) { Navigator.of(context).push( DialogRoute( context: context, - builder: (BuildContext context) => const AlertDialog(title: Text('You clicked print!')), + builder: (BuildContext context) => + const AlertDialog(title: Text('You clicked print!')), ), ); } @@ -93,7 +97,10 @@ class _ContextMenuControllerExampleAppState extends State { final TextEditingController _controller = TextEditingController( - text: 'Right click (desktop) or long press (mobile) to see the menu with custom buttons.', + text: + 'Right click (desktop) or long press (mobile) to see the menu with custom buttons.', ); @override @@ -55,31 +56,38 @@ class _EditableTextToolbarBuilderExampleAppState const SizedBox(height: 20.0), TextField( controller: _controller, - contextMenuBuilder: (BuildContext context, EditableTextState editableTextState) { - return AdaptiveTextSelectionToolbar( - anchors: editableTextState.contextMenuAnchors, - // Build the default buttons, but make them look custom. - // In a real project you may want to build different - // buttons depending on the platform. - children: editableTextState.contextMenuButtonItems.map(( - ContextMenuButtonItem buttonItem, + contextMenuBuilder: + ( + BuildContext context, + EditableTextState editableTextState, ) { - return CupertinoButton( - color: const Color(0xffaaaa00), - disabledColor: const Color(0xffaaaaff), - onPressed: buttonItem.onPressed, - padding: const EdgeInsets.all(10.0), - pressedOpacity: 0.7, - child: SizedBox( - width: 200.0, - child: Text( - CupertinoTextSelectionToolbarButton.getButtonLabel(context, buttonItem), - ), - ), + return AdaptiveTextSelectionToolbar( + anchors: editableTextState.contextMenuAnchors, + // Build the default buttons, but make them look custom. + // In a real project you may want to build different + // buttons depending on the platform. + children: editableTextState.contextMenuButtonItems.map(( + ContextMenuButtonItem buttonItem, + ) { + return CupertinoButton( + color: const Color(0xffaaaa00), + disabledColor: const Color(0xffaaaaff), + onPressed: buttonItem.onPressed, + padding: const EdgeInsets.all(10.0), + pressedOpacity: 0.7, + child: SizedBox( + width: 200.0, + child: Text( + CupertinoTextSelectionToolbarButton.getButtonLabel( + context, + buttonItem, + ), + ), + ), + ); + }).toList(), ); - }).toList(), - ); - }, + }, ), ], ), diff --git a/examples/api/lib/material/context_menu/editable_text_toolbar_builder.1.dart b/examples/api/lib/material/context_menu/editable_text_toolbar_builder.1.dart index 018415fa763..5e227460111 100644 --- a/examples/api/lib/material/context_menu/editable_text_toolbar_builder.1.dart +++ b/examples/api/lib/material/context_menu/editable_text_toolbar_builder.1.dart @@ -65,30 +65,36 @@ class _EditableTextToolbarBuilderExampleAppState Container(height: 20.0), TextField( controller: _controller, - contextMenuBuilder: (BuildContext context, EditableTextState editableTextState) { - final List buttonItems = - editableTextState.contextMenuButtonItems; - // Here we add an "Email" button to the default TextField - // context menu for the current platform, but only if an email - // address is currently selected. - final TextEditingValue value = _controller.value; - if (_isValidEmail(value.selection.textInside(value.text))) { - buttonItems.insert( - 0, - ContextMenuButtonItem( - label: 'Send email', - onPressed: () { - ContextMenuController.removeAny(); - _showDialog(context); - }, - ), - ); - } - return AdaptiveTextSelectionToolbar.buttonItems( - anchors: editableTextState.contextMenuAnchors, - buttonItems: buttonItems, - ); - }, + contextMenuBuilder: + ( + BuildContext context, + EditableTextState editableTextState, + ) { + final List buttonItems = + editableTextState.contextMenuButtonItems; + // Here we add an "Email" button to the default TextField + // context menu for the current platform, but only if an email + // address is currently selected. + final TextEditingValue value = _controller.value; + if (_isValidEmail( + value.selection.textInside(value.text), + )) { + buttonItems.insert( + 0, + ContextMenuButtonItem( + label: 'Send email', + onPressed: () { + ContextMenuController.removeAny(); + _showDialog(context); + }, + ), + ); + } + return AdaptiveTextSelectionToolbar.buttonItems( + anchors: editableTextState.contextMenuAnchors, + buttonItems: buttonItems, + ); + }, ), ], ), diff --git a/examples/api/lib/material/context_menu/editable_text_toolbar_builder.2.dart b/examples/api/lib/material/context_menu/editable_text_toolbar_builder.2.dart index 025ef1d578b..9488bccb34a 100644 --- a/examples/api/lib/material/context_menu/editable_text_toolbar_builder.2.dart +++ b/examples/api/lib/material/context_menu/editable_text_toolbar_builder.2.dart @@ -22,7 +22,8 @@ class EditableTextToolbarBuilderExampleApp extends StatefulWidget { class _EditableTextToolbarBuilderExampleAppState extends State { final TextEditingController _controller = TextEditingController( - text: 'Right click (desktop) or long press (mobile) to see the menu with a custom toolbar.', + text: + 'Right click (desktop) or long press (mobile) to see the menu with a custom toolbar.', ); @override @@ -47,46 +48,59 @@ class _EditableTextToolbarBuilderExampleAppState Widget build(BuildContext context) { return MaterialApp( home: Scaffold( - appBar: AppBar(title: const Text('Custom toolbar, default-looking buttons')), + appBar: AppBar( + title: const Text('Custom toolbar, default-looking buttons'), + ), body: Center( child: Column( children: [ const SizedBox(height: 20.0), TextField( controller: _controller, - contextMenuBuilder: (BuildContext context, EditableTextState editableTextState) { - return _MyTextSelectionToolbar( - anchor: editableTextState.contextMenuAnchors.primaryAnchor, - // getAdaptiveButtons creates the default button widgets for - // the current platform. - children: AdaptiveTextSelectionToolbar.getAdaptiveButtons( - context, - // These buttons just close the menu when clicked. - [ - ContextMenuButtonItem( - label: 'One', - onPressed: () => ContextMenuController.removeAny(), - ), - ContextMenuButtonItem( - label: 'Two', - onPressed: () => ContextMenuController.removeAny(), - ), - ContextMenuButtonItem( - label: 'Three', - onPressed: () => ContextMenuController.removeAny(), - ), - ContextMenuButtonItem( - label: 'Four', - onPressed: () => ContextMenuController.removeAny(), - ), - ContextMenuButtonItem( - label: 'Five', - onPressed: () => ContextMenuController.removeAny(), - ), - ], - ).toList(), - ); - }, + contextMenuBuilder: + ( + BuildContext context, + EditableTextState editableTextState, + ) { + return _MyTextSelectionToolbar( + anchor: + editableTextState.contextMenuAnchors.primaryAnchor, + // getAdaptiveButtons creates the default button widgets for + // the current platform. + children: + AdaptiveTextSelectionToolbar.getAdaptiveButtons( + context, + // These buttons just close the menu when clicked. + [ + ContextMenuButtonItem( + label: 'One', + onPressed: () => + ContextMenuController.removeAny(), + ), + ContextMenuButtonItem( + label: 'Two', + onPressed: () => + ContextMenuController.removeAny(), + ), + ContextMenuButtonItem( + label: 'Three', + onPressed: () => + ContextMenuController.removeAny(), + ), + ContextMenuButtonItem( + label: 'Four', + onPressed: () => + ContextMenuController.removeAny(), + ), + ContextMenuButtonItem( + label: 'Five', + onPressed: () => + ContextMenuController.removeAny(), + ), + ], + ).toList(), + ); + }, ), ], ), @@ -115,7 +129,7 @@ class _MyTextSelectionToolbar extends StatelessWidget { child: Container( width: 200.0, height: 200.0, - color: Colors.cyanAccent.withOpacity(0.5), + color: Colors.cyanAccent.withValues(alpha: 0.5), child: GridView.count( padding: const EdgeInsets.all(12.0), crossAxisCount: 2, diff --git a/examples/api/lib/material/context_menu/selectable_region_toolbar_builder.0.dart b/examples/api/lib/material/context_menu/selectable_region_toolbar_builder.0.dart index 4b4964b0cf9..06f937fa21c 100644 --- a/examples/api/lib/material/context_menu/selectable_region_toolbar_builder.0.dart +++ b/examples/api/lib/material/context_menu/selectable_region_toolbar_builder.0.dart @@ -28,7 +28,8 @@ class _SelectableRegionToolbarBuilderExampleAppState Navigator.of(context).push( DialogRoute( context: context, - builder: (BuildContext context) => const AlertDialog(title: Text('You clicked print!')), + builder: (BuildContext context) => + const AlertDialog(title: Text('You clicked print!')), ), ); } @@ -61,7 +62,10 @@ class _SelectableRegionToolbarBuilderExampleAppState width: 200.0, child: SelectionArea( contextMenuBuilder: - (BuildContext context, SelectableRegionState selectableRegionState) { + ( + BuildContext context, + SelectableRegionState selectableRegionState, + ) { return AdaptiveTextSelectionToolbar.buttonItems( anchors: selectableRegionState.contextMenuAnchors, buttonItems: [ @@ -76,7 +80,9 @@ class _SelectableRegionToolbarBuilderExampleAppState ], ); }, - child: ListView(children: const [SizedBox(height: 20.0), Text(text)]), + child: ListView( + children: const [SizedBox(height: 20.0), Text(text)], + ), ), ), ), diff --git a/examples/api/lib/material/data_table/data_table.1.dart b/examples/api/lib/material/data_table/data_table.1.dart index f144141a8d1..87299ea991d 100644 --- a/examples/api/lib/material/data_table/data_table.1.dart +++ b/examples/api/lib/material/data_table/data_table.1.dart @@ -41,10 +41,14 @@ class _DataTableExampleState extends State { rows: List.generate( numItems, (int index) => DataRow( - color: WidgetStateProperty.resolveWith((Set states) { + color: WidgetStateProperty.resolveWith(( + Set states, + ) { // All rows will have the same selected color. if (states.contains(WidgetState.selected)) { - return Theme.of(context).colorScheme.primary.withValues(alpha: 0.08); + return Theme.of( + context, + ).colorScheme.primary.withValues(alpha: 0.08); } // Even rows will have a grey color. if (index.isEven) { diff --git a/examples/api/lib/material/date_picker/custom_calendar_date_picker.0.dart b/examples/api/lib/material/date_picker/custom_calendar_date_picker.0.dart index 1775062fecb..f29d75da7de 100644 --- a/examples/api/lib/material/date_picker/custom_calendar_date_picker.0.dart +++ b/examples/api/lib/material/date_picker/custom_calendar_date_picker.0.dart @@ -24,7 +24,8 @@ class CalendarDatePickerExample extends StatefulWidget { const CalendarDatePickerExample({super.key}); @override - State createState() => _CalendarDatePickerExampleState(); + State createState() => + _CalendarDatePickerExampleState(); } class _CalendarDatePickerExampleState extends State { @@ -90,7 +91,8 @@ class CustomCalendarDelegate extends CalendarDelegate { DateTime dateOnly(DateTime date) => DateUtils.dateOnly(date); @override - int monthDelta(DateTime startDate, DateTime endDate) => DateUtils.monthDelta(startDate, endDate); + int monthDelta(DateTime startDate, DateTime endDate) => + DateUtils.monthDelta(startDate, endDate); @override DateTime addMonthsToMonthDate(DateTime monthDate, int monthsToAdd) { @@ -98,7 +100,8 @@ class CustomCalendarDelegate extends CalendarDelegate { } @override - DateTime addDaysToDate(DateTime date, int days) => DateUtils.addDaysToDate(date, days); + DateTime addDaysToDate(DateTime date, int days) => + DateUtils.addDaysToDate(date, days); @override DateTime getMonth(int year, int month) => DateTime(year, month); @@ -117,7 +120,10 @@ class CustomCalendarDelegate extends CalendarDelegate { } @override - String formatShortMonthDay(DateTime date, MaterialLocalizations localizations) { + String formatShortMonthDay( + DateTime date, + MaterialLocalizations localizations, + ) { return localizations.formatShortMonthDay(date); } @@ -137,7 +143,10 @@ class CustomCalendarDelegate extends CalendarDelegate { } @override - DateTime? parseCompactDate(String? inputString, MaterialLocalizations localizations) { + DateTime? parseCompactDate( + String? inputString, + MaterialLocalizations localizations, + ) { return localizations.parseCompactDate(inputString); } diff --git a/examples/api/lib/material/date_picker/date_picker_theme_day_shape.0.dart b/examples/api/lib/material/date_picker/date_picker_theme_day_shape.0.dart index 723b10dd4c4..af521660631 100644 --- a/examples/api/lib/material/date_picker/date_picker_theme_day_shape.0.dart +++ b/examples/api/lib/material/date_picker/date_picker_theme_day_shape.0.dart @@ -16,13 +16,19 @@ class DatePickerApp extends StatelessWidget { return MaterialApp( theme: ThemeData( datePickerTheme: DatePickerThemeData( - todayBackgroundColor: const WidgetStatePropertyAll(Colors.amber), - todayForegroundColor: const WidgetStatePropertyAll(Colors.black), + todayBackgroundColor: const WidgetStatePropertyAll( + Colors.amber, + ), + todayForegroundColor: const WidgetStatePropertyAll( + Colors.black, + ), todayBorder: const BorderSide(width: 2), dayShape: WidgetStatePropertyAll( RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.0)), ), - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16.0)), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16.0), + ), ), ), home: const DatePickerExample(), diff --git a/examples/api/lib/material/date_picker/show_date_picker.0.dart b/examples/api/lib/material/date_picker/show_date_picker.0.dart index db8d2a6e7a4..da2a447f662 100644 --- a/examples/api/lib/material/date_picker/show_date_picker.0.dart +++ b/examples/api/lib/material/date_picker/show_date_picker.0.dart @@ -30,13 +30,16 @@ class DatePickerExample extends StatefulWidget { } /// RestorationProperty objects can be used because of RestorationMixin. -class _DatePickerExampleState extends State with RestorationMixin { +class _DatePickerExampleState extends State + with RestorationMixin { // In this example, the restoration ID for the mixin is passed in through // the [StatefulWidget]'s constructor. @override String? get restorationId => widget.restorationId; - final RestorableDateTime _selectedDate = RestorableDateTime(DateTime(2021, 7, 25)); + final RestorableDateTime _selectedDate = RestorableDateTime( + DateTime(2021, 7, 25), + ); late final RestorableRouteFuture _restorableDatePickerRouteFuture = RestorableRouteFuture( onComplete: _selectDate, @@ -49,7 +52,10 @@ class _DatePickerExampleState extends State with RestorationM ); @pragma('vm:entry-point') - static Route _datePickerRoute(BuildContext context, Object? arguments) { + static Route _datePickerRoute( + BuildContext context, + Object? arguments, + ) { return DialogRoute( context: context, builder: (BuildContext context) { @@ -67,7 +73,10 @@ class _DatePickerExampleState extends State with RestorationM @override void restoreState(RestorationBucket? oldBucket, bool initialRestore) { registerForRestoration(_selectedDate, 'selected_date'); - registerForRestoration(_restorableDatePickerRouteFuture, 'date_picker_route_future'); + registerForRestoration( + _restorableDatePickerRouteFuture, + 'date_picker_route_future', + ); } void _selectDate(DateTime? newSelectedDate) { diff --git a/examples/api/lib/material/date_picker/show_date_picker.1.dart b/examples/api/lib/material/date_picker/show_date_picker.1.dart index 5439e732581..f867b73c3e7 100644 --- a/examples/api/lib/material/date_picker/show_date_picker.1.dart +++ b/examples/api/lib/material/date_picker/show_date_picker.1.dart @@ -56,7 +56,10 @@ class _DatePickerExampleState extends State { ? '${selectedDate!.day}/${selectedDate!.month}/${selectedDate!.year}' : 'No date selected', ), - OutlinedButton(onPressed: _selectDate, child: const Text('Select Date')), + OutlinedButton( + onPressed: _selectDate, + child: const Text('Select Date'), + ), ], ); } diff --git a/examples/api/lib/material/date_picker/show_date_range_picker.0.dart b/examples/api/lib/material/date_picker/show_date_range_picker.0.dart index cbcf07551f6..8ab4f8f3962 100644 --- a/examples/api/lib/material/date_picker/show_date_range_picker.0.dart +++ b/examples/api/lib/material/date_picker/show_date_range_picker.0.dart @@ -30,27 +30,30 @@ class DatePickerExample extends StatefulWidget { } /// RestorationProperty objects can be used because of RestorationMixin. -class _DatePickerExampleState extends State with RestorationMixin { +class _DatePickerExampleState extends State + with RestorationMixin { // In this example, the restoration ID for the mixin is passed in through // the [StatefulWidget]'s constructor. @override String? get restorationId => widget.restorationId; final RestorableDateTimeN _startDate = RestorableDateTimeN(DateTime(2021)); - final RestorableDateTimeN _endDate = RestorableDateTimeN(DateTime(2021, 1, 5)); - late final RestorableRouteFuture _restorableDateRangePickerRouteFuture = - RestorableRouteFuture( - onComplete: _selectDateRange, - onPresent: (NavigatorState navigator, Object? arguments) { - return navigator.restorablePush( - _dateRangePickerRoute, - arguments: { - 'initialStartDate': _startDate.value?.millisecondsSinceEpoch, - 'initialEndDate': _endDate.value?.millisecondsSinceEpoch, - }, - ); + final RestorableDateTimeN _endDate = RestorableDateTimeN( + DateTime(2021, 1, 5), + ); + late final RestorableRouteFuture + _restorableDateRangePickerRouteFuture = RestorableRouteFuture( + onComplete: _selectDateRange, + onPresent: (NavigatorState navigator, Object? arguments) { + return navigator.restorablePush( + _dateRangePickerRoute, + arguments: { + 'initialStartDate': _startDate.value?.millisecondsSinceEpoch, + 'initialEndDate': _endDate.value?.millisecondsSinceEpoch, }, ); + }, + ); void _selectDateRange(DateTimeRange? newSelectedDate) { if (newSelectedDate != null) { @@ -65,17 +68,25 @@ class _DatePickerExampleState extends State with RestorationM void restoreState(RestorationBucket? oldBucket, bool initialRestore) { registerForRestoration(_startDate, 'start_date'); registerForRestoration(_endDate, 'end_date'); - registerForRestoration(_restorableDateRangePickerRouteFuture, 'date_picker_route_future'); + registerForRestoration( + _restorableDateRangePickerRouteFuture, + 'date_picker_route_future', + ); } @pragma('vm:entry-point') - static Route _dateRangePickerRoute(BuildContext context, Object? arguments) { + static Route _dateRangePickerRoute( + BuildContext context, + Object? arguments, + ) { return DialogRoute( context: context, builder: (BuildContext context) { return DateRangePickerDialog( restorationId: 'date_picker_dialog', - initialDateRange: _initialDateTimeRange(arguments! as Map), + initialDateRange: _initialDateTimeRange( + arguments! as Map, + ), firstDate: DateTime(2021), currentDate: DateTime(2021, 1, 25), lastDate: DateTime(2022), @@ -85,10 +96,15 @@ class _DatePickerExampleState extends State with RestorationM } static DateTimeRange? _initialDateTimeRange(Map arguments) { - if (arguments['initialStartDate'] != null && arguments['initialEndDate'] != null) { + if (arguments['initialStartDate'] != null && + arguments['initialEndDate'] != null) { return DateTimeRange( - start: DateTime.fromMillisecondsSinceEpoch(arguments['initialStartDate'] as int), - end: DateTime.fromMillisecondsSinceEpoch(arguments['initialEndDate'] as int), + start: DateTime.fromMillisecondsSinceEpoch( + arguments['initialStartDate'] as int, + ), + end: DateTime.fromMillisecondsSinceEpoch( + arguments['initialEndDate'] as int, + ), ); } diff --git a/examples/api/lib/material/dialog/alert_dialog.0.dart b/examples/api/lib/material/dialog/alert_dialog.0.dart index 7afbe1ed93f..c6ac864cdf2 100644 --- a/examples/api/lib/material/dialog/alert_dialog.0.dart +++ b/examples/api/lib/material/dialog/alert_dialog.0.dart @@ -38,7 +38,10 @@ class DialogExample extends StatelessWidget { onPressed: () => Navigator.pop(context, 'Cancel'), child: const Text('Cancel'), ), - TextButton(onPressed: () => Navigator.pop(context, 'OK'), child: const Text('OK')), + TextButton( + onPressed: () => Navigator.pop(context, 'OK'), + child: const Text('OK'), + ), ], ), ), diff --git a/examples/api/lib/material/dialog/alert_dialog.1.dart b/examples/api/lib/material/dialog/alert_dialog.1.dart index 5a4c6238a69..53781415394 100644 --- a/examples/api/lib/material/dialog/alert_dialog.1.dart +++ b/examples/api/lib/material/dialog/alert_dialog.1.dart @@ -39,7 +39,10 @@ class DialogExample extends StatelessWidget { onPressed: () => Navigator.pop(context, 'Cancel'), child: const Text('Cancel'), ), - TextButton(onPressed: () => Navigator.pop(context, 'OK'), child: const Text('OK')), + TextButton( + onPressed: () => Navigator.pop(context, 'OK'), + child: const Text('OK'), + ), ], ), ), diff --git a/examples/api/lib/material/dialog/show_dialog.0.dart b/examples/api/lib/material/dialog/show_dialog.0.dart index f9e716e4ee2..ea2079ae199 100644 --- a/examples/api/lib/material/dialog/show_dialog.0.dart +++ b/examples/api/lib/material/dialog/show_dialog.0.dart @@ -47,14 +47,18 @@ class DialogExample extends StatelessWidget { ), actions: [ TextButton( - style: TextButton.styleFrom(textStyle: Theme.of(context).textTheme.labelLarge), + style: TextButton.styleFrom( + textStyle: Theme.of(context).textTheme.labelLarge, + ), child: const Text('Disable'), onPressed: () { Navigator.of(context).pop(); }, ), TextButton( - style: TextButton.styleFrom(textStyle: Theme.of(context).textTheme.labelLarge), + style: TextButton.styleFrom( + textStyle: Theme.of(context).textTheme.labelLarge, + ), child: const Text('Enable'), onPressed: () { Navigator.of(context).pop(); diff --git a/examples/api/lib/material/dialog/show_dialog.1.dart b/examples/api/lib/material/dialog/show_dialog.1.dart index 2eef68574a9..ec561bad9b2 100644 --- a/examples/api/lib/material/dialog/show_dialog.1.dart +++ b/examples/api/lib/material/dialog/show_dialog.1.dart @@ -50,14 +50,18 @@ class DialogExample extends StatelessWidget { ), actions: [ TextButton( - style: TextButton.styleFrom(textStyle: Theme.of(context).textTheme.labelLarge), + style: TextButton.styleFrom( + textStyle: Theme.of(context).textTheme.labelLarge, + ), child: const Text('Disable'), onPressed: () { Navigator.of(context).pop(); }, ), TextButton( - style: TextButton.styleFrom(textStyle: Theme.of(context).textTheme.labelLarge), + style: TextButton.styleFrom( + textStyle: Theme.of(context).textTheme.labelLarge, + ), child: const Text('Enable'), onPressed: () { Navigator.of(context).pop(); diff --git a/examples/api/lib/material/dialog/show_dialog.2.dart b/examples/api/lib/material/dialog/show_dialog.2.dart index f2187f3ad06..8f3679c44fd 100644 --- a/examples/api/lib/material/dialog/show_dialog.2.dart +++ b/examples/api/lib/material/dialog/show_dialog.2.dart @@ -36,7 +36,10 @@ class DialogExample extends StatelessWidget { } @pragma('vm:entry-point') - static Route _dialogBuilder(BuildContext context, Object? arguments) { + static Route _dialogBuilder( + BuildContext context, + Object? arguments, + ) { return DialogRoute( context: context, builder: (BuildContext context) { @@ -50,14 +53,18 @@ class DialogExample extends StatelessWidget { ), actions: [ TextButton( - style: TextButton.styleFrom(textStyle: Theme.of(context).textTheme.labelLarge), + style: TextButton.styleFrom( + textStyle: Theme.of(context).textTheme.labelLarge, + ), child: const Text('Disable'), onPressed: () { Navigator.of(context).pop(); }, ), TextButton( - style: TextButton.styleFrom(textStyle: Theme.of(context).textTheme.labelLarge), + style: TextButton.styleFrom( + textStyle: Theme.of(context).textTheme.labelLarge, + ), child: const Text('Enable'), onPressed: () { Navigator.of(context).pop(); diff --git a/examples/api/lib/material/divider/divider.0.dart b/examples/api/lib/material/divider/divider.0.dart index 1d78b210dc6..8e50f00893b 100644 --- a/examples/api/lib/material/divider/divider.0.dart +++ b/examples/api/lib/material/divider/divider.0.dart @@ -36,7 +36,13 @@ class DividerExample extends StatelessWidget { child: Center(child: Text('Above')), ), ), - const Divider(height: 20, thickness: 5, indent: 20, endIndent: 0, color: Colors.black), + const Divider( + height: 20, + thickness: 5, + indent: 20, + endIndent: 0, + color: Colors.black, + ), // Subheader example from Material spec. // https://material.io/components/dividers#types Container( diff --git a/examples/api/lib/material/drawer/drawer.0.dart b/examples/api/lib/material/drawer/drawer.0.dart index 3c463a580ce..f466889b295 100644 --- a/examples/api/lib/material/drawer/drawer.0.dart +++ b/examples/api/lib/material/drawer/drawer.0.dart @@ -37,7 +37,10 @@ class _DrawerExampleState extends State { children: [ const DrawerHeader( decoration: BoxDecoration(color: Colors.blue), - child: Text('Drawer Header', style: TextStyle(color: Colors.white, fontSize: 24)), + child: Text( + 'Drawer Header', + style: TextStyle(color: Colors.white, fontSize: 24), + ), ), ListTile( leading: const Icon(Icons.message), diff --git a/examples/api/lib/material/dropdown/dropdown_button.selected_item_builder.0.dart b/examples/api/lib/material/dropdown/dropdown_button.selected_item_builder.0.dart index 661d226f9d7..58ceb3b611d 100644 --- a/examples/api/lib/material/dropdown/dropdown_button.selected_item_builder.0.dart +++ b/examples/api/lib/material/dropdown/dropdown_button.selected_item_builder.0.dart @@ -65,7 +65,10 @@ class _DropdownButtonExampleState extends State { constraints: const BoxConstraints(minWidth: 100), child: Text( item, - style: const TextStyle(color: Colors.blue, fontWeight: FontWeight.w600), + style: const TextStyle( + color: Colors.blue, + fontWeight: FontWeight.w600, + ), ), ); }).toList(); diff --git a/examples/api/lib/material/dropdown/dropdown_button.style.0.dart b/examples/api/lib/material/dropdown/dropdown_button.style.0.dart index d031d875baa..c52fcc42f56 100644 --- a/examples/api/lib/material/dropdown/dropdown_button.style.0.dart +++ b/examples/api/lib/material/dropdown/dropdown_button.style.0.dart @@ -54,7 +54,10 @@ class _DropdownButtonExampleState extends State { return options.map((String value) { return Align( alignment: Alignment.centerLeft, - child: Text(dropdownValue, style: const TextStyle(color: Colors.white)), + child: Text( + dropdownValue, + style: const TextStyle(color: Colors.white), + ), ); }).toList(); }, diff --git a/examples/api/lib/material/dropdown_menu/dropdown_menu.0.dart b/examples/api/lib/material/dropdown_menu/dropdown_menu.0.dart index b01007f76a5..efc04be7ce2 100644 --- a/examples/api/lib/material/dropdown_menu/dropdown_menu.0.dart +++ b/examples/api/lib/material/dropdown_menu/dropdown_menu.0.dart @@ -56,7 +56,11 @@ enum IconLabel { static final List entries = UnmodifiableListView( values.map( - (IconLabel icon) => IconEntry(value: icon, label: icon.label, leadingIcon: Icon(icon.icon)), + (IconLabel icon) => IconEntry( + value: icon, + label: icon.label, + leadingIcon: Icon(icon.icon), + ), ), ); } @@ -135,10 +139,15 @@ class _DropdownMenuExampleState extends State { mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, children: [ - Text('You selected a ${selectedColor?.label} ${selectedIcon?.label}'), + Text( + 'You selected a ${selectedColor?.label} ${selectedIcon?.label}', + ), Padding( padding: const EdgeInsets.symmetric(horizontal: 5), - child: Icon(selectedIcon?.icon, color: selectedColor?.color), + child: Icon( + selectedIcon?.icon, + color: selectedColor?.color, + ), ), ], ), diff --git a/examples/api/lib/material/dropdown_menu/dropdown_menu.2.dart b/examples/api/lib/material/dropdown_menu/dropdown_menu.2.dart index 36ef43cb398..c76f9a6d6cd 100644 --- a/examples/api/lib/material/dropdown_menu/dropdown_menu.2.dart +++ b/examples/api/lib/material/dropdown_menu/dropdown_menu.2.dart @@ -50,7 +50,10 @@ class _DropdownMenuExampleState extends State { tileColor: colorScheme.primaryContainer, title: const Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [Text('enabled: true'), Text('requestFocusOnTap: true')], + children: [ + Text('enabled: true'), + Text('requestFocusOnTap: true'), + ], ), subtitle: Column( children: [ @@ -65,7 +68,9 @@ class _DropdownMenuExampleState extends State { }, dropdownMenuEntries: menuEntries, ), - const Text('Text cursor is shown when hovering over the DropdownMenu.'), + const Text( + 'Text cursor is shown when hovering over the DropdownMenu.', + ), ], ), ), @@ -74,7 +79,10 @@ class _DropdownMenuExampleState extends State { tileColor: colorScheme.primaryContainer, title: const Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [Text('enabled: true'), Text('requestFocusOnTap: false')], + children: [ + Text('enabled: true'), + Text('requestFocusOnTap: false'), + ], ), subtitle: Column( children: [ @@ -89,7 +97,9 @@ class _DropdownMenuExampleState extends State { }, dropdownMenuEntries: menuEntries, ), - const Text('Clickable cursor is shown when hovering over the DropdownMenu.'), + const Text( + 'Clickable cursor is shown when hovering over the DropdownMenu.', + ), ], ), ), @@ -98,7 +108,10 @@ class _DropdownMenuExampleState extends State { tileColor: colorScheme.onInverseSurface, title: const Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [Text('enabled: false'), Text('requestFocusOnTap: true')], + children: [ + Text('enabled: false'), + Text('requestFocusOnTap: true'), + ], ), subtitle: Column( children: [ @@ -114,7 +127,9 @@ class _DropdownMenuExampleState extends State { }, dropdownMenuEntries: menuEntries, ), - const Text('Default cursor is shown when hovering over the DropdownMenu.'), + const Text( + 'Default cursor is shown when hovering over the DropdownMenu.', + ), ], ), ), @@ -123,7 +138,10 @@ class _DropdownMenuExampleState extends State { tileColor: colorScheme.onInverseSurface, title: const Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [Text('enabled: false'), Text('requestFocusOnTap: false')], + children: [ + Text('enabled: false'), + Text('requestFocusOnTap: false'), + ], ), subtitle: Column( children: [ @@ -139,7 +157,9 @@ class _DropdownMenuExampleState extends State { }, dropdownMenuEntries: menuEntries, ), - const Text('Default cursor is shown when hovering over the DropdownMenu.'), + const Text( + 'Default cursor is shown when hovering over the DropdownMenu.', + ), ], ), ), diff --git a/examples/api/lib/material/dropdown_menu/dropdown_menu_entry_label_widget.0.dart b/examples/api/lib/material/dropdown_menu/dropdown_menu_entry_label_widget.0.dart index 5d56feb8d3e..ee58b6d307b 100644 --- a/examples/api/lib/material/dropdown_menu/dropdown_menu_entry_label_widget.0.dart +++ b/examples/api/lib/material/dropdown_menu/dropdown_menu_entry_label_widget.0.dart @@ -26,7 +26,8 @@ class DropdownMenuEntryLabelWidgetExample extends StatefulWidget { _DropdownMenuEntryLabelWidgetExampleState(); } -class _DropdownMenuEntryLabelWidgetExampleState extends State { +class _DropdownMenuEntryLabelWidgetExampleState + extends State { late final TextEditingController controller; @override @@ -57,16 +58,22 @@ class _DropdownMenuEntryLabelWidgetExampleState extends State>((ColorItem item) { - final String labelText = '${item.label} $longText\n'; - return DropdownMenuEntry( - value: item, - label: labelText, - // Try commenting the labelWidget out or changing - // the labelWidget's Text parameters. - labelWidget: Text(labelText, maxLines: 1, overflow: TextOverflow.ellipsis), - ); - }).toList(), + dropdownMenuEntries: ColorItem.values + .map>((ColorItem item) { + final String labelText = '${item.label} $longText\n'; + return DropdownMenuEntry( + value: item, + label: labelText, + // Try commenting the labelWidget out or changing + // the labelWidget's Text parameters. + labelWidget: Text( + labelText, + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ); + }) + .toList(), ), ), ); diff --git a/examples/api/lib/material/elevated_button/elevated_button.0.dart b/examples/api/lib/material/elevated_button/elevated_button.0.dart index 65180c17dcd..4fc174803ab 100644 --- a/examples/api/lib/material/elevated_button/elevated_button.0.dart +++ b/examples/api/lib/material/elevated_button/elevated_button.0.dart @@ -32,15 +32,25 @@ class ElevatedButtonExample extends StatefulWidget { class _ElevatedButtonExampleState extends State { @override Widget build(BuildContext context) { - final ButtonStyle style = ElevatedButton.styleFrom(textStyle: const TextStyle(fontSize: 20)); + final ButtonStyle style = ElevatedButton.styleFrom( + textStyle: const TextStyle(fontSize: 20), + ); return Center( child: Column( mainAxisSize: MainAxisSize.min, children: [ - ElevatedButton(style: style, onPressed: null, child: const Text('Disabled')), + ElevatedButton( + style: style, + onPressed: null, + child: const Text('Disabled'), + ), const SizedBox(height: 30), - ElevatedButton(style: style, onPressed: () {}, child: const Text('Enabled')), + ElevatedButton( + style: style, + onPressed: () {}, + child: const Text('Enabled'), + ), ], ), ); diff --git a/examples/api/lib/material/expansion_panel/expansion_panel_list.0.dart b/examples/api/lib/material/expansion_panel/expansion_panel_list.0.dart index 8cc64056af2..50acb5865fd 100644 --- a/examples/api/lib/material/expansion_panel/expansion_panel_list.0.dart +++ b/examples/api/lib/material/expansion_panel/expansion_panel_list.0.dart @@ -24,7 +24,11 @@ class ExpansionPanelListExampleApp extends StatelessWidget { // stores ExpansionPanel state information class Item { - Item({required this.expandedValue, required this.headerValue, this.isExpanded = false}); + Item({ + required this.expandedValue, + required this.headerValue, + this.isExpanded = false, + }); String expandedValue; String headerValue; @@ -33,7 +37,10 @@ class Item { List generateItems(int numberOfItems) { return List.generate(numberOfItems, (int index) { - return Item(headerValue: 'Panel $index', expandedValue: 'This is item number $index'); + return Item( + headerValue: 'Panel $index', + expandedValue: 'This is item number $index', + ); }); } @@ -41,7 +48,8 @@ class ExpansionPanelListExample extends StatefulWidget { const ExpansionPanelListExample({super.key}); @override - State createState() => _ExpansionPanelListExampleState(); + State createState() => + _ExpansionPanelListExampleState(); } class _ExpansionPanelListExampleState extends State { @@ -66,7 +74,9 @@ class _ExpansionPanelListExampleState extends State { }, body: ListTile( title: Text(item.expandedValue), - subtitle: const Text('To delete this panel, tap the trash can icon'), + subtitle: const Text( + 'To delete this panel, tap the trash can icon', + ), trailing: const Icon(Icons.delete), onTap: () { setState(() { diff --git a/examples/api/lib/material/expansion_panel/expansion_panel_list.expansion_panel_list_radio.0.dart b/examples/api/lib/material/expansion_panel/expansion_panel_list.expansion_panel_list_radio.0.dart index 9fc8c7b5781..bc0c130b395 100644 --- a/examples/api/lib/material/expansion_panel/expansion_panel_list.expansion_panel_list_radio.0.dart +++ b/examples/api/lib/material/expansion_panel/expansion_panel_list.expansion_panel_list_radio.0.dart @@ -24,7 +24,11 @@ class ExpansionPanelListRadioExampleApp extends StatelessWidget { // stores ExpansionPanel state information class Item { - Item({required this.id, required this.expandedValue, required this.headerValue}); + Item({ + required this.id, + required this.expandedValue, + required this.headerValue, + }); int id; String expandedValue; @@ -45,10 +49,12 @@ class ExpansionPanelListRadioExample extends StatefulWidget { const ExpansionPanelListRadioExample({super.key}); @override - State createState() => _ExpansionPanelListRadioExampleState(); + State createState() => + _ExpansionPanelListRadioExampleState(); } -class _ExpansionPanelListRadioExampleState extends State { +class _ExpansionPanelListRadioExampleState + extends State { final List _data = generateItems(8); @override @@ -67,7 +73,9 @@ class _ExpansionPanelListRadioExampleState extends State { title: const Text('ExpansionTile 2'), subtitle: const Text('Custom expansion arrow icon'), trailing: Icon( - _customTileExpanded ? Icons.arrow_drop_down_circle : Icons.arrow_drop_down, + _customTileExpanded + ? Icons.arrow_drop_down_circle + : Icons.arrow_drop_down, ), - children: const [ListTile(title: Text('This is tile number 2'))], + children: const [ + ListTile(title: Text('This is tile number 2')), + ], onExpansionChanged: (bool expanded) { setState(() { _customTileExpanded = expanded; diff --git a/examples/api/lib/material/expansion_tile/expansion_tile.1.dart b/examples/api/lib/material/expansion_tile/expansion_tile.1.dart index f8c6a3ffa5a..f28725cd61d 100644 --- a/examples/api/lib/material/expansion_tile/expansion_tile.1.dart +++ b/examples/api/lib/material/expansion_tile/expansion_tile.1.dart @@ -4,7 +4,7 @@ import 'package:flutter/material.dart'; -/// Flutter code sample for [ExpansionTile] and [ExpansionTileController]. +/// Flutter code sample for [ExpansionTile] and [ExpansibleController]. void main() { runApp(const ExpansionTileControllerApp()); @@ -14,11 +14,13 @@ class ExpansionTileControllerApp extends StatefulWidget { const ExpansionTileControllerApp({super.key}); @override - State createState() => _ExpansionTileControllerAppState(); + State createState() => + _ExpansionTileControllerAppState(); } -class _ExpansionTileControllerAppState extends State { - final ExpansionTileController controller = ExpansionTileController(); +class _ExpansionTileControllerAppState + extends State { + final ExpansibleController controller = ExpansibleController(); @override Widget build(BuildContext context) { @@ -66,7 +68,7 @@ class _ExpansionTileControllerAppState extends State child: ElevatedButton( child: const Text('Collapse This Tile'), onPressed: () { - return ExpansionTileController.of(context).collapse(); + return ExpansibleController.of(context).collapse(); }, ), ); diff --git a/examples/api/lib/material/expansion_tile/expansion_tile.2.dart b/examples/api/lib/material/expansion_tile/expansion_tile.2.dart index 66267cd4a5c..ecaf621b3e3 100644 --- a/examples/api/lib/material/expansion_tile/expansion_tile.2.dart +++ b/examples/api/lib/material/expansion_tile/expansion_tile.2.dart @@ -12,21 +12,26 @@ void main() { enum AnimationStyles { defaultStyle, custom, none } -const List<(AnimationStyles, String)> animationStyleSegments = <(AnimationStyles, String)>[ - (AnimationStyles.defaultStyle, 'Default'), - (AnimationStyles.custom, 'Custom'), - (AnimationStyles.none, 'None'), -]; +const List<(AnimationStyles, String)> animationStyleSegments = + <(AnimationStyles, String)>[ + (AnimationStyles.defaultStyle, 'Default'), + (AnimationStyles.custom, 'Custom'), + (AnimationStyles.none, 'None'), + ]; class ExpansionTileAnimationStyleApp extends StatefulWidget { const ExpansionTileAnimationStyleApp({super.key}); @override - State createState() => _ExpansionTileAnimationStyleAppState(); + State createState() => + _ExpansionTileAnimationStyleAppState(); } -class _ExpansionTileAnimationStyleAppState extends State { - Set _animationStyleSelection = {AnimationStyles.defaultStyle}; +class _ExpansionTileAnimationStyleAppState + extends State { + Set _animationStyleSelection = { + AnimationStyles.defaultStyle, + }; AnimationStyle? _animationStyle; @override @@ -55,11 +60,16 @@ class _ExpansionTileAnimationStyleAppState extends State>(( - (AnimationStyles, String) shirt, - ) { - return ButtonSegment(value: shirt.$1, label: Text(shirt.$2)); - }).toList(), + segments: animationStyleSegments + .map>(( + (AnimationStyles, String) shirt, + ) { + return ButtonSegment( + value: shirt.$1, + label: Text(shirt.$2), + ); + }) + .toList(), ), const SizedBox(height: 20), ExpansionTile( diff --git a/examples/api/lib/material/filled_button/filled_button.0.dart b/examples/api/lib/material/filled_button/filled_button.0.dart index 342b6c87cc7..4bf4e4c99bd 100644 --- a/examples/api/lib/material/filled_button/filled_button.0.dart +++ b/examples/api/lib/material/filled_button/filled_button.0.dart @@ -39,9 +39,15 @@ class FilledButtonApp extends StatelessWidget { const SizedBox(height: 30), const Text('Filled tonal'), const SizedBox(height: 15), - FilledButton.tonal(onPressed: () {}, child: const Text('Enabled')), + FilledButton.tonal( + onPressed: () {}, + child: const Text('Enabled'), + ), const SizedBox(height: 30), - const FilledButton.tonal(onPressed: null, child: Text('Disabled')), + const FilledButton.tonal( + onPressed: null, + child: Text('Disabled'), + ), ], ), ], diff --git a/examples/api/lib/material/flexible_space_bar/flexible_space_bar.0.dart b/examples/api/lib/material/flexible_space_bar/flexible_space_bar.0.dart index fe5c0ed2915..623570abfdf 100644 --- a/examples/api/lib/material/flexible_space_bar/flexible_space_bar.0.dart +++ b/examples/api/lib/material/flexible_space_bar/flexible_space_bar.0.dart @@ -20,7 +20,9 @@ class FlexibleSpaceBarExampleApp extends StatelessWidget { ), home: Scaffold( body: CustomScrollView( - physics: const BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics()), + physics: const BouncingScrollPhysics( + parent: AlwaysScrollableScrollPhysics(), + ), slivers: [ SliverAppBar( stretch: true, diff --git a/examples/api/lib/material/floating_action_button/floating_action_button.0.dart b/examples/api/lib/material/floating_action_button/floating_action_button.0.dart index fd3fad45644..893130b2051 100644 --- a/examples/api/lib/material/floating_action_button/floating_action_button.0.dart +++ b/examples/api/lib/material/floating_action_button/floating_action_button.0.dart @@ -23,10 +23,12 @@ class FloatingActionButtonExample extends StatefulWidget { const FloatingActionButtonExample({super.key}); @override - State createState() => _FloatingActionButtonExampleState(); + State createState() => + _FloatingActionButtonExampleState(); } -class _FloatingActionButtonExampleState extends State { +class _FloatingActionButtonExampleState + extends State { // The FAB's foregroundColor, backgroundColor, and shape static const List<(Color?, Color? background, ShapeBorder?)> customizations = <(Color?, Color?, ShapeBorder?)>[ diff --git a/examples/api/lib/material/floating_action_button/floating_action_button.2.dart b/examples/api/lib/material/floating_action_button/floating_action_button.2.dart index c62616b7a8f..716c5ca06c4 100644 --- a/examples/api/lib/material/floating_action_button/floating_action_button.2.dart +++ b/examples/api/lib/material/floating_action_button/floating_action_button.2.dart @@ -32,7 +32,10 @@ class FloatingActionButtonExample extends StatelessWidget { ), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), - child: Text(title, style: TextStyle(color: colorScheme.onInverseSurface)), + child: Text( + title, + style: TextStyle(color: colorScheme.onInverseSurface), + ), ), ); } diff --git a/examples/api/lib/material/floating_action_button_location/standard_fab_location.0.dart b/examples/api/lib/material/floating_action_button_location/standard_fab_location.0.dart index 51a1c0ced6f..d9e95e692bd 100644 --- a/examples/api/lib/material/floating_action_button_location/standard_fab_location.0.dart +++ b/examples/api/lib/material/floating_action_button_location/standard_fab_location.0.dart @@ -17,13 +17,17 @@ class StandardFabLocationExampleApp extends StatelessWidget { } } -class AlmostEndFloatFabLocation extends StandardFabLocation with FabEndOffsetX, FabFloatOffsetY { +class AlmostEndFloatFabLocation extends StandardFabLocation + with FabEndOffsetX, FabFloatOffsetY { @override - double getOffsetX(ScaffoldPrelayoutGeometry scaffoldGeometry, double adjustment) { - final double directionalAdjustment = scaffoldGeometry.textDirection == TextDirection.ltr - ? -50.0 - : 50.0; - return super.getOffsetX(scaffoldGeometry, adjustment) + directionalAdjustment; + double getOffsetX( + ScaffoldPrelayoutGeometry scaffoldGeometry, + double adjustment, + ) { + final double directionalAdjustment = + scaffoldGeometry.textDirection == TextDirection.ltr ? -50.0 : 50.0; + return super.getOffsetX(scaffoldGeometry, adjustment) + + directionalAdjustment; } } diff --git a/examples/api/lib/material/icon_button/icon_button.1.dart b/examples/api/lib/material/icon_button/icon_button.1.dart index 5a6b2ed1e47..2bc28d1acf8 100644 --- a/examples/api/lib/material/icon_button/icon_button.1.dart +++ b/examples/api/lib/material/icon_button/icon_button.1.dart @@ -32,8 +32,15 @@ class IconButtonExample extends StatelessWidget { color: Colors.white, child: Center( child: Ink( - decoration: const ShapeDecoration(color: Colors.lightBlue, shape: CircleBorder()), - child: IconButton(icon: const Icon(Icons.android), color: Colors.white, onPressed: () {}), + decoration: const ShapeDecoration( + color: Colors.lightBlue, + shape: CircleBorder(), + ), + child: IconButton( + icon: const Icon(Icons.android), + color: Colors.white, + onPressed: () {}, + ), ), ), ); diff --git a/examples/api/lib/material/icon_button/icon_button.2.dart b/examples/api/lib/material/icon_button/icon_button.2.dart index 9d7b0418c04..1884860049d 100644 --- a/examples/api/lib/material/icon_button/icon_button.2.dart +++ b/examples/api/lib/material/icon_button/icon_button.2.dart @@ -56,16 +56,28 @@ class ButtonTypesGroup extends StatelessWidget { child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - IconButton(icon: const Icon(Icons.filter_drama), onPressed: onPressed), + IconButton( + icon: const Icon(Icons.filter_drama), + onPressed: onPressed, + ), // Filled icon button - IconButton.filled(onPressed: onPressed, icon: const Icon(Icons.filter_drama)), + IconButton.filled( + onPressed: onPressed, + icon: const Icon(Icons.filter_drama), + ), // Filled tonal icon button - IconButton.filledTonal(onPressed: onPressed, icon: const Icon(Icons.filter_drama)), + IconButton.filledTonal( + onPressed: onPressed, + icon: const Icon(Icons.filter_drama), + ), // Outlined icon button - IconButton.outlined(onPressed: onPressed, icon: const Icon(Icons.filter_drama)), + IconButton.outlined( + onPressed: onPressed, + icon: const Icon(Icons.filter_drama), + ), ], ), ); diff --git a/examples/api/lib/material/ink/ink.image_clip.0.dart b/examples/api/lib/material/ink/ink.image_clip.0.dart index 4b679c716ba..38fc7d4d951 100644 --- a/examples/api/lib/material/ink/ink.image_clip.0.dart +++ b/examples/api/lib/material/ink/ink.image_clip.0.dart @@ -46,7 +46,10 @@ class ImageClipExample extends StatelessWidget { padding: EdgeInsets.all(10.0), child: Text( 'PUFFIN', - style: TextStyle(fontWeight: FontWeight.w900, color: Colors.white), + style: TextStyle( + fontWeight: FontWeight.w900, + color: Colors.white, + ), ), ), ), diff --git a/examples/api/lib/material/ink/ink.image_clip.1.dart b/examples/api/lib/material/ink/ink.image_clip.1.dart index 4074377aae5..8c6dc81a3d0 100644 --- a/examples/api/lib/material/ink/ink.image_clip.1.dart +++ b/examples/api/lib/material/ink/ink.image_clip.1.dart @@ -47,7 +47,10 @@ class ImageClipExample extends StatelessWidget { padding: EdgeInsets.all(10.0), child: Text( 'PUFFIN', - style: TextStyle(fontWeight: FontWeight.w900, color: Colors.white), + style: TextStyle( + fontWeight: FontWeight.w900, + color: Colors.white, + ), ), ), ), diff --git a/examples/api/lib/material/input_chip/input_chip.1.dart b/examples/api/lib/material/input_chip/input_chip.1.dart index 506944b69b2..2397d1379a6 100644 --- a/examples/api/lib/material/input_chip/input_chip.1.dart +++ b/examples/api/lib/material/input_chip/input_chip.1.dart @@ -69,7 +69,10 @@ class EditableChipFieldExampleState extends State { child: ListView.builder( itemCount: _suggestions.length, itemBuilder: (BuildContext context, int index) { - return ToppingSuggestion(_suggestions[index], onTap: _selectSuggestion); + return ToppingSuggestion( + _suggestions[index], + onTap: _selectSuggestion, + ); }, ), ), @@ -81,12 +84,18 @@ class EditableChipFieldExampleState extends State { Future _onSearchChanged(String value) async { final List results = await _suggestionCallback(value); setState(() { - _suggestions = results.where((String topping) => !_toppings.contains(topping)).toList(); + _suggestions = results + .where((String topping) => !_toppings.contains(topping)) + .toList(); }); } Widget _chipBuilder(BuildContext context, String topping) { - return ToppingInputChip(topping: topping, onDeleted: _onChipDeleted, onSelected: _onChipTapped); + return ToppingInputChip( + topping: topping, + onDeleted: _onChipDeleted, + onSelected: _onChipTapped, + ); } void _selectSuggestion(String topping) { @@ -175,7 +184,9 @@ class ChipsInputState extends State> { void initState() { super.initState(); - controller = ChipsInputEditingController([...widget.values], widget.chipBuilder); + controller = ChipsInputEditingController([ + ...widget.values, + ], widget.chipBuilder); controller.addListener(_textListener); } @@ -223,7 +234,9 @@ class ChipsInputState extends State> { static int countReplacements(String text) { return text.codeUnits - .where((int u) => u == ChipsInputEditingController.kObjectReplacementChar) + .where( + (int u) => u == ChipsInputEditingController.kObjectReplacementChar, + ) .length; } @@ -238,8 +251,10 @@ class ChipsInputState extends State> { style: widget.style, strutStyle: widget.strutStyle, controller: controller, - onChanged: (String value) => widget.onTextChanged?.call(controller.textWithoutReplacements), - onSubmitted: (String value) => widget.onSubmitted?.call(controller.textWithoutReplacements), + onChanged: (String value) => + widget.onTextChanged?.call(controller.textWithoutReplacements), + onSubmitted: (String value) => + widget.onSubmitted?.call(controller.textWithoutReplacements), ); } } @@ -291,7 +306,8 @@ class ChipsInputEditingController extends TextEditingController { style: style, children: [ ...chipWidgets, - if (textWithoutReplacements.isNotEmpty) TextSpan(text: textWithoutReplacements), + if (textWithoutReplacements.isNotEmpty) + TextSpan(text: textWithoutReplacements), ], ); } diff --git a/examples/api/lib/material/input_decorator/input_decoration.1.dart b/examples/api/lib/material/input_decorator/input_decoration.1.dart index 350a9314d5e..15e8feac84d 100644 --- a/examples/api/lib/material/input_decorator/input_decoration.1.dart +++ b/examples/api/lib/material/input_decorator/input_decoration.1.dart @@ -28,7 +28,10 @@ class InputDecorationExample extends StatelessWidget { @override Widget build(BuildContext context) { return const TextField( - decoration: InputDecoration.collapsed(hintText: 'Hint Text', border: OutlineInputBorder()), + decoration: InputDecoration.collapsed( + hintText: 'Hint Text', + border: OutlineInputBorder(), + ), ); } } diff --git a/examples/api/lib/material/input_decorator/input_decoration.floating_label_style_error.0.dart b/examples/api/lib/material/input_decorator/input_decoration.floating_label_style_error.0.dart index 38954c53cec..54075d2713c 100644 --- a/examples/api/lib/material/input_decorator/input_decoration.floating_label_style_error.0.dart +++ b/examples/api/lib/material/input_decorator/input_decoration.floating_label_style_error.0.dart @@ -34,7 +34,9 @@ class InputDecoratorExample extends StatelessWidget { // The WidgetStateProperty's value is a text style that is orange // by default, but the theme's error color if the input decorator // is in its error state. - floatingLabelStyle: WidgetStateTextStyle.resolveWith((Set states) { + floatingLabelStyle: WidgetStateTextStyle.resolveWith(( + Set states, + ) { final Color color = states.contains(WidgetState.error) ? Theme.of(context).colorScheme.error : Colors.orange; diff --git a/examples/api/lib/material/input_decorator/input_decoration.helper.0.dart b/examples/api/lib/material/input_decorator/input_decoration.helper.0.dart index e9cbd51d9ab..5e405100343 100644 --- a/examples/api/lib/material/input_decorator/input_decoration.helper.0.dart +++ b/examples/api/lib/material/input_decorator/input_decoration.helper.0.dart @@ -34,7 +34,13 @@ class HelperExample extends StatelessWidget { TextSpan( children: [ WidgetSpan(child: Text('Helper Text ')), - WidgetSpan(child: Icon(Icons.help_outline, color: Colors.blue, size: 20.0)), + WidgetSpan( + child: Icon( + Icons.help_outline, + color: Colors.blue, + size: 20.0, + ), + ), ], ), ), diff --git a/examples/api/lib/material/input_decorator/input_decoration.prefix_icon.0.dart b/examples/api/lib/material/input_decorator/input_decoration.prefix_icon.0.dart index cbaebf7471a..7e3d2499f4a 100644 --- a/examples/api/lib/material/input_decorator/input_decoration.prefix_icon.0.dart +++ b/examples/api/lib/material/input_decorator/input_decoration.prefix_icon.0.dart @@ -26,7 +26,11 @@ class InputDecoratorExample extends StatelessWidget { decoration: InputDecoration( border: OutlineInputBorder(), labelText: 'Enter name', - prefixIcon: Align(widthFactor: 1.0, heightFactor: 1.0, child: Icon(Icons.person)), + prefixIcon: Align( + widthFactor: 1.0, + heightFactor: 1.0, + child: Icon(Icons.person), + ), ), ); } diff --git a/examples/api/lib/material/input_decorator/input_decoration.prefix_icon_constraints.0.dart b/examples/api/lib/material/input_decorator/input_decoration.prefix_icon_constraints.0.dart index ee0053818e4..eb781afee09 100644 --- a/examples/api/lib/material/input_decorator/input_decoration.prefix_icon_constraints.0.dart +++ b/examples/api/lib/material/input_decorator/input_decoration.prefix_icon_constraints.0.dart @@ -44,7 +44,10 @@ class PrefixIconConstraintsExample extends StatelessWidget { isDense: true, hintText: 'Smaller Icon Constraints', prefixIcon: Icon(Icons.search), - prefixIconConstraints: BoxConstraints(minHeight: 32, minWidth: 32), + prefixIconConstraints: BoxConstraints( + minHeight: 32, + minWidth: 32, + ), ), ), ], diff --git a/examples/api/lib/material/input_decorator/input_decoration.suffix_icon.0.dart b/examples/api/lib/material/input_decorator/input_decoration.suffix_icon.0.dart index 9d0cca38437..6e3718af540 100644 --- a/examples/api/lib/material/input_decorator/input_decoration.suffix_icon.0.dart +++ b/examples/api/lib/material/input_decorator/input_decoration.suffix_icon.0.dart @@ -26,7 +26,11 @@ class InputDecoratorExample extends StatelessWidget { decoration: InputDecoration( border: OutlineInputBorder(), labelText: 'Enter password', - suffixIcon: Align(widthFactor: 1.0, heightFactor: 1.0, child: Icon(Icons.remove_red_eye)), + suffixIcon: Align( + widthFactor: 1.0, + heightFactor: 1.0, + child: Icon(Icons.remove_red_eye), + ), ), ); } diff --git a/examples/api/lib/material/input_decorator/input_decoration.suffix_icon_constraints.0.dart b/examples/api/lib/material/input_decorator/input_decoration.suffix_icon_constraints.0.dart index 9489a4201df..df1422d7abd 100644 --- a/examples/api/lib/material/input_decorator/input_decoration.suffix_icon_constraints.0.dart +++ b/examples/api/lib/material/input_decorator/input_decoration.suffix_icon_constraints.0.dart @@ -44,7 +44,10 @@ class SuffixIconConstraintsExample extends StatelessWidget { isDense: true, hintText: 'Smaller Icon Constraints', suffixIcon: Icon(Icons.search), - suffixIconConstraints: BoxConstraints(minHeight: 32, minWidth: 32), + suffixIconConstraints: BoxConstraints( + minHeight: 32, + minWidth: 32, + ), ), ), ], diff --git a/examples/api/lib/material/input_decorator/input_decoration.widget_state.0.dart b/examples/api/lib/material/input_decorator/input_decoration.widget_state.0.dart index f691c93b315..d72d840150c 100644 --- a/examples/api/lib/material/input_decorator/input_decoration.widget_state.0.dart +++ b/examples/api/lib/material/input_decorator/input_decoration.widget_state.0.dart @@ -31,10 +31,12 @@ class MaterialStateExample extends StatelessWidget { initialValue: 'abc', decoration: const InputDecoration( prefixIcon: Icon(Icons.person), - prefixIconColor: WidgetStateColor.fromMap({ - WidgetState.focused: Colors.green, - WidgetState.any: Colors.grey, - }), + prefixIconColor: WidgetStateColor.fromMap( + { + WidgetState.focused: Colors.green, + WidgetState.any: Colors.grey, + }, + ), ), ); } diff --git a/examples/api/lib/material/input_decorator/input_decoration.widget_state.1.dart b/examples/api/lib/material/input_decorator/input_decoration.widget_state.1.dart index d9568c1ec60..9250a581927 100644 --- a/examples/api/lib/material/input_decorator/input_decoration.widget_state.1.dart +++ b/examples/api/lib/material/input_decorator/input_decoration.widget_state.1.dart @@ -28,11 +28,12 @@ class MaterialStateExample extends StatelessWidget { @override Widget build(BuildContext context) { return InputDecorationTheme( - prefixIconColor: const WidgetStateColor.fromMap({ - WidgetState.error: Colors.red, - WidgetState.focused: Colors.blue, - WidgetState.any: Colors.grey, - }), + prefixIconColor: + const WidgetStateColor.fromMap({ + WidgetState.error: Colors.red, + WidgetState.focused: Colors.blue, + WidgetState.any: Colors.grey, + }), child: TextFormField( initialValue: 'example.com', decoration: const InputDecoration(prefixIcon: Icon(Icons.web)), diff --git a/examples/api/lib/material/list_tile/custom_list_item.0.dart b/examples/api/lib/material/list_tile/custom_list_item.0.dart index 7d9d69a8027..24ca8ce96b8 100644 --- a/examples/api/lib/material/list_tile/custom_list_item.0.dart +++ b/examples/api/lib/material/list_tile/custom_list_item.0.dart @@ -41,7 +41,11 @@ class CustomListItem extends StatelessWidget { Expanded(flex: 2, child: thumbnail), Expanded( flex: 3, - child: _VideoDescription(title: title, user: user, viewCount: viewCount), + child: _VideoDescription( + title: title, + user: user, + viewCount: viewCount, + ), ), const Icon(Icons.more_vert, size: 16.0), ], @@ -51,7 +55,11 @@ class CustomListItem extends StatelessWidget { } class _VideoDescription extends StatelessWidget { - const _VideoDescription({required this.title, required this.user, required this.viewCount}); + const _VideoDescription({ + required this.title, + required this.user, + required this.viewCount, + }); final String title; final String user; @@ -64,7 +72,10 @@ class _VideoDescription extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(title, style: const TextStyle(fontWeight: FontWeight.w500, fontSize: 14.0)), + Text( + title, + style: const TextStyle(fontWeight: FontWeight.w500, fontSize: 14.0), + ), const Padding(padding: EdgeInsets.symmetric(vertical: 2.0)), Text(user, style: const TextStyle(fontSize: 10.0)), const Padding(padding: EdgeInsets.symmetric(vertical: 1.0)), @@ -89,13 +100,17 @@ class CustomListItemExample extends StatelessWidget { CustomListItem( user: 'Flutter', viewCount: 999000, - thumbnail: Container(decoration: const BoxDecoration(color: Colors.blue)), + thumbnail: Container( + decoration: const BoxDecoration(color: Colors.blue), + ), title: 'The Flutter YouTube Channel', ), CustomListItem( user: 'Dash', viewCount: 884000, - thumbnail: Container(decoration: const BoxDecoration(color: Colors.yellow)), + thumbnail: Container( + decoration: const BoxDecoration(color: Colors.yellow), + ), title: 'Announcing Flutter 1.0', ), ], diff --git a/examples/api/lib/material/list_tile/custom_list_item.1.dart b/examples/api/lib/material/list_tile/custom_list_item.1.dart index f326e7659d4..1ec07e65242 100644 --- a/examples/api/lib/material/list_tile/custom_list_item.1.dart +++ b/examples/api/lib/material/list_tile/custom_list_item.1.dart @@ -52,7 +52,10 @@ class _ArticleDescription extends StatelessWidget { style: const TextStyle(fontSize: 12.0, color: Colors.black54), ), ), - Text(author, style: const TextStyle(fontSize: 12.0, color: Colors.black87)), + Text( + author, + style: const TextStyle(fontSize: 12.0, color: Colors.black87), + ), Text( '$publishDate - $readDuration', style: const TextStyle(fontSize: 12.0, color: Colors.black54), @@ -120,7 +123,9 @@ class CustomListItemExample extends StatelessWidget { padding: const EdgeInsets.all(10.0), children: [ CustomListItemTwo( - thumbnail: Container(decoration: const BoxDecoration(color: Colors.pink)), + thumbnail: Container( + decoration: const BoxDecoration(color: Colors.pink), + ), title: 'Flutter 1.0 Launch', subtitle: 'Flutter continues to improve and expand its horizons. ' @@ -130,7 +135,9 @@ class CustomListItemExample extends StatelessWidget { readDuration: '5 mins', ), CustomListItemTwo( - thumbnail: Container(decoration: const BoxDecoration(color: Colors.blue)), + thumbnail: Container( + decoration: const BoxDecoration(color: Colors.blue), + ), title: 'Flutter 1.2 Release - Continual updates to the framework', subtitle: 'Flutter once again improves and makes updates.', author: 'Flutter', diff --git a/examples/api/lib/material/list_tile/list_tile.0.dart b/examples/api/lib/material/list_tile/list_tile.0.dart index f0d084b994e..230955eda0a 100644 --- a/examples/api/lib/material/list_tile/list_tile.0.dart +++ b/examples/api/lib/material/list_tile/list_tile.0.dart @@ -14,7 +14,9 @@ class ListTileApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( - theme: ThemeData(listTileTheme: const ListTileThemeData(textColor: Colors.white)), + theme: ThemeData( + listTileTheme: const ListTileThemeData(textColor: Colors.white), + ), home: const ListTileExample(), ); } @@ -27,7 +29,8 @@ class ListTileExample extends StatefulWidget { State createState() => _ListTileExampleState(); } -class _ListTileExampleState extends State with TickerProviderStateMixin { +class _ListTileExampleState extends State + with TickerProviderStateMixin { late final AnimationController _fadeController; late final AnimationController _sizeController; late final Animation _fadeAnimation; @@ -36,15 +39,25 @@ class _ListTileExampleState extends State with TickerProviderSt @override void initState() { super.initState(); - _fadeController = AnimationController(duration: const Duration(seconds: 1), vsync: this) - ..repeat(reverse: true); + _fadeController = AnimationController( + duration: const Duration(seconds: 1), + vsync: this, + )..repeat(reverse: true); - _sizeController = AnimationController(duration: const Duration(milliseconds: 850), vsync: this) - ..repeat(reverse: true); + _sizeController = AnimationController( + duration: const Duration(milliseconds: 850), + vsync: this, + )..repeat(reverse: true); - _fadeAnimation = CurvedAnimation(parent: _fadeController, curve: Curves.easeInOut); + _fadeAnimation = CurvedAnimation( + parent: _fadeController, + curve: Curves.easeInOut, + ); - _sizeAnimation = CurvedAnimation(parent: _sizeController, curve: Curves.easeOut); + _sizeAnimation = CurvedAnimation( + parent: _sizeController, + curve: Curves.easeOut, + ); } @override diff --git a/examples/api/lib/material/list_tile/list_tile.1.dart b/examples/api/lib/material/list_tile/list_tile.1.dart index da7c6eab831..931381cdc0f 100644 --- a/examples/api/lib/material/list_tile/list_tile.1.dart +++ b/examples/api/lib/material/list_tile/list_tile.1.dart @@ -28,7 +28,10 @@ class ListTileExample extends StatelessWidget { children: const [ Card(child: ListTile(title: Text('One-line ListTile'))), Card( - child: ListTile(leading: FlutterLogo(), title: Text('One-line with leading widget')), + child: ListTile( + leading: FlutterLogo(), + title: Text('One-line with leading widget'), + ), ), Card( child: ListTile( @@ -43,7 +46,12 @@ class ListTileExample extends StatelessWidget { trailing: Icon(Icons.more_vert), ), ), - Card(child: ListTile(title: Text('One-line dense ListTile'), dense: true)), + Card( + child: ListTile( + title: Text('One-line dense ListTile'), + dense: true, + ), + ), Card( child: ListTile( leading: FlutterLogo(size: 56.0), @@ -56,7 +64,9 @@ class ListTileExample extends StatelessWidget { child: ListTile( leading: FlutterLogo(size: 72.0), title: Text('Three-line ListTile'), - subtitle: Text('A sufficiently long subtitle warrants three lines.'), + subtitle: Text( + 'A sufficiently long subtitle warrants three lines.', + ), trailing: Icon(Icons.more_vert), isThreeLine: true, ), diff --git a/examples/api/lib/material/list_tile/list_tile.3.dart b/examples/api/lib/material/list_tile/list_tile.3.dart index 54e259de8bf..410b7d648de 100644 --- a/examples/api/lib/material/list_tile/list_tile.3.dart +++ b/examples/api/lib/material/list_tile/list_tile.3.dart @@ -42,11 +42,12 @@ class _ListTileExampleState extends State { _selected = !_selected; }); }, - iconColor: const WidgetStateColor.fromMap({ - WidgetState.disabled: Colors.red, - WidgetState.selected: Colors.green, - WidgetState.any: Colors.black, - }), + iconColor: + const WidgetStateColor.fromMap({ + WidgetState.disabled: Colors.red, + WidgetState.selected: Colors.green, + WidgetState.any: Colors.black, + }), // The same can be achieved using the .resolveWith() constructor. // The text color will be identical to the icon color above. textColor: WidgetStateColor.resolveWith((Set states) { diff --git a/examples/api/lib/material/list_tile/list_tile.4.dart b/examples/api/lib/material/list_tile/list_tile.4.dart index 71410e83812..87c1a1f3471 100644 --- a/examples/api/lib/material/list_tile/list_tile.4.dart +++ b/examples/api/lib/material/list_tile/list_tile.4.dart @@ -47,28 +47,29 @@ class _ListTileExampleState extends State { titleAlignment = value; }); }, - itemBuilder: (BuildContext context) => >[ - const PopupMenuItem( - value: ListTileTitleAlignment.threeLine, - child: Text('threeLine'), - ), - const PopupMenuItem( - value: ListTileTitleAlignment.titleHeight, - child: Text('titleHeight'), - ), - const PopupMenuItem( - value: ListTileTitleAlignment.top, - child: Text('top'), - ), - const PopupMenuItem( - value: ListTileTitleAlignment.center, - child: Text('center'), - ), - const PopupMenuItem( - value: ListTileTitleAlignment.bottom, - child: Text('bottom'), - ), - ], + itemBuilder: (BuildContext context) => + >[ + const PopupMenuItem( + value: ListTileTitleAlignment.threeLine, + child: Text('threeLine'), + ), + const PopupMenuItem( + value: ListTileTitleAlignment.titleHeight, + child: Text('titleHeight'), + ), + const PopupMenuItem( + value: ListTileTitleAlignment.top, + child: Text('top'), + ), + const PopupMenuItem( + value: ListTileTitleAlignment.center, + child: Text('center'), + ), + const PopupMenuItem( + value: ListTileTitleAlignment.bottom, + child: Text('bottom'), + ), + ], ), ), const Divider(), diff --git a/examples/api/lib/material/material_state/material_state_border_side.0.dart b/examples/api/lib/material/material_state/material_state_border_side.0.dart index 349af693668..cb26d7f45e2 100644 --- a/examples/api/lib/material/material_state/material_state_border_side.0.dart +++ b/examples/api/lib/material/material_state/material_state_border_side.0.dart @@ -4,7 +4,7 @@ import 'package:flutter/material.dart'; -/// Flutter code sample for [MaterialStateBorderSide]. +/// Flutter code sample for [WidgetStateBorderSide]. void main() => runApp(const MaterialStateBorderSideExampleApp()); @@ -26,10 +26,12 @@ class MaterialStateBorderSideExample extends StatefulWidget { const MaterialStateBorderSideExample({super.key}); @override - State createState() => _MaterialStateBorderSideExampleState(); + State createState() => + _MaterialStateBorderSideExampleState(); } -class _MaterialStateBorderSideExampleState extends State { +class _MaterialStateBorderSideExampleState + extends State { bool isSelected = true; @override @@ -42,8 +44,8 @@ class _MaterialStateBorderSideExampleState extends State states) { - if (states.contains(MaterialState.selected)) { + side: WidgetStateBorderSide.resolveWith((Set states) { + if (states.contains(WidgetState.selected)) { return const BorderSide(color: Colors.red); } return null; // Defer to default value on the theme or widget. diff --git a/examples/api/lib/material/material_state/material_state_mouse_cursor.0.dart b/examples/api/lib/material/material_state/material_state_mouse_cursor.0.dart index f7170a0114b..b54b55c1277 100644 --- a/examples/api/lib/material/material_state/material_state_mouse_cursor.0.dart +++ b/examples/api/lib/material/material_state/material_state_mouse_cursor.0.dart @@ -4,7 +4,7 @@ import 'package:flutter/material.dart'; -/// Flutter code sample for [MaterialStateMouseCursor]. +/// Flutter code sample for [WidgetStateMouseCursor]. void main() => runApp(const MaterialStateMouseCursorExampleApp()); @@ -27,12 +27,12 @@ class MaterialStateMouseCursorExampleApp extends StatelessWidget { } } -class ListTileCursor extends MaterialStateMouseCursor { +class ListTileCursor extends WidgetStateMouseCursor { const ListTileCursor(); @override - MouseCursor resolve(Set states) { - if (states.contains(MaterialState.disabled)) { + MouseCursor resolve(Set states) { + if (states.contains(WidgetState.disabled)) { return SystemMouseCursors.forbidden; } return SystemMouseCursors.click; diff --git a/examples/api/lib/material/material_state/material_state_property.0.dart b/examples/api/lib/material/material_state/material_state_property.0.dart index 02426cc4b43..182b47ca2aa 100644 --- a/examples/api/lib/material/material_state/material_state_property.0.dart +++ b/examples/api/lib/material/material_state/material_state_property.0.dart @@ -4,7 +4,7 @@ import 'package:flutter/material.dart'; -/// Flutter code sample for [MaterialStateProperty]. +/// Flutter code sample for [WidgetStateProperty]. void main() => runApp(const MaterialStatePropertyExampleApp()); @@ -27,11 +27,11 @@ class MaterialStatePropertyExample extends StatelessWidget { @override Widget build(BuildContext context) { - Color getColor(Set states) { - const Set interactiveStates = { - MaterialState.pressed, - MaterialState.hovered, - MaterialState.focused, + Color getColor(Set states) { + const Set interactiveStates = { + WidgetState.pressed, + WidgetState.hovered, + WidgetState.focused, }; if (states.any(interactiveStates.contains)) { return Colors.blue; @@ -40,7 +40,9 @@ class MaterialStatePropertyExample extends StatelessWidget { } return TextButton( - style: ButtonStyle(foregroundColor: MaterialStateProperty.resolveWith(getColor)), + style: ButtonStyle( + foregroundColor: WidgetStateProperty.resolveWith(getColor), + ), onPressed: () {}, child: const Text('TextButton'), ); diff --git a/examples/api/lib/material/menu_anchor/checkbox_menu_button.0.dart b/examples/api/lib/material/menu_anchor/checkbox_menu_button.0.dart index 15791f4a6b6..632b92e5917 100644 --- a/examples/api/lib/material/menu_anchor/checkbox_menu_button.0.dart +++ b/examples/api/lib/material/menu_anchor/checkbox_menu_button.0.dart @@ -60,19 +60,24 @@ class _MyCheckboxMenuState extends State { child: const Text('Show Message'), ), ], - builder: (BuildContext context, MenuController controller, Widget? child) { - return TextButton( - focusNode: _buttonFocusNode, - onPressed: () { - if (controller.isOpen) { - controller.close(); - } else { - controller.open(); - } + builder: + ( + BuildContext context, + MenuController controller, + Widget? child, + ) { + return TextButton( + focusNode: _buttonFocusNode, + onPressed: () { + if (controller.isOpen) { + controller.close(); + } else { + controller.open(); + } + }, + child: const Text('OPEN MENU'), + ); }, - child: const Text('OPEN MENU'), - ); - }, ), Expanded( child: Container( diff --git a/examples/api/lib/material/menu_anchor/menu_accelerator_label.0.dart b/examples/api/lib/material/menu_anchor/menu_accelerator_label.0.dart index 7d9baae39d6..eeb0dc7416c 100644 --- a/examples/api/lib/material/menu_anchor/menu_accelerator_label.0.dart +++ b/examples/api/lib/material/menu_anchor/menu_accelerator_label.0.dart @@ -36,17 +36,17 @@ class MyMenuBar extends StatelessWidget { ), MenuItemButton( onPressed: () { - ScaffoldMessenger.of( - context, - ).showSnackBar(const SnackBar(content: Text('Saved!'))); + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar(content: Text('Saved!')), + ); }, child: const MenuAcceleratorLabel('&Save'), ), MenuItemButton( onPressed: () { - ScaffoldMessenger.of( - context, - ).showSnackBar(const SnackBar(content: Text('Quit!'))); + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar(content: Text('Quit!')), + ); }, child: const MenuAcceleratorLabel('&Quit'), ), @@ -57,17 +57,17 @@ class MyMenuBar extends StatelessWidget { menuChildren: [ MenuItemButton( onPressed: () { - ScaffoldMessenger.of( - context, - ).showSnackBar(const SnackBar(content: Text('Magnify!'))); + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar(content: Text('Magnify!')), + ); }, child: const MenuAcceleratorLabel('&Magnify'), ), MenuItemButton( onPressed: () { - ScaffoldMessenger.of( - context, - ).showSnackBar(const SnackBar(content: Text('Minify!'))); + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar(content: Text('Minify!')), + ); }, child: const MenuAcceleratorLabel('Mi&nify'), ), @@ -79,7 +79,11 @@ class MyMenuBar extends StatelessWidget { ), ], ), - Expanded(child: FlutterLogo(size: MediaQuery.of(context).size.shortestSide * 0.5)), + Expanded( + child: FlutterLogo( + size: MediaQuery.of(context).size.shortestSide * 0.5, + ), + ), ], ); } @@ -93,7 +97,10 @@ class MenuAcceleratorApp extends StatelessWidget { return MaterialApp( home: Shortcuts( shortcuts: { - const SingleActivator(LogicalKeyboardKey.keyT, control: true): VoidCallbackIntent(() { + const SingleActivator( + LogicalKeyboardKey.keyT, + control: true, + ): VoidCallbackIntent(() { debugDumpApp(); }), }, diff --git a/examples/api/lib/material/menu_anchor/menu_anchor.0.dart b/examples/api/lib/material/menu_anchor/menu_anchor.0.dart index c7fc47371bb..b5f2b5506fd 100644 --- a/examples/api/lib/material/menu_anchor/menu_anchor.0.dart +++ b/examples/api/lib/material/menu_anchor/menu_anchor.0.dart @@ -15,12 +15,27 @@ void main() => runApp(const MenuApp()); /// they could be used for simple menu systems. enum MenuEntry { about('About'), - showMessage('Show Message', SingleActivator(LogicalKeyboardKey.keyS, control: true)), - hideMessage('Hide Message', SingleActivator(LogicalKeyboardKey.keyS, control: true)), + showMessage( + 'Show Message', + SingleActivator(LogicalKeyboardKey.keyS, control: true), + ), + hideMessage( + 'Hide Message', + SingleActivator(LogicalKeyboardKey.keyS, control: true), + ), colorMenu('Color Menu'), - colorRed('Red Background', SingleActivator(LogicalKeyboardKey.keyR, control: true)), - colorGreen('Green Background', SingleActivator(LogicalKeyboardKey.keyG, control: true)), - colorBlue('Blue Background', SingleActivator(LogicalKeyboardKey.keyB, control: true)); + colorRed( + 'Red Background', + SingleActivator(LogicalKeyboardKey.keyR, control: true), + ), + colorGreen( + 'Green Background', + SingleActivator(LogicalKeyboardKey.keyG, control: true), + ), + colorBlue( + 'Blue Background', + SingleActivator(LogicalKeyboardKey.keyB, control: true), + ); const MenuEntry(this.label, [this.shortcut]); final String label; @@ -70,10 +85,12 @@ class _MyCascadingMenuState extends State { // Collect the shortcuts from the different menu selections so that they can // be registered to apply to the entire app. Menus don't register their // shortcuts, they only display the shortcut hint text. - final Map shortcuts = { - for (final MenuEntry item in MenuEntry.values) - if (item.shortcut != null) item.shortcut!: VoidCallbackIntent(() => _activate(item)), - }; + final Map shortcuts = + { + for (final MenuEntry item in MenuEntry.values) + if (item.shortcut != null) + item.shortcut!: VoidCallbackIntent(() => _activate(item)), + }; // Register the shortcuts with the ShortcutRegistry so that they are // available to the entire application. _shortcutsEntry = ShortcutRegistry.of(context).addAll(shortcuts); @@ -131,19 +148,20 @@ class _MyCascadingMenuState extends State { child: const Text('Background Color'), ), ], - builder: (BuildContext context, MenuController controller, Widget? child) { - return TextButton( - focusNode: _buttonFocusNode, - onPressed: () { - if (controller.isOpen) { - controller.close(); - } else { - controller.open(); - } + builder: + (BuildContext context, MenuController controller, Widget? child) { + return TextButton( + focusNode: _buttonFocusNode, + onPressed: () { + if (controller.isOpen) { + controller.close(); + } else { + controller.open(); + } + }, + child: const Text('OPEN MENU'), + ); }, - child: const Text('OPEN MENU'), - ); - }, ), Expanded( child: Container( @@ -159,7 +177,11 @@ class _MyCascadingMenuState extends State { style: Theme.of(context).textTheme.headlineSmall, ), ), - Text(_lastSelection != null ? 'Last Selected: ${_lastSelection!.label}' : ''), + Text( + _lastSelection != null + ? 'Last Selected: ${_lastSelection!.label}' + : '', + ), ], ), ), diff --git a/examples/api/lib/material/menu_anchor/menu_anchor.1.dart b/examples/api/lib/material/menu_anchor/menu_anchor.1.dart index 05b20d75bcd..e68b4e2b1fe 100644 --- a/examples/api/lib/material/menu_anchor/menu_anchor.1.dart +++ b/examples/api/lib/material/menu_anchor/menu_anchor.1.dart @@ -16,12 +16,27 @@ void main() => runApp(const ContextMenuApp()); /// they could be used for simple menu systems. enum MenuEntry { about('About'), - showMessage('Show Message', SingleActivator(LogicalKeyboardKey.keyS, control: true)), - hideMessage('Hide Message', SingleActivator(LogicalKeyboardKey.keyS, control: true)), + showMessage( + 'Show Message', + SingleActivator(LogicalKeyboardKey.keyS, control: true), + ), + hideMessage( + 'Hide Message', + SingleActivator(LogicalKeyboardKey.keyS, control: true), + ), colorMenu('Color Menu'), - colorRed('Red Background', SingleActivator(LogicalKeyboardKey.keyR, control: true)), - colorGreen('Green Background', SingleActivator(LogicalKeyboardKey.keyG, control: true)), - colorBlue('Blue Background', SingleActivator(LogicalKeyboardKey.keyB, control: true)); + colorRed( + 'Red Background', + SingleActivator(LogicalKeyboardKey.keyR, control: true), + ), + colorGreen( + 'Green Background', + SingleActivator(LogicalKeyboardKey.keyG, control: true), + ), + colorBlue( + 'Blue Background', + SingleActivator(LogicalKeyboardKey.keyB, control: true), + ); const MenuEntry(this.label, [this.shortcut]); final String label; @@ -79,10 +94,12 @@ class _MyContextMenuState extends State { // Collect the shortcuts from the different menu selections so that they can // be registered to apply to the entire app. Menus don't register their // shortcuts, they only display the shortcut hint text. - final Map shortcuts = { - for (final MenuEntry item in MenuEntry.values) - if (item.shortcut != null) item.shortcut!: VoidCallbackIntent(() => _activate(item)), - }; + final Map shortcuts = + { + for (final MenuEntry item in MenuEntry.values) + if (item.shortcut != null) + item.shortcut!: VoidCallbackIntent(() => _activate(item)), + }; // Register the shortcuts with the ShortcutRegistry so that they are // available to the entire application. _shortcutsEntry = ShortcutRegistry.of(context).addAll(shortcuts); @@ -172,7 +189,9 @@ class _MyContextMenuState extends State { children: [ const Padding( padding: EdgeInsets.all(8.0), - child: Text('Right-click anywhere on the background to show the menu.'), + child: Text( + 'Right-click anywhere on the background to show the menu.', + ), ), Padding( padding: const EdgeInsets.all(12.0), @@ -181,7 +200,11 @@ class _MyContextMenuState extends State { style: Theme.of(context).textTheme.headlineSmall, ), ), - Text(_lastSelection != null ? 'Last Selected: ${_lastSelection!.label}' : ''), + Text( + _lastSelection != null + ? 'Last Selected: ${_lastSelection!.label}' + : '', + ), ], ), ), @@ -236,7 +259,9 @@ class _MyContextMenuState extends State { case TargetPlatform.macOS: // Only open the menu on these platforms if the control button is down // when the tap occurs. - if (HardwareKeyboard.instance.logicalKeysPressed.contains(LogicalKeyboardKey.controlLeft) || + if (HardwareKeyboard.instance.logicalKeysPressed.contains( + LogicalKeyboardKey.controlLeft, + ) || HardwareKeyboard.instance.logicalKeysPressed.contains( LogicalKeyboardKey.controlRight, )) { diff --git a/examples/api/lib/material/menu_anchor/menu_anchor.2.dart b/examples/api/lib/material/menu_anchor/menu_anchor.2.dart index cbaebf336d7..83db71d295e 100644 --- a/examples/api/lib/material/menu_anchor/menu_anchor.2.dart +++ b/examples/api/lib/material/menu_anchor/menu_anchor.2.dart @@ -39,23 +39,25 @@ class _MenuAnchorExampleState extends State { ), body: Center( child: MenuAnchor( - builder: (BuildContext context, MenuController controller, Widget? child) { - return IconButton( - onPressed: () { - if (controller.isOpen) { - controller.close(); - } else { - controller.open(); - } + builder: + (BuildContext context, MenuController controller, Widget? child) { + return IconButton( + onPressed: () { + if (controller.isOpen) { + controller.close(); + } else { + controller.open(); + } + }, + icon: const Icon(Icons.more_horiz), + tooltip: 'Show menu', + ); }, - icon: const Icon(Icons.more_horiz), - tooltip: 'Show menu', - ); - }, menuChildren: List.generate( 3, (int index) => MenuItemButton( - onPressed: () => setState(() => selectedMenu = SampleItem.values[index]), + onPressed: () => + setState(() => selectedMenu = SampleItem.values[index]), child: Text('Item ${index + 1}'), ), ), diff --git a/examples/api/lib/material/menu_anchor/menu_bar.0.dart b/examples/api/lib/material/menu_anchor/menu_bar.0.dart index fc86bc4d3d7..4a02fc369eb 100644 --- a/examples/api/lib/material/menu_anchor/menu_bar.0.dart +++ b/examples/api/lib/material/menu_anchor/menu_bar.0.dart @@ -14,11 +14,15 @@ void main() => runApp(const MenuBarApp()); /// This sort of class is not required, but illustrates one way that defining /// menus could be done. class MenuEntry { - const MenuEntry({required this.label, this.shortcut, this.onPressed, this.menuChildren}) - : assert( - menuChildren == null || onPressed == null, - 'onPressed is ignored if menuChildren are provided', - ); + const MenuEntry({ + required this.label, + this.shortcut, + this.onPressed, + this.menuChildren, + }) : assert( + menuChildren == null || onPressed == null, + 'onPressed is ignored if menuChildren are provided', + ); final String label; final MenuSerializableShortcut? shortcut; @@ -43,14 +47,19 @@ class MenuEntry { return selections.map(buildSelection).toList(); } - static Map shortcuts(List selections) { - final Map result = {}; + static Map shortcuts( + List selections, + ) { + final Map result = + {}; for (final MenuEntry selection in selections) { if (selection.menuChildren != null) { result.addAll(MenuEntry.shortcuts(selection.menuChildren!)); } else { if (selection.shortcut != null && selection.onPressed != null) { - result[selection.shortcut!] = VoidCallbackIntent(selection.onPressed!); + result[selection.shortcut!] = VoidCallbackIntent( + selection.onPressed!, + ); } } } @@ -103,7 +112,9 @@ class _MyMenuBarState extends State { children: [ Row( mainAxisSize: MainAxisSize.min, - children: [Expanded(child: MenuBar(children: MenuEntry.build(_getMenus())))], + children: [ + Expanded(child: MenuBar(children: MenuEntry.build(_getMenus()))), + ], ), Expanded( child: Container( @@ -119,7 +130,11 @@ class _MyMenuBarState extends State { style: Theme.of(context).textTheme.headlineSmall, ), ), - Text(_lastSelection != null ? 'Last Selected: $_lastSelection' : ''), + Text( + _lastSelection != null + ? 'Last Selected: $_lastSelection' + : '', + ), ], ), ), @@ -150,11 +165,16 @@ class _MyMenuBarState extends State { label: showingMessage ? 'Hide Message' : 'Show Message', onPressed: () { setState(() { - _lastSelection = showingMessage ? 'Hide Message' : 'Show Message'; + _lastSelection = showingMessage + ? 'Hide Message' + : 'Show Message'; showingMessage = !showingMessage; }); }, - shortcut: const SingleActivator(LogicalKeyboardKey.keyS, control: true), + shortcut: const SingleActivator( + LogicalKeyboardKey.keyS, + control: true, + ), ), // Hides the message, but is only enabled if the message isn't // already hidden. @@ -181,7 +201,10 @@ class _MyMenuBarState extends State { backgroundColor = Colors.red; }); }, - shortcut: const SingleActivator(LogicalKeyboardKey.keyR, control: true), + shortcut: const SingleActivator( + LogicalKeyboardKey.keyR, + control: true, + ), ), MenuEntry( label: 'Green Background', @@ -191,7 +214,10 @@ class _MyMenuBarState extends State { backgroundColor = Colors.green; }); }, - shortcut: const SingleActivator(LogicalKeyboardKey.keyG, control: true), + shortcut: const SingleActivator( + LogicalKeyboardKey.keyG, + control: true, + ), ), MenuEntry( label: 'Blue Background', @@ -201,7 +227,10 @@ class _MyMenuBarState extends State { backgroundColor = Colors.blue; }); }, - shortcut: const SingleActivator(LogicalKeyboardKey.keyB, control: true), + shortcut: const SingleActivator( + LogicalKeyboardKey.keyB, + control: true, + ), ), ], ), @@ -211,7 +240,9 @@ class _MyMenuBarState extends State { // (Re-)register the shortcuts with the ShortcutRegistry so that they are // available to the entire application, and update them if they've changed. _shortcutsEntry?.dispose(); - _shortcutsEntry = ShortcutRegistry.of(context).addAll(MenuEntry.shortcuts(result)); + _shortcutsEntry = ShortcutRegistry.of( + context, + ).addAll(MenuEntry.shortcuts(result)); return result; } } diff --git a/examples/api/lib/material/menu_anchor/radio_menu_button.0.dart b/examples/api/lib/material/menu_anchor/radio_menu_button.0.dart index 70105c95bda..f95ac197e69 100644 --- a/examples/api/lib/material/menu_anchor/radio_menu_button.0.dart +++ b/examples/api/lib/material/menu_anchor/radio_menu_button.0.dart @@ -37,9 +37,14 @@ class _MyRadioMenuState extends State { @override void didChangeDependencies() { super.didChangeDependencies(); - _entry = ShortcutRegistry.of(context).addAll({ + _entry = ShortcutRegistry.of(context).addAll(< + ShortcutActivator, + VoidCallbackIntent + >{ _redShortcut: VoidCallbackIntent(() => _setBackgroundColor(Colors.red)), - _greenShortcut: VoidCallbackIntent(() => _setBackgroundColor(Colors.green)), + _greenShortcut: VoidCallbackIntent( + () => _setBackgroundColor(Colors.green), + ), _blueShortcut: VoidCallbackIntent(() => _setBackgroundColor(Colors.blue)), }); } @@ -87,19 +92,20 @@ class _MyRadioMenuState extends State { child: const Text('Blue Background'), ), ], - builder: (BuildContext context, MenuController controller, Widget? child) { - return TextButton( - focusNode: _buttonFocusNode, - onPressed: () { - if (controller.isOpen) { - controller.close(); - } else { - controller.open(); - } + builder: + (BuildContext context, MenuController controller, Widget? child) { + return TextButton( + focusNode: _buttonFocusNode, + onPressed: () { + if (controller.isOpen) { + controller.close(); + } else { + controller.open(); + } + }, + child: const Text('OPEN MENU'), + ); }, - child: const Text('OPEN MENU'), - ); - }, ), Expanded(child: Container(color: _backgroundColor)), ], diff --git a/examples/api/lib/material/navigation_bar/navigation_bar.0.dart b/examples/api/lib/material/navigation_bar/navigation_bar.0.dart index de0be9f55c9..d7ec20425ad 100644 --- a/examples/api/lib/material/navigation_bar/navigation_bar.0.dart +++ b/examples/api/lib/material/navigation_bar/navigation_bar.0.dart @@ -61,7 +61,9 @@ class _NavigationExampleState extends State { shadowColor: Colors.transparent, margin: const EdgeInsets.all(8.0), child: SizedBox.expand( - child: Center(child: Text('Home page', style: theme.textTheme.titleLarge)), + child: Center( + child: Text('Home page', style: theme.textTheme.titleLarge), + ), ), ), @@ -105,7 +107,9 @@ class _NavigationExampleState extends State { ), child: Text( 'Hello', - style: theme.textTheme.bodyLarge!.copyWith(color: theme.colorScheme.onPrimary), + style: theme.textTheme.bodyLarge!.copyWith( + color: theme.colorScheme.onPrimary, + ), ), ), ); @@ -121,7 +125,9 @@ class _NavigationExampleState extends State { ), child: Text( 'Hi!', - style: theme.textTheme.bodyLarge!.copyWith(color: theme.colorScheme.onPrimary), + style: theme.textTheme.bodyLarge!.copyWith( + color: theme.colorScheme.onPrimary, + ), ), ), ); diff --git a/examples/api/lib/material/navigation_bar/navigation_bar.1.dart b/examples/api/lib/material/navigation_bar/navigation_bar.1.dart index c5e2171cce6..83d5921bcc8 100644 --- a/examples/api/lib/material/navigation_bar/navigation_bar.1.dart +++ b/examples/api/lib/material/navigation_bar/navigation_bar.1.dart @@ -26,7 +26,8 @@ class NavigationExample extends StatefulWidget { class _NavigationExampleState extends State { int currentPageIndex = 0; - NavigationDestinationLabelBehavior labelBehavior = NavigationDestinationLabelBehavior.alwaysShow; + NavigationDestinationLabelBehavior labelBehavior = + NavigationDestinationLabelBehavior.alwaysShow; @override Widget build(BuildContext context) { @@ -63,7 +64,8 @@ class _NavigationExampleState extends State { ElevatedButton( onPressed: () { setState(() { - labelBehavior = NavigationDestinationLabelBehavior.alwaysShow; + labelBehavior = + NavigationDestinationLabelBehavior.alwaysShow; }); }, child: const Text('alwaysShow'), @@ -71,7 +73,8 @@ class _NavigationExampleState extends State { ElevatedButton( onPressed: () { setState(() { - labelBehavior = NavigationDestinationLabelBehavior.onlyShowSelected; + labelBehavior = + NavigationDestinationLabelBehavior.onlyShowSelected; }); }, child: const Text('onlyShowSelected'), @@ -79,7 +82,8 @@ class _NavigationExampleState extends State { ElevatedButton( onPressed: () { setState(() { - labelBehavior = NavigationDestinationLabelBehavior.alwaysHide; + labelBehavior = + NavigationDestinationLabelBehavior.alwaysHide; }); }, child: const Text('alwaysHide'), diff --git a/examples/api/lib/material/navigation_bar/navigation_bar.2.dart b/examples/api/lib/material/navigation_bar/navigation_bar.2.dart index 29285c71ef2..1a105bc328f 100644 --- a/examples/api/lib/material/navigation_bar/navigation_bar.2.dart +++ b/examples/api/lib/material/navigation_bar/navigation_bar.2.dart @@ -32,12 +32,14 @@ class _HomeState extends State with TickerProviderStateMixin { int selectedIndex = 0; AnimationController buildFaderController() { - return AnimationController(vsync: this, duration: const Duration(milliseconds: 300)) - ..addStatusListener((AnimationStatus status) { - if (status.isDismissed) { - setState(() {}); // Rebuild unselected destinations offstage. - } - }); + return AnimationController( + vsync: this, + duration: const Duration(milliseconds: 300), + )..addStatusListener((AnimationStatus status) { + if (status.isDismissed) { + setState(() {}); // Rebuild unselected destinations offstage. + } + }); } @override @@ -79,7 +81,8 @@ class _HomeState extends State with TickerProviderStateMixin { Widget build(BuildContext context) { return NavigatorPopHandler( onPopWithResult: (void result) { - final NavigatorState navigator = navigatorKeys[selectedIndex].currentState!; + final NavigatorState navigator = + navigatorKeys[selectedIndex].currentState!; navigator.pop(); }, child: Scaffold( @@ -110,7 +113,9 @@ class _HomeState extends State with TickerProviderStateMixin { selectedIndex = index; }); }, - destinations: allDestinations.map((Destination destination) { + destinations: allDestinations.map(( + Destination destination, + ) { return NavigationDestination( icon: Icon(destination.icon, color: destination.color), label: destination.title, @@ -182,7 +187,11 @@ class RootPage extends StatelessWidget { ElevatedButton( style: buttonStyle, onPressed: () { - showDialog(context: context, useRootNavigator: false, builder: _buildDialog); + showDialog( + context: context, + useRootNavigator: false, + builder: _buildDialog, + ); }, child: const Text('Local Dialog'), ), @@ -192,7 +201,8 @@ class RootPage extends StatelessWidget { onPressed: () { showDialog( context: context, - useRootNavigator: true, // ignore: avoid_redundant_argument_values + useRootNavigator: + true, // ignore: avoid_redundant_argument_values builder: _buildDialog, ); }, @@ -244,7 +254,7 @@ class ListPage extends StatelessWidget { final ButtonStyle buttonStyle = OutlinedButton.styleFrom( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8), - side: BorderSide(color: colorScheme.onSurface.withOpacity(0.12)), + side: BorderSide(color: colorScheme.onSurface.withValues(alpha: 0.12)), ), foregroundColor: destination.color, fixedSize: const Size.fromHeight(64), @@ -266,7 +276,11 @@ class ListPage extends StatelessWidget { child: OutlinedButton( style: buttonStyle.copyWith( backgroundColor: WidgetStatePropertyAll( - Color.lerp(destination.color[100], Colors.white, index / itemCount)!, + Color.lerp( + destination.color[100], + Colors.white, + index / itemCount, + )!, ), ), onPressed: () { @@ -321,10 +335,15 @@ class _TextPageState extends State { alignment: Alignment.center, child: TextField( controller: textController, - style: theme.primaryTextTheme.headlineMedium?.copyWith(color: widget.destination.color), + style: theme.primaryTextTheme.headlineMedium?.copyWith( + color: widget.destination.color, + ), decoration: InputDecoration( focusedBorder: UnderlineInputBorder( - borderSide: BorderSide(color: widget.destination.color, width: 3.0), + borderSide: BorderSide( + color: widget.destination.color, + width: 3.0, + ), ), ), ), @@ -334,7 +353,11 @@ class _TextPageState extends State { } class DestinationView extends StatefulWidget { - const DestinationView({super.key, required this.destination, required this.navigatorKey}); + const DestinationView({ + super.key, + required this.destination, + required this.navigatorKey, + }); final Destination destination; final Key navigatorKey; diff --git a/examples/api/lib/material/navigation_drawer/navigation_drawer.0.dart b/examples/api/lib/material/navigation_drawer/navigation_drawer.0.dart index cb0afe68746..ea8c837b690 100644 --- a/examples/api/lib/material/navigation_drawer/navigation_drawer.0.dart +++ b/examples/api/lib/material/navigation_drawer/navigation_drawer.0.dart @@ -22,9 +22,21 @@ class ExampleDestination { } const List destinations = [ - ExampleDestination('Messages', Icon(Icons.widgets_outlined), Icon(Icons.widgets)), - ExampleDestination('Profile', Icon(Icons.format_paint_outlined), Icon(Icons.format_paint)), - ExampleDestination('Settings', Icon(Icons.settings_outlined), Icon(Icons.settings)), + ExampleDestination( + 'Messages', + Icon(Icons.widgets_outlined), + Icon(Icons.widgets), + ), + ExampleDestination( + 'Profile', + Icon(Icons.format_paint_outlined), + Icon(Icons.format_paint), + ), + ExampleDestination( + 'Settings', + Icon(Icons.settings_outlined), + Icon(Icons.settings), + ), ]; class NavigationDrawerApp extends StatelessWidget { @@ -32,7 +44,10 @@ class NavigationDrawerApp extends StatelessWidget { @override Widget build(BuildContext context) { - return const MaterialApp(debugShowCheckedModeBanner: false, home: NavigationDrawerExample()); + return const MaterialApp( + debugShowCheckedModeBanner: false, + home: NavigationDrawerExample(), + ); } } @@ -40,7 +55,8 @@ class NavigationDrawerExample extends StatefulWidget { const NavigationDrawerExample({super.key}); @override - State createState() => _NavigationDrawerExampleState(); + State createState() => + _NavigationDrawerExampleState(); } class _NavigationDrawerExampleState extends State { @@ -98,7 +114,9 @@ class _NavigationDrawerExampleState extends State { padding: const EdgeInsets.symmetric(horizontal: 5), child: NavigationRail( minWidth: 50, - destinations: destinations.map((ExampleDestination destination) { + destinations: destinations.map(( + ExampleDestination destination, + ) { return NavigationRailDestination( label: Text(destination.label), icon: destination.icon, @@ -120,7 +138,10 @@ class _NavigationDrawerExampleState extends State { mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Text('Page Index = $screenIndex'), - ElevatedButton(onPressed: openDrawer, child: const Text('Open Drawer')), + ElevatedButton( + onPressed: openDrawer, + child: const Text('Open Drawer'), + ), ], ), ), @@ -133,7 +154,10 @@ class _NavigationDrawerExampleState extends State { children: [ Padding( padding: const EdgeInsets.fromLTRB(28, 16, 16, 10), - child: Text('Header', style: Theme.of(context).textTheme.titleSmall), + child: Text( + 'Header', + style: Theme.of(context).textTheme.titleSmall, + ), ), ...destinations.map((ExampleDestination destination) { return NavigationDrawerDestination( @@ -142,7 +166,10 @@ class _NavigationDrawerExampleState extends State { selectedIcon: destination.selectedIcon, ); }), - const Padding(padding: EdgeInsets.fromLTRB(28, 16, 28, 10), child: Divider()), + const Padding( + padding: EdgeInsets.fromLTRB(28, 16, 28, 10), + child: Divider(), + ), ], ), ); @@ -156,6 +183,8 @@ class _NavigationDrawerExampleState extends State { @override Widget build(BuildContext context) { - return showNavigationDrawer ? buildDrawerScaffold(context) : buildBottomBarScaffold(); + return showNavigationDrawer + ? buildDrawerScaffold(context) + : buildBottomBarScaffold(); } } diff --git a/examples/api/lib/material/navigation_rail/navigation_rail.0.dart b/examples/api/lib/material/navigation_rail/navigation_rail.0.dart index 238e3b472bd..f66c8966768 100644 --- a/examples/api/lib/material/navigation_rail/navigation_rail.0.dart +++ b/examples/api/lib/material/navigation_rail/navigation_rail.0.dart @@ -76,7 +76,10 @@ class _NavRailExampleState extends State { ), NavigationRailDestination( icon: Badge(label: Text('4'), child: Icon(Icons.star_border)), - selectedIcon: Badge(label: Text('4'), child: Icon(Icons.star)), + selectedIcon: Badge( + label: Text('4'), + child: Icon(Icons.star), + ), label: Text('Third'), ), ], @@ -107,11 +110,12 @@ class _NavRailExampleState extends State { ), ], selected: {labelType}, - onSelectionChanged: (Set newSelection) { - setState(() { - labelType = newSelection.first; - }); - }, + onSelectionChanged: + (Set newSelection) { + setState(() { + labelType = newSelection.first; + }); + }, ), const SizedBox(height: 20), Text('Group alignment: $groupAlignment'), @@ -140,7 +144,9 @@ class _NavRailExampleState extends State { }, ), SwitchListTile( - title: Text(showTrailing ? 'Hide Trailing' : 'Show Trailing'), + title: Text( + showTrailing ? 'Hide Trailing' : 'Show Trailing', + ), value: showTrailing, onChanged: (bool value) { setState(() { diff --git a/examples/api/lib/material/navigation_rail/navigation_rail.extended_animation.0.dart b/examples/api/lib/material/navigation_rail/navigation_rail.extended_animation.0.dart index 2d74d5338dc..4bc68be58a1 100644 --- a/examples/api/lib/material/navigation_rail/navigation_rail.extended_animation.0.dart +++ b/examples/api/lib/material/navigation_rail/navigation_rail.extended_animation.0.dart @@ -94,16 +94,23 @@ class MyNavigationRailFab extends StatelessWidget { @override Widget build(BuildContext context) { - final Animation animation = NavigationRail.extendedAnimation(context); + final Animation animation = NavigationRail.extendedAnimation( + context, + ); return AnimatedBuilder( animation: animation, builder: (BuildContext context, Widget? child) { // The extended fab has a shorter height than the regular fab. return Container( height: 56, - padding: EdgeInsets.symmetric(vertical: lerpDouble(0, 6, animation.value)!), + padding: EdgeInsets.symmetric( + vertical: lerpDouble(0, 6, animation.value)!, + ), child: animation.value == 0 - ? FloatingActionButton(onPressed: onPressed, child: const Icon(Icons.add)) + ? FloatingActionButton( + onPressed: onPressed, + child: const Icon(Icons.add), + ) : Align( alignment: AlignmentDirectional.centerStart, widthFactor: animation.value, diff --git a/examples/api/lib/material/page_transitions_theme/page_transitions_theme.0.dart b/examples/api/lib/material/page_transitions_theme/page_transitions_theme.0.dart index 53817b46f0d..dc2dab2eed7 100644 --- a/examples/api/lib/material/page_transitions_theme/page_transitions_theme.0.dart +++ b/examples/api/lib/material/page_transitions_theme/page_transitions_theme.0.dart @@ -43,7 +43,9 @@ class HomePage extends StatelessWidget { child: ElevatedButton( onPressed: () { Navigator.of(context).push( - MaterialPageRoute(builder: (BuildContext context) => const SecondPage()), + MaterialPageRoute( + builder: (BuildContext context) => const SecondPage(), + ), ); }, child: const Text('To SecondPage'), diff --git a/examples/api/lib/material/page_transitions_theme/page_transitions_theme.1.dart b/examples/api/lib/material/page_transitions_theme/page_transitions_theme.1.dart index 38ce8d7d76e..1c524392161 100644 --- a/examples/api/lib/material/page_transitions_theme/page_transitions_theme.1.dart +++ b/examples/api/lib/material/page_transitions_theme/page_transitions_theme.1.dart @@ -17,7 +17,9 @@ class PageTransitionsThemeApp extends StatelessWidget { theme: ThemeData( pageTransitionsTheme: const PageTransitionsTheme( builders: { - TargetPlatform.android: ZoomPageTransitionsBuilder(allowSnapshotting: false), + TargetPlatform.android: ZoomPageTransitionsBuilder( + allowSnapshotting: false, + ), }, ), ), @@ -37,7 +39,9 @@ class HomePage extends StatelessWidget { child: ElevatedButton( onPressed: () { Navigator.of(context).push( - MaterialPageRoute(builder: (BuildContext context) => const SecondPage()), + MaterialPageRoute( + builder: (BuildContext context) => const SecondPage(), + ), ); }, child: const Text('To SecondPage'), diff --git a/examples/api/lib/material/page_transitions_theme/page_transitions_theme.3.dart b/examples/api/lib/material/page_transitions_theme/page_transitions_theme.3.dart index a2d48f96b9c..6e743d2494e 100644 --- a/examples/api/lib/material/page_transitions_theme/page_transitions_theme.3.dart +++ b/examples/api/lib/material/page_transitions_theme/page_transitions_theme.3.dart @@ -56,7 +56,9 @@ class HomePage extends StatelessWidget { elevation: 0, color: Theme.of(context).colorScheme.surfaceContainerLowest, child: ListView( - children: List.generate(Colors.primaries.length, (int index) { + children: List.generate(Colors.primaries.length, ( + int index, + ) { final Text kittenName = Text('Kitten $index'); final CircleAvatar avatar = CircleAvatar( backgroundColor: Colors.primaries[index], diff --git a/examples/api/lib/material/paginated_data_table/paginated_data_table.0.dart b/examples/api/lib/material/paginated_data_table/paginated_data_table.0.dart index db56412ed79..2890ffb639b 100644 --- a/examples/api/lib/material/paginated_data_table/paginated_data_table.0.dart +++ b/examples/api/lib/material/paginated_data_table/paginated_data_table.0.dart @@ -59,7 +59,10 @@ class DataTableExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return const MaterialApp( - home: SingleChildScrollView(padding: EdgeInsets.all(12.0), child: DataTableExample()), + home: SingleChildScrollView( + padding: EdgeInsets.all(12.0), + child: DataTableExample(), + ), ); } } diff --git a/examples/api/lib/material/paginated_data_table/paginated_data_table.1.dart b/examples/api/lib/material/paginated_data_table/paginated_data_table.1.dart index a6120d5138a..9c4716a280c 100644 --- a/examples/api/lib/material/paginated_data_table/paginated_data_table.1.dart +++ b/examples/api/lib/material/paginated_data_table/paginated_data_table.1.dart @@ -10,7 +10,11 @@ class MyDataSource extends DataTableSource { static const List _displayIndexToRawIndex = [0, 3, 4, 5, 6]; late List>> sortedData; - void setData(List>> rawData, int sortColumn, bool sortAscending) { + void setData( + List>> rawData, + int sortColumn, + bool sortAscending, + ) { sortedData = rawData.toList() ..sort((List> a, List> b) { final Comparable cellA = a[_displayIndexToRawIndex[sortColumn]]; @@ -39,7 +43,9 @@ class MyDataSource extends DataTableSource { return DataRow.byIndex( index: sortedData[index][0] as int, cells: [ - cellFor('S${sortedData[index][1]}E${sortedData[index][2].toString().padLeft(2, '0')}'), + cellFor( + 'S${sortedData[index][1]}E${sortedData[index][2].toString().padLeft(2, '0')}', + ), cellFor(sortedData[index][3]), cellFor(sortedData[index][4]), cellFor(sortedData[index][5]), @@ -63,7 +69,10 @@ class DataTableExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return const MaterialApp( - home: SingleChildScrollView(padding: EdgeInsets.all(12.0), child: DataTableExample()), + home: SingleChildScrollView( + padding: EdgeInsets.all(12.0), + child: DataTableExample(), + ), ); } } @@ -260,7 +269,15 @@ final List>> episodes = >>[ 'Kathryn Lyn, Bill Wolkoff', DateTime(2023, 7, 22), ], - >[18, 2, 8, 'Under the Cloak of War', '', 'Davy Perez', DateTime(2023, 7, 27)], + >[ + 18, + 2, + 8, + 'Under the Cloak of War', + '', + 'Davy Perez', + DateTime(2023, 7, 27), + ], >[ 19, 2, @@ -270,5 +287,13 @@ final List>> episodes = >>[ 'Dana Horgan, Bill Wolkoff', DateTime(2023, 8, 3), ], - >[20, 2, 10, 'Hegemony', '', 'Henry Alonso Myers', DateTime(2023, 8, 10)], + >[ + 20, + 2, + 10, + 'Hegemony', + '', + 'Henry Alonso Myers', + DateTime(2023, 8, 10), + ], ]; diff --git a/examples/api/lib/material/platform_menu_bar/platform_menu_bar.0.dart b/examples/api/lib/material/platform_menu_bar/platform_menu_bar.0.dart index 66b1377dfb0..f49ca875d4b 100644 --- a/examples/api/lib/material/platform_menu_bar/platform_menu_bar.0.dart +++ b/examples/api/lib/material/platform_menu_bar/platform_menu_bar.0.dart @@ -92,7 +92,10 @@ class _PlatformMenuBarExampleState extends State { menus: [ PlatformMenuItem( label: 'I am not throwing away my shot.', - shortcut: const SingleActivator(LogicalKeyboardKey.digit1, meta: true), + shortcut: const SingleActivator( + LogicalKeyboardKey.digit1, + meta: true, + ), onSelected: () { setState(() { _message = 'I am not throwing away my shot.'; @@ -100,11 +103,16 @@ class _PlatformMenuBarExampleState extends State { }, ), PlatformMenuItem( - label: "There's a million things I haven't done, but just you wait.", - shortcut: const SingleActivator(LogicalKeyboardKey.digit2, meta: true), + label: + "There's a million things I haven't done, but just you wait.", + shortcut: const SingleActivator( + LogicalKeyboardKey.digit2, + meta: true, + ), onSelected: () { setState(() { - _message = "There's a million things I haven't done, but just you wait."; + _message = + "There's a million things I haven't done, but just you wait."; }); }, ), @@ -112,8 +120,12 @@ class _PlatformMenuBarExampleState extends State { ), ], ), - if (PlatformProvidedMenuItem.hasMenu(PlatformProvidedMenuItemType.quit)) - const PlatformProvidedMenuItem(type: PlatformProvidedMenuItemType.quit), + if (PlatformProvidedMenuItem.hasMenu( + PlatformProvidedMenuItemType.quit, + )) + const PlatformProvidedMenuItem( + type: PlatformProvidedMenuItemType.quit, + ), ], ), ], diff --git a/examples/api/lib/material/popup_menu/popup_menu.0.dart b/examples/api/lib/material/popup_menu/popup_menu.0.dart index fc540c25339..055454e02d9 100644 --- a/examples/api/lib/material/popup_menu/popup_menu.0.dart +++ b/examples/api/lib/material/popup_menu/popup_menu.0.dart @@ -43,9 +43,18 @@ class _PopupMenuExampleState extends State { }); }, itemBuilder: (BuildContext context) => >[ - const PopupMenuItem(value: SampleItem.itemOne, child: Text('Item 1')), - const PopupMenuItem(value: SampleItem.itemTwo, child: Text('Item 2')), - const PopupMenuItem(value: SampleItem.itemThree, child: Text('Item 3')), + const PopupMenuItem( + value: SampleItem.itemOne, + child: Text('Item 1'), + ), + const PopupMenuItem( + value: SampleItem.itemTwo, + child: Text('Item 2'), + ), + const PopupMenuItem( + value: SampleItem.itemThree, + child: Text('Item 3'), + ), ], ), ), diff --git a/examples/api/lib/material/popup_menu/popup_menu.1.dart b/examples/api/lib/material/popup_menu/popup_menu.1.dart index ae99a964d22..da7cee1f6aa 100644 --- a/examples/api/lib/material/popup_menu/popup_menu.1.dart +++ b/examples/api/lib/material/popup_menu/popup_menu.1.dart @@ -46,9 +46,18 @@ class _PopupMenuExampleState extends State { }); }, itemBuilder: (BuildContext context) => >[ - const PopupMenuItem(value: SampleItem.itemOne, child: Text('Item 1')), - const PopupMenuItem(value: SampleItem.itemTwo, child: Text('Item 2')), - const PopupMenuItem(value: SampleItem.itemThree, child: Text('Item 3')), + const PopupMenuItem( + value: SampleItem.itemOne, + child: Text('Item 1'), + ), + const PopupMenuItem( + value: SampleItem.itemTwo, + child: Text('Item 2'), + ), + const PopupMenuItem( + value: SampleItem.itemThree, + child: Text('Item 3'), + ), ], ), ), diff --git a/examples/api/lib/material/popup_menu/popup_menu.2.dart b/examples/api/lib/material/popup_menu/popup_menu.2.dart index a4671647e23..8c432be44e0 100644 --- a/examples/api/lib/material/popup_menu/popup_menu.2.dart +++ b/examples/api/lib/material/popup_menu/popup_menu.2.dart @@ -19,11 +19,12 @@ class PopupMenuApp extends StatelessWidget { enum AnimationStyles { defaultStyle, custom, none } -const List<(AnimationStyles, String)> animationStyleSegments = <(AnimationStyles, String)>[ - (AnimationStyles.defaultStyle, 'Default'), - (AnimationStyles.custom, 'Custom'), - (AnimationStyles.none, 'None'), -]; +const List<(AnimationStyles, String)> animationStyleSegments = + <(AnimationStyles, String)>[ + (AnimationStyles.defaultStyle, 'Default'), + (AnimationStyles.custom, 'Custom'), + (AnimationStyles.none, 'None'), + ]; enum Menu { preview, share, getLink, remove, download } @@ -35,7 +36,9 @@ class PopupMenuExample extends StatefulWidget { } class _PopupMenuExampleState extends State { - Set _animationStyleSelection = {AnimationStyles.defaultStyle}; + Set _animationStyleSelection = { + AnimationStyles.defaultStyle, + }; AnimationStyle? _animationStyle; @override @@ -68,11 +71,16 @@ class _PopupMenuExampleState extends State { } }); }, - segments: animationStyleSegments.map>(( - (AnimationStyles, String) shirt, - ) { - return ButtonSegment(value: shirt.$1, label: Text(shirt.$2)); - }).toList(), + segments: animationStyleSegments + .map>(( + (AnimationStyles, String) shirt, + ) { + return ButtonSegment( + value: shirt.$1, + label: Text(shirt.$2), + ); + }) + .toList(), ), const SizedBox(height: 10), PopupMenuButton( @@ -89,16 +97,25 @@ class _PopupMenuExampleState extends State { ), const PopupMenuItem( value: Menu.share, - child: ListTile(leading: Icon(Icons.share_outlined), title: Text('Share')), + child: ListTile( + leading: Icon(Icons.share_outlined), + title: Text('Share'), + ), ), const PopupMenuItem( value: Menu.getLink, - child: ListTile(leading: Icon(Icons.link_outlined), title: Text('Get link')), + child: ListTile( + leading: Icon(Icons.link_outlined), + title: Text('Get link'), + ), ), const PopupMenuDivider(), const PopupMenuItem( value: Menu.remove, - child: ListTile(leading: Icon(Icons.delete_outline), title: Text('Remove')), + child: ListTile( + leading: Icon(Icons.delete_outline), + title: Text('Remove'), + ), ), const PopupMenuItem( value: Menu.download, diff --git a/examples/api/lib/material/progress_indicator/circular_progress_indicator.0.dart b/examples/api/lib/material/progress_indicator/circular_progress_indicator.0.dart index 3a5c704581c..17ed6876107 100644 --- a/examples/api/lib/material/progress_indicator/circular_progress_indicator.0.dart +++ b/examples/api/lib/material/progress_indicator/circular_progress_indicator.0.dart @@ -21,7 +21,8 @@ class ProgressIndicatorExample extends StatefulWidget { const ProgressIndicatorExample({super.key}); @override - State createState() => _ProgressIndicatorExampleState(); + State createState() => + _ProgressIndicatorExampleState(); } class _ProgressIndicatorExampleState extends State @@ -32,11 +33,12 @@ class _ProgressIndicatorExampleState extends State @override void initState() { super.initState(); - controller = AnimationController(vsync: this, duration: const Duration(seconds: 5)) - ..addListener(() { - setState(() {}); - }) - ..repeat(reverse: true); + controller = + AnimationController(vsync: this, duration: const Duration(seconds: 5)) + ..addListener(() { + setState(() {}); + }) + ..repeat(reverse: true); } @override @@ -56,11 +58,16 @@ class _ProgressIndicatorExampleState extends State const Text('Determinate CircularProgressIndicator'), Padding( padding: const EdgeInsets.symmetric(horizontal: 16), - child: CircularProgressIndicator(year2023: year2023, value: controller.value), + child: CircularProgressIndicator( + // ignore: deprecated_member_use + year2023: year2023, + value: controller.value, + ), ), const Text('Indeterminate CircularProgressIndicator'), Padding( padding: const EdgeInsets.symmetric(horizontal: 16), + // ignore: deprecated_member_use child: CircularProgressIndicator(year2023: year2023), ), SwitchListTile( diff --git a/examples/api/lib/material/progress_indicator/circular_progress_indicator.1.dart b/examples/api/lib/material/progress_indicator/circular_progress_indicator.1.dart index 1851fcae0e6..f641aa6d27f 100644 --- a/examples/api/lib/material/progress_indicator/circular_progress_indicator.1.dart +++ b/examples/api/lib/material/progress_indicator/circular_progress_indicator.1.dart @@ -24,7 +24,8 @@ class ProgressIndicatorExample extends StatefulWidget { const ProgressIndicatorExample({super.key}); @override - State createState() => _ProgressIndicatorExampleState(); + State createState() => + _ProgressIndicatorExampleState(); } class _ProgressIndicatorExampleState extends State @@ -62,7 +63,10 @@ class _ProgressIndicatorExampleState extends State spacing: 16.0, mainAxisAlignment: MainAxisAlignment.center, children: [ - Text('Circular progress indicator', style: Theme.of(context).textTheme.titleLarge), + Text( + 'Circular progress indicator', + style: Theme.of(context).textTheme.titleLarge, + ), CircularProgressIndicator( value: controller.value, semanticsLabel: 'Circular progress indicator', @@ -70,7 +74,10 @@ class _ProgressIndicatorExampleState extends State Row( children: [ Expanded( - child: Text('determinate Mode', style: Theme.of(context).textTheme.titleSmall), + child: Text( + 'determinate Mode', + style: Theme.of(context).textTheme.titleSmall, + ), ), Switch( value: determinate, diff --git a/examples/api/lib/material/progress_indicator/circular_progress_indicator.2.dart b/examples/api/lib/material/progress_indicator/circular_progress_indicator.2.dart index de414048f8d..f62889b42af 100644 --- a/examples/api/lib/material/progress_indicator/circular_progress_indicator.2.dart +++ b/examples/api/lib/material/progress_indicator/circular_progress_indicator.2.dart @@ -24,7 +24,8 @@ class ProgressIndicatorExample extends StatefulWidget { const ProgressIndicatorExample({super.key}); @override - State createState() => _ProgressIndicatorExampleState(); + State createState() => + _ProgressIndicatorExampleState(); } class _ProgressIndicatorExampleState extends State @@ -87,7 +88,9 @@ class _ProgressIndicatorExampleState extends State Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Text('Theme controller? ${hasThemeController ? 'Yes' : 'No'}'), + Text( + 'Theme controller? ${hasThemeController ? 'Yes' : 'No'}', + ), TextButton( onPressed: () { setState(() { diff --git a/examples/api/lib/material/progress_indicator/linear_progress_indicator.0.dart b/examples/api/lib/material/progress_indicator/linear_progress_indicator.0.dart index be3e88700ad..d91ed042d21 100644 --- a/examples/api/lib/material/progress_indicator/linear_progress_indicator.0.dart +++ b/examples/api/lib/material/progress_indicator/linear_progress_indicator.0.dart @@ -21,7 +21,8 @@ class ProgressIndicatorExample extends StatefulWidget { const ProgressIndicatorExample({super.key}); @override - State createState() => _ProgressIndicatorExampleState(); + State createState() => + _ProgressIndicatorExampleState(); } class _ProgressIndicatorExampleState extends State @@ -61,11 +62,16 @@ class _ProgressIndicatorExampleState extends State const Text('Determinate LinearProgressIndicator'), Padding( padding: const EdgeInsets.symmetric(horizontal: 16), - child: LinearProgressIndicator(year2023: year2023, value: controller.value), + child: LinearProgressIndicator( + // ignore: deprecated_member_use + year2023: year2023, + value: controller.value, + ), ), const Text('Indeterminate LinearProgressIndicator'), Padding( padding: const EdgeInsets.symmetric(horizontal: 16), + // ignore: deprecated_member_use child: LinearProgressIndicator(year2023: year2023), ), SwitchListTile( diff --git a/examples/api/lib/material/progress_indicator/linear_progress_indicator.1.dart b/examples/api/lib/material/progress_indicator/linear_progress_indicator.1.dart index 159ed8425a2..98b35120a17 100644 --- a/examples/api/lib/material/progress_indicator/linear_progress_indicator.1.dart +++ b/examples/api/lib/material/progress_indicator/linear_progress_indicator.1.dart @@ -21,7 +21,8 @@ class ProgressIndicatorExample extends StatefulWidget { const ProgressIndicatorExample({super.key}); @override - State createState() => _ProgressIndicatorExampleState(); + State createState() => + _ProgressIndicatorExampleState(); } class _ProgressIndicatorExampleState extends State @@ -60,7 +61,10 @@ class _ProgressIndicatorExampleState extends State spacing: 16.0, mainAxisAlignment: MainAxisAlignment.center, children: [ - const Text('Linear progress indicator', style: TextStyle(fontSize: 20)), + const Text( + 'Linear progress indicator', + style: TextStyle(fontSize: 20), + ), LinearProgressIndicator( value: determinate ? controller.value : null, semanticsLabel: 'Linear progress indicator', diff --git a/examples/api/lib/material/radio/radio.1.dart b/examples/api/lib/material/radio/radio.1.dart index 13bae7f1d3a..c368ef13574 100644 --- a/examples/api/lib/material/radio/radio.1.dart +++ b/examples/api/lib/material/radio/radio.1.dart @@ -49,7 +49,9 @@ class _RadioExampleState extends State { title: const Text('Fill color'), leading: Radio( value: RadioType.fillColor, - fillColor: WidgetStateColor.resolveWith((Set states) { + fillColor: WidgetStateColor.resolveWith(( + Set states, + ) { if (states.contains(WidgetState.selected)) { return Colors.deepPurple; } else { @@ -62,7 +64,9 @@ class _RadioExampleState extends State { title: const Text('Background color'), leading: Radio( value: RadioType.backgroundColor, - backgroundColor: WidgetStateColor.resolveWith((Set states) { + backgroundColor: WidgetStateColor.resolveWith(( + Set states, + ) { if (states.contains(WidgetState.selected)) { return Colors.greenAccent.withValues(alpha: 0.5); } else { @@ -75,7 +79,9 @@ class _RadioExampleState extends State { title: const Text('Side'), leading: Radio( value: RadioType.side, - side: WidgetStateBorderSide.resolveWith((Set states) { + side: WidgetStateBorderSide.resolveWith(( + Set states, + ) { if (states.contains(WidgetState.selected)) { return const BorderSide( color: Colors.red, diff --git a/examples/api/lib/material/radio_list_tile/custom_labeled_radio.1.dart b/examples/api/lib/material/radio_list_tile/custom_labeled_radio.1.dart index decd223f7f3..bf7f996d480 100644 --- a/examples/api/lib/material/radio_list_tile/custom_labeled_radio.1.dart +++ b/examples/api/lib/material/radio_list_tile/custom_labeled_radio.1.dart @@ -23,7 +23,12 @@ class LabeledRadioApp extends StatelessWidget { } class LabeledRadio extends StatelessWidget { - const LabeledRadio({super.key, required this.label, required this.padding, required this.value}); + const LabeledRadio({ + super.key, + required this.label, + required this.padding, + required this.value, + }); final String label; final EdgeInsets padding; diff --git a/examples/api/lib/material/refresh_indicator/refresh_indicator.0.dart b/examples/api/lib/material/refresh_indicator/refresh_indicator.0.dart index 5b23b986411..bc7cc9c4778 100644 --- a/examples/api/lib/material/refresh_indicator/refresh_indicator.0.dart +++ b/examples/api/lib/material/refresh_indicator/refresh_indicator.0.dart @@ -21,11 +21,13 @@ class RefreshIndicatorExample extends StatefulWidget { const RefreshIndicatorExample({super.key}); @override - State createState() => _RefreshIndicatorExampleState(); + State createState() => + _RefreshIndicatorExampleState(); } class _RefreshIndicatorExampleState extends State { - final GlobalKey _refreshIndicatorKey = GlobalKey(); + final GlobalKey _refreshIndicatorKey = + GlobalKey(); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/refresh_indicator/refresh_indicator.1.dart b/examples/api/lib/material/refresh_indicator/refresh_indicator.1.dart index d966644a524..f92e065e137 100644 --- a/examples/api/lib/material/refresh_indicator/refresh_indicator.1.dart +++ b/examples/api/lib/material/refresh_indicator/refresh_indicator.1.dart @@ -59,7 +59,10 @@ class RefreshIndicatorExample extends StatelessWidget { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Text('Pull down here', style: Theme.of(context).textTheme.headlineMedium), + Text( + 'Pull down here', + style: Theme.of(context).textTheme.headlineMedium, + ), const Text("RefreshIndicator won't trigger"), ], ), diff --git a/examples/api/lib/material/refresh_indicator/refresh_indicator.2.dart b/examples/api/lib/material/refresh_indicator/refresh_indicator.2.dart index 76d93a13cae..75443de392f 100644 --- a/examples/api/lib/material/refresh_indicator/refresh_indicator.2.dart +++ b/examples/api/lib/material/refresh_indicator/refresh_indicator.2.dart @@ -21,7 +21,8 @@ class RefreshIndicatorExample extends StatefulWidget { const RefreshIndicatorExample({super.key}); @override - State createState() => _RefreshIndicatorExampleState(); + State createState() => + _RefreshIndicatorExampleState(); } class _RefreshIndicatorExampleState extends State { @@ -64,7 +65,9 @@ class _RefreshIndicatorExampleState extends State { return ListTile( tileColor: Colors.green[100], title: const Text('Pull down here'), - subtitle: const Text('A custom refresh indicator will be shown'), + subtitle: const Text( + 'A custom refresh indicator will be shown', + ), ); }, ), diff --git a/examples/api/lib/material/reorderable_list/reorderable_list_view.0.dart b/examples/api/lib/material/reorderable_list/reorderable_list_view.0.dart index e5a798eb7a3..14d49f5a588 100644 --- a/examples/api/lib/material/reorderable_list/reorderable_list_view.0.dart +++ b/examples/api/lib/material/reorderable_list/reorderable_list_view.0.dart @@ -35,8 +35,8 @@ class _ReorderableListViewExampleState extends State { @override Widget build(BuildContext context) { final ColorScheme colorScheme = Theme.of(context).colorScheme; - final Color oddItemColor = colorScheme.primary.withOpacity(0.05); - final Color evenItemColor = colorScheme.primary.withOpacity(0.15); + final Color oddItemColor = colorScheme.primary.withValues(alpha: 0.05); + final Color evenItemColor = colorScheme.primary.withValues(alpha: 0.15); return ReorderableListView( padding: const EdgeInsets.symmetric(horizontal: 40), diff --git a/examples/api/lib/material/reorderable_list/reorderable_list_view.1.dart b/examples/api/lib/material/reorderable_list/reorderable_list_view.1.dart index 9f489203715..ebd2a9621d3 100644 --- a/examples/api/lib/material/reorderable_list/reorderable_list_view.1.dart +++ b/examples/api/lib/material/reorderable_list/reorderable_list_view.1.dart @@ -37,11 +37,15 @@ class _ReorderableExampleState extends State { @override Widget build(BuildContext context) { final ColorScheme colorScheme = Theme.of(context).colorScheme; - final Color oddItemColor = colorScheme.secondary.withOpacity(0.05); - final Color evenItemColor = colorScheme.secondary.withOpacity(0.15); + final Color oddItemColor = colorScheme.secondary.withValues(alpha: 0.05); + final Color evenItemColor = colorScheme.secondary.withValues(alpha: 0.15); final Color draggableItemColor = colorScheme.secondary; - Widget proxyDecorator(Widget child, int index, Animation animation) { + Widget proxyDecorator( + Widget child, + int index, + Animation animation, + ) { return AnimatedBuilder( animation: animation, builder: (BuildContext context, Widget? child) { diff --git a/examples/api/lib/material/reorderable_list/reorderable_list_view.2.dart b/examples/api/lib/material/reorderable_list/reorderable_list_view.2.dart index 17b1981f8ae..6dd0690c17a 100644 --- a/examples/api/lib/material/reorderable_list/reorderable_list_view.2.dart +++ b/examples/api/lib/material/reorderable_list/reorderable_list_view.2.dart @@ -44,11 +44,18 @@ class _ReorderableExampleState extends State { Card( key: Key('$index'), color: _items[index].isOdd ? oddItemColor : evenItemColor, - child: SizedBox(height: 80, child: Center(child: Text('Card ${_items[index]}'))), + child: SizedBox( + height: 80, + child: Center(child: Text('Card ${_items[index]}')), + ), ), ]; - Widget proxyDecorator(Widget child, int index, Animation animation) { + Widget proxyDecorator( + Widget child, + int index, + Animation animation, + ) { return AnimatedBuilder( animation: animation, builder: (BuildContext context, Widget? child) { @@ -59,7 +66,11 @@ class _ReorderableExampleState extends State { scale: scale, // Create a Card based on the color and the content of the dragged one // and set its elevation to the animated value. - child: Card(elevation: elevation, color: cards[index].color, child: cards[index].child), + child: Card( + elevation: elevation, + color: cards[index].color, + child: cards[index].child, + ), ); }, child: child, diff --git a/examples/api/lib/material/reorderable_list/reorderable_list_view.build_default_drag_handles.0.dart b/examples/api/lib/material/reorderable_list/reorderable_list_view.build_default_drag_handles.0.dart index 77c21b1b926..b291ad760d7 100644 --- a/examples/api/lib/material/reorderable_list/reorderable_list_view.build_default_drag_handles.0.dart +++ b/examples/api/lib/material/reorderable_list/reorderable_list_view.build_default_drag_handles.0.dart @@ -35,8 +35,8 @@ class _ReorderableExampleState extends State { @override Widget build(BuildContext context) { final ColorScheme colorScheme = Theme.of(context).colorScheme; - final Color oddItemColor = colorScheme.primary.withOpacity(0.05); - final Color evenItemColor = colorScheme.primary.withOpacity(0.15); + final Color oddItemColor = colorScheme.primary.withValues(alpha: 0.05); + final Color evenItemColor = colorScheme.primary.withValues(alpha: 0.15); return ReorderableListView( buildDefaultDragHandles: false, diff --git a/examples/api/lib/material/scaffold/scaffold.drawer.0.dart b/examples/api/lib/material/scaffold/scaffold.drawer.0.dart index 91425a8a79f..64e374e34af 100644 --- a/examples/api/lib/material/scaffold/scaffold.drawer.0.dart +++ b/examples/api/lib/material/scaffold/scaffold.drawer.0.dart @@ -41,7 +41,10 @@ class _DrawerExampleState extends State { key: _scaffoldKey, appBar: AppBar(title: const Text('Drawer Demo')), body: Center( - child: ElevatedButton(onPressed: _openDrawer, child: const Text('Open Drawer')), + child: ElevatedButton( + onPressed: _openDrawer, + child: const Text('Open Drawer'), + ), ), drawer: Drawer( child: Center( @@ -49,7 +52,10 @@ class _DrawerExampleState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ const Text('This is the Drawer'), - ElevatedButton(onPressed: _closeDrawer, child: const Text('Close Drawer')), + ElevatedButton( + onPressed: _closeDrawer, + child: const Text('Close Drawer'), + ), ], ), ), diff --git a/examples/api/lib/material/scaffold/scaffold.end_drawer.0.dart b/examples/api/lib/material/scaffold/scaffold.end_drawer.0.dart index 5d26aae38c6..f41747d5c41 100644 --- a/examples/api/lib/material/scaffold/scaffold.end_drawer.0.dart +++ b/examples/api/lib/material/scaffold/scaffold.end_drawer.0.dart @@ -41,7 +41,10 @@ class _EndDrawerExampleState extends State { key: _scaffoldKey, appBar: AppBar(title: const Text('Drawer Demo')), body: Center( - child: ElevatedButton(onPressed: _openEndDrawer, child: const Text('Open End Drawer')), + child: ElevatedButton( + onPressed: _openEndDrawer, + child: const Text('Open End Drawer'), + ), ), endDrawer: Drawer( child: Center( @@ -49,7 +52,10 @@ class _EndDrawerExampleState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ const Text('This is the Drawer'), - ElevatedButton(onPressed: _closeEndDrawer, child: const Text('Close Drawer')), + ElevatedButton( + onPressed: _closeEndDrawer, + child: const Text('Close Drawer'), + ), ], ), ), diff --git a/examples/api/lib/material/scaffold/scaffold.floating_action_button_animator.0.dart b/examples/api/lib/material/scaffold/scaffold.floating_action_button_animator.0.dart index 813e730ac32..15d703517a9 100644 --- a/examples/api/lib/material/scaffold/scaffold.floating_action_button_animator.0.dart +++ b/examples/api/lib/material/scaffold/scaffold.floating_action_button_animator.0.dart @@ -13,7 +13,9 @@ class ScaffoldFloatingActionButtonAnimatorApp extends StatelessWidget { @override Widget build(BuildContext context) { - return const MaterialApp(home: ScaffoldFloatingActionButtonAnimatorExample()); + return const MaterialApp( + home: ScaffoldFloatingActionButtonAnimatorExample(), + ); } } @@ -42,7 +44,9 @@ class ScaffoldFloatingActionButtonAnimatorExample extends StatefulWidget { class _ScaffoldFloatingActionButtonAnimatorExampleState extends State { - Set _selectedFabAnimator = {FabAnimator.defaultStyle}; + Set _selectedFabAnimator = { + FabAnimator.defaultStyle, + }; Set _selectedFabLocation = {FabLocation.endFloat}; FloatingActionButtonAnimator? _floatingActionButtonAnimator; FloatingActionButtonLocation? _floatingActionButtonLocation; @@ -64,7 +68,8 @@ class _ScaffoldFloatingActionButtonAnimatorExampleState setState(() { _floatingActionButtonAnimator = switch (styles.first) { FabAnimator.defaultStyle => null, - FabAnimator.none => FloatingActionButtonAnimator.noAnimation, + FabAnimator.none => + FloatingActionButtonAnimator.noAnimation, }; _selectedFabAnimator = styles; }); @@ -74,7 +79,10 @@ class _ScaffoldFloatingActionButtonAnimatorExampleState ) { final FabAnimator animator = fabAnimator.$1; final String label = fabAnimator.$2; - return ButtonSegment(value: animator, label: Text(label)); + return ButtonSegment( + value: animator, + label: Text(label), + ); }).toList(), ), const SizedBox(height: 10), @@ -83,8 +91,10 @@ class _ScaffoldFloatingActionButtonAnimatorExampleState onSelectionChanged: (Set styles) { setState(() { _floatingActionButtonLocation = switch (styles.first) { - FabLocation.centerFloat => FloatingActionButtonLocation.centerFloat, - FabLocation.endFloat => FloatingActionButtonLocation.endFloat, + FabLocation.centerFloat => + FloatingActionButtonLocation.centerFloat, + FabLocation.endFloat => + FloatingActionButtonLocation.endFloat, FabLocation.endTop => FloatingActionButtonLocation.endTop, }; _selectedFabLocation = styles; @@ -95,7 +105,10 @@ class _ScaffoldFloatingActionButtonAnimatorExampleState ) { final FabLocation location = fabLocation.$1; final String label = fabLocation.$2; - return ButtonSegment(value: location, label: Text(label)); + return ButtonSegment( + value: location, + label: Text(label), + ); }).toList(), ), const SizedBox(height: 10), @@ -113,7 +126,10 @@ class _ScaffoldFloatingActionButtonAnimatorExampleState ), floatingActionButton: !_showFab ? null - : FloatingActionButton(onPressed: () {}, child: const Icon(Icons.add)), + : FloatingActionButton( + onPressed: () {}, + child: const Icon(Icons.add), + ), ); } } diff --git a/examples/api/lib/material/scaffold/scaffold_messenger.0.dart b/examples/api/lib/material/scaffold/scaffold_messenger.0.dart index 21b23e8a8fe..10b0e89e1e1 100644 --- a/examples/api/lib/material/scaffold/scaffold_messenger.0.dart +++ b/examples/api/lib/material/scaffold/scaffold_messenger.0.dart @@ -29,9 +29,9 @@ class ScaffoldMessengerExample extends StatelessWidget { Widget build(BuildContext context) { return OutlinedButton( onPressed: () { - ScaffoldMessenger.of( - context, - ).showSnackBar(const SnackBar(content: Text('A SnackBar has been shown.'))); + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar(content: Text('A SnackBar has been shown.')), + ); }, child: const Text('Show SnackBar'), ); diff --git a/examples/api/lib/material/scaffold/scaffold_messenger.of.0.dart b/examples/api/lib/material/scaffold/scaffold_messenger.of.0.dart index 1ddf1ec8f0d..08380a6ac79 100644 --- a/examples/api/lib/material/scaffold/scaffold_messenger.of.0.dart +++ b/examples/api/lib/material/scaffold/scaffold_messenger.of.0.dart @@ -30,7 +30,9 @@ class OfExample extends StatelessWidget { return ElevatedButton( child: const Text('SHOW A SNACKBAR'), onPressed: () { - ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('Have a snack!'))); + ScaffoldMessenger.of( + context, + ).showSnackBar(const SnackBar(content: Text('Have a snack!'))); }, ); } diff --git a/examples/api/lib/material/scaffold/scaffold_messenger.of.1.dart b/examples/api/lib/material/scaffold/scaffold_messenger.of.1.dart index 2beec64ef80..ee878ebc959 100644 --- a/examples/api/lib/material/scaffold/scaffold_messenger.of.1.dart +++ b/examples/api/lib/material/scaffold/scaffold_messenger.of.1.dart @@ -42,7 +42,10 @@ class _OfExampleAppState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ const Text('You have pushed the button this many times:'), - Text('$_counter', style: Theme.of(context).textTheme.headlineMedium), + Text( + '$_counter', + style: Theme.of(context).textTheme.headlineMedium, + ), ], ), ), diff --git a/examples/api/lib/material/scaffold/scaffold_messenger_state.show_material_banner.0.dart b/examples/api/lib/material/scaffold/scaffold_messenger_state.show_material_banner.0.dart index 112f3e34f5c..9f74094a053 100644 --- a/examples/api/lib/material/scaffold/scaffold_messenger_state.show_material_banner.0.dart +++ b/examples/api/lib/material/scaffold/scaffold_messenger_state.show_material_banner.0.dart @@ -32,7 +32,9 @@ class ShowMaterialBannerExample extends StatelessWidget { ScaffoldMessenger.of(context).showMaterialBanner( const MaterialBanner( content: Text('This is a MaterialBanner'), - actions: [TextButton(onPressed: null, child: Text('DISMISS'))], + actions: [ + TextButton(onPressed: null, child: Text('DISMISS')), + ], ), ); }, diff --git a/examples/api/lib/material/scaffold/scaffold_messenger_state.show_snack_bar.0.dart b/examples/api/lib/material/scaffold/scaffold_messenger_state.show_snack_bar.0.dart index 0bf077e523e..1d4cbab4132 100644 --- a/examples/api/lib/material/scaffold/scaffold_messenger_state.show_snack_bar.0.dart +++ b/examples/api/lib/material/scaffold/scaffold_messenger_state.show_snack_bar.0.dart @@ -29,9 +29,9 @@ class ShowSnackBarExample extends StatelessWidget { Widget build(BuildContext context) { return OutlinedButton( onPressed: () { - ScaffoldMessenger.of( - context, - ).showSnackBar(const SnackBar(content: Text('A SnackBar has been shown.'))); + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar(content: Text('A SnackBar has been shown.')), + ); }, child: const Text('Show SnackBar'), ); diff --git a/examples/api/lib/material/scaffold/scaffold_messenger_state.show_snack_bar.2.dart b/examples/api/lib/material/scaffold/scaffold_messenger_state.show_snack_bar.2.dart index 29941a0470d..ed719814fad 100644 --- a/examples/api/lib/material/scaffold/scaffold_messenger_state.show_snack_bar.2.dart +++ b/examples/api/lib/material/scaffold/scaffold_messenger_state.show_snack_bar.2.dart @@ -19,11 +19,12 @@ class SnackBarApp extends StatelessWidget { enum AnimationStyles { defaultStyle, custom, none } -const List<(AnimationStyles, String)> animationStyleSegments = <(AnimationStyles, String)>[ - (AnimationStyles.defaultStyle, 'Default'), - (AnimationStyles.custom, 'Custom'), - (AnimationStyles.none, 'None'), -]; +const List<(AnimationStyles, String)> animationStyleSegments = + <(AnimationStyles, String)>[ + (AnimationStyles.defaultStyle, 'Default'), + (AnimationStyles.custom, 'Custom'), + (AnimationStyles.none, 'None'), + ]; class SnackBarExample extends StatefulWidget { const SnackBarExample({super.key}); @@ -33,7 +34,9 @@ class SnackBarExample extends StatefulWidget { } class _SnackBarExampleState extends State { - Set _animationStyleSelection = {AnimationStyles.defaultStyle}; + Set _animationStyleSelection = { + AnimationStyles.defaultStyle, + }; AnimationStyle? _animationStyle; @override @@ -59,11 +62,16 @@ class _SnackBarExampleState extends State { _animationStyleSelection = styles; }); }, - segments: animationStyleSegments.map>(( - (AnimationStyles, String) shirt, - ) { - return ButtonSegment(value: shirt.$1, label: Text(shirt.$2)); - }).toList(), + segments: animationStyleSegments + .map>(( + (AnimationStyles, String) shirt, + ) { + return ButtonSegment( + value: shirt.$1, + label: Text(shirt.$2), + ); + }) + .toList(), ), const SizedBox(height: 10), Builder( @@ -71,7 +79,10 @@ class _SnackBarExampleState extends State { return ElevatedButton( onPressed: () { ScaffoldMessenger.of(context).showSnackBar( - const SnackBar(content: Text('I am a snack bar.'), showCloseIcon: true), + const SnackBar( + content: Text('I am a snack bar.'), + showCloseIcon: true, + ), snackBarAnimationStyle: _animationStyle, ); }, diff --git a/examples/api/lib/material/scaffold/scaffold_state.show_bottom_sheet.1.dart b/examples/api/lib/material/scaffold/scaffold_state.show_bottom_sheet.1.dart index a4127e1ab1f..db2713937a9 100644 --- a/examples/api/lib/material/scaffold/scaffold_state.show_bottom_sheet.1.dart +++ b/examples/api/lib/material/scaffold/scaffold_state.show_bottom_sheet.1.dart @@ -24,11 +24,12 @@ class ShowBottomSheetExampleApp extends StatelessWidget { enum AnimationStyles { defaultStyle, custom, none } -const List<(AnimationStyles, String)> animationStyleSegments = <(AnimationStyles, String)>[ - (AnimationStyles.defaultStyle, 'Default'), - (AnimationStyles.custom, 'Custom'), - (AnimationStyles.none, 'None'), -]; +const List<(AnimationStyles, String)> animationStyleSegments = + <(AnimationStyles, String)>[ + (AnimationStyles.defaultStyle, 'Default'), + (AnimationStyles.custom, 'Custom'), + (AnimationStyles.none, 'None'), + ]; class ShowBottomSheetExample extends StatefulWidget { const ShowBottomSheetExample({super.key}); @@ -38,7 +39,9 @@ class ShowBottomSheetExample extends StatefulWidget { } class _ShowBottomSheetExampleState extends State { - Set _animationStyleSelection = {AnimationStyles.defaultStyle}; + Set _animationStyleSelection = { + AnimationStyles.defaultStyle, + }; AnimationStyle? _animationStyle; @override @@ -62,38 +65,44 @@ class _ShowBottomSheetExampleState extends State { _animationStyleSelection = styles; }); }, - segments: animationStyleSegments.map>(( - (AnimationStyles, String) shirt, - ) { - return ButtonSegment(value: shirt.$1, label: Text(shirt.$2)); - }).toList(), + segments: animationStyleSegments + .map>(( + (AnimationStyles, String) shirt, + ) { + return ButtonSegment( + value: shirt.$1, + label: Text(shirt.$2), + ); + }) + .toList(), ), const SizedBox(height: 10), ElevatedButton( child: const Text('showBottomSheet'), onPressed: () { - Scaffold.of(context).showBottomSheet(sheetAnimationStyle: _animationStyle, ( - BuildContext context, - ) { - return SizedBox( - height: 200, - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.min, - children: [ - const Text('BottomSheet'), - ElevatedButton( - child: const Text('Close'), - onPressed: () { - Navigator.pop(context); - }, - ), - ], + Scaffold.of(context).showBottomSheet( + sheetAnimationStyle: _animationStyle, + (BuildContext context) { + return SizedBox( + height: 200, + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + const Text('BottomSheet'), + ElevatedButton( + child: const Text('Close'), + onPressed: () { + Navigator.pop(context); + }, + ), + ], + ), ), - ), - ); - }); + ); + }, + ); }, ), ], diff --git a/examples/api/lib/material/scrollbar/scrollbar.0.dart b/examples/api/lib/material/scrollbar/scrollbar.0.dart index 18177652f0d..7733c24e95e 100644 --- a/examples/api/lib/material/scrollbar/scrollbar.0.dart +++ b/examples/api/lib/material/scrollbar/scrollbar.0.dart @@ -31,7 +31,9 @@ class ScrollbarExample extends StatelessWidget { child: GridView.builder( primary: true, itemCount: 120, - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3), + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, + ), itemBuilder: (BuildContext context, int index) { return Center(child: Text('item $index')); }, diff --git a/examples/api/lib/material/scrollbar/scrollbar.1.dart b/examples/api/lib/material/scrollbar/scrollbar.1.dart index 348d8e6efa1..896f84907f3 100644 --- a/examples/api/lib/material/scrollbar/scrollbar.1.dart +++ b/examples/api/lib/material/scrollbar/scrollbar.1.dart @@ -40,7 +40,9 @@ class _ScrollbarExampleState extends State { child: GridView.builder( controller: _controllerOne, itemCount: 120, - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3), + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, + ), itemBuilder: (BuildContext context, int index) { return Center(child: Text('item $index')); }, diff --git a/examples/api/lib/material/search_anchor/search_anchor.0.dart b/examples/api/lib/material/search_anchor/search_anchor.0.dart index f5b09b5c0cb..59463c91a08 100644 --- a/examples/api/lib/material/search_anchor/search_anchor.0.dart +++ b/examples/api/lib/material/search_anchor/search_anchor.0.dart @@ -28,7 +28,9 @@ class _SearchBarAppState extends State { icon: const Icon(Icons.call_missed), onPressed: () { controller.text = color.label; - controller.selection = TextSelection.collapsed(offset: controller.text.length); + controller.selection = TextSelection.collapsed( + offset: controller.text.length, + ); }, ), ), @@ -47,7 +49,9 @@ class _SearchBarAppState extends State { icon: const Icon(Icons.call_missed), onPressed: () { controller.text = filteredColor.label; - controller.selection = TextSelection.collapsed(offset: controller.text.length); + controller.selection = TextSelection.collapsed( + offset: controller.text.length, + ); }, ), onTap: () { @@ -83,19 +87,23 @@ class _SearchBarAppState extends State { children: [ SearchAnchor.bar( barHintText: 'Search colors', - suggestionsBuilder: (BuildContext context, SearchController controller) { - if (controller.text.isEmpty) { - if (searchHistory.isNotEmpty) { - return getHistoryList(controller); - } - return [ - Center( - child: Text('No search history.', style: TextStyle(color: colors.outline)), - ), - ]; - } - return getSuggestions(controller); - }, + suggestionsBuilder: + (BuildContext context, SearchController controller) { + if (controller.text.isEmpty) { + if (searchHistory.isNotEmpty) { + return getHistoryList(controller); + } + return [ + Center( + child: Text( + 'No search history.', + style: TextStyle(color: colors.outline), + ), + ), + ]; + } + return getSuggestions(controller); + }, ), cardSize, Card(color: colors.primary, child: cardSize), diff --git a/examples/api/lib/material/search_anchor/search_anchor.1.dart b/examples/api/lib/material/search_anchor/search_anchor.1.dart index 31c44c61c58..566e2cec677 100644 --- a/examples/api/lib/material/search_anchor/search_anchor.1.dart +++ b/examples/api/lib/material/search_anchor/search_anchor.1.dart @@ -35,14 +35,15 @@ class _PinnedSearchBarAppState extends State { floating: true, // We can also uncomment this line and set `pinned` to true to see a pinned search bar. title: SearchAnchor.bar( - suggestionsBuilder: (BuildContext context, SearchController controller) { - return List.generate(5, (int index) { - return ListTile( - titleAlignment: ListTileTitleAlignment.center, - title: Text('Initial list item $index'), - ); - }); - }, + suggestionsBuilder: + (BuildContext context, SearchController controller) { + return List.generate(5, (int index) { + return ListTile( + titleAlignment: ListTileTitleAlignment.center, + title: Text('Initial list item $index'), + ); + }); + }, ), ), // The listed items below are just for filling the screen @@ -58,7 +59,9 @@ class _PinnedSearchBarAppState extends State { itemBuilder: (BuildContext context, int index) { return SizedBox( width: 100.0, - child: Card(child: Center(child: Text('Card $index'))), + child: Card( + child: Center(child: Text('Card $index')), + ), ); }, ), @@ -68,7 +71,10 @@ class _PinnedSearchBarAppState extends State { SliverToBoxAdapter( child: Padding( padding: const EdgeInsets.symmetric(horizontal: 20), - child: Container(height: 1000, color: Colors.deepPurple.withValues(alpha: 0.5)), + child: Container( + height: 1000, + color: Colors.deepPurple.withValues(alpha: 0.5), + ), ), ), ], diff --git a/examples/api/lib/material/search_anchor/search_anchor.2.dart b/examples/api/lib/material/search_anchor/search_anchor.2.dart index 71c17c233d4..5f95df7e2c8 100644 --- a/examples/api/lib/material/search_anchor/search_anchor.2.dart +++ b/examples/api/lib/material/search_anchor/search_anchor.2.dart @@ -35,19 +35,20 @@ class _SearchBarAppState extends State { }, ); }, - suggestionsBuilder: (BuildContext context, SearchController controller) { - return List.generate(5, (int index) { - final String item = 'item $index'; - return ListTile( - title: Text(item), - onTap: () { - setState(() { - controller.closeView(item); - }); - }, - ); - }); - }, + suggestionsBuilder: + (BuildContext context, SearchController controller) { + return List.generate(5, (int index) { + final String item = 'item $index'; + return ListTile( + title: Text(item), + onTap: () { + setState(() { + controller.closeView(item); + }); + }, + ); + }); + }, ), Center( child: controller.text.isEmpty diff --git a/examples/api/lib/material/search_anchor/search_anchor.3.dart b/examples/api/lib/material/search_anchor/search_anchor.3.dart index 7eb7e554347..e5551fe1498 100644 --- a/examples/api/lib/material/search_anchor/search_anchor.3.dart +++ b/examples/api/lib/material/search_anchor/search_anchor.3.dart @@ -50,31 +50,38 @@ class _AsyncSearchAnchorState extends State<_AsyncSearchAnchor> { }, ); }, - suggestionsBuilder: (BuildContext context, SearchController controller) async { - _searchingWithQuery = controller.text; - final List options = (await _FakeAPI.search(_searchingWithQuery!)).toList(); + suggestionsBuilder: + (BuildContext context, SearchController controller) async { + _searchingWithQuery = controller.text; + final List options = (await _FakeAPI.search( + _searchingWithQuery!, + )).toList(); - // If another search happened after this one, throw away these options. - // Use the previous options instead and wait for the newer request to - // finish. - if (_searchingWithQuery != controller.text) { - return _lastOptions; - } + // If another search happened after this one, throw away these options. + // Use the previous options instead and wait for the newer request to + // finish. + if (_searchingWithQuery != controller.text) { + return _lastOptions; + } - _lastOptions = List.generate(options.length, (int index) { - final String item = options[index]; - return ListTile(title: Text(item)); - }); + _lastOptions = List.generate(options.length, (int index) { + final String item = options[index]; + return ListTile(title: Text(item)); + }); - return _lastOptions; - }, + return _lastOptions; + }, ); } } // Mimics a remote API. class _FakeAPI { - static const List _kOptions = ['aardvark', 'bobcat', 'chameleon']; + static const List _kOptions = [ + 'aardvark', + 'bobcat', + 'chameleon', + ]; // Searches the options, but injects a fake "network" delay. static Future> search(String query) async { diff --git a/examples/api/lib/material/search_anchor/search_anchor.4.dart b/examples/api/lib/material/search_anchor/search_anchor.4.dart index b81a8fbef8a..5f5e16fb57c 100644 --- a/examples/api/lib/material/search_anchor/search_anchor.4.dart +++ b/examples/api/lib/material/search_anchor/search_anchor.4.dart @@ -20,7 +20,9 @@ class SearchAnchorAsyncExampleApp extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( home: Scaffold( - appBar: AppBar(title: const Text('SearchAnchor - async and debouncing')), + appBar: AppBar( + title: const Text('SearchAnchor - async and debouncing'), + ), body: const Center(child: _AsyncSearchAnchor()), ), ); @@ -78,30 +80,37 @@ class _AsyncSearchAnchorState extends State<_AsyncSearchAnchor> { }, ); }, - suggestionsBuilder: (BuildContext context, SearchController controller) async { - final List? options = (await _debouncedSearch(controller.text))?.toList(); - if (options == null) { - return _lastOptions; - } - _lastOptions = List.generate(options.length, (int index) { - final String item = options[index]; - return ListTile( - title: Text(item), - onTap: () { - debugPrint('You just selected $item'); - }, - ); - }); + suggestionsBuilder: + (BuildContext context, SearchController controller) async { + final List? options = (await _debouncedSearch( + controller.text, + ))?.toList(); + if (options == null) { + return _lastOptions; + } + _lastOptions = List.generate(options.length, (int index) { + final String item = options[index]; + return ListTile( + title: Text(item), + onTap: () { + debugPrint('You just selected $item'); + }, + ); + }); - return _lastOptions; - }, + return _lastOptions; + }, ); } } // Mimics a remote API. class _FakeAPI { - static const List _kOptions = ['aardvark', 'bobcat', 'chameleon']; + static const List _kOptions = [ + 'aardvark', + 'bobcat', + 'chameleon', + ]; // Searches the options, but injects a fake "network" delay. static Future> search(String query) async { diff --git a/examples/api/lib/material/search_anchor/search_bar.0.dart b/examples/api/lib/material/search_anchor/search_bar.0.dart index 5ca2318cc32..8512351f2ae 100644 --- a/examples/api/lib/material/search_anchor/search_bar.0.dart +++ b/examples/api/lib/material/search_anchor/search_bar.0.dart @@ -20,7 +20,9 @@ class _SearchBarAppState extends State { @override Widget build(BuildContext context) { - final ThemeData themeData = ThemeData(brightness: isDark ? Brightness.dark : Brightness.light); + final ThemeData themeData = ThemeData( + brightness: isDark ? Brightness.dark : Brightness.light, + ); return MaterialApp( theme: themeData, @@ -59,19 +61,20 @@ class _SearchBarAppState extends State { ], ); }, - suggestionsBuilder: (BuildContext context, SearchController controller) { - return List.generate(5, (int index) { - final String item = 'item $index'; - return ListTile( - title: Text(item), - onTap: () { - setState(() { - controller.closeView(item); - }); - }, - ); - }); - }, + suggestionsBuilder: + (BuildContext context, SearchController controller) { + return List.generate(5, (int index) { + final String item = 'item $index'; + return ListTile( + title: Text(item), + onTap: () { + setState(() { + controller.closeView(item); + }); + }, + ); + }); + }, ), ), ), diff --git a/examples/api/lib/material/selectable_region/selectable_region.0.dart b/examples/api/lib/material/selectable_region/selectable_region.0.dart index 5771aa3311b..6e51f93f1d3 100644 --- a/examples/api/lib/material/selectable_region/selectable_region.0.dart +++ b/examples/api/lib/material/selectable_region/selectable_region.0.dart @@ -54,24 +54,32 @@ class MySelectableAdapter extends StatelessWidget { } class _SelectableAdapter extends SingleChildRenderObjectWidget { - const _SelectableAdapter({required this.registrar, required Widget child}) : super(child: child); + const _SelectableAdapter({required this.registrar, required Widget child}) + : super(child: child); final SelectionRegistrar registrar; @override _RenderSelectableAdapter createRenderObject(BuildContext context) { - return _RenderSelectableAdapter(DefaultSelectionStyle.of(context).selectionColor!, registrar); + return _RenderSelectableAdapter( + DefaultSelectionStyle.of(context).selectionColor!, + registrar, + ); } @override - void updateRenderObject(BuildContext context, _RenderSelectableAdapter renderObject) { + void updateRenderObject( + BuildContext context, + _RenderSelectableAdapter renderObject, + ) { renderObject ..selectionColor = DefaultSelectionStyle.of(context).selectionColor! ..registrar = registrar; } } -class _RenderSelectableAdapter extends RenderProxyBox with Selectable, SelectionRegistrant { +class _RenderSelectableAdapter extends RenderProxyBox + with Selectable, SelectionRegistrant { _RenderSelectableAdapter(Color selectionColor, SelectionRegistrar registrar) : _selectionColor = selectionColor, _geometry = ValueNotifier(_noSelection) { @@ -101,7 +109,8 @@ class _RenderSelectableAdapter extends RenderProxyBox with Selectable, Selection void addListener(VoidCallback listener) => _geometry.addListener(listener); @override - void removeListener(VoidCallback listener) => _geometry.removeListener(listener); + void removeListener(VoidCallback listener) => + _geometry.removeListener(listener); @override SelectionGeometry get value => _geometry.value; @@ -156,8 +165,12 @@ class _RenderSelectableAdapter extends RenderProxyBox with Selectable, Selection _geometry.value = SelectionGeometry( status: SelectionStatus.uncollapsed, hasContent: true, - startSelectionPoint: isReversed ? secondSelectionPoint : firstSelectionPoint, - endSelectionPoint: isReversed ? firstSelectionPoint : secondSelectionPoint, + startSelectionPoint: isReversed + ? secondSelectionPoint + : firstSelectionPoint, + endSelectionPoint: isReversed + ? firstSelectionPoint + : secondSelectionPoint, selectionRects: [selectionRect], ); } @@ -169,10 +182,20 @@ class _RenderSelectableAdapter extends RenderProxyBox with Selectable, Selection switch (event.type) { case SelectionEventType.startEdgeUpdate: case SelectionEventType.endEdgeUpdate: - final Rect renderObjectRect = Rect.fromLTWH(0, 0, size.width, size.height); + final Rect renderObjectRect = Rect.fromLTWH( + 0, + 0, + size.width, + size.height, + ); // Normalize offset in case it is out side of the rect. - final Offset point = globalToLocal((event as SelectionEdgeUpdateEvent).globalPosition); - final Offset adjustedPoint = SelectionUtils.adjustDragOffset(renderObjectRect, point); + final Offset point = globalToLocal( + (event as SelectionEdgeUpdateEvent).globalPosition, + ); + final Offset adjustedPoint = SelectionUtils.adjustDragOffset( + renderObjectRect, + point, + ); if (event.type == SelectionEventType.startEdgeUpdate) { _start = adjustedPoint; } else { @@ -199,15 +222,21 @@ class _RenderSelectableAdapter extends RenderProxyBox with Selectable, Selection } } // Move the corresponding selection edge. - final Offset newOffset = extendSelectionEvent.forward ? Offset.infinite : Offset.zero; + final Offset newOffset = extendSelectionEvent.forward + ? Offset.infinite + : Offset.zero; if (extendSelectionEvent.isEnd) { if (newOffset == _end) { - result = extendSelectionEvent.forward ? SelectionResult.next : SelectionResult.previous; + result = extendSelectionEvent.forward + ? SelectionResult.next + : SelectionResult.previous; } _end = newOffset; } else { if (newOffset == _start) { - result = extendSelectionEvent.forward ? SelectionResult.next : SelectionResult.previous; + result = extendSelectionEvent.forward + ? SelectionResult.next + : SelectionResult.previous; } _start = newOffset; } @@ -228,7 +257,8 @@ class _RenderSelectableAdapter extends RenderProxyBox with Selectable, Selection _start = _end = Offset.infinite; } // Move the corresponding selection edge. - if (extendSelectionEvent.direction == SelectionExtendDirection.previousLine || + if (extendSelectionEvent.direction == + SelectionExtendDirection.previousLine || horizontalBaseLine < 0) { newOffset = Offset.zero; } else { @@ -242,7 +272,8 @@ class _RenderSelectableAdapter extends RenderProxyBox with Selectable, Selection _start = _end = Offset.zero; } // Move the corresponding selection edge. - if (extendSelectionEvent.direction == SelectionExtendDirection.nextLine || + if (extendSelectionEvent.direction == + SelectionExtendDirection.nextLine || horizontalBaseLine > size.width) { newOffset = Offset.infinite; } else { @@ -269,7 +300,9 @@ class _RenderSelectableAdapter extends RenderProxyBox with Selectable, Selection // widget into clipboard. @override SelectedContent? getSelectedContent() { - return value.hasSelection ? const SelectedContent(plainText: 'Custom Text') : null; + return value.hasSelection + ? const SelectedContent(plainText: 'Custom Text') + : null; } @override @@ -306,19 +339,28 @@ class _RenderSelectableAdapter extends RenderProxyBox with Selectable, Selection final Paint selectionPaint = Paint() ..style = PaintingStyle.fill ..color = _selectionColor; - context.canvas.drawRect(_getSelectionHighlightRect().shift(offset), selectionPaint); + context.canvas.drawRect( + _getSelectionHighlightRect().shift(offset), + selectionPaint, + ); // Push the layer links if any. if (_startHandle != null) { context.pushLayer( - LeaderLayer(link: _startHandle!, offset: offset + value.startSelectionPoint!.localPosition), + LeaderLayer( + link: _startHandle!, + offset: offset + value.startSelectionPoint!.localPosition, + ), (PaintingContext context, Offset offset) {}, Offset.zero, ); } if (_endHandle != null) { context.pushLayer( - LeaderLayer(link: _endHandle!, offset: offset + value.endSelectionPoint!.localPosition), + LeaderLayer( + link: _endHandle!, + offset: offset + value.endSelectionPoint!.localPosition, + ), (PaintingContext context, Offset offset) {}, Offset.zero, ); diff --git a/examples/api/lib/material/selection_area/selection_area.1.dart b/examples/api/lib/material/selection_area/selection_area.1.dart index 6710e66d019..a0c2ea6ad82 100644 --- a/examples/api/lib/material/selection_area/selection_area.1.dart +++ b/examples/api/lib/material/selection_area/selection_area.1.dart @@ -16,7 +16,9 @@ class SelectionAreaSelectionListenerExampleApp extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', - theme: ThemeData(colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple)), + theme: ThemeData( + colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), + ), home: const MyHomePage(title: 'Flutter Demo Home Page'), ); } @@ -32,7 +34,8 @@ class MyHomePage extends StatefulWidget { } class _MyHomePageState extends State { - final SelectionListenerNotifier _selectionNotifier = SelectionListenerNotifier(); + final SelectionListenerNotifier _selectionNotifier = + SelectionListenerNotifier(); SelectableRegionSelectionStatus? _selectableRegionStatus; void _handleOnSelectionStateChanged(SelectableRegionSelectionStatus status) { @@ -61,20 +64,21 @@ class _MyHomePageState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - for (final (int? offset, String label) in <(int? offset, String label)>[ - ( - _selectionNotifier.registered - ? _selectionNotifier.selection.range?.startOffset - : null, - 'StartOffset', - ), - ( - _selectionNotifier.registered - ? _selectionNotifier.selection.range?.endOffset - : null, - 'EndOffset', - ), - ]) + for (final (int? offset, String label) + in <(int? offset, String label)>[ + ( + _selectionNotifier.registered + ? _selectionNotifier.selection.range?.startOffset + : null, + 'StartOffset', + ), + ( + _selectionNotifier.registered + ? _selectionNotifier.selection.range?.endOffset + : null, + 'EndOffset', + ), + ]) Text('Selection $label: $offset'), Text( 'Selection Status: ${_selectionNotifier.registered ? _selectionNotifier.selection.status : 'SelectionListenerNotifier not registered.'}', @@ -97,7 +101,11 @@ class _MyHomePageState extends State { } class MySelectableText extends StatefulWidget { - const MySelectableText({super.key, required this.selectionNotifier, required this.onChanged}); + const MySelectableText({ + super.key, + required this.selectionNotifier, + required this.onChanged, + }); final SelectionListenerNotifier selectionNotifier; final ValueChanged onChanged; @@ -120,7 +128,9 @@ class _MySelectableTextState extends State { void didChangeDependencies() { super.didChangeDependencies(); _selectableRegionScope?.removeListener(_handleOnSelectableRegionChanged); - _selectableRegionScope = SelectableRegionSelectionStatusScope.maybeOf(context); + _selectableRegionScope = SelectableRegionSelectionStatusScope.maybeOf( + context, + ); _selectableRegionScope?.addListener(_handleOnSelectableRegionChanged); } @@ -135,7 +145,9 @@ class _MySelectableTextState extends State { Widget build(BuildContext context) { return SelectionListener( selectionNotifier: widget.selectionNotifier, - child: const Text('This is some text under a SelectionArea that can be selected.'), + child: const Text( + 'This is some text under a SelectionArea that can be selected.', + ), ); } } diff --git a/examples/api/lib/material/selection_area/selection_area.2.dart b/examples/api/lib/material/selection_area/selection_area.2.dart index 67a940f643b..9cda62ea0de 100644 --- a/examples/api/lib/material/selection_area/selection_area.2.dart +++ b/examples/api/lib/material/selection_area/selection_area.2.dart @@ -18,7 +18,9 @@ class SelectionAreaColorTextRedExampleApp extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', - theme: ThemeData(colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple)), + theme: ThemeData( + colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), + ), home: const MyHomePage(title: 'Flutter Demo Home Page'), ); } @@ -36,9 +38,11 @@ class MyHomePage extends StatefulWidget { typedef LocalSpanRange = ({int startOffset, int endOffset}); class _MyHomePageState extends State { - final SelectionListenerNotifier _selectionNotifier = SelectionListenerNotifier(); + final SelectionListenerNotifier _selectionNotifier = + SelectionListenerNotifier(); final ContextMenuController _menuController = ContextMenuController(); - final GlobalKey selectionAreaKey = GlobalKey(); + final GlobalKey selectionAreaKey = + GlobalKey(); // The data of the top level TextSpans. Each TextSpan is mapped to a LocalSpanRange, // which is the range the textspan covers relative to the SelectionListener it is under. @@ -47,14 +51,17 @@ class _MyHomePageState extends State { // to a LocalSpanRange, being the range the bullet covers relative to the SelectionListener // it is under. Map bulletSourceMap = {}; - Map> widgetSpanMaps = >{}; + Map> widgetSpanMaps = + >{}; // The origin data used to restore the demo to its initial state. late final Map originSourceData; late final Map originBulletSourceData; void _initData() { const String bulletListTitle = 'This is some bulleted list:\n'; - final List bullets = [for (int i = 1; i <= 7; i += 1) '• Bullet $i']; + final List bullets = [ + for (int i = 1; i <= 7; i += 1) '• Bullet $i', + ]; final TextSpan bulletedList = TextSpan( text: bulletListTitle, children: [ @@ -62,7 +69,10 @@ class _MyHomePageState extends State { child: Column( children: [ for (final String bullet in bullets) - Padding(padding: const EdgeInsets.only(left: 20.0), child: Text(bullet)), + Padding( + padding: const EdgeInsets.only(left: 20.0), + child: Text(bullet), + ), ], ), ), @@ -81,43 +91,63 @@ class _MyHomePageState extends State { widgetSpanMaps[currentOffset] = bulletSourceMap; // Map individual bullets to a local range. for (final String bullet in bullets) { - bulletSourceMap[(startOffset: currentOffset, endOffset: currentOffset + bullet.length)] = - TextSpan(text: bullet); + bulletSourceMap[( + startOffset: currentOffset, + endOffset: currentOffset + bullet.length, + )] = TextSpan( + text: bullet, + ); currentOffset += bullet.length; } const TextSpan secondTextParagraph = TextSpan( text: 'This is some text in a text widget.', - children: [TextSpan(text: ' This is some more text in the same text widget.')], + children: [ + TextSpan(text: ' This is some more text in the same text widget.'), + ], + ); + const TextSpan thirdTextParagraph = TextSpan( + text: 'This is some text in another text widget.', ); - const TextSpan thirdTextParagraph = TextSpan(text: 'This is some text in another text widget.'); // Map second and third paragraphs to local ranges. dataSourceMap[( startOffset: currentOffset, endOffset: - currentOffset + secondTextParagraph.toPlainText(includeSemanticsLabels: false).length, + currentOffset + + secondTextParagraph + .toPlainText(includeSemanticsLabels: false) + .length, )] = secondTextParagraph; - currentOffset += secondTextParagraph.toPlainText(includeSemanticsLabels: false).length; + currentOffset += secondTextParagraph + .toPlainText(includeSemanticsLabels: false) + .length; dataSourceMap[( startOffset: currentOffset, endOffset: - currentOffset + thirdTextParagraph.toPlainText(includeSemanticsLabels: false).length, + currentOffset + + thirdTextParagraph + .toPlainText(includeSemanticsLabels: false) + .length, )] = thirdTextParagraph; // Save the origin data so we can revert our changes. originSourceData = {}; - for (final MapEntry entry in dataSourceMap.entries) { + for (final MapEntry entry + in dataSourceMap.entries) { originSourceData[entry.key] = entry.value; } originBulletSourceData = {}; - for (final MapEntry entry in bulletSourceMap.entries) { + for (final MapEntry entry + in bulletSourceMap.entries) { originBulletSourceData[entry.key] = entry.value; } } - void _handleSelectableRegionStatusChanged(SelectableRegionSelectionStatus status) { + void _handleSelectableRegionStatusChanged( + SelectableRegionSelectionStatus status, + ) { if (_menuController.isShown) { ContextMenuController.removeAny(); } @@ -127,11 +157,16 @@ class _MyHomePageState extends State { } if (selectionAreaKey.currentState == null || !selectionAreaKey.currentState!.mounted || - selectionAreaKey.currentState!.selectableRegion.contextMenuAnchors.secondaryAnchor == + selectionAreaKey + .currentState! + .selectableRegion + .contextMenuAnchors + .secondaryAnchor == null) { return; } - final SelectedContentRange? selectedContentRange = _selectionNotifier.selection.range; + final SelectedContentRange? selectedContentRange = + _selectionNotifier.selection.range; if (selectedContentRange == null) { return; } @@ -154,7 +189,8 @@ class _MyHomePageState extends State { dataMap: dataSourceMap, coloringChildSpan: false, ); - selectionAreaKey.currentState!.selectableRegion.clearSelection(); + selectionAreaKey.currentState!.selectableRegion + .clearSelection(); }, label: 'Color Text Red', ), @@ -196,14 +232,18 @@ class _MyHomePageState extends State { // The selection details is covering the current entry so let's color the range red. final TextSpan rawSpan = entry.value; // Determine local ranges relative to rawSpan. - final int clampedLocalStart = normalizedStartOffset < entryLocalRange.startOffset + final int clampedLocalStart = + normalizedStartOffset < entryLocalRange.startOffset ? entryLocalRange.startOffset : normalizedStartOffset; - final int clampedLocalEnd = normalizedEndOffset > entryLocalRange.endOffset + final int clampedLocalEnd = + normalizedEndOffset > entryLocalRange.endOffset ? entryLocalRange.endOffset : normalizedEndOffset; - final int startOffset = (clampedLocalStart - entryLocalRange.startOffset).abs(); - final int endOffset = startOffset + (clampedLocalEnd - clampedLocalStart).abs(); + final int startOffset = (clampedLocalStart - entryLocalRange.startOffset) + .abs(); + final int endOffset = + startOffset + (clampedLocalEnd - clampedLocalStart).abs(); final List beforeSelection = []; final List insideSelection = []; final List afterSelection = []; @@ -217,7 +257,10 @@ class _MyHomePageState extends State { final int globalNewStart = count + newStart; // Collect spans before selection. beforeSelection.add( - TextSpan(style: child.style, text: rawText.substring(0, newStart)), + TextSpan( + style: child.style, + text: rawText.substring(0, newStart), + ), ); // Check if this span also contains the selection. if (globalNewStart == startOffset && newStart < rawText.length) { @@ -225,10 +268,13 @@ class _MyHomePageState extends State { newStart + (endOffset - startOffset), rawText.length, ); - final int globalNewStartAfterSelection = count + newStartAfterSelection; + final int globalNewStartAfterSelection = + count + newStartAfterSelection; insideSelection.add( TextSpan( - style: const TextStyle(color: Colors.red).merge(entry.value.style), + style: const TextStyle( + color: Colors.red, + ).merge(entry.value.style), text: rawText.substring(newStart, newStartAfterSelection), ), ); @@ -236,7 +282,10 @@ class _MyHomePageState extends State { if (globalNewStartAfterSelection == endOffset && newStartAfterSelection < rawText.length) { afterSelection.add( - TextSpan(style: child.style, text: rawText.substring(newStartAfterSelection)), + TextSpan( + style: child.style, + text: rawText.substring(newStartAfterSelection), + ), ); } } @@ -255,7 +304,12 @@ class _MyHomePageState extends State { ); // Check if this span contains content after the selection. if (globalNewStart == endOffset && newStart < rawText.length) { - afterSelection.add(TextSpan(style: child.style, text: rawText.substring(newStart))); + afterSelection.add( + TextSpan( + style: child.style, + text: rawText.substring(newStart), + ), + ); } } count += rawText.length; @@ -265,7 +319,8 @@ class _MyHomePageState extends State { // We have arrived at a WidgetSpan but it is unaccounted for. return true; } - final Map widgetSpanSourceMap = widgetSpanMaps[count]!; + final Map widgetSpanSourceMap = + widgetSpanMaps[count]!; if (count < startOffset && count + (widgetSpanSourceMap.keys.last.endOffset - @@ -318,7 +373,8 @@ class _MyHomePageState extends State { ); } count += - (widgetSpanSourceMap.keys.last.endOffset - widgetSpanSourceMap.keys.first.startOffset) + (widgetSpanSourceMap.keys.last.endOffset - + widgetSpanSourceMap.keys.first.startOffset) .abs(); return true; } @@ -326,7 +382,11 @@ class _MyHomePageState extends State { }); dataMap[entry.key] = TextSpan( style: dataMap[entry.key]!.style, - children: [...beforeSelection, ...insideSelection, ...afterSelection], + children: [ + ...beforeSelection, + ...insideSelection, + ...afterSelection, + ], ); } // Avoid clearing the selection and setting the state @@ -367,10 +427,12 @@ class _MyHomePageState extends State { onPressed: () { setState(() { // Resets the state to the origin data. - for (final MapEntry entry in originSourceData.entries) { + for (final MapEntry entry + in originSourceData.entries) { dataSourceMap[entry.key] = entry.value; } - for (final MapEntry entry in originBulletSourceData.entries) { + for (final MapEntry entry + in originBulletSourceData.entries) { bulletSourceMap[entry.key] = entry.value; } }); @@ -411,7 +473,9 @@ class _MySelectableTextColumnState extends State { void didChangeDependencies() { super.didChangeDependencies(); _selectableRegionScope?.removeListener(_handleOnSelectableRegionChanged); - _selectableRegionScope = SelectableRegionSelectionStatusScope.maybeOf(context); + _selectableRegionScope = SelectableRegionSelectionStatusScope.maybeOf( + context, + ); _selectableRegionScope?.addListener(_handleOnSelectableRegionChanged); } @@ -430,7 +494,8 @@ class _MySelectableTextColumnState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - for (final MapEntry entry in widget.dataSourceMap.entries) + for (final MapEntry entry + in widget.dataSourceMap.entries) Text.rich(entry.value), ], ), diff --git a/examples/api/lib/material/selection_container/selection_container.0.dart b/examples/api/lib/material/selection_container/selection_container.0.dart index bb71436d26f..362ea204698 100644 --- a/examples/api/lib/material/selection_container/selection_container.0.dart +++ b/examples/api/lib/material/selection_container/selection_container.0.dart @@ -41,8 +41,10 @@ class SelectionAllOrNoneContainer extends StatefulWidget { State createState() => _SelectionAllOrNoneContainerState(); } -class _SelectionAllOrNoneContainerState extends State { - final SelectAllOrNoneContainerDelegate delegate = SelectAllOrNoneContainerDelegate(); +class _SelectionAllOrNoneContainerState + extends State { + final SelectAllOrNoneContainerDelegate delegate = + SelectAllOrNoneContainerDelegate(); @override void dispose() { @@ -56,7 +58,8 @@ class _SelectionAllOrNoneContainerState extends State { spacing: 16, children: [ Slider( + // ignore: deprecated_member_use year2023: year2023, value: _currentSliderValue, max: 100, @@ -50,6 +51,7 @@ class _SliderExampleState extends State { }, ), Slider( + // ignore: deprecated_member_use year2023: year2023, value: _currentDiscreteSliderValue, max: 100, diff --git a/examples/api/lib/material/snack_bar/snack_bar.1.dart b/examples/api/lib/material/snack_bar/snack_bar.1.dart index bb08851e9d3..605b585f46e 100644 --- a/examples/api/lib/material/snack_bar/snack_bar.1.dart +++ b/examples/api/lib/material/snack_bar/snack_bar.1.dart @@ -45,7 +45,9 @@ class SnackBarExample extends StatelessWidget { horizontal: 8.0, // Inner padding for SnackBar content. ), behavior: SnackBarBehavior.floating, - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10.0)), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), ), ); }, diff --git a/examples/api/lib/material/snack_bar/snack_bar.2.dart b/examples/api/lib/material/snack_bar/snack_bar.2.dart index f884f41f168..87f9668b23c 100644 --- a/examples/api/lib/material/snack_bar/snack_bar.2.dart +++ b/examples/api/lib/material/snack_bar/snack_bar.2.dart @@ -141,7 +141,9 @@ class _SnackBarExampleState extends State { }, ) : null; - final double? width = _snackBarBehavior == SnackBarBehavior.floating ? 400.0 : null; + final double? width = _snackBarBehavior == SnackBarBehavior.floating + ? 400.0 + : null; final String label = _multiLine ? 'A Snack Bar with quite a lot of text which spans across multiple ' 'lines. You can look at how the Action Label moves around when trying ' diff --git a/examples/api/lib/material/stepper/step_style.0.dart b/examples/api/lib/material/stepper/step_style.0.dart index 26e2dee8920..164a9356850 100644 --- a/examples/api/lib/material/stepper/step_style.0.dart +++ b/examples/api/lib/material/stepper/step_style.0.dart @@ -58,7 +58,9 @@ class _StepStyleExampleState extends State { isActive: true, stepStyle: _stepStyle.copyWith( connectorColor: Colors.orange, - gradient: const LinearGradient(colors: [Colors.white, Colors.black]), + gradient: const LinearGradient( + colors: [Colors.white, Colors.black], + ), ), ), Step( diff --git a/examples/api/lib/material/stepper/stepper.0.dart b/examples/api/lib/material/stepper/stepper.0.dart index a6f7596f68e..c399e826cfe 100644 --- a/examples/api/lib/material/stepper/stepper.0.dart +++ b/examples/api/lib/material/stepper/stepper.0.dart @@ -63,7 +63,10 @@ class _StepperExampleState extends State { child: const Text('Content for Step 1'), ), ), - const Step(title: Text('Step 2 title'), content: Text('Content for Step 2')), + const Step( + title: Text('Step 2 title'), + content: Text('Content for Step 2'), + ), ], ); } diff --git a/examples/api/lib/material/stepper/stepper.controls_builder.0.dart b/examples/api/lib/material/stepper/stepper.controls_builder.0.dart index e5ff18641f6..1a3d30cf8e4 100644 --- a/examples/api/lib/material/stepper/stepper.controls_builder.0.dart +++ b/examples/api/lib/material/stepper/stepper.controls_builder.0.dart @@ -31,8 +31,14 @@ class ControlsBuilderExample extends StatelessWidget { controlsBuilder: (BuildContext context, ControlsDetails details) { return Row( children: [ - TextButton(onPressed: details.onStepContinue, child: const Text('NEXT')), - TextButton(onPressed: details.onStepCancel, child: const Text('CANCEL')), + TextButton( + onPressed: details.onStepContinue, + child: const Text('NEXT'), + ), + TextButton( + onPressed: details.onStepCancel, + child: const Text('CANCEL'), + ), ], ); }, diff --git a/examples/api/lib/material/switch/switch.1.dart b/examples/api/lib/material/switch/switch.1.dart index 5275f6f93d0..b680b1b1032 100644 --- a/examples/api/lib/material/switch/switch.1.dart +++ b/examples/api/lib/material/switch/switch.1.dart @@ -36,9 +36,10 @@ class _SwitchExampleState extends State { Widget build(BuildContext context) { // This object sets amber as the track color when the switch is selected. // Otherwise, it resolves to null and defers to values from the theme data. - const WidgetStateProperty trackColor = WidgetStateProperty.fromMap( - {WidgetState.selected: Colors.amber}, - ); + const WidgetStateProperty trackColor = + WidgetStateProperty.fromMap({ + WidgetState.selected: Colors.amber, + }); // This object sets the track color based on two WidgetState attributes. // If neither state applies, it resolves to null. final WidgetStateProperty overlayColor = diff --git a/examples/api/lib/material/switch/switch.2.dart b/examples/api/lib/material/switch/switch.2.dart index c70bf8e355b..47fce6aeda1 100644 --- a/examples/api/lib/material/switch/switch.2.dart +++ b/examples/api/lib/material/switch/switch.2.dart @@ -33,12 +33,11 @@ class _SwitchExampleState extends State { bool light0 = true; bool light1 = true; - static const WidgetStateProperty thumbIcon = WidgetStateProperty.fromMap( - { - WidgetState.selected: Icon(Icons.check), - WidgetState.any: Icon(Icons.close), - }, - ); + static const WidgetStateProperty thumbIcon = + WidgetStateProperty.fromMap({ + WidgetState.selected: Icon(Icons.check), + WidgetState.any: Icon(Icons.close), + }); @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/switch/switch.4.dart b/examples/api/lib/material/switch/switch.4.dart index 78914b379c4..fb243fbbafd 100644 --- a/examples/api/lib/material/switch/switch.4.dart +++ b/examples/api/lib/material/switch/switch.4.dart @@ -23,9 +23,13 @@ class _SwitchAppState extends State { Widget build(BuildContext context) { final ThemeData theme = ThemeData( platform: isMaterial ? TargetPlatform.android : TargetPlatform.iOS, - adaptations: >[if (isCustomized) const _SwitchThemeAdaptation()], + adaptations: >[ + if (isCustomized) const _SwitchThemeAdaptation(), + ], + ); + final ButtonStyle style = OutlinedButton.styleFrom( + fixedSize: const Size(220, 40), ); - final ButtonStyle style = OutlinedButton.styleFrom(fixedSize: const Size(220, 40)); return MaterialApp( theme: theme, @@ -67,7 +71,11 @@ class _SwitchAppState extends State { } class SwitchWithLabel extends StatefulWidget { - const SwitchWithLabel({super.key, required this.enabled, required this.label}); + const SwitchWithLabel({ + super.key, + required this.enabled, + required this.label, + }); final bool enabled; final String label; @@ -84,7 +92,11 @@ class _SwitchWithLabelState extends State { return Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Container(width: 150, padding: const EdgeInsets.only(right: 20), child: Text(widget.label)), + Container( + width: 150, + padding: const EdgeInsets.only(right: 20), + child: Text(widget.label), + ), Switch.adaptive( value: active, onChanged: !widget.enabled diff --git a/examples/api/lib/material/tab_controller/tab_controller.1.dart b/examples/api/lib/material/tab_controller/tab_controller.1.dart index 365bdca5609..4a7f6e3cd9b 100644 --- a/examples/api/lib/material/tab_controller/tab_controller.1.dart +++ b/examples/api/lib/material/tab_controller/tab_controller.1.dart @@ -11,7 +11,11 @@ void main() => runApp(const TabControllerExampleApp()); class TabControllerExampleApp extends StatelessWidget { const TabControllerExampleApp({super.key}); - static const List tabs = [Tab(text: 'Zeroth'), Tab(text: 'First'), Tab(text: 'Second')]; + static const List tabs = [ + Tab(text: 'Zeroth'), + Tab(text: 'First'), + Tab(text: 'Second'), + ]; @override Widget build(BuildContext context) { @@ -37,7 +41,10 @@ class TabControllerExample extends StatelessWidget { body: TabBarView( children: tabs.map((Tab tab) { return Center( - child: Text('${tab.text!} Tab', style: Theme.of(context).textTheme.headlineSmall), + child: Text( + '${tab.text!} Tab', + style: Theme.of(context).textTheme.headlineSmall, + ), ); }).toList(), ), @@ -48,24 +55,32 @@ class TabControllerExample extends StatelessWidget { } class DefaultTabControllerListener extends StatefulWidget { - const DefaultTabControllerListener({required this.onTabChanged, required this.child, super.key}); + const DefaultTabControllerListener({ + required this.onTabChanged, + required this.child, + super.key, + }); final ValueChanged onTabChanged; final Widget child; @override - State createState() => _DefaultTabControllerListenerState(); + State createState() => + _DefaultTabControllerListenerState(); } -class _DefaultTabControllerListenerState extends State { +class _DefaultTabControllerListenerState + extends State { TabController? _controller; @override void didChangeDependencies() { super.didChangeDependencies(); - final TabController? defaultTabController = DefaultTabController.maybeOf(context); + final TabController? defaultTabController = DefaultTabController.maybeOf( + context, + ); assert(() { if (defaultTabController == null) { diff --git a/examples/api/lib/material/tabs/tab_bar.1.dart b/examples/api/lib/material/tabs/tab_bar.1.dart index b3ba502cd8f..daedc8c59f4 100644 --- a/examples/api/lib/material/tabs/tab_bar.1.dart +++ b/examples/api/lib/material/tabs/tab_bar.1.dart @@ -26,7 +26,8 @@ class TabBarExample extends StatefulWidget { /// [AnimationController]s can be created with `vsync: this` because of /// [TickerProviderStateMixin]. -class _TabBarExampleState extends State with TickerProviderStateMixin { +class _TabBarExampleState extends State + with TickerProviderStateMixin { late final TabController _tabController; @override diff --git a/examples/api/lib/material/tabs/tab_bar.2.dart b/examples/api/lib/material/tabs/tab_bar.2.dart index 7121957e498..626570b4855 100644 --- a/examples/api/lib/material/tabs/tab_bar.2.dart +++ b/examples/api/lib/material/tabs/tab_bar.2.dart @@ -58,7 +58,8 @@ class NestedTabBar extends StatefulWidget { State createState() => _NestedTabBarState(); } -class _NestedTabBarState extends State with TickerProviderStateMixin { +class _NestedTabBarState extends State + with TickerProviderStateMixin { late final TabController _tabController; @override @@ -94,7 +95,9 @@ class _NestedTabBarState extends State with TickerProviderStateMix ), Card( margin: const EdgeInsets.all(16.0), - child: Center(child: Text('${widget.outerTab}: Specifications tab')), + child: Center( + child: Text('${widget.outerTab}: Specifications tab'), + ), ), ], ), diff --git a/examples/api/lib/material/tabs/tab_bar.indicator_animation.0.dart b/examples/api/lib/material/tabs/tab_bar.indicator_animation.0.dart index 263aac81632..e04a431c1bd 100644 --- a/examples/api/lib/material/tabs/tab_bar.indicator_animation.0.dart +++ b/examples/api/lib/material/tabs/tab_bar.indicator_animation.0.dart @@ -27,7 +27,8 @@ class IndicatorAnimationExample extends StatefulWidget { const IndicatorAnimationExample({super.key}); @override - State createState() => _IndicatorAnimationExampleState(); + State createState() => + _IndicatorAnimationExampleState(); } class _IndicatorAnimationExampleState extends State { @@ -68,11 +69,16 @@ class _IndicatorAnimationExampleState extends State { _tabIndicatorAnimation = styles.first; }); }, - segments: indicatorAnimationSegments.map>(( - (TabIndicatorAnimation, String) shirt, - ) { - return ButtonSegment(value: shirt.$1, label: Text(shirt.$2)); - }).toList(), + segments: indicatorAnimationSegments + .map>(( + (TabIndicatorAnimation, String) shirt, + ) { + return ButtonSegment( + value: shirt.$1, + label: Text(shirt.$2), + ); + }) + .toList(), ), const SizedBox(height: 16), const Expanded( diff --git a/examples/api/lib/material/tabs/tab_bar.onFocusChange.dart b/examples/api/lib/material/tabs/tab_bar.onFocusChange.dart index 4e532196bc4..12f56db9fe3 100644 --- a/examples/api/lib/material/tabs/tab_bar.onFocusChange.dart +++ b/examples/api/lib/material/tabs/tab_bar.onFocusChange.dart @@ -45,9 +45,24 @@ class _TabBarExampleState extends State { }); }, tabs: [ - Tab(icon: Icon(Icons.cloud_outlined, size: focusedIndex == 0 ? 35 : 25)), - Tab(icon: Icon(Icons.beach_access_sharp, size: focusedIndex == 1 ? 35 : 25)), - Tab(icon: Icon(Icons.brightness_5_sharp, size: focusedIndex == 2 ? 35 : 25)), + Tab( + icon: Icon( + Icons.cloud_outlined, + size: focusedIndex == 0 ? 35 : 25, + ), + ), + Tab( + icon: Icon( + Icons.beach_access_sharp, + size: focusedIndex == 1 ? 35 : 25, + ), + ), + Tab( + icon: Icon( + Icons.brightness_5_sharp, + size: focusedIndex == 2 ? 35 : 25, + ), + ), ], ), ), diff --git a/examples/api/lib/material/tabs/tab_bar.onHover.dart b/examples/api/lib/material/tabs/tab_bar.onHover.dart index 9e150a3024a..dc41e8f82e7 100644 --- a/examples/api/lib/material/tabs/tab_bar.onHover.dart +++ b/examples/api/lib/material/tabs/tab_bar.onHover.dart @@ -25,7 +25,11 @@ class TabBarExample extends StatefulWidget { } class _TabBarExampleState extends State { - final List tabColors = [Colors.purple, Colors.purple, Colors.purple]; + final List tabColors = [ + Colors.purple, + Colors.purple, + Colors.purple, + ]; @override Widget build(BuildContext context) { diff --git a/examples/api/lib/material/text_button/text_button.0.dart b/examples/api/lib/material/text_button/text_button.0.dart index 84fc277a038..5e216470687 100644 --- a/examples/api/lib/material/text_button/text_button.0.dart +++ b/examples/api/lib/material/text_button/text_button.0.dart @@ -44,7 +44,11 @@ class _TextButtonExampleAppState extends State { } class TextButtonExample extends StatefulWidget { - const TextButtonExample({super.key, required this.darkMode, required this.updateDarkMode}); + const TextButtonExample({ + super.key, + required this.darkMode, + required this.updateDarkMode, + }); final bool darkMode; final ValueChanged updateDarkMode; @@ -98,7 +102,11 @@ class _TextButtonExampleState extends State { // Adapt colors that are not part of the color scheme to // the current dark/light mode. Used to define TextButton #7's // gradients. - final (Color color1, Color color2, Color color3) = switch (colorScheme.brightness) { + final ( + Color color1, + Color color2, + Color color3, + ) = switch (colorScheme.brightness) { Brightness.light => (Colors.blue, Colors.orange, Colors.yellow), Brightness.dark => (Colors.purple, Colors.cyan, Colors.yellow), }; @@ -109,7 +117,9 @@ class _TextButtonExampleState extends State { Decoration? statesToDecoration(Set states) { if (states.contains(WidgetState.pressed)) { return BoxDecoration( - gradient: LinearGradient(colors: [color2, color2]), // solid fill + gradient: LinearGradient( + colors: [color2, color2], + ), // solid fill ); } return BoxDecoration( @@ -204,19 +214,23 @@ class _TextButtonExampleState extends State { // theme or the MaterialApp theme's ThemeData.textButtonTheme. TextButton( style: TextButton.styleFrom( - foregroundBuilder: (BuildContext context, Set states, Widget? child) { - return ShaderMask( - shaderCallback: (Rect bounds) { - return LinearGradient( - begin: Alignment.bottomCenter, - end: Alignment.topCenter, - colors: [colorScheme.primary, colorScheme.onPrimary], - ).createShader(bounds); + foregroundBuilder: + (BuildContext context, Set states, Widget? child) { + return ShaderMask( + shaderCallback: (Rect bounds) { + return LinearGradient( + begin: Alignment.bottomCenter, + end: Alignment.topCenter, + colors: [ + colorScheme.primary, + colorScheme.onPrimary, + ], + ).createShader(bounds); + }, + blendMode: BlendMode.srcATop, + child: child, + ); }, - blendMode: BlendMode.srcATop, - child: child, - ); - }, ), onPressed: () {}, child: const Text('TextButton #5'), @@ -236,16 +250,17 @@ class _TextButtonExampleState extends State { // outlines the button's shape. TextButton( style: TextButton.styleFrom( - foregroundBuilder: (BuildContext context, Set states, Widget? child) { - return DecoratedBox( - decoration: BoxDecoration( - border: states.contains(WidgetState.hovered) - ? Border(bottom: BorderSide(color: colorScheme.primary)) - : const Border(), // essentially "no border" - ), - child: child, - ); - }, + foregroundBuilder: + (BuildContext context, Set states, Widget? child) { + return DecoratedBox( + decoration: BoxDecoration( + border: states.contains(WidgetState.hovered) + ? Border(bottom: BorderSide(color: colorScheme.primary)) + : const Border(), // essentially "no border" + ), + child: child, + ); + }, ), onPressed: () {}, child: const Text('TextButton #6'), @@ -273,15 +288,22 @@ class _TextButtonExampleState extends State { style: TextButton.styleFrom( overlayColor: color2, - backgroundBuilder: (BuildContext context, Set states, Widget? child) { - return AnimatedContainer( - duration: const Duration(milliseconds: 500), - decoration: statesToDecoration(states), - child: child, - ); - }, + backgroundBuilder: + ( + BuildContext context, + Set states, + Widget? child, + ) { + return AnimatedContainer( + duration: const Duration(milliseconds: 500), + decoration: statesToDecoration(states), + child: child, + ); + }, ).copyWith( - side: WidgetStateProperty.resolveWith((Set states) { + side: WidgetStateProperty.resolveWith(( + Set states, + ) { if (states.contains(WidgetState.hovered)) { return BorderSide(width: 3, color: color3); } @@ -304,14 +326,18 @@ class _TextButtonExampleState extends State { onPressed: () {}, style: TextButton.styleFrom( foregroundColor: Colors.white, - backgroundBuilder: (BuildContext context, Set states, Widget? child) { - return Ink( - decoration: const BoxDecoration( - image: DecorationImage(image: grassImage, fit: BoxFit.cover), - ), - child: child, - ); - }, + backgroundBuilder: + (BuildContext context, Set states, Widget? child) { + return Ink( + decoration: const BoxDecoration( + image: DecorationImage( + image: grassImage, + fit: BoxFit.cover, + ), + ), + child: child, + ); + }, ), child: const Text('TextButton #8'), ), @@ -348,27 +374,28 @@ class _TextButtonExampleState extends State { }, style: TextButton.styleFrom( overlayColor: Colors.transparent, - foregroundBuilder: (BuildContext context, Set states, Widget? child) { - late final ImageProvider image; - if (currentAction != null) { - image = runningImage; - } else if (states.contains(WidgetState.pressed)) { - image = pressedImage; - } else if (states.contains(WidgetState.hovered)) { - image = hoveredImage; - } else { - image = defaultImage; - } - return AnimatedContainer( - width: 64, - height: 64, - duration: const Duration(milliseconds: 300), - curve: Curves.fastOutSlowIn, - decoration: BoxDecoration( - image: DecorationImage(image: image, fit: BoxFit.contain), - ), - ); - }, + foregroundBuilder: + (BuildContext context, Set states, Widget? child) { + late final ImageProvider image; + if (currentAction != null) { + image = runningImage; + } else if (states.contains(WidgetState.pressed)) { + image = pressedImage; + } else if (states.contains(WidgetState.hovered)) { + image = hoveredImage; + } else { + image = defaultImage; + } + return AnimatedContainer( + width: 64, + height: 64, + duration: const Duration(milliseconds: 300), + curve: Curves.fastOutSlowIn, + decoration: BoxDecoration( + image: DecorationImage(image: image, fit: BoxFit.contain), + ), + ); + }, ), child: const Text('This child is not used'), ), @@ -459,7 +486,10 @@ class TextButtonExampleSwitches extends StatelessWidget { children: [ const Expanded(child: Text('RTL Text')), const SizedBox(width: 4), - Switch(value: textDirection == TextDirection.rtl, onChanged: updateRTL), + Switch( + value: textDirection == TextDirection.rtl, + onChanged: updateRTL, + ), ], ), ], diff --git a/examples/api/lib/material/text_field/text_field.0.dart b/examples/api/lib/material/text_field/text_field.0.dart index b5a00e83863..c6e5244b53e 100644 --- a/examples/api/lib/material/text_field/text_field.0.dart +++ b/examples/api/lib/material/text_field/text_field.0.dart @@ -15,7 +15,10 @@ class ObscuredTextFieldSample extends StatelessWidget { width: 250, child: TextField( obscureText: true, - decoration: InputDecoration(border: OutlineInputBorder(), labelText: 'Password'), + decoration: InputDecoration( + border: OutlineInputBorder(), + labelText: 'Password', + ), ), ); } diff --git a/examples/api/lib/material/text_field/text_field.1.dart b/examples/api/lib/material/text_field/text_field.1.dart index 67a0ce57e35..7f0479b9407 100644 --- a/examples/api/lib/material/text_field/text_field.1.dart +++ b/examples/api/lib/material/text_field/text_field.1.dart @@ -51,7 +51,9 @@ class _TextFieldExampleState extends State { builder: (BuildContext context) { return AlertDialog( title: const Text('Thanks!'), - content: Text('You typed "$value", which has length ${value.characters.length}.'), + content: Text( + 'You typed "$value", which has length ${value.characters.length}.', + ), actions: [ TextButton( onPressed: () { diff --git a/examples/api/lib/material/text_field/text_field.3.dart b/examples/api/lib/material/text_field/text_field.3.dart index d14be54d60b..51c7fd567c6 100644 --- a/examples/api/lib/material/text_field/text_field.3.dart +++ b/examples/api/lib/material/text_field/text_field.3.dart @@ -29,10 +29,12 @@ class TextFieldShiftEnterExample extends StatefulWidget { const TextFieldShiftEnterExample({super.key}); @override - State createState() => _TextFieldShiftEnterExampleState(); + State createState() => + _TextFieldShiftEnterExampleState(); } -class _TextFieldShiftEnterExampleState extends State { +class _TextFieldShiftEnterExampleState + extends State { final FocusNode _focusNode = FocusNode(); final TextEditingController _controller = TextEditingController(); @@ -72,22 +74,25 @@ class _TextFieldShiftEnterExampleState extends State actions: >{ // When the _InsertNewLineTextIntent is invoked, CallbackAction's // onInvoke callback is executed. - _InsertNewLineTextIntent: CallbackAction<_InsertNewLineTextIntent>( - onInvoke: (_InsertNewLineTextIntent intent) { - final TextEditingValue value = _controller.value; - final String newText = value.text.replaceRange( - value.selection.start, - value.selection.end, - '\n', - ); - _controller.value = value.copyWith( - text: newText, - selection: TextSelection.collapsed(offset: value.selection.start + 1), - ); + _InsertNewLineTextIntent: + CallbackAction<_InsertNewLineTextIntent>( + onInvoke: (_InsertNewLineTextIntent intent) { + final TextEditingValue value = _controller.value; + final String newText = value.text.replaceRange( + value.selection.start, + value.selection.end, + '\n', + ); + _controller.value = value.copyWith( + text: newText, + selection: TextSelection.collapsed( + offset: value.selection.start + 1, + ), + ); - return null; - }, - ), + return null; + }, + ), }, child: Padding( padding: const EdgeInsets.all(12), @@ -95,7 +100,10 @@ class _TextFieldShiftEnterExampleState extends State focusNode: _focusNode, autofocus: true, controller: _controller, - decoration: const InputDecoration(border: OutlineInputBorder(), labelText: 'Text'), + decoration: const InputDecoration( + border: OutlineInputBorder(), + labelText: 'Text', + ), maxLines: null, textInputAction: TextInputAction.done, onSubmitted: (String? text) { diff --git a/examples/api/lib/material/text_form_field/text_form_field.1.dart b/examples/api/lib/material/text_form_field/text_form_field.1.dart index 5ee73b08c93..cbf8c278d2b 100644 --- a/examples/api/lib/material/text_form_field/text_form_field.1.dart +++ b/examples/api/lib/material/text_form_field/text_form_field.1.dart @@ -49,7 +49,9 @@ class _TextFormFieldExampleState extends State { constraints: BoxConstraints.tight(const Size(200, 50)), child: TextFormField( onSaved: (String? value) { - debugPrint('Value for field $index saved as "$value"'); + debugPrint( + 'Value for field $index saved as "$value"', + ); }, ), ), diff --git a/examples/api/lib/material/text_form_field/text_form_field.2.dart b/examples/api/lib/material/text_form_field/text_form_field.2.dart index bbefb138a5b..ba8db000b87 100644 --- a/examples/api/lib/material/text_form_field/text_form_field.2.dart +++ b/examples/api/lib/material/text_form_field/text_form_field.2.dart @@ -99,7 +99,9 @@ class _TextFormFieldExampleState extends State { TextFormField( forceErrorText: forceErrorText, controller: controller, - decoration: const InputDecoration(hintText: 'Please write a username'), + decoration: const InputDecoration( + hintText: 'Please write a username', + ), validator: validator, onChanged: onChanged, ), diff --git a/examples/api/lib/material/theme/theme_extension.1.dart b/examples/api/lib/material/theme/theme_extension.1.dart index 1855ecd8494..4fa47c5761c 100644 --- a/examples/api/lib/material/theme/theme_extension.1.dart +++ b/examples/api/lib/material/theme/theme_extension.1.dart @@ -16,7 +16,10 @@ class MyColors extends ThemeExtension { @override MyColors copyWith({Color? brandColor, Color? danger}) { - return MyColors(brandColor: brandColor ?? this.brandColor, danger: danger ?? this.danger); + return MyColors( + brandColor: brandColor ?? this.brandColor, + danger: danger ?? this.danger, + ); } @override @@ -45,7 +48,8 @@ class ThemeExtensionExampleApp extends StatefulWidget { const ThemeExtensionExampleApp({super.key}); @override - State createState() => _ThemeExtensionExampleAppState(); + State createState() => + _ThemeExtensionExampleAppState(); } class _ThemeExtensionExampleAppState extends State { @@ -65,7 +69,10 @@ class _ThemeExtensionExampleAppState extends State { ), darkTheme: ThemeData.dark().copyWith( extensions: >[ - const MyColors(brandColor: Color(0xFF90CAF9), danger: Color(0xFFEF9A9A)), + const MyColors( + brandColor: Color(0xFF90CAF9), + danger: Color(0xFFEF9A9A), + ), ], ), themeMode: isLightTheme ? ThemeMode.light : ThemeMode.dark, @@ -75,7 +82,11 @@ class _ThemeExtensionExampleAppState extends State { } class Home extends StatelessWidget { - const Home({super.key, required this.isLightTheme, required this.toggleTheme}); + const Home({ + super.key, + required this.isLightTheme, + required this.toggleTheme, + }); final bool isLightTheme; final void Function() toggleTheme; diff --git a/examples/api/lib/material/theme_data/theme_data.0.dart b/examples/api/lib/material/theme_data/theme_data.0.dart index 0fe884a0531..d6670b70781 100644 --- a/examples/api/lib/material/theme_data/theme_data.0.dart +++ b/examples/api/lib/material/theme_data/theme_data.0.dart @@ -91,7 +91,9 @@ class _HomeState extends State { ), child: Text( '${pointCount.toInt()} Points', - style: theme.textTheme.headlineMedium!.copyWith(color: colorScheme.onPrimaryContainer), + style: theme.textTheme.headlineMedium!.copyWith( + color: colorScheme.onPrimaryContainer, + ), ), ), floatingActionButton: FloatingActionButton( diff --git a/examples/api/lib/material/time_picker/show_time_picker.0.dart b/examples/api/lib/material/time_picker/show_time_picker.0.dart index 05dc9556ed0..ad93b5b57fd 100644 --- a/examples/api/lib/material/time_picker/show_time_picker.0.dart +++ b/examples/api/lib/material/time_picker/show_time_picker.0.dart @@ -158,7 +158,8 @@ class _TimePickerOptionsState extends State { value: orientation, title: '$Orientation', choiceLabels: { - for (final Orientation choice in Orientation.values) choice: choice.name, + for (final Orientation choice in Orientation.values) + choice: choice.name, null: 'from MediaQuery', }, onChanged: _orientationChanged, @@ -178,7 +179,10 @@ class _TimePickerOptionsState extends State { value: widget.useMaterial3, onChanged: widget.setUseMaterial3, title: 'Material Version', - choiceLabels: const {false: 'Material 2', true: 'Material 3'}, + choiceLabels: const { + false: 'Material 2', + true: 'Material 3', + }, ), ], ), @@ -205,13 +209,15 @@ class _TimePickerOptionsState extends State { // rarely necessary, because the default values are // usually used as-is. return Theme( - data: Theme.of(context).copyWith(materialTapTargetSize: tapTargetSize), + data: Theme.of( + context, + ).copyWith(materialTapTargetSize: tapTargetSize), child: Directionality( textDirection: textDirection, child: MediaQuery( - data: MediaQuery.of( - context, - ).copyWith(alwaysUse24HourFormat: use24HourTime), + data: MediaQuery.of(context).copyWith( + alwaysUse24HourFormat: use24HourTime, + ), child: child!, ), ), @@ -224,7 +230,8 @@ class _TimePickerOptionsState extends State { }, ), ), - if (selectedTime != null) Text('Selected time: ${selectedTime!.format(context)}'), + if (selectedTime != null) + Text('Selected time: ${selectedTime!.format(context)}'), ], ), ), @@ -284,7 +291,12 @@ class ChoiceCard extends StatelessWidget { // This aggregates a ChoiceCard so that it presents a set of radio buttons for // the allowed enum values for the user to select from. class EnumCard extends StatelessWidget { - const EnumCard({super.key, required this.value, required this.choices, required this.onChanged}); + const EnumCard({ + super.key, + required this.value, + required this.choices, + required this.onChanged, + }); final T value; final Iterable choices; @@ -296,7 +308,9 @@ class EnumCard extends StatelessWidget { value: value, choices: choices, onChanged: onChanged, - choiceLabels: {for (final T choice in choices) choice: choice.name}, + choiceLabels: { + for (final T choice in choices) choice: choice.name, + }, title: value.runtimeType.toString(), ); } @@ -331,12 +345,21 @@ class _RadioSelectionState extends State> { Padding( padding: const EdgeInsetsDirectional.only(end: 8), child: Radio( + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use groupValue: widget.groupValue, value: widget.value, + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use onChanged: widget.onChanged, ), ), - GestureDetector(onTap: () => widget.onChanged(widget.value), child: widget.child), + GestureDetector( + onTap: () => widget.onChanged(widget.value), + child: widget.child, + ), ], ); } diff --git a/examples/api/lib/material/toggle_buttons/toggle_buttons.0.dart b/examples/api/lib/material/toggle_buttons/toggle_buttons.0.dart index 36938288150..291433837fa 100644 --- a/examples/api/lib/material/toggle_buttons/toggle_buttons.0.dart +++ b/examples/api/lib/material/toggle_buttons/toggle_buttons.0.dart @@ -6,11 +6,23 @@ import 'package:flutter/material.dart'; /// Flutter code sample for [ToggleButtons]. -const List fruits = [Text('Apple'), Text('Banana'), Text('Orange')]; +const List fruits = [ + Text('Apple'), + Text('Banana'), + Text('Orange'), +]; -const List vegetables = [Text('Tomatoes'), Text('Potatoes'), Text('Carrots')]; +const List vegetables = [ + Text('Tomatoes'), + Text('Potatoes'), + Text('Carrots'), +]; -const List icons = [Icon(Icons.sunny), Icon(Icons.cloud), Icon(Icons.ac_unit)]; +const List icons = [ + Icon(Icons.sunny), + Icon(Icons.cloud), + Icon(Icons.ac_unit), +]; void main() => runApp(const ToggleButtonsExampleApp()); @@ -19,7 +31,9 @@ class ToggleButtonsExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { - return const MaterialApp(home: ToggleButtonsSample(title: 'ToggleButtons Sample')); + return const MaterialApp( + home: ToggleButtonsSample(title: 'ToggleButtons Sample'), + ); } } @@ -68,7 +82,10 @@ class _ToggleButtonsSampleState extends State { selectedColor: Colors.white, fillColor: Colors.red[200], color: Colors.red[400], - constraints: const BoxConstraints(minHeight: 40.0, minWidth: 80.0), + constraints: const BoxConstraints( + minHeight: 40.0, + minWidth: 80.0, + ), isSelected: _selectedFruits, children: fruits, ), @@ -89,7 +106,10 @@ class _ToggleButtonsSampleState extends State { selectedColor: Colors.white, fillColor: Colors.green[200], color: Colors.green[400], - constraints: const BoxConstraints(minHeight: 40.0, minWidth: 80.0), + constraints: const BoxConstraints( + minHeight: 40.0, + minWidth: 80.0, + ), isSelected: _selectedVegetables, children: vegetables, ), diff --git a/examples/api/lib/material/toggle_buttons/toggle_buttons.1.dart b/examples/api/lib/material/toggle_buttons/toggle_buttons.1.dart index c04d821b9d2..5bc6ce8f554 100644 --- a/examples/api/lib/material/toggle_buttons/toggle_buttons.1.dart +++ b/examples/api/lib/material/toggle_buttons/toggle_buttons.1.dart @@ -56,13 +56,16 @@ class _ToggleButtonsExampleState extends State { // This callback return the index of the child that was pressed. onPressed: (int index) { setState(() { - _toggleButtonsSelection[index] = !_toggleButtonsSelection[index]; + _toggleButtonsSelection[index] = + !_toggleButtonsSelection[index]; }); }, // Constraints are used to determine the size of each child widget. constraints: const BoxConstraints(minHeight: 32.0, minWidth: 56.0), // ToggleButtons uses a List to build its children. - children: shirtSizeOptions.map(((ShirtSize, String) shirt) => Text(shirt.$2)).toList(), + children: shirtSizeOptions + .map(((ShirtSize, String) shirt) => Text(shirt.$2)) + .toList(), ), const SizedBox(height: 20), const Text('SegmentedButton'), @@ -85,8 +88,13 @@ class _ToggleButtonsExampleState extends State { }, // SegmentedButton uses a List> to build its children // instead of a List like ToggleButtons. - segments: shirtSizeOptions.map>(((ShirtSize, String) shirt) { - return ButtonSegment(value: shirt.$1, label: Text(shirt.$2)); + segments: shirtSizeOptions.map>(( + (ShirtSize, String) shirt, + ) { + return ButtonSegment( + value: shirt.$1, + label: Text(shirt.$2), + ); }).toList(), ), ], diff --git a/examples/api/lib/material/tooltip/tooltip.0.dart b/examples/api/lib/material/tooltip/tooltip.0.dart index 71cac51b6aa..f8ce0318fe7 100644 --- a/examples/api/lib/material/tooltip/tooltip.0.dart +++ b/examples/api/lib/material/tooltip/tooltip.0.dart @@ -14,7 +14,9 @@ class TooltipExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( - theme: ThemeData(tooltipTheme: const TooltipThemeData(preferBelow: false)), + theme: ThemeData( + tooltipTheme: const TooltipThemeData(preferBelow: false), + ), home: Scaffold( appBar: AppBar(title: const Text('Tooltip Sample')), body: const Center(child: TooltipSample()), diff --git a/examples/api/lib/material/tooltip/tooltip.1.dart b/examples/api/lib/material/tooltip/tooltip.1.dart index b68f29498ce..1b595a32355 100644 --- a/examples/api/lib/material/tooltip/tooltip.1.dart +++ b/examples/api/lib/material/tooltip/tooltip.1.dart @@ -14,7 +14,9 @@ class TooltipExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( - theme: ThemeData(tooltipTheme: const TooltipThemeData(preferBelow: false)), + theme: ThemeData( + tooltipTheme: const TooltipThemeData(preferBelow: false), + ), home: Scaffold( appBar: AppBar(title: const Text('Tooltip Sample')), body: const Center(child: TooltipSample()), @@ -32,7 +34,9 @@ class TooltipSample extends StatelessWidget { message: 'I am a Tooltip', decoration: BoxDecoration( borderRadius: BorderRadius.circular(25), - gradient: const LinearGradient(colors: [Colors.amber, Colors.red]), + gradient: const LinearGradient( + colors: [Colors.amber, Colors.red], + ), ), constraints: const BoxConstraints(minWidth: 250), padding: const EdgeInsets.all(8.0), diff --git a/examples/api/lib/material/tooltip/tooltip.2.dart b/examples/api/lib/material/tooltip/tooltip.2.dart index 03cf450edf5..97acc1538ff 100644 --- a/examples/api/lib/material/tooltip/tooltip.2.dart +++ b/examples/api/lib/material/tooltip/tooltip.2.dart @@ -14,7 +14,9 @@ class TooltipExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( - theme: ThemeData(tooltipTheme: const TooltipThemeData(preferBelow: false)), + theme: ThemeData( + tooltipTheme: const TooltipThemeData(preferBelow: false), + ), home: Scaffold( appBar: AppBar(title: const Text('Tooltip Sample')), body: const Center(child: TooltipSample()), diff --git a/examples/api/lib/material/tooltip/tooltip.3.dart b/examples/api/lib/material/tooltip/tooltip.3.dart index 03899aeb0df..c33683b463d 100644 --- a/examples/api/lib/material/tooltip/tooltip.3.dart +++ b/examples/api/lib/material/tooltip/tooltip.3.dart @@ -14,7 +14,9 @@ class TooltipExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( - theme: ThemeData(tooltipTheme: const TooltipThemeData(preferBelow: false)), + theme: ThemeData( + tooltipTheme: const TooltipThemeData(preferBelow: false), + ), home: const TooltipSample(title: 'Tooltip Sample'), ); } diff --git a/examples/api/lib/material/widget_state_input_border/widget_state_input_border.0.dart b/examples/api/lib/material/widget_state_input_border/widget_state_input_border.0.dart index 39aa08b2376..d5e6c6e53a3 100644 --- a/examples/api/lib/material/widget_state_input_border/widget_state_input_border.0.dart +++ b/examples/api/lib/material/widget_state_input_border/widget_state_input_border.0.dart @@ -78,7 +78,9 @@ class WidgetStateInputBorderExample extends StatelessWidget { /// such as when rebuilding a [Theme] widget. static UnderlineInputBorder veryCoolBorder(Set states) { if (states.disabled) { - return const UnderlineInputBorder(borderSide: BorderSide(color: Colors.grey)); + return const UnderlineInputBorder( + borderSide: BorderSide(color: Colors.grey), + ); } const Color dullViolet = Color(0xFF502080); @@ -95,7 +97,9 @@ class WidgetStateInputBorderExample extends StatelessWidget { Widget build(BuildContext context) { final InputDecoration decoration = InputDecoration( border: const WidgetStateInputBorder.resolveWith(veryCoolBorder), - labelText: enabled ? 'Type something awesome…' : '(click below to enable)', + labelText: enabled + ? 'Type something awesome…' + : '(click below to enable)', ); return AnimatedFractionallySizedBox( diff --git a/examples/api/lib/painting/axis_direction/axis_direction.0.dart b/examples/api/lib/painting/axis_direction/axis_direction.0.dart index 2ed2387f089..76b241b4666 100644 --- a/examples/api/lib/painting/axis_direction/axis_direction.0.dart +++ b/examples/api/lib/painting/axis_direction/axis_direction.0.dart @@ -102,7 +102,9 @@ class _MyWidgetState extends State { return DefaultTextStyle( style: const TextStyle(fontWeight: FontWeight.bold, color: Colors.white), child: RadioTheme( - data: RadioThemeData(fillColor: WidgetStateProperty.all(Colors.white)), + data: RadioThemeData( + fillColor: WidgetStateProperty.all(Colors.white), + ), child: Padding( padding: const EdgeInsets.all(8.0), child: Row( @@ -110,28 +112,52 @@ class _MyWidgetState extends State { children: [ Radio( value: AxisDirection.up, + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use groupValue: _axisDirection, + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use onChanged: _onAxisDirectionChanged, ), const Text('up'), _spacer, Radio( value: AxisDirection.down, + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use groupValue: _axisDirection, + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use onChanged: _onAxisDirectionChanged, ), const Text('down'), _spacer, Radio( value: AxisDirection.left, + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use groupValue: _axisDirection, + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use onChanged: _onAxisDirectionChanged, ), const Text('left'), _spacer, Radio( value: AxisDirection.right, + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use groupValue: _axisDirection, + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use onChanged: _onAxisDirectionChanged, ), const Text('right'), @@ -150,7 +176,10 @@ class _MyWidgetState extends State { title: const Text('AxisDirections'), bottom: PreferredSize( preferredSize: const Size.fromHeight(50), - child: Padding(padding: const EdgeInsets.all(8.0), child: _getRadioRow()), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: _getRadioRow(), + ), ), ), // Also works for ListView.builder, which creates a SliverList for itself. diff --git a/examples/api/lib/painting/gradient/linear_gradient.0.dart b/examples/api/lib/painting/gradient/linear_gradient.0.dart index 7416a1135e6..503bdaeb349 100644 --- a/examples/api/lib/painting/gradient/linear_gradient.0.dart +++ b/examples/api/lib/painting/gradient/linear_gradient.0.dart @@ -42,7 +42,10 @@ class MoodyGradient extends StatelessWidget { ), ), child: const Center( - child: Text('From Night to Day', style: TextStyle(fontSize: 24, color: Colors.white)), + child: Text( + 'From Night to Day', + style: TextStyle(fontSize: 24, color: Colors.white), + ), ), ), ); diff --git a/examples/api/lib/painting/image_provider/image_provider.0.dart b/examples/api/lib/painting/image_provider/image_provider.0.dart index f99e3b13ab1..f3326d406cd 100644 --- a/examples/api/lib/painting/image_provider/image_provider.0.dart +++ b/examples/api/lib/painting/image_provider/image_provider.0.dart @@ -44,18 +44,24 @@ class CustomNetworkImage extends ImageProvider { @override ImageStreamCompleter loadImage(Uri key, ImageDecoderCallback decode) { - final StreamController chunkEvents = StreamController(); + final StreamController chunkEvents = + StreamController(); debugPrint('Fetching "$key"...'); return MultiFrameImageStreamCompleter( codec: _httpClient .getUrl(key) - .then((HttpClientRequest request) => request.close()) + .then( + (HttpClientRequest request) => request.close(), + ) .then((HttpClientResponse response) { return consolidateHttpClientResponseBytes( response, onBytesReceived: (int cumulative, int? total) { chunkEvents.add( - ImageChunkEvent(cumulativeBytesLoaded: cumulative, expectedTotalBytes: total), + ImageChunkEvent( + cumulativeBytesLoaded: cumulative, + expectedTotalBytes: total, + ), ); }, ); @@ -80,7 +86,8 @@ class CustomNetworkImage extends ImageProvider { } @override - String toString() => '${objectRuntimeType(this, 'CustomNetworkImage')}("$url")'; + String toString() => + '${objectRuntimeType(this, 'CustomNetworkImage')}("$url")'; } void main() => runApp(const ExampleApp()); diff --git a/examples/api/lib/painting/linear_border/linear_border.0.dart b/examples/api/lib/painting/linear_border/linear_border.0.dart index 7a3c4c915ec..21d461a081b 100644 --- a/examples/api/lib/painting/linear_border/linear_border.0.dart +++ b/examples/api/lib/painting/linear_border/linear_border.0.dart @@ -51,11 +51,20 @@ class SampleCard extends StatelessWidget { mainAxisSize: MainAxisSize.min, children: [ Text(title, style: textTheme.titleMedium), - Text(subtitle, style: textTheme.bodyMedium!.copyWith(color: colorScheme.secondary)), + Text( + subtitle, + style: textTheme.bodyMedium!.copyWith( + color: colorScheme.secondary, + ), + ), const SizedBox(height: 16), Row( - children: List.generate(children.length * 2 - 1, (int index) { - return index.isEven ? children[index ~/ 2] : const SizedBox(width: 16); + children: List.generate(children.length * 2 - 1, ( + int index, + ) { + return index.isEven + ? children[index ~/ 2] + : const SizedBox(width: 16); }), ), ], @@ -84,8 +93,14 @@ class _HomeState extends State { width: 0, color: colorScheme.inversePrimary, ); // hairline - final BorderSide primarySide2 = BorderSide(width: 2, color: colorScheme.onPrimaryContainer); - final BorderSide primarySide3 = BorderSide(width: 3, color: colorScheme.inversePrimary); + final BorderSide primarySide2 = BorderSide( + width: 2, + color: colorScheme.onPrimaryContainer, + ); + final BorderSide primarySide3 = BorderSide( + width: 3, + color: colorScheme.inversePrimary, + ); return Scaffold( body: SingleChildScrollView( @@ -107,7 +122,10 @@ class _HomeState extends State { subtitle: 'Standard button widgets', children: [ TextButton( - style: TextButton.styleFrom(side: primarySide3, shape: LinearBorder.bottom()), + style: TextButton.styleFrom( + side: primarySide3, + shape: LinearBorder.bottom(), + ), onPressed: () {}, child: const Text('Text'), ), @@ -140,22 +158,34 @@ class _HomeState extends State { subtitle: 'Convenience constructors', children: [ TextButton( - style: TextButton.styleFrom(side: primarySide0, shape: LinearBorder.start()), + style: TextButton.styleFrom( + side: primarySide0, + shape: LinearBorder.start(), + ), onPressed: () {}, child: const Text('Start()'), ), TextButton( - style: TextButton.styleFrom(side: primarySide0, shape: LinearBorder.end()), + style: TextButton.styleFrom( + side: primarySide0, + shape: LinearBorder.end(), + ), onPressed: () {}, child: const Text('End()'), ), TextButton( - style: TextButton.styleFrom(side: primarySide0, shape: LinearBorder.top()), + style: TextButton.styleFrom( + side: primarySide0, + shape: LinearBorder.top(), + ), onPressed: () {}, child: const Text('Top()'), ), TextButton( - style: TextButton.styleFrom(side: primarySide0, shape: LinearBorder.bottom()), + style: TextButton.styleFrom( + side: primarySide0, + shape: LinearBorder.bottom(), + ), onPressed: () {}, child: const Text('Bottom()'), ), @@ -219,7 +249,10 @@ class _HomeState extends State { TextButton( style: TextButton.styleFrom( side: primarySide0, - shape: const LinearBorder(start: LinearBorderEdge(), end: LinearBorderEdge()), + shape: const LinearBorder( + start: LinearBorderEdge(), + end: LinearBorderEdge(), + ), ), onPressed: () {}, child: const Text('Vertical'), @@ -253,19 +286,28 @@ class _HomeState extends State { }, ), TextButton( - style: TextButton.styleFrom(side: primarySide3, shape: shape), + style: TextButton.styleFrom( + side: primarySide3, + shape: shape, + ), onPressed: () {}, child: const Text('Press Play'), ), TextButton( style: ButtonStyle( - side: WidgetStateProperty.resolveWith((Set states) { - return states.contains(WidgetState.hovered) ? primarySide3 : null; + side: WidgetStateProperty.resolveWith(( + Set states, + ) { + return states.contains(WidgetState.hovered) + ? primarySide3 + : null; }), shape: WidgetStateProperty.resolveWith(( Set states, ) { - return states.contains(WidgetState.hovered) ? shape0 : shape1; + return states.contains(WidgetState.hovered) + ? shape0 + : shape1; }), ), onPressed: () {}, diff --git a/examples/api/lib/painting/rounded_superellipse_border/rounded_superellipse_border.0.dart b/examples/api/lib/painting/rounded_superellipse_border/rounded_superellipse_border.0.dart index 38dee663f98..c1a8d105c39 100644 --- a/examples/api/lib/painting/rounded_superellipse_border/rounded_superellipse_border.0.dart +++ b/examples/api/lib/painting/rounded_superellipse_border/rounded_superellipse_border.0.dart @@ -18,18 +18,25 @@ class RoundedSuperellipseBorderExample extends StatefulWidget { static final GlobalKey kRadiusSliderKey = GlobalKey(); @override - State createState() => RoundedSuperellipseBorderExampleState(); + State createState() => + RoundedSuperellipseBorderExampleState(); } -class RoundedSuperellipseBorderExampleState extends State { +class RoundedSuperellipseBorderExampleState + extends State { bool _toggle = true; double _borderThickness = 4; double _borderRadius = 69; @override Widget build(BuildContext context) { - final BorderRadiusGeometry radius = BorderRadiusGeometry.circular(_borderRadius); - final BorderSide side = BorderSide(width: _borderThickness, color: const Color(0xFF111111)); + final BorderRadiusGeometry radius = BorderRadiusGeometry.circular( + _borderRadius, + ); + final BorderSide side = BorderSide( + width: _borderThickness, + color: const Color(0xFF111111), + ); final ShapeBorder shape = _toggle ? RoundedSuperellipseBorder(side: side, borderRadius: radius) : RoundedRectangleBorder(side: side, borderRadius: radius); @@ -47,7 +54,10 @@ class RoundedSuperellipseBorderExampleState extends State[ - ConstrainedBox(constraints: const BoxConstraints(minWidth: 50), child: Text(label)), + ConstrainedBox( + constraints: const BoxConstraints(minWidth: 50), + child: Text(label), + ), Expanded(child: slider), - ConstrainedBox(constraints: const BoxConstraints(minWidth: 50), child: Text(valueString)), + ConstrainedBox( + constraints: const BoxConstraints(minWidth: 50), + child: Text(valueString), + ), ], ); } diff --git a/examples/api/lib/painting/star_border/star_border.0.dart b/examples/api/lib/painting/star_border/star_border.0.dart index 0e72ea3c2fe..f3530c00e13 100644 --- a/examples/api/lib/painting/star_border/star_border.0.dart +++ b/examples/api/lib/painting/star_border/star_border.0.dart @@ -252,13 +252,15 @@ class _OptionsState extends State { ), ), Tooltip( - message: 'Round the number of points to the nearest integer.', + message: + 'Round the number of points to the nearest integer.', child: Padding( padding: const EdgeInsets.all(8.0), child: OutlinedButton( child: const Text('Nearest'), onPressed: () { - widget.model.points = widget.model.points.roundToDouble(); + widget.model.points = widget.model.points + .roundToDouble(); }, ), ), @@ -418,7 +420,12 @@ class ControlSlider extends StatelessWidget { Expanded(flex: 2, child: Text(label, textAlign: TextAlign.end)), Expanded( flex: 5, - child: Slider(onChanged: onChanged, min: min, max: max, value: value), + child: Slider( + onChanged: onChanged, + min: min, + max: max, + value: value, + ), ), Expanded(child: Text(value.toStringAsFixed(precision))), ], diff --git a/examples/api/lib/rendering/box/parent_data.0.dart b/examples/api/lib/rendering/box/parent_data.0.dart index de9a4bb2966..c890f9ddff0 100644 --- a/examples/api/lib/rendering/box/parent_data.0.dart +++ b/examples/api/lib/rendering/box/parent_data.0.dart @@ -37,7 +37,9 @@ class _SampleAppState extends State { 'effectiveness and thus to developer happiness.', ), Headline('Bugs affecting more people are more valuable (maximize N)'), - Paragraph('We will make more people happier if we fix a bug experienced by more people.'), + Paragraph( + 'We will make more people happier if we fix a bug experienced by more people.', + ), Paragraph( 'One thing to be careful about is to think about the number of ' 'people we are ignoring in our metrics. For example, if we had ' @@ -46,7 +48,9 @@ class _SampleAppState extends State { 'However, fixing the bug would enable millions of developers ' "to use our product, and that's the number that counts.", ), - Headline('Bugs with greater impact on developers are more valuable (maximize ΔH)'), + Headline( + 'Bugs with greater impact on developers are more valuable (maximize ΔH)', + ), Paragraph( 'A slight improvement to the user experience is less valuable ' 'than a greater improvement. For example, if our application, ' @@ -89,7 +93,9 @@ class _SampleAppState extends State { body: SingleChildScrollView( padding: const EdgeInsets.symmetric(horizontal: 30.0, vertical: 20.0), // CompactLayout and OpenLayout are the two rendering widgets defined below. - child: _compact ? const CompactLayout(children: body) : const OpenLayout(children: body), + child: _compact + ? const CompactLayout(children: body) + : const OpenLayout(children: body), ), ), ); @@ -139,7 +145,8 @@ class TextCategory extends ParentDataWidget { @override void applyParentData(RenderObject renderObject) { - final TextFlowParentData parentData = renderObject.parentData! as TextFlowParentData; + final TextFlowParentData parentData = + renderObject.parentData! as TextFlowParentData; if (parentData.category != category) { parentData.category = category; renderObject.parent!.markNeedsLayout(); @@ -161,7 +168,10 @@ class CompactLayout extends MultiChildRenderObjectWidget { } @override - void updateRenderObject(BuildContext context, RenderCompactLayout renderObject) { + void updateRenderObject( + BuildContext context, + RenderCompactLayout renderObject, + ) { // nothing to update } } @@ -268,7 +278,8 @@ abstract class RenderTextFlow extends RenderBox double height = 0.0; RenderBox? child = firstChild; while (child != null) { - final String category = (child.parentData! as TextFlowParentData).category; + final String category = + (child.parentData! as TextFlowParentData).category; if (previousCategory != null) { height += spacingBetween(previousCategory, category); } @@ -285,7 +296,8 @@ abstract class RenderTextFlow extends RenderBox double height = 0.0; RenderBox? child = firstChild; while (child != null) { - final String category = (child.parentData! as TextFlowParentData).category; + final String category = + (child.parentData! as TextFlowParentData).category; if (previousCategory != null) { height += spacingBetween(previousCategory, category); } @@ -310,12 +322,15 @@ abstract class RenderTextFlow extends RenderBox @override Size computeDryLayout(BoxConstraints constraints) { - final BoxConstraints innerConstraints = BoxConstraints.tightFor(width: constraints.maxWidth); + final BoxConstraints innerConstraints = BoxConstraints.tightFor( + width: constraints.maxWidth, + ); String? previousCategory; double y = 0.0; RenderBox? child = firstChild; while (child != null) { - final String category = (child.parentData! as TextFlowParentData).category; + final String category = + (child.parentData! as TextFlowParentData).category; if (previousCategory != null) { y += spacingBetween(previousCategory, category); } @@ -334,12 +349,15 @@ abstract class RenderTextFlow extends RenderBox @override void performLayout() { - final BoxConstraints innerConstraints = BoxConstraints.tightFor(width: constraints.maxWidth); + final BoxConstraints innerConstraints = BoxConstraints.tightFor( + width: constraints.maxWidth, + ); String? previousCategory; double y = 0.0; RenderBox? child = firstChild; while (child != null) { - final String category = (child.parentData! as TextFlowParentData).category; + final String category = + (child.parentData! as TextFlowParentData).category; if (previousCategory != null) { // This is where we call the function that computes the spacing between // the different children. The arguments are the categories, obtained diff --git a/examples/api/lib/rendering/growth_direction/growth_direction.0.dart b/examples/api/lib/rendering/growth_direction/growth_direction.0.dart index 00ef16e2c4c..bd3ddf96836 100644 --- a/examples/api/lib/rendering/growth_direction/growth_direction.0.dart +++ b/examples/api/lib/rendering/growth_direction/growth_direction.0.dart @@ -110,7 +110,9 @@ class _MyWidgetState extends State { return DefaultTextStyle( style: const TextStyle(fontWeight: FontWeight.bold, color: Colors.white), child: RadioTheme( - data: RadioThemeData(fillColor: WidgetStateProperty.all(Colors.white)), + data: RadioThemeData( + fillColor: WidgetStateProperty.all(Colors.white), + ), child: Padding( padding: const EdgeInsets.all(8.0), child: Row( @@ -118,28 +120,52 @@ class _MyWidgetState extends State { children: [ Radio( value: AxisDirection.up, + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use groupValue: _axisDirection, + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use onChanged: _onAxisDirectionChanged, ), const Text('up'), _spacer, Radio( value: AxisDirection.down, + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use groupValue: _axisDirection, + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use onChanged: _onAxisDirectionChanged, ), const Text('down'), _spacer, Radio( value: AxisDirection.left, + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use groupValue: _axisDirection, + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use onChanged: _onAxisDirectionChanged, ), const Text('left'), _spacer, Radio( value: AxisDirection.right, + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use groupValue: _axisDirection, + // TODO(loic-shaQrma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use onChanged: _onAxisDirectionChanged, ), const Text('right'), @@ -186,7 +212,10 @@ class _MyWidgetState extends State { title: const Text('GrowthDirections'), bottom: PreferredSize( preferredSize: const Size.fromHeight(50), - child: Padding(padding: const EdgeInsets.all(8.0), child: _getRadioRow()), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: _getRadioRow(), + ), ), ), body: CustomScrollView( diff --git a/examples/api/lib/rendering/scroll_direction/scroll_direction.0.dart b/examples/api/lib/rendering/scroll_direction/scroll_direction.0.dart index 2d86696ead3..48cad616fe7 100644 --- a/examples/api/lib/rendering/scroll_direction/scroll_direction.0.dart +++ b/examples/api/lib/rendering/scroll_direction/scroll_direction.0.dart @@ -106,7 +106,9 @@ class _MyWidgetState extends State { return DefaultTextStyle( style: const TextStyle(fontWeight: FontWeight.bold, color: Colors.white), child: RadioTheme( - data: RadioThemeData(fillColor: WidgetStateProperty.all(Colors.white)), + data: RadioThemeData( + fillColor: WidgetStateProperty.all(Colors.white), + ), child: Padding( padding: const EdgeInsets.all(8.0), child: Row( @@ -114,28 +116,52 @@ class _MyWidgetState extends State { children: [ Radio( value: AxisDirection.up, + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use groupValue: _axisDirection, + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use onChanged: _onAxisDirectionChanged, ), const Text('up'), spacer, Radio( value: AxisDirection.down, + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use groupValue: _axisDirection, + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use onChanged: _onAxisDirectionChanged, ), const Text('down'), spacer, Radio( value: AxisDirection.left, + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use groupValue: _axisDirection, + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use onChanged: _onAxisDirectionChanged, ), const Text('left'), spacer, Radio( value: AxisDirection.right, + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use groupValue: _axisDirection, + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use onChanged: _onAxisDirectionChanged, ), const Text('right'), @@ -163,7 +189,10 @@ class _MyWidgetState extends State { title: const Text('ScrollDirections'), bottom: PreferredSize( preferredSize: const Size.fromHeight(50), - child: Padding(padding: const EdgeInsets.all(8.0), child: _getRadioRow()), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: _getRadioRow(), + ), ), ), body: NotificationListener( @@ -186,12 +215,17 @@ class _MyWidgetState extends State { child = _getLeading(); } else { child = Container( - color: index.isEven ? Colors.amber[100] : Colors.amberAccent, + color: index.isEven + ? Colors.amber[100] + : Colors.amberAccent, padding: const EdgeInsets.all(8.0), child: Center(child: Text(alphabet[index - 1])), ); } - return Padding(padding: const EdgeInsets.all(8.0), child: child); + return Padding( + padding: const EdgeInsets.all(8.0), + child: child, + ); }, ), ], diff --git a/examples/api/lib/rendering/sliver_grid/sliver_grid_delegate_with_fixed_cross_axis_count.0.dart b/examples/api/lib/rendering/sliver_grid/sliver_grid_delegate_with_fixed_cross_axis_count.0.dart index 3fe60c04d11..30b584e308c 100644 --- a/examples/api/lib/rendering/sliver_grid/sliver_grid_delegate_with_fixed_cross_axis_count.0.dart +++ b/examples/api/lib/rendering/sliver_grid/sliver_grid_delegate_with_fixed_cross_axis_count.0.dart @@ -6,16 +6,20 @@ import 'package:flutter/material.dart'; /// Flutter code sample for [SliverGridDelegateWithFixedCrossAxisCount]. -void main() => runApp(const SliverGridDelegateWithFixedCrossAxisCountExampleApp()); +void main() => + runApp(const SliverGridDelegateWithFixedCrossAxisCountExampleApp()); -class SliverGridDelegateWithFixedCrossAxisCountExampleApp extends StatelessWidget { +class SliverGridDelegateWithFixedCrossAxisCountExampleApp + extends StatelessWidget { const SliverGridDelegateWithFixedCrossAxisCountExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( - appBar: AppBar(title: const Text('SliverGridDelegateWithFixedCrossAxisCount Sample')), + appBar: AppBar( + title: const Text('SliverGridDelegateWithFixedCrossAxisCount Sample'), + ), body: const SliverGridDelegateWithFixedCrossAxisCountExample(), ), ); diff --git a/examples/api/lib/rendering/sliver_grid/sliver_grid_delegate_with_fixed_cross_axis_count.1.dart b/examples/api/lib/rendering/sliver_grid/sliver_grid_delegate_with_fixed_cross_axis_count.1.dart index bfe4899ddbd..c438ab02a8b 100644 --- a/examples/api/lib/rendering/sliver_grid/sliver_grid_delegate_with_fixed_cross_axis_count.1.dart +++ b/examples/api/lib/rendering/sliver_grid/sliver_grid_delegate_with_fixed_cross_axis_count.1.dart @@ -6,16 +6,20 @@ import 'package:flutter/material.dart'; /// Flutter code sample for [SliverGridDelegateWithFixedCrossAxisCount]. -void main() => runApp(const SliverGridDelegateWithFixedCrossAxisCountExampleApp()); +void main() => + runApp(const SliverGridDelegateWithFixedCrossAxisCountExampleApp()); -class SliverGridDelegateWithFixedCrossAxisCountExampleApp extends StatelessWidget { +class SliverGridDelegateWithFixedCrossAxisCountExampleApp + extends StatelessWidget { const SliverGridDelegateWithFixedCrossAxisCountExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( - appBar: AppBar(title: const Text('SliverGridDelegateWithFixedCrossAxisCount Sample')), + appBar: AppBar( + title: const Text('SliverGridDelegateWithFixedCrossAxisCount Sample'), + ), body: const SliverGridDelegateWithFixedCrossAxisCountExample(), ), ); diff --git a/examples/api/lib/services/binding/handle_request_app_exit.0.dart b/examples/api/lib/services/binding/handle_request_app_exit.0.dart index dd7f7464649..a7302fbe9ce 100644 --- a/examples/api/lib/services/binding/handle_request_app_exit.0.dart +++ b/examples/api/lib/services/binding/handle_request_app_exit.0.dart @@ -46,7 +46,9 @@ class _BodyState extends State with WidgetsBindingObserver { } Future _quit() async { - final AppExitType exitType = _shouldExit ? AppExitType.required : AppExitType.cancelable; + final AppExitType exitType = _shouldExit + ? AppExitType.required + : AppExitType.cancelable; setState(() { lastResponse = 'App requesting ${exitType.name} exit'; }); @@ -55,7 +57,9 @@ class _BodyState extends State with WidgetsBindingObserver { @override Future didRequestAppExit() async { - final AppExitResponse response = _shouldExit ? AppExitResponse.exit : AppExitResponse.cancel; + final AppExitResponse response = _shouldExit + ? AppExitResponse.exit + : AppExitResponse.cancel; setState(() { lastResponse = 'App responded ${response.name} to exit request'; }); @@ -83,7 +87,10 @@ class _BodyState extends State with WidgetsBindingObserver { child: Column( mainAxisSize: MainAxisSize.min, children: [ - const RadioListTile(title: Text('Do Not Allow Exit'), value: false), + const RadioListTile( + title: Text('Do Not Allow Exit'), + value: false, + ), const RadioListTile(title: Text('Allow Exit'), value: true), const SizedBox(height: 30), ElevatedButton(onPressed: _quit, child: const Text('Quit')), diff --git a/examples/api/lib/services/keyboard_key/logical_keyboard_key.0.dart b/examples/api/lib/services/keyboard_key/logical_keyboard_key.0.dart index 908b743fac4..64cdcb6841a 100644 --- a/examples/api/lib/services/keyboard_key/logical_keyboard_key.0.dart +++ b/examples/api/lib/services/keyboard_key/logical_keyboard_key.0.dart @@ -52,7 +52,8 @@ class _MyKeyExampleState extends State { _message = 'Pressed the "Q" key!'; } else { if (kReleaseMode) { - _message = 'Not a Q: Pressed 0x${event.logicalKey.keyId.toRadixString(16)}'; + _message = + 'Not a Q: Pressed 0x${event.logicalKey.keyId.toRadixString(16)}'; } else { // As the name implies, the debugName will only print useful // information in debug mode. diff --git a/examples/api/lib/services/keyboard_key/physical_keyboard_key.0.dart b/examples/api/lib/services/keyboard_key/physical_keyboard_key.0.dart index 1eb74c8177f..356bab498bf 100644 --- a/examples/api/lib/services/keyboard_key/physical_keyboard_key.0.dart +++ b/examples/api/lib/services/keyboard_key/physical_keyboard_key.0.dart @@ -57,7 +57,8 @@ class _MyPhysicalKeyExampleState extends State { } else { // As the name implies, the debugName will only print useful // information in debug mode. - _message = 'Not the key next to CAPS LOCK: Pressed ${event.physicalKey.debugName}'; + _message = + 'Not the key next to CAPS LOCK: Pressed ${event.physicalKey.debugName}'; } } }); diff --git a/examples/api/lib/services/system_chrome/system_chrome.set_system_u_i_overlay_style.0.dart b/examples/api/lib/services/system_chrome/system_chrome.set_system_u_i_overlay_style.0.dart index 36aa16798c0..6a8d82bb46a 100644 --- a/examples/api/lib/services/system_chrome/system_chrome.set_system_u_i_overlay_style.0.dart +++ b/examples/api/lib/services/system_chrome/system_chrome.set_system_u_i_overlay_style.0.dart @@ -24,7 +24,8 @@ class SystemOverlayStyleExample extends StatefulWidget { const SystemOverlayStyleExample({super.key}); @override - State createState() => _SystemOverlayStyleExampleState(); + State createState() => + _SystemOverlayStyleExampleState(); } class _SystemOverlayStyleExampleState extends State { @@ -54,7 +55,10 @@ class _SystemOverlayStyleExampleState extends State { systemOverlayStyle: _currentStyle, ), body: Center( - child: ElevatedButton(onPressed: _changeColor, child: const Text('Change Color')), + child: ElevatedButton( + onPressed: _changeColor, + child: const Text('Change Color'), + ), ), ); } diff --git a/examples/api/lib/services/system_chrome/system_chrome.set_system_u_i_overlay_style.1.dart b/examples/api/lib/services/system_chrome/system_chrome.set_system_u_i_overlay_style.1.dart index 6b5e217e5ae..781306f2c24 100644 --- a/examples/api/lib/services/system_chrome/system_chrome.set_system_u_i_overlay_style.1.dart +++ b/examples/api/lib/services/system_chrome/system_chrome.set_system_u_i_overlay_style.1.dart @@ -24,7 +24,8 @@ class SystemOverlayStyleExample extends StatefulWidget { const SystemOverlayStyleExample({super.key}); @override - State createState() => _SystemOverlayStyleExampleState(); + State createState() => + _SystemOverlayStyleExampleState(); } class _SystemOverlayStyleExampleState extends State { @@ -63,7 +64,10 @@ class _SystemOverlayStyleExampleState extends State { ), Expanded( child: Center( - child: ElevatedButton(onPressed: _changeColor, child: const Text('Change Color')), + child: ElevatedButton( + onPressed: _changeColor, + child: const Text('Change Color'), + ), ), ), ], diff --git a/examples/api/lib/services/text_input/text_input_control.0.dart b/examples/api/lib/services/text_input/text_input_control.0.dart index fd1c997d847..22a65933261 100644 --- a/examples/api/lib/services/text_input/text_input_control.0.dart +++ b/examples/api/lib/services/text_input/text_input_control.0.dart @@ -102,7 +102,10 @@ class MyVirtualKeyboardState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ for (final String key in ['A', 'B', 'C']) - ElevatedButton(child: Text(key), onPressed: () => _handleKeyPress(key)), + ElevatedButton( + child: Text(key), + onPressed: () => _handleKeyPress(key), + ), ], ), ), diff --git a/examples/api/lib/ui/text/font_feature.0.dart b/examples/api/lib/ui/text/font_feature.0.dart index ea099e8bb9a..6f3d63de8f1 100644 --- a/examples/api/lib/ui/text/font_feature.0.dart +++ b/examples/api/lib/ui/text/font_feature.0.dart @@ -42,7 +42,10 @@ class ExampleWidget extends StatelessWidget { style: TextStyle(fontFamily: 'Cardo', fontSize: 24), ), const Spacer(), - Text('but old-style figures blend well with lower case:', style: titleStyle), + Text( + 'but old-style figures blend well with lower case:', + style: titleStyle, + ), const Text( 'The 1972 cup final was a 1-1 draw.', style: TextStyle( @@ -54,7 +57,10 @@ class ExampleWidget extends StatelessWidget { const Spacer(), const Divider(), const Spacer(), - Text('fractions look better with a custom ligature:', style: titleStyle), + Text( + 'fractions look better with a custom ligature:', + style: titleStyle, + ), const Text( 'Add 1/2 tsp of flour and stir.', style: TextStyle( @@ -67,7 +73,10 @@ class ExampleWidget extends StatelessWidget { const Divider(), const Spacer(), Text('multiple stylistic sets in one font:', style: titleStyle), - const Text('Raleway Dots', style: TextStyle(fontFamily: 'Raleway Dots', fontSize: 48)), + const Text( + 'Raleway Dots', + style: TextStyle(fontFamily: 'Raleway Dots', fontSize: 48), + ), Text( 'Raleway Dots', style: TextStyle( diff --git a/examples/api/lib/ui/text/font_feature.font_feature_alternative.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_alternative.0.dart index a96da266213..68ed8f9c75f 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_alternative.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_alternative.0.dart @@ -14,7 +14,8 @@ class ExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return WidgetsApp( - builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + builder: (BuildContext context, Widget? navigator) => + const ExampleWidget(), color: const Color(0xffffffff), ); } diff --git a/examples/api/lib/ui/text/font_feature.font_feature_alternative_fractions.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_alternative_fractions.0.dart index 54150bb8dcc..a135b9065bc 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_alternative_fractions.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_alternative_fractions.0.dart @@ -14,7 +14,8 @@ class ExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return WidgetsApp( - builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + builder: (BuildContext context, Widget? navigator) => + const ExampleWidget(), color: const Color(0xffffffff), ); } diff --git a/examples/api/lib/ui/text/font_feature.font_feature_case_sensitive_forms.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_case_sensitive_forms.0.dart index 77e8b09fb2b..9c7db44aae1 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_case_sensitive_forms.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_case_sensitive_forms.0.dart @@ -14,7 +14,8 @@ class ExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return WidgetsApp( - builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + builder: (BuildContext context, Widget? navigator) => + const ExampleWidget(), color: const Color(0xffffffff), ); } diff --git a/examples/api/lib/ui/text/font_feature.font_feature_character_variant.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_character_variant.0.dart index 9a49d255cef..ab7f816d560 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_character_variant.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_character_variant.0.dart @@ -14,7 +14,8 @@ class ExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return WidgetsApp( - builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + builder: (BuildContext context, Widget? navigator) => + const ExampleWidget(), color: const Color(0xffffffff), ); } diff --git a/examples/api/lib/ui/text/font_feature.font_feature_contextual_alternates.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_contextual_alternates.0.dart index d62fb90baa6..4d56ff9e56d 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_contextual_alternates.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_contextual_alternates.0.dart @@ -14,7 +14,8 @@ class ExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return WidgetsApp( - builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + builder: (BuildContext context, Widget? navigator) => + const ExampleWidget(), color: const Color(0xffffffff), ); } diff --git a/examples/api/lib/ui/text/font_feature.font_feature_denominator.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_denominator.0.dart index a7d98c95632..0c85beaefb8 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_denominator.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_denominator.0.dart @@ -14,7 +14,8 @@ class ExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return WidgetsApp( - builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + builder: (BuildContext context, Widget? navigator) => + const ExampleWidget(), color: const Color(0xffffffff), ); } diff --git a/examples/api/lib/ui/text/font_feature.font_feature_fractions.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_fractions.0.dart index 6066505ddda..24ab4802b6a 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_fractions.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_fractions.0.dart @@ -14,7 +14,8 @@ class ExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return WidgetsApp( - builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + builder: (BuildContext context, Widget? navigator) => + const ExampleWidget(), color: const Color(0xffffffff), ); } diff --git a/examples/api/lib/ui/text/font_feature.font_feature_historical_forms.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_historical_forms.0.dart index 7d7f9dfe800..a22f59c0b3a 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_historical_forms.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_historical_forms.0.dart @@ -14,7 +14,8 @@ class ExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return WidgetsApp( - builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + builder: (BuildContext context, Widget? navigator) => + const ExampleWidget(), color: const Color(0xffffffff), ); } diff --git a/examples/api/lib/ui/text/font_feature.font_feature_historical_ligatures.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_historical_ligatures.0.dart index 8bdabb993d2..997889f1a34 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_historical_ligatures.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_historical_ligatures.0.dart @@ -14,7 +14,8 @@ class ExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return WidgetsApp( - builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + builder: (BuildContext context, Widget? navigator) => + const ExampleWidget(), color: const Color(0xffffffff), ); } diff --git a/examples/api/lib/ui/text/font_feature.font_feature_lining_figures.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_lining_figures.0.dart index 22e1109b3a2..75805b21693 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_lining_figures.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_lining_figures.0.dart @@ -14,7 +14,8 @@ class ExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return WidgetsApp( - builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + builder: (BuildContext context, Widget? navigator) => + const ExampleWidget(), color: const Color(0xffffffff), ); } diff --git a/examples/api/lib/ui/text/font_feature.font_feature_locale_aware.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_locale_aware.0.dart index ef811d69e80..b8edc01ec90 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_locale_aware.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_locale_aware.0.dart @@ -14,7 +14,8 @@ class ExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return WidgetsApp( - builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + builder: (BuildContext context, Widget? navigator) => + const ExampleWidget(), color: const Color(0xffffffff), ); } @@ -29,7 +30,10 @@ class ExampleWidget extends StatelessWidget { // (https://www.google.com/fonts). return const Text( '次 化 刃 直 入 令', - locale: Locale('zh', 'CN'), // or Locale('ja'), Locale('ko'), Locale('zh', 'TW'), etc + locale: Locale( + 'zh', + 'CN', + ), // or Locale('ja'), Locale('ko'), Locale('zh', 'TW'), etc style: TextStyle(fontFamily: 'Noto Sans'), ); } diff --git a/examples/api/lib/ui/text/font_feature.font_feature_notational_forms.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_notational_forms.0.dart index f0e77860764..6d28983ed12 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_notational_forms.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_notational_forms.0.dart @@ -14,7 +14,8 @@ class ExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return WidgetsApp( - builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + builder: (BuildContext context, Widget? navigator) => + const ExampleWidget(), color: const Color(0xffffffff), ); } diff --git a/examples/api/lib/ui/text/font_feature.font_feature_numerators.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_numerators.0.dart index ff620041252..7f6713c6802 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_numerators.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_numerators.0.dart @@ -14,7 +14,8 @@ class ExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return WidgetsApp( - builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + builder: (BuildContext context, Widget? navigator) => + const ExampleWidget(), color: const Color(0xffffffff), ); } diff --git a/examples/api/lib/ui/text/font_feature.font_feature_oldstyle_figures.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_oldstyle_figures.0.dart index 680ccb8c6c7..d777dc629d4 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_oldstyle_figures.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_oldstyle_figures.0.dart @@ -14,7 +14,8 @@ class ExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return WidgetsApp( - builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + builder: (BuildContext context, Widget? navigator) => + const ExampleWidget(), color: const Color(0xffffffff), ); } diff --git a/examples/api/lib/ui/text/font_feature.font_feature_ordinal_forms.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_ordinal_forms.0.dart index a27cbc1ac88..6aa3f33afac 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_ordinal_forms.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_ordinal_forms.0.dart @@ -14,7 +14,8 @@ class ExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return WidgetsApp( - builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + builder: (BuildContext context, Widget? navigator) => + const ExampleWidget(), color: const Color(0xffffffff), ); } diff --git a/examples/api/lib/ui/text/font_feature.font_feature_proportional_figures.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_proportional_figures.0.dart index 3a9813842e3..147ec2cf41d 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_proportional_figures.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_proportional_figures.0.dart @@ -14,7 +14,8 @@ class ExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return WidgetsApp( - builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + builder: (BuildContext context, Widget? navigator) => + const ExampleWidget(), color: const Color(0xffffffff), ); } diff --git a/examples/api/lib/ui/text/font_feature.font_feature_scientific_inferiors.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_scientific_inferiors.0.dart index eb941c28ad3..75e1e8e61bd 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_scientific_inferiors.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_scientific_inferiors.0.dart @@ -14,7 +14,8 @@ class ExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return WidgetsApp( - builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + builder: (BuildContext context, Widget? navigator) => + const ExampleWidget(), color: const Color(0xffffffff), ); } diff --git a/examples/api/lib/ui/text/font_feature.font_feature_slashed_zero.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_slashed_zero.0.dart index cb8cbb06658..bc4034aeb92 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_slashed_zero.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_slashed_zero.0.dart @@ -14,7 +14,8 @@ class ExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return WidgetsApp( - builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + builder: (BuildContext context, Widget? navigator) => + const ExampleWidget(), color: const Color(0xffffffff), ); } diff --git a/examples/api/lib/ui/text/font_feature.font_feature_stylistic_alternates.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_stylistic_alternates.0.dart index 211a053367c..9c1e67055ad 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_stylistic_alternates.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_stylistic_alternates.0.dart @@ -14,7 +14,8 @@ class ExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return WidgetsApp( - builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + builder: (BuildContext context, Widget? navigator) => + const ExampleWidget(), color: const Color(0xffffffff), ); } diff --git a/examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.0.dart index 5f6ed491c78..c249d8abd57 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.0.dart @@ -14,7 +14,8 @@ class ExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return WidgetsApp( - builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + builder: (BuildContext context, Widget? navigator) => + const ExampleWidget(), color: const Color(0xffffffff), ); } diff --git a/examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.1.dart b/examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.1.dart index c79420d61a7..512897f84da 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.1.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.1.dart @@ -14,7 +14,8 @@ class ExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return WidgetsApp( - builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + builder: (BuildContext context, Widget? navigator) => + const ExampleWidget(), color: const Color(0xffffffff), ); } @@ -31,7 +32,10 @@ class ExampleWidget extends StatelessWidget { '-> MCMXCVII <-', // 1997 style: TextStyle( fontFamily: 'Piazzolla', - fontFeatures: [FontFeature.stylisticSet(1), FontFeature.stylisticSet(2)], + fontFeatures: [ + FontFeature.stylisticSet(1), + FontFeature.stylisticSet(2), + ], ), ); } diff --git a/examples/api/lib/ui/text/font_feature.font_feature_subscripts.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_subscripts.0.dart index 2ac93a4accb..6c58c74fb1f 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_subscripts.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_subscripts.0.dart @@ -14,7 +14,8 @@ class ExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return WidgetsApp( - builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + builder: (BuildContext context, Widget? navigator) => + const ExampleWidget(), color: const Color(0xffffffff), ); } diff --git a/examples/api/lib/ui/text/font_feature.font_feature_superscripts.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_superscripts.0.dart index d1da9eb711d..0bca8ea49b2 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_superscripts.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_superscripts.0.dart @@ -14,7 +14,8 @@ class ExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return WidgetsApp( - builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + builder: (BuildContext context, Widget? navigator) => + const ExampleWidget(), color: const Color(0xffffffff), ); } diff --git a/examples/api/lib/ui/text/font_feature.font_feature_swash.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_swash.0.dart index aa87ec76a7e..d2ec6e49f59 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_swash.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_swash.0.dart @@ -14,7 +14,8 @@ class ExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return WidgetsApp( - builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + builder: (BuildContext context, Widget? navigator) => + const ExampleWidget(), color: const Color(0xffffffff), ); } diff --git a/examples/api/lib/ui/text/font_feature.font_feature_tabular_figures.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_tabular_figures.0.dart index ea2bbd3b348..5c4ba6a9ace 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_tabular_figures.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_tabular_figures.0.dart @@ -14,7 +14,8 @@ class ExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return WidgetsApp( - builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + builder: (BuildContext context, Widget? navigator) => + const ExampleWidget(), color: const Color(0xffffffff), ); } diff --git a/examples/api/lib/widgets/actions/action.action_overridable.0.dart b/examples/api/lib/widgets/actions/action.action_overridable.0.dart index fd4ddef286a..e106fdb4917 100644 --- a/examples/api/lib/widgets/actions/action.action_overridable.0.dart +++ b/examples/api/lib/widgets/actions/action.action_overridable.0.dart @@ -26,13 +26,13 @@ class CopyableText extends StatelessWidget { final String text; - void _copy(CopyTextIntent intent) => Clipboard.setData(ClipboardData(text: text)); + void _copy(CopyTextIntent intent) => + Clipboard.setData(ClipboardData(text: text)); @override Widget build(BuildContext context) { - final Action defaultCopyAction = CallbackAction( - onInvoke: _copy, - ); + final Action defaultCopyAction = + CallbackAction(onInvoke: _copy); return Shortcuts( shortcuts: const { SingleActivator(LogicalKeyboardKey.keyC, control: true): copyTextIntent, diff --git a/examples/api/lib/widgets/actions/action_listener.0.dart b/examples/api/lib/widgets/actions/action_listener.0.dart index 8aa51d547f4..0dd67b11fb7 100644 --- a/examples/api/lib/widgets/actions/action_listener.0.dart +++ b/examples/api/lib/widgets/actions/action_listener.0.dart @@ -52,7 +52,10 @@ class _ActionListenerExampleState extends State { children: [ Padding( padding: const EdgeInsets.all(8.0), - child: OutlinedButton(onPressed: _toggleState, child: Text(_on ? 'Disable' : 'Enable')), + child: OutlinedButton( + onPressed: _toggleState, + child: Text(_on ? 'Disable' : 'Enable'), + ), ), if (_on) Padding( @@ -60,14 +63,17 @@ class _ActionListenerExampleState extends State { child: ActionListener( listener: (Action action) { if (action.intentType == MyIntent) { - ScaffoldMessenger.of( - context, - ).showSnackBar(const SnackBar(content: Text('Action Listener Called'))); + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar(content: Text('Action Listener Called')), + ); } }, action: _myAction, child: ElevatedButton( - onPressed: () => const ActionDispatcher().invokeAction(_myAction, const MyIntent()), + onPressed: () => const ActionDispatcher().invokeAction( + _myAction, + const MyIntent(), + ), child: const Text('Call Action Listener'), ), ), diff --git a/examples/api/lib/widgets/actions/focusable_action_detector.0.dart b/examples/api/lib/widgets/actions/focusable_action_detector.0.dart index 211996f1e60..c3a59be3f6a 100644 --- a/examples/api/lib/widgets/actions/focusable_action_detector.0.dart +++ b/examples/api/lib/widgets/actions/focusable_action_detector.0.dart @@ -33,25 +33,34 @@ class _FadButtonState extends State { bool _hovering = false; bool _on = false; late final Map> _actionMap; - final Map _shortcutMap = const { - SingleActivator(LogicalKeyboardKey.keyX): ActivateIntent(), - }; + final Map _shortcutMap = + const { + SingleActivator(LogicalKeyboardKey.keyX): ActivateIntent(), + }; @override void initState() { super.initState(); _actionMap = >{ - ActivateIntent: CallbackAction(onInvoke: (Intent intent) => _toggleState()), + ActivateIntent: CallbackAction( + onInvoke: (Intent intent) => _toggleState(), + ), }; } Color get color { Color baseColor = Colors.lightBlue; if (_focused) { - baseColor = Color.alphaBlend(Colors.black.withOpacity(0.25), baseColor); + baseColor = Color.alphaBlend( + Colors.black.withValues(alpha: 0.25), + baseColor, + ); } if (_hovering) { - baseColor = Color.alphaBlend(Colors.black.withOpacity(0.1), baseColor); + baseColor = Color.alphaBlend( + Colors.black.withValues(alpha: 0.1), + baseColor, + ); } return baseColor; } @@ -85,7 +94,11 @@ class _FadButtonState extends State { onShowHoverHighlight: _handleHoveHighlight, child: Row( children: [ - Container(padding: const EdgeInsets.all(10.0), color: color, child: widget.child), + Container( + padding: const EdgeInsets.all(10.0), + color: color, + child: widget.child, + ), Container( width: 30, height: 30, @@ -103,10 +116,12 @@ class FocusableActionDetectorExample extends StatefulWidget { const FocusableActionDetectorExample({super.key}); @override - State createState() => _FocusableActionDetectorExampleState(); + State createState() => + _FocusableActionDetectorExampleState(); } -class _FocusableActionDetectorExampleState extends State { +class _FocusableActionDetectorExampleState + extends State { @override Widget build(BuildContext context) { return Scaffold( @@ -117,7 +132,10 @@ class _FocusableActionDetectorExampleState extends State[ Padding( padding: const EdgeInsets.all(8.0), - child: TextButton(onPressed: () {}, child: const Text('Press Me')), + child: TextButton( + onPressed: () {}, + child: const Text('Press Me'), + ), ), Padding( padding: const EdgeInsets.all(8.0), diff --git a/examples/api/lib/widgets/animated_grid/animated_grid.0.dart b/examples/api/lib/widgets/animated_grid/animated_grid.0.dart index 2d61a4191db..59e8c299de6 100644 --- a/examples/api/lib/widgets/animated_grid/animated_grid.0.dart +++ b/examples/api/lib/widgets/animated_grid/animated_grid.0.dart @@ -21,7 +21,8 @@ class _AnimatedGridSampleState extends State { final GlobalKey _gridKey = GlobalKey(); late ListModel _list; int? _selectedItem; - late int _nextItem; // The next item inserted when the user presses the '+' button. + late int + _nextItem; // The next item inserted when the user presses the '+' button. @override void initState() { @@ -35,7 +36,11 @@ class _AnimatedGridSampleState extends State { } // Used to build list items that haven't been removed. - Widget _buildItem(BuildContext context, int index, Animation animation) { + Widget _buildItem( + BuildContext context, + int index, + Animation animation, + ) { return CardItem( animation: animation, item: _list[index], @@ -53,7 +58,11 @@ class _AnimatedGridSampleState extends State { // completed (even though it's gone as far as this ListModel is concerned). // The widget will be used by the [AnimatedGridState.removeItem] method's // [AnimatedGridRemovedItemBuilder] parameter. - Widget _buildRemovedItem(int item, BuildContext context, Animation animation) { + Widget _buildRemovedItem( + int item, + BuildContext context, + Animation animation, + ) { return CardItem( animation: animation, item: item, @@ -64,7 +73,9 @@ class _AnimatedGridSampleState extends State { // Insert the "next item" into the list model. void _insert() { - final int index = _selectedItem == null ? _list.length : _list.indexOf(_selectedItem!); + final int index = _selectedItem == null + ? _list.length + : _list.indexOf(_selectedItem!); setState(() { _list.insert(index, _nextItem++); }); @@ -138,8 +149,11 @@ typedef RemovedItemBuilder = /// mutate the list must make the same changes to the animated list in terms /// of [AnimatedGridState.insertItem] and [AnimatedGridState.removeItem]. class ListModel { - ListModel({required this.listKey, required this.removedItemBuilder, Iterable? initialItems}) - : _items = List.from(initialItems ?? []); + ListModel({ + required this.listKey, + required this.removedItemBuilder, + Iterable? initialItems, + }) : _items = List.from(initialItems ?? []); final GlobalKey listKey; final RemovedItemBuilder removedItemBuilder; @@ -149,13 +163,19 @@ class ListModel { void insert(int index, E item) { _items.insert(index, item); - _animatedGrid!.insertItem(index, duration: const Duration(milliseconds: 500)); + _animatedGrid!.insertItem( + index, + duration: const Duration(milliseconds: 500), + ); } E removeAt(int index) { final E removedItem = _items.removeAt(index); if (removedItem != null) { - _animatedGrid!.removeItem(index, (BuildContext context, Animation animation) { + _animatedGrid!.removeItem(index, ( + BuildContext context, + Animation animation, + ) { return removedItemBuilder(removedItem, context, animation); }); } diff --git a/examples/api/lib/widgets/animated_grid/sliver_animated_grid.0.dart b/examples/api/lib/widgets/animated_grid/sliver_animated_grid.0.dart index fc380f23af7..4967788988e 100644 --- a/examples/api/lib/widgets/animated_grid/sliver_animated_grid.0.dart +++ b/examples/api/lib/widgets/animated_grid/sliver_animated_grid.0.dart @@ -12,17 +12,20 @@ class SliverAnimatedGridSample extends StatefulWidget { const SliverAnimatedGridSample({super.key}); @override - State createState() => _SliverAnimatedGridSampleState(); + State createState() => + _SliverAnimatedGridSampleState(); } class _SliverAnimatedGridSampleState extends State { - final GlobalKey _listKey = GlobalKey(); + final GlobalKey _listKey = + GlobalKey(); final GlobalKey _scaffoldKey = GlobalKey(); final GlobalKey _scaffoldMessengerKey = GlobalKey(); late ListModel _list; int? _selectedItem; - late int _nextItem; // The next item inserted when the user presses the '+' button. + late int + _nextItem; // The next item inserted when the user presses the '+' button. @override void initState() { @@ -36,7 +39,11 @@ class _SliverAnimatedGridSampleState extends State { } // Used to build list items that haven't been removed. - Widget _buildItem(BuildContext context, int index, Animation animation) { + Widget _buildItem( + BuildContext context, + int index, + Animation animation, + ) { return CardItem( animation: animation, item: _list[index], @@ -55,13 +62,19 @@ class _SliverAnimatedGridSampleState extends State { // concerned). The widget will be used by the // [AnimatedGridState.removeItem] method's // [AnimatedGridRemovedItemBuilder] parameter. - Widget _buildRemovedItem(int item, BuildContext context, Animation animation) { + Widget _buildRemovedItem( + int item, + BuildContext context, + Animation animation, + ) { return CardItem(animation: animation, removing: true, item: item); } // Insert the "next item" into the list model. void _insert() { - final int index = _selectedItem == null ? _list.length : _list.indexOf(_selectedItem!); + final int index = _selectedItem == null + ? _list.length + : _list.indexOf(_selectedItem!); _list.insert(index, _nextItem++); } @@ -87,14 +100,18 @@ class _SliverAnimatedGridSampleState extends State { body: CustomScrollView( slivers: [ SliverAppBar( - title: const Text('SliverAnimatedGrid', style: TextStyle(fontSize: 30)), + title: const Text( + 'SliverAnimatedGrid', + style: TextStyle(fontSize: 30), + ), expandedHeight: 60, centerTitle: true, backgroundColor: Colors.amber[900], leading: IconButton( icon: const Icon(Icons.remove_circle), onPressed: _remove, - tooltip: 'Remove the selected item, or the last item if none selected.', + tooltip: + 'Remove the selected item, or the last item if none selected.', iconSize: 32, ), actions: [ @@ -124,7 +141,11 @@ class _SliverAnimatedGridSampleState extends State { } typedef RemovedItemBuilder = - Widget Function(int item, BuildContext context, Animation animation); + Widget Function( + int item, + BuildContext context, + Animation animation, + ); // Keeps a Dart [List] in sync with an [AnimatedGrid]. // @@ -136,8 +157,11 @@ typedef RemovedItemBuilder = // mutate the list must make the same changes to the animated list in terms // of [AnimatedGridState.insertItem] and [AnimatedGrid.removeItem]. class ListModel { - ListModel({required this.listKey, required this.removedItemBuilder, Iterable? initialItems}) - : _items = List.from(initialItems ?? []); + ListModel({ + required this.listKey, + required this.removedItemBuilder, + Iterable? initialItems, + }) : _items = List.from(initialItems ?? []); final GlobalKey listKey; final RemovedItemBuilder removedItemBuilder; @@ -205,7 +229,9 @@ class CardItem extends StatelessWidget { child: SizedBox( height: 80.0, child: Card( - color: selected ? Colors.black12 : Colors.primaries[item % Colors.primaries.length], + color: selected + ? Colors.black12 + : Colors.primaries[item % Colors.primaries.length], child: Center( child: Text( (item + 1).toString(), diff --git a/examples/api/lib/widgets/animated_list/animated_list.0.dart b/examples/api/lib/widgets/animated_list/animated_list.0.dart index 751df5ec128..f6a024aaa67 100644 --- a/examples/api/lib/widgets/animated_list/animated_list.0.dart +++ b/examples/api/lib/widgets/animated_list/animated_list.0.dart @@ -21,7 +21,8 @@ class _AnimatedListSampleState extends State { final GlobalKey _listKey = GlobalKey(); late ListModel _list; int? _selectedItem; - late int _nextItem; // The next item inserted when the user presses the '+' button. + late int + _nextItem; // The next item inserted when the user presses the '+' button. @override void initState() { @@ -35,7 +36,11 @@ class _AnimatedListSampleState extends State { } // Used to build list items that haven't been removed. - Widget _buildItem(BuildContext context, int index, Animation animation) { + Widget _buildItem( + BuildContext context, + int index, + Animation animation, + ) { return CardItem( animation: animation, item: _list[index], @@ -55,7 +60,11 @@ class _AnimatedListSampleState extends State { /// completed (even though it's gone as far as this ListModel is concerned). /// The widget will be used by the [AnimatedListState.removeItem] method's /// [AnimatedRemovedItemBuilder] parameter. - Widget _buildRemovedItem(int item, BuildContext context, Animation animation) { + Widget _buildRemovedItem( + int item, + BuildContext context, + Animation animation, + ) { return CardItem( animation: animation, item: item, @@ -65,7 +74,9 @@ class _AnimatedListSampleState extends State { // Insert the "next item" into the list model. void _insert() { - final int index = _selectedItem == null ? _list.length : _list.indexOf(_selectedItem!); + final int index = _selectedItem == null + ? _list.length + : _list.indexOf(_selectedItem!); _list.insert(index, _nextItem); _nextItem++; } @@ -125,8 +136,11 @@ typedef RemovedItemBuilder = /// mutate the list must make the same changes to the animated list in terms /// of [AnimatedListState.insertItem] and [AnimatedListState.removeItem]. class ListModel { - ListModel({required this.listKey, required this.removedItemBuilder, Iterable? initialItems}) - : _items = List.from(initialItems ?? []); + ListModel({ + required this.listKey, + required this.removedItemBuilder, + Iterable? initialItems, + }) : _items = List.from(initialItems ?? []); final GlobalKey listKey; final RemovedItemBuilder removedItemBuilder; @@ -142,7 +156,10 @@ class ListModel { E removeAt(int index) { final E removedItem = _items.removeAt(index); if (removedItem != null) { - _animatedList!.removeItem(index, (BuildContext context, Animation animation) { + _animatedList!.removeItem(index, ( + BuildContext context, + Animation animation, + ) { return removedItemBuilder(removedItem, context, animation); }); } diff --git a/examples/api/lib/widgets/animated_list/animated_list_separated.0.dart b/examples/api/lib/widgets/animated_list/animated_list_separated.0.dart index 240b25b80c6..b807c06712d 100644 --- a/examples/api/lib/widgets/animated_list/animated_list_separated.0.dart +++ b/examples/api/lib/widgets/animated_list/animated_list_separated.0.dart @@ -14,14 +14,17 @@ class AnimatedListSeparatedSample extends StatefulWidget { const AnimatedListSeparatedSample({super.key}); @override - State createState() => _AnimatedListSeparatedSampleState(); + State createState() => + _AnimatedListSeparatedSampleState(); } -class _AnimatedListSeparatedSampleState extends State { +class _AnimatedListSeparatedSampleState + extends State { final GlobalKey _listKey = GlobalKey(); late ListModel _list; int? _selectedItem; - late int _nextItem; // The next item inserted when the user presses the '+' button. + late int + _nextItem; // The next item inserted when the user presses the '+' button. @override void initState() { @@ -35,7 +38,11 @@ class _AnimatedListSeparatedSampleState extends State animation) { + Widget _buildItem( + BuildContext context, + int index, + Animation animation, + ) { return CardItem( animation: animation, item: _list[index], @@ -49,7 +56,11 @@ class _AnimatedListSeparatedSampleState extends State animation) { + Widget _buildSeparator( + BuildContext context, + int index, + Animation animation, + ) { return ItemSeparator(animation: animation, item: _list[index]); } @@ -60,7 +71,11 @@ class _AnimatedListSeparatedSampleState extends State animation) { + Widget _buildRemovedItem( + int item, + BuildContext context, + Animation animation, + ) { return CardItem( animation: animation, item: item, @@ -78,7 +93,11 @@ class _AnimatedListSeparatedSampleState extends State animation) { + Widget _buildRemovedSeparator( + BuildContext context, + int index, + Animation animation, + ) { return SizeTransition( sizeFactor: animation, child: ItemSeparator(animation: animation, item: null), @@ -87,7 +106,9 @@ class _AnimatedListSeparatedSampleState extends State = /// mutate the list must make the same changes to the animated list in terms /// of [AnimatedListState.insertItem] and [AnimatedListState.removeItem]. class ListModel { - ListModel({required this.listKey, required this.removedItemBuilder, Iterable? initialItems}) - : _items = List.from(initialItems ?? []); + ListModel({ + required this.listKey, + required this.removedItemBuilder, + Iterable? initialItems, + }) : _items = List.from(initialItems ?? []); final GlobalKey listKey; final RemovedItemBuilder removedItemBuilder; @@ -166,7 +190,10 @@ class ListModel { E removeAt(int index) { final E removedItem = _items.removeAt(index); if (removedItem != null) { - _animatedList!.removeItem(index, (BuildContext context, Animation animation) { + _animatedList!.removeItem(index, ( + BuildContext context, + Animation animation, + ) { return removedItemBuilder(removedItem, context, animation); }); } @@ -250,7 +277,9 @@ class ItemSeparator extends StatelessWidget { child: SizedBox( height: 40.0, child: Card( - color: item == null ? Colors.grey : Colors.primaries[item! % Colors.primaries.length], + color: item == null + ? Colors.grey + : Colors.primaries[item! % Colors.primaries.length], child: Center( child: Text( item == null ? 'Removing separator' : 'Separator $item', diff --git a/examples/api/lib/widgets/animated_list/sliver_animated_list.0.dart b/examples/api/lib/widgets/animated_list/sliver_animated_list.0.dart index 80a44d9bc53..06edc027f90 100644 --- a/examples/api/lib/widgets/animated_list/sliver_animated_list.0.dart +++ b/examples/api/lib/widgets/animated_list/sliver_animated_list.0.dart @@ -12,17 +12,20 @@ class SliverAnimatedListSample extends StatefulWidget { const SliverAnimatedListSample({super.key}); @override - State createState() => _SliverAnimatedListSampleState(); + State createState() => + _SliverAnimatedListSampleState(); } class _SliverAnimatedListSampleState extends State { - final GlobalKey _listKey = GlobalKey(); + final GlobalKey _listKey = + GlobalKey(); final GlobalKey _scaffoldKey = GlobalKey(); final GlobalKey _scaffoldMessengerKey = GlobalKey(); late ListModel _list; int? _selectedItem; - late int _nextItem; // The next item inserted when the user presses the '+' button. + late int + _nextItem; // The next item inserted when the user presses the '+' button. @override void initState() { @@ -36,7 +39,11 @@ class _SliverAnimatedListSampleState extends State { } // Used to build list items that haven't been removed. - Widget _buildItem(BuildContext context, int index, Animation animation) { + Widget _buildItem( + BuildContext context, + int index, + Animation animation, + ) { return CardItem( animation: animation, item: _list[index], @@ -56,13 +63,19 @@ class _SliverAnimatedListSampleState extends State { /// completed (even though it's gone as far this ListModel is concerned). The /// widget will be used by the [AnimatedListState.removeItem] method's /// [AnimatedRemovedItemBuilder] parameter. - Widget _buildRemovedItem(int item, BuildContext context, Animation animation) { + Widget _buildRemovedItem( + int item, + BuildContext context, + Animation animation, + ) { return CardItem(animation: animation, item: item); } // Insert the "next item" into the list model. void _insert() { - final int index = _selectedItem == null ? _list.length : _list.indexOf(_selectedItem!); + final int index = _selectedItem == null + ? _list.length + : _list.indexOf(_selectedItem!); _list.insert(index, _nextItem++); } @@ -76,7 +89,10 @@ class _SliverAnimatedListSampleState extends State { } else { _scaffoldMessengerKey.currentState!.showSnackBar( const SnackBar( - content: Text('Select an item to remove from the list.', style: TextStyle(fontSize: 20)), + content: Text( + 'Select an item to remove from the list.', + style: TextStyle(fontSize: 20), + ), ), ); } @@ -91,7 +107,10 @@ class _SliverAnimatedListSampleState extends State { body: CustomScrollView( slivers: [ SliverAppBar( - title: const Text('SliverAnimatedList', style: TextStyle(fontSize: 30)), + title: const Text( + 'SliverAnimatedList', + style: TextStyle(fontSize: 30), + ), expandedHeight: 60, centerTitle: true, backgroundColor: Colors.amber[900], @@ -135,8 +154,11 @@ typedef RemovedItemBuilder = // mutate the list must make the same changes to the animated list in terms // of [AnimatedListState.insertItem] and [AnimatedList.removeItem]. class ListModel { - ListModel({required this.listKey, required this.removedItemBuilder, Iterable? initialItems}) - : _items = List.from(initialItems ?? []); + ListModel({ + required this.listKey, + required this.removedItemBuilder, + Iterable? initialItems, + }) : _items = List.from(initialItems ?? []); final GlobalKey listKey; final RemovedItemBuilder removedItemBuilder; @@ -199,9 +221,14 @@ class CardItem extends StatelessWidget { child: SizedBox( height: 80.0, child: Card( - color: selected ? Colors.black12 : Colors.primaries[item % Colors.primaries.length], + color: selected + ? Colors.black12 + : Colors.primaries[item % Colors.primaries.length], child: Center( - child: Text('Item $item', style: Theme.of(context).textTheme.headlineMedium), + child: Text( + 'Item $item', + style: Theme.of(context).textTheme.headlineMedium, + ), ), ), ), diff --git a/examples/api/lib/widgets/animated_size/animated_size.0.dart b/examples/api/lib/widgets/animated_size/animated_size.0.dart index e5bc9b4d36b..25d607eddf9 100644 --- a/examples/api/lib/widgets/animated_size/animated_size.0.dart +++ b/examples/api/lib/widgets/animated_size/animated_size.0.dart @@ -28,7 +28,11 @@ class AnimatedSizeExampleApp extends StatelessWidget { } class AnimatedSizeExample extends StatefulWidget { - const AnimatedSizeExample({required this.duration, required this.curve, super.key}); + const AnimatedSizeExample({ + required this.duration, + required this.curve, + super.key, + }); final Duration duration; diff --git a/examples/api/lib/widgets/animated_switcher/animated_switcher.0.dart b/examples/api/lib/widgets/animated_switcher/animated_switcher.0.dart index ccf6ae82b86..68d2092f053 100644 --- a/examples/api/lib/widgets/animated_switcher/animated_switcher.0.dart +++ b/examples/api/lib/widgets/animated_switcher/animated_switcher.0.dart @@ -21,7 +21,8 @@ class AnimatedSwitcherExample extends StatefulWidget { const AnimatedSwitcherExample({super.key}); @override - State createState() => _AnimatedSwitcherExampleState(); + State createState() => + _AnimatedSwitcherExampleState(); } class _AnimatedSwitcherExampleState extends State { diff --git a/examples/api/lib/widgets/app/widgets_app.widgets_app.0.dart b/examples/api/lib/widgets/app/widgets_app.widgets_app.0.dart index 6fac19c175b..2c169caf5f3 100644 --- a/examples/api/lib/widgets/app/widgets_app.widgets_app.0.dart +++ b/examples/api/lib/widgets/app/widgets_app.widgets_app.0.dart @@ -17,15 +17,16 @@ class WidgetsAppExampleApp extends StatelessWidget { title: 'Example', color: const Color(0xFF000000), home: const Center(child: Text('Hello World')), - pageRouteBuilder: (RouteSettings settings, WidgetBuilder builder) => PageRouteBuilder( - settings: settings, - pageBuilder: - ( - BuildContext context, - Animation animation, - Animation secondaryAnimation, - ) => builder(context), - ), + pageRouteBuilder: (RouteSettings settings, WidgetBuilder builder) => + PageRouteBuilder( + settings: settings, + pageBuilder: + ( + BuildContext context, + Animation animation, + Animation secondaryAnimation, + ) => builder(context), + ), ); } } diff --git a/examples/api/lib/widgets/app_lifecycle_listener/app_lifecycle_listener.1.dart b/examples/api/lib/widgets/app_lifecycle_listener/app_lifecycle_listener.1.dart index 43f6be32475..f9fdf9710d6 100644 --- a/examples/api/lib/widgets/app_lifecycle_listener/app_lifecycle_listener.1.dart +++ b/examples/api/lib/widgets/app_lifecycle_listener/app_lifecycle_listener.1.dart @@ -47,12 +47,16 @@ class _ApplicationExitControlState extends State { } Future _quit() async { - final AppExitType exitType = _shouldExit ? AppExitType.required : AppExitType.cancelable; + final AppExitType exitType = _shouldExit + ? AppExitType.required + : AppExitType.cancelable; await ServicesBinding.instance.exitApplication(exitType); } Future _handleExitRequest() async { - final AppExitResponse response = _shouldExit ? AppExitResponse.exit : AppExitResponse.cancel; + final AppExitResponse response = _shouldExit + ? AppExitResponse.exit + : AppExitResponse.cancel; setState(() { _lastExitResponse = 'App responded ${response.name} to exit request'; }); @@ -80,7 +84,10 @@ class _ApplicationExitControlState extends State { child: Column( mainAxisSize: MainAxisSize.min, children: [ - const RadioListTile(title: Text('Do Not Allow Exit'), value: false), + const RadioListTile( + title: Text('Do Not Allow Exit'), + value: false, + ), const RadioListTile(title: Text('Allow Exit'), value: true), const SizedBox(height: 30), ElevatedButton(onPressed: _quit, child: const Text('Quit')), diff --git a/examples/api/lib/widgets/async/future_builder.0.dart b/examples/api/lib/widgets/async/future_builder.0.dart index 90293468385..039dcd11831 100644 --- a/examples/api/lib/widgets/async/future_builder.0.dart +++ b/examples/api/lib/widgets/async/future_builder.0.dart @@ -41,7 +41,11 @@ class _FutureBuilderExampleState extends State { List children; if (snapshot.hasData) { children = [ - const Icon(Icons.check_circle_outline, color: Colors.green, size: 60), + const Icon( + Icons.check_circle_outline, + color: Colors.green, + size: 60, + ), Padding( padding: const EdgeInsets.only(top: 16), child: Text('Result: ${snapshot.data}'), @@ -57,12 +61,22 @@ class _FutureBuilderExampleState extends State { ]; } else { children = const [ - SizedBox(width: 60, height: 60, child: CircularProgressIndicator()), - Padding(padding: EdgeInsets.only(top: 16), child: Text('Awaiting result...')), + SizedBox( + width: 60, + height: 60, + child: CircularProgressIndicator(), + ), + Padding( + padding: EdgeInsets.only(top: 16), + child: Text('Awaiting result...'), + ), ]; } return Center( - child: Column(mainAxisAlignment: MainAxisAlignment.center, children: children), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: children, + ), ); }, ), diff --git a/examples/api/lib/widgets/async/stream_builder.0.dart b/examples/api/lib/widgets/async/stream_builder.0.dart index 8c5118abde9..e06d0af8641 100644 --- a/examples/api/lib/widgets/async/stream_builder.0.dart +++ b/examples/api/lib/widgets/async/stream_builder.0.dart @@ -103,30 +103,54 @@ class BidsStatus extends StatelessWidget { case ConnectionState.none: children = const [ Icon(Icons.info, color: Colors.blue, size: 60), - Padding(padding: EdgeInsets.only(top: 16), child: Text('Select a lot')), + Padding( + padding: EdgeInsets.only(top: 16), + child: Text('Select a lot'), + ), ]; case ConnectionState.waiting: children = const [ - SizedBox(width: 60, height: 60, child: CircularProgressIndicator()), - Padding(padding: EdgeInsets.only(top: 16), child: Text('Awaiting bids...')), + SizedBox( + width: 60, + height: 60, + child: CircularProgressIndicator(), + ), + Padding( + padding: EdgeInsets.only(top: 16), + child: Text('Awaiting bids...'), + ), ]; case ConnectionState.active: children = [ - const Icon(Icons.check_circle_outline, color: Colors.green, size: 60), - Padding(padding: const EdgeInsets.only(top: 16), child: Text('\$${snapshot.data}')), + const Icon( + Icons.check_circle_outline, + color: Colors.green, + size: 60, + ), + Padding( + padding: const EdgeInsets.only(top: 16), + child: Text('\$${snapshot.data}'), + ), ]; case ConnectionState.done: children = [ const Icon(Icons.info, color: Colors.blue, size: 60), Padding( padding: const EdgeInsets.only(top: 16), - child: Text(snapshot.hasData ? '\$${snapshot.data} (closed)' : '(closed)'), + child: Text( + snapshot.hasData + ? '\$${snapshot.data} (closed)' + : '(closed)', + ), ), ]; } } - return Column(mainAxisAlignment: MainAxisAlignment.center, children: children); + return Column( + mainAxisAlignment: MainAxisAlignment.center, + children: children, + ); }, ); } diff --git a/examples/api/lib/widgets/autocomplete/raw_autocomplete.0.dart b/examples/api/lib/widgets/autocomplete/raw_autocomplete.0.dart index c78b3d6f07b..d93561a3cd8 100644 --- a/examples/api/lib/widgets/autocomplete/raw_autocomplete.0.dart +++ b/examples/api/lib/widgets/autocomplete/raw_autocomplete.0.dart @@ -25,7 +25,11 @@ class AutocompleteExampleApp extends StatelessWidget { class AutocompleteBasicExample extends StatelessWidget { const AutocompleteBasicExample({super.key}); - static const List _options = ['aardvark', 'bobcat', 'chameleon']; + static const List _options = [ + 'aardvark', + 'bobcat', + 'chameleon', + ]; @override Widget build(BuildContext context) { diff --git a/examples/api/lib/widgets/autocomplete/raw_autocomplete.1.dart b/examples/api/lib/widgets/autocomplete/raw_autocomplete.1.dart index 17f946f6de0..378e4f04489 100644 --- a/examples/api/lib/widgets/autocomplete/raw_autocomplete.1.dart +++ b/examples/api/lib/widgets/autocomplete/raw_autocomplete.1.dart @@ -65,7 +65,9 @@ class AutocompleteCustomTypeExample extends StatelessWidget { return _userOptions.where((User option) { // Search based on User.toString, which includes both name and // email, even though the display string is just the name. - return option.toString().contains(textEditingValue.text.toLowerCase()); + return option.toString().contains( + textEditingValue.text.toLowerCase(), + ); }); }, displayStringForOption: _displayStringForOption, @@ -85,7 +87,11 @@ class AutocompleteCustomTypeExample extends StatelessWidget { ); }, optionsViewBuilder: - (BuildContext context, AutocompleteOnSelected onSelected, Iterable options) { + ( + BuildContext context, + AutocompleteOnSelected onSelected, + Iterable options, + ) { return Align( alignment: Alignment.topLeft, child: Material( @@ -101,7 +107,9 @@ class AutocompleteCustomTypeExample extends StatelessWidget { onTap: () { onSelected(option); }, - child: ListTile(title: Text(_displayStringForOption(option))), + child: ListTile( + title: Text(_displayStringForOption(option)), + ), ); }, ), diff --git a/examples/api/lib/widgets/autocomplete/raw_autocomplete.2.dart b/examples/api/lib/widgets/autocomplete/raw_autocomplete.2.dart index 843c2056f77..6bb24725bde 100644 --- a/examples/api/lib/widgets/autocomplete/raw_autocomplete.2.dart +++ b/examples/api/lib/widgets/autocomplete/raw_autocomplete.2.dart @@ -35,7 +35,11 @@ class AutocompleteFormExampleState extends State { String? _dropdownValue; String? _autocompleteSelection; - static const List _options = ['aardvark', 'bobcat', 'chameleon']; + static const List _options = [ + 'aardvark', + 'bobcat', + 'chameleon', + ]; @override Widget build(BuildContext context) { @@ -54,11 +58,14 @@ class AutocompleteFormExampleState extends State { _dropdownValue = newValue; }); }, - items: ['One', 'Two', 'Free', 'Four'].map>(( - String value, - ) { - return DropdownMenuItem(value: value, child: Text(value)); - }).toList(), + items: ['One', 'Two', 'Free', 'Four'] + .map>((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }) + .toList(), validator: (String? value) { if (value == null) { return 'Must make a selection.'; @@ -68,7 +75,9 @@ class AutocompleteFormExampleState extends State { ), TextFormField( controller: _textEditingController, - decoration: const InputDecoration(hintText: 'This is a regular TextFormField'), + decoration: const InputDecoration( + hintText: 'This is a regular TextFormField', + ), validator: (String? value) { if (value == null || value.isEmpty) { return "Can't be empty."; @@ -96,7 +105,9 @@ class AutocompleteFormExampleState extends State { ) { return TextFormField( controller: textEditingController, - decoration: const InputDecoration(hintText: 'This is a RawAutocomplete!'), + decoration: const InputDecoration( + hintText: 'This is a RawAutocomplete!', + ), focusNode: focusNode, onFieldSubmitted: (String value) { onFieldSubmitted(); @@ -154,7 +165,9 @@ class AutocompleteFormExampleState extends State { child: ListBody( children: [ Text('DropdownButtonFormField: "$_dropdownValue"'), - Text('TextFormField: "${_textEditingController.text}"'), + Text( + 'TextFormField: "${_textEditingController.text}"', + ), Text('RawAutocomplete: "$_autocompleteSelection"'), ], ), diff --git a/examples/api/lib/widgets/autocomplete/raw_autocomplete.focus_node.0.dart b/examples/api/lib/widgets/autocomplete/raw_autocomplete.focus_node.0.dart index 4ec18332848..a3fdb636cb1 100644 --- a/examples/api/lib/widgets/autocomplete/raw_autocomplete.focus_node.0.dart +++ b/examples/api/lib/widgets/autocomplete/raw_autocomplete.focus_node.0.dart @@ -39,7 +39,9 @@ class RawAutocompleteSplitState extends State { title: TextFormField( controller: _textEditingController, focusNode: _focusNode, - decoration: const InputDecoration(hintText: 'Split RawAutocomplete App'), + decoration: const InputDecoration( + hintText: 'Split RawAutocomplete App', + ), onFieldSubmitted: (String value) { RawAutocomplete.onFieldSubmitted(_autocompleteKey); }, diff --git a/examples/api/lib/widgets/autofill/autofill_group.0.dart b/examples/api/lib/widgets/autofill/autofill_group.0.dart index fc6fcec7241..3b0c397c3b0 100644 --- a/examples/api/lib/widgets/autofill/autofill_group.0.dart +++ b/examples/api/lib/widgets/autofill/autofill_group.0.dart @@ -80,11 +80,15 @@ class _AutofillGroupExampleState extends State { children: [ TextField( controller: billingAddress1, - autofillHints: const [AutofillHints.streetAddressLine1], + autofillHints: const [ + AutofillHints.streetAddressLine1, + ], ), TextField( controller: billingAddress2, - autofillHints: const [AutofillHints.streetAddressLine2], + autofillHints: const [ + AutofillHints.streetAddressLine2, + ], ), ], ), @@ -101,7 +105,9 @@ class _AutofillGroupExampleState extends State { ), TextField( controller: creditCardSecurityCode, - autofillHints: const [AutofillHints.creditCardSecurityCode], + autofillHints: const [ + AutofillHints.creditCardSecurityCode, + ], ), ], ), diff --git a/examples/api/lib/widgets/basic/absorb_pointer.0.dart b/examples/api/lib/widgets/basic/absorb_pointer.0.dart index a9d855cc4e3..e2f19b94df2 100644 --- a/examples/api/lib/widgets/basic/absorb_pointer.0.dart +++ b/examples/api/lib/widgets/basic/absorb_pointer.0.dart @@ -30,13 +30,19 @@ class AbsorbPointerExample extends StatelessWidget { return Stack( alignment: AlignmentDirectional.center, children: [ - SizedBox(width: 200.0, height: 100.0, child: ElevatedButton(onPressed: () {}, child: null)), + SizedBox( + width: 200.0, + height: 100.0, + child: ElevatedButton(onPressed: () {}, child: null), + ), SizedBox( width: 100.0, height: 200.0, child: AbsorbPointer( child: ElevatedButton( - style: ElevatedButton.styleFrom(backgroundColor: Colors.blue.shade200), + style: ElevatedButton.styleFrom( + backgroundColor: Colors.blue.shade200, + ), onPressed: () {}, child: null, ), diff --git a/examples/api/lib/widgets/basic/clip_rrect.1.dart b/examples/api/lib/widgets/basic/clip_rrect.1.dart index 16761780a89..686115a8d87 100644 --- a/examples/api/lib/widgets/basic/clip_rrect.1.dart +++ b/examples/api/lib/widgets/basic/clip_rrect.1.dart @@ -32,7 +32,10 @@ class ClipRRectExample extends StatelessWidget { constraints: const BoxConstraints.expand(), // Add a FittedBox to make ClipRRect sized accordingly to the image it contains child: FittedBox( - child: ClipRRect(borderRadius: BorderRadius.circular(40.0), child: const _FakedImage()), + child: ClipRRect( + borderRadius: BorderRadius.circular(40.0), + child: const _FakedImage(), + ), ), ); } diff --git a/examples/api/lib/widgets/basic/custom_multi_child_layout.0.dart b/examples/api/lib/widgets/basic/custom_multi_child_layout.0.dart index a3a60bc9491..09b95025a0b 100644 --- a/examples/api/lib/widgets/basic/custom_multi_child_layout.0.dart +++ b/examples/api/lib/widgets/basic/custom_multi_child_layout.0.dart @@ -62,10 +62,16 @@ class _CascadeLayoutDelegate extends MultiChildLayoutDelegate { switch (textDirection) { case TextDirection.rtl: positionChild(color, childPosition - Offset(currentSize.width, 0)); - childPosition += Offset(-currentSize.width, currentSize.height - overlap); + childPosition += Offset( + -currentSize.width, + currentSize.height - overlap, + ); case TextDirection.ltr: positionChild(color, childPosition); - childPosition += Offset(currentSize.width, currentSize.height - overlap); + childPosition += Offset( + currentSize.width, + currentSize.height - overlap, + ); } } } @@ -76,7 +82,8 @@ class _CascadeLayoutDelegate extends MultiChildLayoutDelegate { // automatically cause a relayout, like any other widget. @override bool shouldRelayout(_CascadeLayoutDelegate oldDelegate) { - return oldDelegate.textDirection != textDirection || oldDelegate.overlap != overlap; + return oldDelegate.textDirection != textDirection || + oldDelegate.overlap != overlap; } } diff --git a/examples/api/lib/widgets/basic/flow.0.dart b/examples/api/lib/widgets/basic/flow.0.dart index 9457921014d..995827cdda9 100644 --- a/examples/api/lib/widgets/basic/flow.0.dart +++ b/examples/api/lib/widgets/basic/flow.0.dart @@ -29,7 +29,8 @@ class FlowMenu extends StatefulWidget { State createState() => _FlowMenuState(); } -class _FlowMenuState extends State with SingleTickerProviderStateMixin { +class _FlowMenuState extends State + with SingleTickerProviderStateMixin { late AnimationController menuAnimation; IconData lastTapped = Icons.notifications; final List menuItems = [ @@ -49,11 +50,15 @@ class _FlowMenuState extends State with SingleTickerProviderStateMixin @override void initState() { super.initState(); - menuAnimation = AnimationController(duration: const Duration(milliseconds: 250), vsync: this); + menuAnimation = AnimationController( + duration: const Duration(milliseconds: 250), + vsync: this, + ); } Widget flowMenuItem(IconData icon) { - final double buttonDiameter = MediaQuery.of(context).size.width / menuItems.length; + final double buttonDiameter = + MediaQuery.of(context).size.width / menuItems.length; return Padding( padding: const EdgeInsets.symmetric(vertical: 8.0), child: RawMaterialButton( @@ -76,13 +81,16 @@ class _FlowMenuState extends State with SingleTickerProviderStateMixin Widget build(BuildContext context) { return Flow( delegate: FlowMenuDelegate(menuAnimation: menuAnimation), - children: menuItems.map((IconData icon) => flowMenuItem(icon)).toList(), + children: menuItems + .map((IconData icon) => flowMenuItem(icon)) + .toList(), ); } } class FlowMenuDelegate extends FlowDelegate { - FlowMenuDelegate({required this.menuAnimation}) : super(repaint: menuAnimation); + FlowMenuDelegate({required this.menuAnimation}) + : super(repaint: menuAnimation); final Animation menuAnimation; @@ -96,7 +104,10 @@ class FlowMenuDelegate extends FlowDelegate { double dx = 0.0; for (int i = 0; i < context.childCount; ++i) { dx = context.getChildSize(i)!.width * i; - context.paintChild(i, transform: Matrix4.translationValues(dx * menuAnimation.value, 0, 0)); + context.paintChild( + i, + transform: Matrix4.translationValues(dx * menuAnimation.value, 0, 0), + ); } } } diff --git a/examples/api/lib/widgets/basic/fractionally_sized_box.0.dart b/examples/api/lib/widgets/basic/fractionally_sized_box.0.dart index b39c6df7fcf..64ed6de82af 100644 --- a/examples/api/lib/widgets/basic/fractionally_sized_box.0.dart +++ b/examples/api/lib/widgets/basic/fractionally_sized_box.0.dart @@ -33,7 +33,9 @@ class FractionallySizedBoxExample extends StatelessWidget { heightFactor: 0.5, alignment: FractionalOffset.center, child: DecoratedBox( - decoration: BoxDecoration(border: Border.all(color: Colors.blue, width: 4)), + decoration: BoxDecoration( + border: Border.all(color: Colors.blue, width: 4), + ), ), ), ); diff --git a/examples/api/lib/widgets/basic/ignore_pointer.0.dart b/examples/api/lib/widgets/basic/ignore_pointer.0.dart index c557c8074a0..5c9b2c3db68 100644 --- a/examples/api/lib/widgets/basic/ignore_pointer.0.dart +++ b/examples/api/lib/widgets/basic/ignore_pointer.0.dart @@ -15,7 +15,10 @@ class IgnorePointerApp extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( home: Scaffold( - appBar: AppBar(centerTitle: true, title: const Text('IgnorePointer Sample')), + appBar: AppBar( + centerTitle: true, + title: const Text('IgnorePointer Sample'), + ), body: const Center(child: IgnorePointerExample()), ), ); @@ -46,7 +49,9 @@ class _IgnorePointerExampleState extends State { IgnorePointer( ignoring: ignoring, child: ElevatedButton( - style: ElevatedButton.styleFrom(padding: const EdgeInsets.all(24.0)), + style: ElevatedButton.styleFrom( + padding: const EdgeInsets.all(24.0), + ), onPressed: () {}, child: const Text('Click me!'), ), @@ -55,7 +60,9 @@ class _IgnorePointerExampleState extends State { onPressed: () { setIgnoring(!ignoring); }, - child: Text(ignoring ? 'Set ignoring to false' : 'Set ignoring to true'), + child: Text( + ignoring ? 'Set ignoring to false' : 'Set ignoring to true', + ), ), ], ); diff --git a/examples/api/lib/widgets/basic/indexed_stack.0.dart b/examples/api/lib/widgets/basic/indexed_stack.0.dart index 43b6245e4ee..7c924be40a4 100644 --- a/examples/api/lib/widgets/basic/indexed_stack.0.dart +++ b/examples/api/lib/widgets/basic/indexed_stack.0.dart @@ -72,7 +72,9 @@ class _IndexedStackExampleState extends State { children: [ IndexedStack( index: index, - children: [for (final String name in names) PersonTracker(name: name)], + children: [ + for (final String name in names) PersonTracker(name: name), + ], ), ], ), diff --git a/examples/api/lib/widgets/basic/listener.0.dart b/examples/api/lib/widgets/basic/listener.0.dart index f4fd29cc2de..da0c74b85a9 100644 --- a/examples/api/lib/widgets/basic/listener.0.dart +++ b/examples/api/lib/widgets/basic/listener.0.dart @@ -69,12 +69,16 @@ class _ListenerExampleState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - const Text('You have pressed or released in this area this many times:'), + const Text( + 'You have pressed or released in this area this many times:', + ), Text( '$_downCounter presses\n$_upCounter releases', style: Theme.of(context).textTheme.headlineMedium, ), - Text('The cursor is here: (${x.toStringAsFixed(2)}, ${y.toStringAsFixed(2)})'), + Text( + 'The cursor is here: (${x.toStringAsFixed(2)}, ${y.toStringAsFixed(2)})', + ), ], ), ), diff --git a/examples/api/lib/widgets/basic/mouse_region.0.dart b/examples/api/lib/widgets/basic/mouse_region.0.dart index 95bae4dda0a..c4a32c3b786 100644 --- a/examples/api/lib/widgets/basic/mouse_region.0.dart +++ b/examples/api/lib/widgets/basic/mouse_region.0.dart @@ -67,12 +67,16 @@ class _MouseRegionExampleState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - const Text('You have entered or exited this box this many times:'), + const Text( + 'You have entered or exited this box this many times:', + ), Text( '$_enterCounter Entries\n$_exitCounter Exits', style: Theme.of(context).textTheme.headlineMedium, ), - Text('The cursor is here: (${x.toStringAsFixed(2)}, ${y.toStringAsFixed(2)})'), + Text( + 'The cursor is here: (${x.toStringAsFixed(2)}, ${y.toStringAsFixed(2)})', + ), ], ), ), diff --git a/examples/api/lib/widgets/basic/mouse_region.on_exit.1.dart b/examples/api/lib/widgets/basic/mouse_region.on_exit.1.dart index 02308db36ba..5e2ccf1b92d 100644 --- a/examples/api/lib/widgets/basic/mouse_region.on_exit.1.dart +++ b/examples/api/lib/widgets/basic/mouse_region.on_exit.1.dart @@ -24,7 +24,11 @@ class MouseRegionApp extends StatelessWidget { // A region that hides its content one second after being hovered. class MyTimedButton extends StatefulWidget { - const MyTimedButton({super.key, required this.onEnterButton, required this.onExitButton}); + const MyTimedButton({ + super.key, + required this.onEnterButton, + required this.onExitButton, + }); final VoidCallback onEnterButton; final VoidCallback onExitButton; diff --git a/examples/api/lib/widgets/basic/offstage.0.dart b/examples/api/lib/widgets/basic/offstage.0.dart index 40ba62c803d..32fda7c9081 100644 --- a/examples/api/lib/widgets/basic/offstage.0.dart +++ b/examples/api/lib/widgets/basic/offstage.0.dart @@ -34,7 +34,8 @@ class _OffstageExampleState extends State { bool _offstage = true; Size _getFlutterLogoSize() { - final RenderBox renderLogo = _key.currentContext!.findRenderObject()! as RenderBox; + final RenderBox renderLogo = + _key.currentContext!.findRenderObject()! as RenderBox; return renderLogo.size; } @@ -61,7 +62,11 @@ class _OffstageExampleState extends State { child: const Text('Get Flutter Logo size'), onPressed: () { ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text('Flutter Logo size is ${_getFlutterLogoSize()}')), + SnackBar( + content: Text( + 'Flutter Logo size is ${_getFlutterLogoSize()}', + ), + ), ); }, ), diff --git a/examples/api/lib/widgets/basic/physical_shape.0.dart b/examples/api/lib/widgets/basic/physical_shape.0.dart index ab9c167c309..e762ff0974b 100644 --- a/examples/api/lib/widgets/basic/physical_shape.0.dart +++ b/examples/api/lib/widgets/basic/physical_shape.0.dart @@ -30,14 +30,19 @@ class PhysicalShapeExample extends StatelessWidget { return PhysicalShape( elevation: 5.0, clipper: ShapeBorderClipper( - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10.0)), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), ), color: Colors.orange, child: const SizedBox( height: 200.0, width: 200.0, child: Center( - child: Text('Hello, World!', style: TextStyle(color: Colors.white, fontSize: 20.0)), + child: Text( + 'Hello, World!', + style: TextStyle(color: Colors.white, fontSize: 20.0), + ), ), ), ); diff --git a/examples/api/lib/widgets/binding/widget_binding_observer.0.dart b/examples/api/lib/widgets/binding/widget_binding_observer.0.dart index 64bf556bf54..6982d01f704 100644 --- a/examples/api/lib/widgets/binding/widget_binding_observer.0.dart +++ b/examples/api/lib/widgets/binding/widget_binding_observer.0.dart @@ -26,10 +26,12 @@ class WidgetBindingsObserverSample extends StatefulWidget { const WidgetBindingsObserverSample({super.key}); @override - State createState() => _WidgetBindingsObserverSampleState(); + State createState() => + _WidgetBindingsObserverSampleState(); } -class _WidgetBindingsObserverSampleState extends State +class _WidgetBindingsObserverSampleState + extends State with WidgetsBindingObserver { final List _stateHistoryList = []; @@ -67,6 +69,8 @@ class _WidgetBindingsObserverSampleState extends State { ), ), DragTarget( - builder: (BuildContext context, List accepted, List rejected) { - return Container( - height: 100.0, - width: 100.0, - color: Colors.cyan, - child: Center(child: Text('Value is updated to: $acceptedData')), - ); - }, + builder: + ( + BuildContext context, + List accepted, + List rejected, + ) { + return Container( + height: 100.0, + width: 100.0, + color: Colors.cyan, + child: Center( + child: Text('Value is updated to: $acceptedData'), + ), + ); + }, onAcceptWithDetails: (DragTargetDetails details) { setState(() { acceptedData += details.data; diff --git a/examples/api/lib/widgets/draggable_scrollable_sheet/draggable_scrollable_sheet.0.dart b/examples/api/lib/widgets/draggable_scrollable_sheet/draggable_scrollable_sheet.0.dart index 2fe099ff34f..1bdd9dbf5bf 100644 --- a/examples/api/lib/widgets/draggable_scrollable_sheet/draggable_scrollable_sheet.0.dart +++ b/examples/api/lib/widgets/draggable_scrollable_sheet/draggable_scrollable_sheet.0.dart @@ -15,7 +15,9 @@ class DraggableScrollableSheetExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( - theme: ThemeData(colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue.shade100)), + theme: ThemeData( + colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue.shade100), + ), home: Scaffold( appBar: AppBar(title: const Text('DraggableScrollableSheet Sample')), body: const DraggableScrollableSheetExample(), @@ -28,10 +30,12 @@ class DraggableScrollableSheetExample extends StatefulWidget { const DraggableScrollableSheetExample({super.key}); @override - State createState() => _DraggableScrollableSheetExampleState(); + State createState() => + _DraggableScrollableSheetExampleState(); } -class _DraggableScrollableSheetExampleState extends State { +class _DraggableScrollableSheetExampleState + extends State { double _sheetPosition = 0.5; final double _dragSensitivity = 600; @@ -66,7 +70,10 @@ class _DraggableScrollableSheetExampleState extends State kIsWeb || switch (defaultTargetPlatform) { - TargetPlatform.macOS || TargetPlatform.linux || TargetPlatform.windows => true, - TargetPlatform.android || TargetPlatform.iOS || TargetPlatform.fuchsia => false, + TargetPlatform.macOS || + TargetPlatform.linux || + TargetPlatform.windows => true, + TargetPlatform.android || + TargetPlatform.iOS || + TargetPlatform.fuchsia => false, }; } /// A draggable widget that accepts vertical drag gestures /// and this is only visible on desktop and web platforms. class Grabber extends StatelessWidget { - const Grabber({super.key, required this.onVerticalDragUpdate, required this.isOnDesktopAndWeb}); + const Grabber({ + super.key, + required this.onVerticalDragUpdate, + required this.isOnDesktopAndWeb, + }); final ValueChanged onVerticalDragUpdate; final bool isOnDesktopAndWeb; diff --git a/examples/api/lib/widgets/editable_text/editable_text.on_content_inserted.0.dart b/examples/api/lib/widgets/editable_text/editable_text.on_content_inserted.0.dart index 59211fff706..e0f087302a4 100644 --- a/examples/api/lib/widgets/editable_text/editable_text.on_content_inserted.0.dart +++ b/examples/api/lib/widgets/editable_text/editable_text.on_content_inserted.0.dart @@ -23,10 +23,12 @@ class KeyboardInsertedContentDemo extends StatefulWidget { const KeyboardInsertedContentDemo({super.key}); @override - State createState() => _KeyboardInsertedContentDemoState(); + State createState() => + _KeyboardInsertedContentDemoState(); } -class _KeyboardInsertedContentDemoState extends State { +class _KeyboardInsertedContentDemoState + extends State { final TextEditingController _controller = TextEditingController(); Uint8List? bytes; @@ -43,7 +45,9 @@ class _KeyboardInsertedContentDemoState extends State[ - const Text("Here's a text field that supports inserting only png or gif content:"), + const Text( + "Here's a text field that supports inserting only png or gif content:", + ), TextField( controller: _controller, contentInsertionConfiguration: ContentInsertionConfiguration( @@ -57,7 +61,8 @@ class _KeyboardInsertedContentDemoState extends State createState() => _TextEditingControllerExampleState(); + State createState() => + _TextEditingControllerExampleState(); } -class _TextEditingControllerExampleState extends State { +class _TextEditingControllerExampleState + extends State { final TextEditingController _controller = TextEditingController(); @override @@ -34,7 +36,10 @@ class _TextEditingControllerExampleState extends State createState() => _TextEditingControllerExampleState(); + State createState() => + _TextEditingControllerExampleState(); } -class _TextEditingControllerExampleState extends State { +class _TextEditingControllerExampleState + extends State { // Create a controller whose initial selection is empty (collapsed) and positioned // before the text (offset is 0). final TextEditingController _controller = TextEditingController.fromValue( - const TextEditingValue(text: 'Flutter', selection: TextSelection.collapsed(offset: 0)), + const TextEditingValue( + text: 'Flutter', + selection: TextSelection.collapsed(offset: 0), + ), ); @override diff --git a/examples/api/lib/widgets/focus_manager/focus_node.0.dart b/examples/api/lib/widgets/focus_manager/focus_node.0.dart index 2f270db6acb..7bac6d36bb2 100644 --- a/examples/api/lib/widgets/focus_manager/focus_node.0.dart +++ b/examples/api/lib/widgets/focus_manager/focus_node.0.dart @@ -54,7 +54,9 @@ class _ColorfulButtonState extends State { KeyEventResult _handleKeyPress(FocusNode node, KeyEvent event) { if (event is KeyDownEvent) { - debugPrint('Focus node ${node.debugLabel} got key event: ${event.logicalKey}'); + debugPrint( + 'Focus node ${node.debugLabel} got key event: ${event.logicalKey}', + ); switch (event.logicalKey) { case LogicalKeyboardKey.keyR: debugPrint('Changing color to red.'); @@ -104,7 +106,9 @@ class _ColorfulButtonState extends State { height: 100, color: _focused ? _color : Colors.white, alignment: Alignment.center, - child: Text(_focused ? "I'm in color! Press R,G,B!" : 'Press to focus'), + child: Text( + _focused ? "I'm in color! Press R,G,B!" : 'Press to focus', + ), ), ), ); @@ -117,6 +121,9 @@ class FocusNodeExample extends StatelessWidget { @override Widget build(BuildContext context) { final TextTheme textTheme = Theme.of(context).textTheme; - return DefaultTextStyle(style: textTheme.headlineMedium!, child: const ColorfulButton()); + return DefaultTextStyle( + style: textTheme.headlineMedium!, + child: const ColorfulButton(), + ); } } diff --git a/examples/api/lib/widgets/focus_manager/focus_node.unfocus.0.dart b/examples/api/lib/widgets/focus_manager/focus_node.unfocus.0.dart index 6d28b4f466f..3ca9f57e69b 100644 --- a/examples/api/lib/widgets/focus_manager/focus_node.unfocus.0.dart +++ b/examples/api/lib/widgets/focus_manager/focus_node.unfocus.0.dart @@ -41,7 +41,9 @@ class _UnfocusExampleState extends State { width: 200, child: Padding( padding: EdgeInsets.all(8.0), - child: TextField(decoration: InputDecoration(border: OutlineInputBorder())), + child: TextField( + decoration: InputDecoration(border: OutlineInputBorder()), + ), ), ); }), @@ -49,12 +51,20 @@ class _UnfocusExampleState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - ...List.generate(UnfocusDisposition.values.length, (int index) { + ...List.generate(UnfocusDisposition.values.length, ( + int index, + ) { return Row( mainAxisSize: MainAxisSize.min, children: [ Radio( + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use groupValue: disposition, + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use onChanged: (UnfocusDisposition? value) { setState(() { if (value != null) { diff --git a/examples/api/lib/widgets/focus_scope/focus.0.dart b/examples/api/lib/widgets/focus_scope/focus.0.dart index 0cff241a07d..b3b0e5dae15 100644 --- a/examples/api/lib/widgets/focus_scope/focus.0.dart +++ b/examples/api/lib/widgets/focus_scope/focus.0.dart @@ -35,7 +35,9 @@ class _FocusExampleState extends State { KeyEventResult _handleKeyPress(FocusNode node, KeyEvent event) { if (event is KeyDownEvent) { - debugPrint('Focus node ${node.debugLabel} got key event: ${event.logicalKey}'); + debugPrint( + 'Focus node ${node.debugLabel} got key event: ${event.logicalKey}', + ); switch (event.logicalKey) { case LogicalKeyboardKey.keyR: debugPrint('Changing color to red.'); @@ -89,7 +91,11 @@ class _FocusExampleState extends State { height: 100, alignment: Alignment.center, color: hasFocus ? _color : Colors.white, - child: Text(hasFocus ? "I'm in color! Press R,G,B!" : 'Press to focus'), + child: Text( + hasFocus + ? "I'm in color! Press R,G,B!" + : 'Press to focus', + ), ), ), ); diff --git a/examples/api/lib/widgets/focus_scope/focus.1.dart b/examples/api/lib/widgets/focus_scope/focus.1.dart index 9317333a887..813d65a4235 100644 --- a/examples/api/lib/widgets/focus_scope/focus.1.dart +++ b/examples/api/lib/widgets/focus_scope/focus.1.dart @@ -42,7 +42,9 @@ class FocusableText extends StatelessWidget { return Container( padding: const EdgeInsets.all(8.0), // Change the color based on whether or not this Container has focus. - color: Focus.of(context).hasPrimaryFocus ? Colors.red : Colors.white, + color: Focus.of(context).hasPrimaryFocus + ? Colors.red + : Colors.white, child: Text(data), ); }, diff --git a/examples/api/lib/widgets/focus_scope/focus.2.dart b/examples/api/lib/widgets/focus_scope/focus.2.dart index 34002908863..5e2ef4ee64e 100644 --- a/examples/api/lib/widgets/focus_scope/focus.2.dart +++ b/examples/api/lib/widgets/focus_scope/focus.2.dart @@ -47,7 +47,9 @@ class _FocusExampleState extends State { void _addChild() { // Calling requestFocus here creates a deferred request for focus, since the // node is not yet part of the focus tree. - childFocusNodes.add(FocusNode(debugLabel: 'Child ${children.length}')..requestFocus()); + childFocusNodes.add( + FocusNode(debugLabel: 'Child ${children.length}')..requestFocus(), + ); children.add( Padding( diff --git a/examples/api/lib/widgets/focus_scope/focus_scope.0.dart b/examples/api/lib/widgets/focus_scope/focus_scope.0.dart index 06f93c98bbb..40c0330d460 100644 --- a/examples/api/lib/widgets/focus_scope/focus_scope.0.dart +++ b/examples/api/lib/widgets/focus_scope/focus_scope.0.dart @@ -138,7 +138,9 @@ class _FocusScopeExampleState extends State { // TRY THIS: Try changing this to Colors.green.withValues(alpha: 0.8) to see for // yourself that the hidden components do/don't get focus. backgroundColor: Colors.green, - onPressed: backdropIsVisible ? null : () => setState(() => backdropIsVisible = true), + onPressed: backdropIsVisible + ? null + : () => setState(() => backdropIsVisible = true), child: DefaultTextStyle( style: Theme.of(context).textTheme.displayMedium!, child: const Text('FOREGROUND'), diff --git a/examples/api/lib/widgets/focus_traversal/focus_traversal_group.0.dart b/examples/api/lib/widgets/focus_traversal/focus_traversal_group.0.dart index ca86383f7f0..cfb2754329c 100644 --- a/examples/api/lib/widgets/focus_traversal/focus_traversal_group.0.dart +++ b/examples/api/lib/widgets/focus_traversal/focus_traversal_group.0.dart @@ -43,7 +43,10 @@ class _OrderedButtonState extends State> { @override void initState() { super.initState(); - focusNode = FocusNode(debugLabel: widget.name, canRequestFocus: widget.canRequestFocus); + focusNode = FocusNode( + debugLabel: widget.name, + canRequestFocus: widget.canRequestFocus, + ); } @override @@ -138,8 +141,13 @@ class FocusTraversalGroupExample extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: List.generate(3, (int index) { // Order as "C" "B", "A". - final String order = String.fromCharCode('A'.codeUnitAt(0) + (2 - index)); - return OrderedButton(name: 'String: $order', order: order); + final String order = String.fromCharCode( + 'A'.codeUnitAt(0) + (2 - index), + ); + return OrderedButton( + name: 'String: $order', + order: order, + ); }), ), ), @@ -154,7 +162,10 @@ class FocusTraversalGroupExample extends StatelessWidget { child: Row( mainAxisAlignment: MainAxisAlignment.center, children: List.generate(3, (int index) { - return OrderedButton(name: 'ignored num: ${3 - index}', order: 3 - index); + return OrderedButton( + name: 'ignored num: ${3 - index}', + order: 3 - index, + ); }), ), ), diff --git a/examples/api/lib/widgets/focus_traversal/ordered_traversal_policy.0.dart b/examples/api/lib/widgets/focus_traversal/ordered_traversal_policy.0.dart index f400c7e865f..2961da44441 100644 --- a/examples/api/lib/widgets/focus_traversal/ordered_traversal_policy.0.dart +++ b/examples/api/lib/widgets/focus_traversal/ordered_traversal_policy.0.dart @@ -23,7 +23,12 @@ class OrderedTraversalPolicyExampleApp extends StatelessWidget { } class DemoButton extends StatelessWidget { - const DemoButton({super.key, required this.name, this.autofocus = false, required this.order}); + const DemoButton({ + super.key, + required this.name, + this.autofocus = false, + required this.order, + }); final String name; final bool autofocus; diff --git a/examples/api/lib/widgets/form/form.1.dart b/examples/api/lib/widgets/form/form.1.dart index 4c60ebfca7f..c9e7ccb6cc3 100644 --- a/examples/api/lib/widgets/form/form.1.dart +++ b/examples/api/lib/widgets/form/form.1.dart @@ -101,7 +101,9 @@ class _SaveableFormState extends State<_SaveableForm> { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - const Text('If the field below is unsaved, a confirmation dialog will be shown on back.'), + const Text( + 'If the field below is unsaved, a confirmation dialog will be shown on back.', + ), const SizedBox(height: 20.0), Form( canPop: !_isDirty, @@ -135,7 +137,8 @@ class _SaveableFormState extends State<_SaveableForm> { child: Row( children: [ const Text('Save'), - if (_controller.text.isNotEmpty) Icon(_isDirty ? Icons.warning : Icons.check), + if (_controller.text.isNotEmpty) + Icon(_isDirty ? Icons.warning : Icons.check), ], ), ), @@ -144,7 +147,8 @@ class _SaveableFormState extends State<_SaveableForm> { ), TextButton( onPressed: () async { - final bool shouldPop = !_isDirty || (await _showDialog() ?? false); + final bool shouldPop = + !_isDirty || (await _showDialog() ?? false); if (!shouldPop) { return; } diff --git a/examples/api/lib/widgets/framework/build_owner.0.dart b/examples/api/lib/widgets/framework/build_owner.0.dart index cf93f75be9d..58eaec3563a 100644 --- a/examples/api/lib/widgets/framework/build_owner.0.dart +++ b/examples/api/lib/widgets/framework/build_owner.0.dart @@ -44,11 +44,12 @@ Size measureWidget(Widget widget) { final PipelineOwner pipelineOwner = PipelineOwner(); final MeasurementView rootView = pipelineOwner.rootNode = MeasurementView(); final BuildOwner buildOwner = BuildOwner(focusManager: FocusManager()); - final RenderObjectToWidgetElement element = RenderObjectToWidgetAdapter( - container: rootView, - debugShortDescription: '[root]', - child: widget, - ).attachToRenderTree(buildOwner); + final RenderObjectToWidgetElement element = + RenderObjectToWidgetAdapter( + container: rootView, + debugShortDescription: '[root]', + child: widget, + ).attachToRenderTree(buildOwner); try { rootView.scheduleInitialLayout(); pipelineOwner.flushLayout(); @@ -60,7 +61,8 @@ Size measureWidget(Widget widget) { } } -class MeasurementView extends RenderBox with RenderObjectWithChildMixin { +class MeasurementView extends RenderBox + with RenderObjectWithChildMixin { @override void performLayout() { assert(child != null); diff --git a/examples/api/lib/widgets/gesture_detector/gesture_detector.1.dart b/examples/api/lib/widgets/gesture_detector/gesture_detector.1.dart index d894e7c0bab..1a81ef2035c 100644 --- a/examples/api/lib/widgets/gesture_detector/gesture_detector.1.dart +++ b/examples/api/lib/widgets/gesture_detector/gesture_detector.1.dart @@ -36,7 +36,9 @@ class _GestureDetectorExampleState extends State { child: GestureDetector( onTap: () { setState(() { - _color == Colors.yellow ? _color = Colors.white : _color = Colors.yellow; + _color == Colors.yellow + ? _color = Colors.white + : _color = Colors.yellow; }); }, ), diff --git a/examples/api/lib/widgets/gesture_detector/gesture_detector.2.dart b/examples/api/lib/widgets/gesture_detector/gesture_detector.2.dart index 83c945e55a5..5e78ff87ba1 100644 --- a/examples/api/lib/widgets/gesture_detector/gesture_detector.2.dart +++ b/examples/api/lib/widgets/gesture_detector/gesture_detector.2.dart @@ -32,10 +32,12 @@ class NestedGestureDetectorsExample extends StatefulWidget { const NestedGestureDetectorsExample({super.key}); @override - State createState() => _NestedGestureDetectorsExampleState(); + State createState() => + _NestedGestureDetectorsExampleState(); } -class _NestedGestureDetectorsExampleState extends State { +class _NestedGestureDetectorsExampleState + extends State { bool _isYellowTranslucent = false; _OnTapWinner _winner = _OnTapWinner.none; final Border highlightBorder = Border.all(color: Colors.red, width: 5); @@ -77,7 +79,9 @@ class _NestedGestureDetectorsExampleState extends State { child: GestureDetector( behavior: HitTestBehavior.translucent, onPanStart: (DragStartDetails details) { - _initialPosition = details.localPosition - _currentPosition; + _initialPosition = + details.localPosition - _currentPosition; }, onPanUpdate: (DragUpdateDetails details) { - _currentPosition = details.localPosition - _initialPosition; - final Rect withinBoundary = DragBoundary.forRectOf( - context, - useGlobalPosition: false, - ).nearestPositionWithinBoundary(_currentPosition & _boxSize); + _currentPosition = + details.localPosition - _initialPosition; + final Rect withinBoundary = + DragBoundary.forRectOf( + context, + useGlobalPosition: false, + ).nearestPositionWithinBoundary( + _currentPosition & _boxSize, + ); setState(() { _currentPosition = withinBoundary.topLeft; }); diff --git a/examples/api/lib/widgets/hardware_keyboard/key_event_manager.0.dart b/examples/api/lib/widgets/hardware_keyboard/key_event_manager.0.dart index 32dd5660981..98ecd169a88 100644 --- a/examples/api/lib/widgets/hardware_keyboard/key_event_manager.0.dart +++ b/examples/api/lib/widgets/hardware_keyboard/key_event_manager.0.dart @@ -2,11 +2,12 @@ // 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/services.dart'; - // TODO(gspencergoog): Delete this example when deprecated RawKeyEvent API is // removed. +// ignore_for_file: deprecated_member_use + +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; /// Flutter code sample for [KeyEventManager.keyMessageHandler]. @@ -56,15 +57,22 @@ class FallbackDemoState extends State { 'This area handles key presses that are unhandled by any shortcuts, by ' 'displaying them below. Try text shortcuts such as Ctrl-A!', ), - Text(_capture == null ? '' : '$_capture is not handled by shortcuts.'), - const TextField(decoration: InputDecoration(label: Text('Text field 1'))), + Text( + _capture == null ? '' : '$_capture is not handled by shortcuts.', + ), + const TextField( + decoration: InputDecoration(label: Text('Text field 1')), + ), Shortcuts( shortcuts: { - const SingleActivator(LogicalKeyboardKey.keyQ): VoidCallbackIntent(() {}), + const SingleActivator(LogicalKeyboardKey.keyQ): + VoidCallbackIntent(() {}), }, child: const TextField( decoration: InputDecoration( - label: Text('This field also considers key Q as a shortcut (that does nothing).'), + label: Text( + 'This field also considers key Q as a shortcut (that does nothing).', + ), ), ), ), @@ -112,16 +120,16 @@ class FallbackKeyEventRegistrar { // have been called somewhere. assert(existing != null); // Assign the global handler with a patched handler. - ServicesBinding.instance.keyEventManager.keyMessageHandler = _instance._buildHandler( - existing!, - ); + ServicesBinding.instance.keyEventManager.keyMessageHandler = _instance + ._buildHandler(existing!); _initialized = true; } return _instance; } static bool _initialized = false; - static final FallbackKeyEventRegistrar _instance = FallbackKeyEventRegistrar._(); + static final FallbackKeyEventRegistrar _instance = + FallbackKeyEventRegistrar._(); final List _fallbackNodes = []; diff --git a/examples/api/lib/widgets/heroes/hero.0.dart b/examples/api/lib/widgets/heroes/hero.0.dart index 3b672a452bb..04173fd48b2 100644 --- a/examples/api/lib/widgets/heroes/hero.0.dart +++ b/examples/api/lib/widgets/heroes/hero.0.dart @@ -39,7 +39,9 @@ class HeroExample extends StatelessWidget { child: BoxWidget(size: Size(50.0, 50.0)), ), onTap: () => _gotoDetailsPage(context), - title: const Text('Tap on the icon to view hero animation transition.'), + title: const Text( + 'Tap on the icon to view hero animation transition.', + ), ), ], ), @@ -70,6 +72,10 @@ class BoxWidget extends StatelessWidget { @override Widget build(BuildContext context) { - return Container(width: size.width, height: size.height, color: Colors.blue); + return Container( + width: size.width, + height: size.height, + color: Colors.blue, + ); } } diff --git a/examples/api/lib/widgets/heroes/hero.1.dart b/examples/api/lib/widgets/heroes/hero.1.dart index f2da451fd64..f7667e7f89b 100644 --- a/examples/api/lib/widgets/heroes/hero.1.dart +++ b/examples/api/lib/widgets/heroes/hero.1.dart @@ -90,14 +90,14 @@ class HeroExample extends StatelessWidget { }, child: BoxWidget( size: const Size(400.0, 400.0), - color: Colors.blue[700]!.withOpacity(0.5), + color: Colors.blue[700]!.withValues(alpha: 0.5), ), ), Hero( tag: 'hero-default-tween', child: BoxWidget( size: const Size(400.0, 400.0), - color: Colors.red[700]!.withOpacity(0.5), + color: Colors.red[700]!.withValues(alpha: 0.5), ), ), ], diff --git a/examples/api/lib/widgets/image/image.error_builder.0.dart b/examples/api/lib/widgets/image/image.error_builder.0.dart index 4050eb60cbd..2f7b8a0339a 100644 --- a/examples/api/lib/widgets/image/image.error_builder.0.dart +++ b/examples/api/lib/widgets/image/image.error_builder.0.dart @@ -32,15 +32,16 @@ class ErrorBuilderExample extends StatelessWidget { ), child: Image.network( 'https://example.does.not.exist/image.jpg', - errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { - // Appropriate logging or analytics, e.g. - // myAnalytics.recordError( - // 'An error occurred loading "https://example.does.not.exist/image.jpg"', - // exception, - // stackTrace, - // ); - return const Text('Image failed to load'); - }, + errorBuilder: + (BuildContext context, Object exception, StackTrace? stackTrace) { + // Appropriate logging or analytics, e.g. + // myAnalytics.recordError( + // 'An error occurred loading "https://example.does.not.exist/image.jpg"', + // exception, + // stackTrace, + // ); + return const Text('Image failed to load'); + }, ), ); } diff --git a/examples/api/lib/widgets/image/image.frame_builder.0.dart b/examples/api/lib/widgets/image/image.frame_builder.0.dart index 5673f76c1ba..7aadcc588ee 100644 --- a/examples/api/lib/widgets/image/image.frame_builder.0.dart +++ b/examples/api/lib/widgets/image/image.frame_builder.0.dart @@ -32,7 +32,12 @@ class FrameBuilderExample extends StatelessWidget { child: Image.network( 'https://flutter.github.io/assets-for-api-docs/assets/widgets/puffin.jpg', frameBuilder: - (BuildContext context, Widget child, int? frame, bool wasSynchronouslyLoaded) { + ( + BuildContext context, + Widget child, + int? frame, + bool wasSynchronouslyLoaded, + ) { if (wasSynchronouslyLoaded) { return child; } diff --git a/examples/api/lib/widgets/image/image.loading_builder.0.dart b/examples/api/lib/widgets/image/image.loading_builder.0.dart index ba62a61485f..bdc7f3b83f7 100644 --- a/examples/api/lib/widgets/image/image.loading_builder.0.dart +++ b/examples/api/lib/widgets/image/image.loading_builder.0.dart @@ -30,18 +30,24 @@ class LoadingBuilderExample extends StatelessWidget { ), child: Image.network( 'https://flutter.github.io/assets-for-api-docs/assets/widgets/falcon.jpg', - loadingBuilder: (BuildContext context, Widget child, ImageChunkEvent? loadingProgress) { - if (loadingProgress == null) { - return child; - } - return Center( - child: CircularProgressIndicator( - value: loadingProgress.expectedTotalBytes != null - ? loadingProgress.cumulativeBytesLoaded / loadingProgress.expectedTotalBytes! - : null, - ), - ); - }, + loadingBuilder: + ( + BuildContext context, + Widget child, + ImageChunkEvent? loadingProgress, + ) { + if (loadingProgress == null) { + return child; + } + return Center( + child: CircularProgressIndicator( + value: loadingProgress.expectedTotalBytes != null + ? loadingProgress.cumulativeBytesLoaded / + loadingProgress.expectedTotalBytes! + : null, + ), + ); + }, ), ); } diff --git a/examples/api/lib/widgets/implicit_animations/animated_align.0.dart b/examples/api/lib/widgets/implicit_animations/animated_align.0.dart index bf1f1ce43aa..227bc72bd2a 100644 --- a/examples/api/lib/widgets/implicit_animations/animated_align.0.dart +++ b/examples/api/lib/widgets/implicit_animations/animated_align.0.dart @@ -26,7 +26,11 @@ class AnimatedAlignExampleApp extends StatelessWidget { } class AnimatedAlignExample extends StatefulWidget { - const AnimatedAlignExample({required this.duration, required this.curve, super.key}); + const AnimatedAlignExample({ + required this.duration, + required this.curve, + super.key, + }); final Duration duration; diff --git a/examples/api/lib/widgets/implicit_animations/animated_container.0.dart b/examples/api/lib/widgets/implicit_animations/animated_container.0.dart index a9706e56e24..dfeb12fe911 100644 --- a/examples/api/lib/widgets/implicit_animations/animated_container.0.dart +++ b/examples/api/lib/widgets/implicit_animations/animated_container.0.dart @@ -26,7 +26,8 @@ class AnimatedContainerExample extends StatefulWidget { const AnimatedContainerExample({super.key}); @override - State createState() => _AnimatedContainerExampleState(); + State createState() => + _AnimatedContainerExampleState(); } class _AnimatedContainerExampleState extends State { @@ -45,7 +46,9 @@ class _AnimatedContainerExampleState extends State { width: selected ? 200.0 : 100.0, height: selected ? 100.0 : 200.0, color: selected ? Colors.red : Colors.blue, - alignment: selected ? Alignment.center : AlignmentDirectional.topCenter, + alignment: selected + ? Alignment.center + : AlignmentDirectional.topCenter, duration: const Duration(seconds: 2), curve: Curves.fastOutSlowIn, child: const FlutterLogo(size: 75), diff --git a/examples/api/lib/widgets/implicit_animations/animated_fractionally_sized_box.0.dart b/examples/api/lib/widgets/implicit_animations/animated_fractionally_sized_box.0.dart index f97f4d35fcb..8775bd9f73b 100644 --- a/examples/api/lib/widgets/implicit_animations/animated_fractionally_sized_box.0.dart +++ b/examples/api/lib/widgets/implicit_animations/animated_fractionally_sized_box.0.dart @@ -18,8 +18,13 @@ class AnimatedFractionallySizedBoxExampleApp extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( home: Scaffold( - appBar: AppBar(title: const Text('AnimatedFractionallySizedBox Sample')), - body: const AnimatedFractionallySizedBoxExample(duration: duration, curve: curve), + appBar: AppBar( + title: const Text('AnimatedFractionallySizedBox Sample'), + ), + body: const AnimatedFractionallySizedBoxExample( + duration: duration, + curve: curve, + ), ), ); } @@ -41,7 +46,8 @@ class AnimatedFractionallySizedBoxExample extends StatefulWidget { _AnimatedFractionallySizedBoxExampleState(); } -class _AnimatedFractionallySizedBoxExampleState extends State { +class _AnimatedFractionallySizedBoxExampleState + extends State { bool selected = false; @override @@ -64,7 +70,10 @@ class _AnimatedFractionallySizedBoxExampleState extends State createState() => _AnimatedPositionedExampleState(); + State createState() => + _AnimatedPositionedExampleState(); } class _AnimatedPositionedExampleState extends State { diff --git a/examples/api/lib/widgets/implicit_animations/sliver_animated_opacity.0.dart b/examples/api/lib/widgets/implicit_animations/sliver_animated_opacity.0.dart index 9e6b1f9061a..0910b74f590 100644 --- a/examples/api/lib/widgets/implicit_animations/sliver_animated_opacity.0.dart +++ b/examples/api/lib/widgets/implicit_animations/sliver_animated_opacity.0.dart @@ -28,17 +28,23 @@ class SliverAnimatedOpacityExampleApp extends StatelessWidget { } class SliverAnimatedOpacityExample extends StatefulWidget { - const SliverAnimatedOpacityExample({required this.duration, required this.curve, super.key}); + const SliverAnimatedOpacityExample({ + required this.duration, + required this.curve, + super.key, + }); final Duration duration; final Curve curve; @override - State createState() => _SliverAnimatedOpacityExampleState(); + State createState() => + _SliverAnimatedOpacityExampleState(); } -class _SliverAnimatedOpacityExampleState extends State +class _SliverAnimatedOpacityExampleState + extends State with SingleTickerProviderStateMixin { bool _visible = true; @@ -54,7 +60,9 @@ class _SliverAnimatedOpacityExampleState extends State { - const LogoModel({super.key, this.backgroundColor, this.large, required super.child}); + const LogoModel({ + super.key, + this.backgroundColor, + this.large, + required super.child, + }); final Color? backgroundColor; final bool? large; @@ -33,16 +38,24 @@ class LogoModel extends InheritedModel { } static bool sizeOf(BuildContext context) { - return InheritedModel.inheritFrom(context, aspect: LogoAspect.large)?.large ?? false; + return InheritedModel.inheritFrom( + context, + aspect: LogoAspect.large, + )?.large ?? + false; } @override bool updateShouldNotify(LogoModel oldWidget) { - return backgroundColor != oldWidget.backgroundColor || large != oldWidget.large; + return backgroundColor != oldWidget.backgroundColor || + large != oldWidget.large; } @override - bool updateShouldNotifyDependent(LogoModel oldWidget, Set dependencies) { + bool updateShouldNotifyDependent( + LogoModel oldWidget, + Set dependencies, + ) { if (backgroundColor != oldWidget.backgroundColor && dependencies.contains(LogoAspect.backgroundColor)) { return true; diff --git a/examples/api/lib/widgets/inherited_notifier/inherited_notifier.0.dart b/examples/api/lib/widgets/inherited_notifier/inherited_notifier.0.dart index d8f85a4efc7..926a6e0725b 100644 --- a/examples/api/lib/widgets/inherited_notifier/inherited_notifier.0.dart +++ b/examples/api/lib/widgets/inherited_notifier/inherited_notifier.0.dart @@ -23,7 +23,10 @@ class SpinModel extends InheritedNotifier { const SpinModel({super.key, super.notifier, required super.child}); static double of(BuildContext context) { - return context.dependOnInheritedWidgetOfExactType()!.notifier!.value; + return context + .dependOnInheritedWidgetOfExactType()! + .notifier! + .value; } } @@ -48,7 +51,8 @@ class InheritedNotifierExample extends StatefulWidget { const InheritedNotifierExample({super.key}); @override - State createState() => _InheritedNotifierExampleState(); + State createState() => + _InheritedNotifierExampleState(); } /// [AnimationController]s can be created with `vsync: this` because of @@ -60,7 +64,10 @@ class _InheritedNotifierExampleState extends State @override void initState() { super.initState(); - _controller = AnimationController(duration: const Duration(seconds: 10), vsync: this)..repeat(); + _controller = AnimationController( + duration: const Duration(seconds: 10), + vsync: this, + )..repeat(); } @override diff --git a/examples/api/lib/widgets/inherited_theme/inherited_theme.0.dart b/examples/api/lib/widgets/inherited_theme/inherited_theme.0.dart index 6786db11b70..7a877e5e30b 100644 --- a/examples/api/lib/widgets/inherited_theme/inherited_theme.0.dart +++ b/examples/api/lib/widgets/inherited_theme/inherited_theme.0.dart @@ -23,7 +23,10 @@ class MyAppBody extends StatelessWidget { // the new route pushed onto said navigator. // Themes are captured outside of the route's builder because when the // builder executes, the context may not be valid anymore. - final CapturedThemes themes = InheritedTheme.capture(from: context, to: navigator.context); + final CapturedThemes themes = InheritedTheme.capture( + from: context, + to: navigator.context, + ); return GestureDetector( onTap: () { Navigator.of(context).push( diff --git a/examples/api/lib/widgets/interactive_viewer/interactive_viewer.builder.0.dart b/examples/api/lib/widgets/interactive_viewer/interactive_viewer.builder.0.dart index 45ab97b24b1..d4e4f096188 100644 --- a/examples/api/lib/widgets/interactive_viewer/interactive_viewer.builder.0.dart +++ b/examples/api/lib/widgets/interactive_viewer/interactive_viewer.builder.0.dart @@ -41,7 +41,11 @@ class _IVBuilderExampleState extends State<_IVBuilderExample> { double xMax = quad.point0.x; double yMin = quad.point0.y; double yMax = quad.point0.y; - for (final Vector3 point in [quad.point1, quad.point2, quad.point3]) { + for (final Vector3 point in [ + quad.point1, + quad.point2, + quad.point3, + ]) { if (point.x < xMin) { xMin = point.x; } else if (point.x > xMax) { @@ -89,7 +93,8 @@ class _IVBuilderExampleState extends State<_IVBuilderExample> { } } -typedef _CellBuilder = Widget Function(BuildContext context, int row, int column); +typedef _CellBuilder = + Widget Function(BuildContext context, int row, int column); class _TableBuilder extends StatelessWidget { const _TableBuilder({ diff --git a/examples/api/lib/widgets/interactive_viewer/interactive_viewer.constrained.0.dart b/examples/api/lib/widgets/interactive_viewer/interactive_viewer.constrained.0.dart index 8db0ef440f2..1b22fe3bd5f 100644 --- a/examples/api/lib/widgets/interactive_viewer/interactive_viewer.constrained.0.dart +++ b/examples/api/lib/widgets/interactive_viewer/interactive_viewer.constrained.0.dart @@ -49,7 +49,10 @@ class ConstrainedExample extends StatelessWidget { color: row % 2 + column % 2 == 1 ? Colors.white : Colors.grey.withValues(alpha: 0.1), - child: Align(alignment: Alignment.centerLeft, child: Text('$row x $column')), + child: Align( + alignment: Alignment.centerLeft, + child: Text('$row x $column'), + ), ), ], ), diff --git a/examples/api/lib/widgets/interactive_viewer/interactive_viewer.transformation_controller.0.dart b/examples/api/lib/widgets/interactive_viewer/interactive_viewer.transformation_controller.0.dart index 79432800cd1..11168cf0a6e 100644 --- a/examples/api/lib/widgets/interactive_viewer/interactive_viewer.transformation_controller.0.dart +++ b/examples/api/lib/widgets/interactive_viewer/interactive_viewer.transformation_controller.0.dart @@ -21,14 +21,17 @@ class TransformationControllerExample extends StatefulWidget { const TransformationControllerExample({super.key}); @override - State createState() => _TransformationControllerExampleState(); + State createState() => + _TransformationControllerExampleState(); } /// [AnimationController]s can be created with `vsync: this` because of /// [TickerProviderStateMixin]. -class _TransformationControllerExampleState extends State +class _TransformationControllerExampleState + extends State with TickerProviderStateMixin { - final TransformationController _transformationController = TransformationController(); + final TransformationController _transformationController = + TransformationController(); Animation? _animationReset; late final AnimationController _controllerReset; @@ -87,7 +90,10 @@ class _TransformationControllerExampleState extends State createState() => _CupertinoMagnifierExampleState(); + State createState() => + _CupertinoMagnifierExampleState(); } class _CupertinoMagnifierExampleState extends State { @@ -34,7 +35,9 @@ class _CupertinoMagnifierExampleState extends State { @override Widget build(BuildContext context) { return CupertinoPageScaffold( - navigationBar: const CupertinoNavigationBar(middle: Text('CupertinoMagnifier Sample')), + navigationBar: const CupertinoNavigationBar( + middle: Text('CupertinoMagnifier Sample'), + ), child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -61,7 +64,9 @@ class _CupertinoMagnifierExampleState extends State { top: dragGesturePosition.dy - magnifierRadius, child: const CupertinoMagnifier( magnificationScale: 1.5, - borderRadius: BorderRadius.all(Radius.circular(magnifierRadius)), + borderRadius: BorderRadius.all( + Radius.circular(magnifierRadius), + ), additionalFocalPointOffset: Offset(0, -magnifierRadius), ), ), diff --git a/examples/api/lib/widgets/magnifier/cupertino_text_magnifier.0.dart b/examples/api/lib/widgets/magnifier/cupertino_text_magnifier.0.dart index e9bd6459085..0ccbee2fdf1 100644 --- a/examples/api/lib/widgets/magnifier/cupertino_text_magnifier.0.dart +++ b/examples/api/lib/widgets/magnifier/cupertino_text_magnifier.0.dart @@ -24,27 +24,32 @@ class CupertinoTextMagnifierExampleApp extends StatefulWidget { const CupertinoTextMagnifierExampleApp({super.key}); @override - State createState() => _CupertinoTextMagnifierExampleAppState(); + State createState() => + _CupertinoTextMagnifierExampleAppState(); } -class _CupertinoTextMagnifierExampleAppState extends State { +class _CupertinoTextMagnifierExampleAppState + extends State { final MagnifierController _controller = MagnifierController(); @override Widget build(BuildContext context) { return CupertinoPageScaffold( - navigationBar: const CupertinoNavigationBar(middle: Text('CupertinoTextMagnifier Sample')), + navigationBar: const CupertinoNavigationBar( + middle: Text('CupertinoTextMagnifier Sample'), + ), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 48.0), child: Center( child: CupertinoTextField( magnifierConfiguration: TextMagnifierConfiguration( - magnifierBuilder: (_, _, ValueNotifier magnifierInfo) { - return CupertinoTextMagnifier( - controller: _controller, - magnifierInfo: magnifierInfo, - ); - }, + magnifierBuilder: + (_, _, ValueNotifier magnifierInfo) { + return CupertinoTextMagnifier( + controller: _controller, + magnifierInfo: magnifierInfo, + ); + }, ), controller: TextEditingController(text: 'Hello world!'), ), diff --git a/examples/api/lib/widgets/magnifier/magnifier.0.dart b/examples/api/lib/widgets/magnifier/magnifier.0.dart index e6002caf01e..a7021bc3f79 100644 --- a/examples/api/lib/widgets/magnifier/magnifier.0.dart +++ b/examples/api/lib/widgets/magnifier/magnifier.0.dart @@ -43,7 +43,9 @@ class _MagnifierExampleAppState extends State { top: dragGesturePosition.dy - magnifierRadius, child: const RawMagnifier( decoration: MagnifierDecoration( - shape: CircleBorder(side: BorderSide(color: Colors.pink, width: 3)), + shape: CircleBorder( + side: BorderSide(color: Colors.pink, width: 3), + ), ), size: Size(magnifierRadius * 2, magnifierRadius * 2), magnificationScale: 2, diff --git a/examples/api/lib/widgets/media_query/media_query_data.system_gesture_insets.0.dart b/examples/api/lib/widgets/media_query/media_query_data.system_gesture_insets.0.dart index 897817aa9a0..f738d70b44e 100644 --- a/examples/api/lib/widgets/media_query/media_query_data.system_gesture_insets.0.dart +++ b/examples/api/lib/widgets/media_query/media_query_data.system_gesture_insets.0.dart @@ -21,17 +21,23 @@ class SystemGestureInsetsExample extends StatefulWidget { const SystemGestureInsetsExample({super.key}); @override - State createState() => _SystemGestureInsetsExampleState(); + State createState() => + _SystemGestureInsetsExampleState(); } -class _SystemGestureInsetsExampleState extends State { +class _SystemGestureInsetsExampleState + extends State { double _currentValue = 0.2; @override Widget build(BuildContext context) { - final EdgeInsets systemGestureInsets = MediaQuery.of(context).systemGestureInsets; + final EdgeInsets systemGestureInsets = MediaQuery.of( + context, + ).systemGestureInsets; return Scaffold( - appBar: AppBar(title: const Text('Pad Slider to avoid systemGestureInsets')), + appBar: AppBar( + title: const Text('Pad Slider to avoid systemGestureInsets'), + ), body: Padding( padding: EdgeInsets.only( // only left and right padding are needed here diff --git a/examples/api/lib/widgets/navigator/navigator.0.dart b/examples/api/lib/widgets/navigator/navigator.0.dart index 4c467b26728..a89e561a1e4 100644 --- a/examples/api/lib/widgets/navigator/navigator.0.dart +++ b/examples/api/lib/widgets/navigator/navigator.0.dart @@ -51,7 +51,9 @@ class CollectPersonalInfoPage extends StatelessWidget { onTap: () { // This moves from the personal info page to the credentials page, // replacing this page with that one. - Navigator.of(context).pushReplacementNamed('signup/choose_credentials'); + Navigator.of( + context, + ).pushReplacementNamed('signup/choose_credentials'); }, child: Container( color: Colors.lightBlue, diff --git a/examples/api/lib/widgets/navigator/navigator.restorable_push.0.dart b/examples/api/lib/widgets/navigator/navigator.restorable_push.0.dart index 1c6555ad22b..52b9d5e3ed3 100644 --- a/examples/api/lib/widgets/navigator/navigator.restorable_push.0.dart +++ b/examples/api/lib/widgets/navigator/navigator.restorable_push.0.dart @@ -15,7 +15,10 @@ class RestorablePushExampleApp extends StatelessWidget { Widget build(BuildContext context) { return const RootRestorationScope( restorationId: 'app', - child: MaterialApp(restorationScopeId: 'app', home: RestorablePushExample()), + child: MaterialApp( + restorationScopeId: 'app', + home: RestorablePushExample(), + ), ); } } diff --git a/examples/api/lib/widgets/navigator/navigator.restorable_push_and_remove_until.0.dart b/examples/api/lib/widgets/navigator/navigator.restorable_push_and_remove_until.0.dart index 199c82d33f1..8418a410412 100644 --- a/examples/api/lib/widgets/navigator/navigator.restorable_push_and_remove_until.0.dart +++ b/examples/api/lib/widgets/navigator/navigator.restorable_push_and_remove_until.0.dart @@ -15,7 +15,10 @@ class RestorablePushAndRemoveUntilExampleApp extends StatelessWidget { Widget build(BuildContext context) { return const RootRestorationScope( restorationId: 'app', - child: MaterialApp(restorationScopeId: 'app', home: RestorablePushAndRemoveUntilExample()), + child: MaterialApp( + restorationScopeId: 'app', + home: RestorablePushAndRemoveUntilExample(), + ), ); } } @@ -29,11 +32,13 @@ class RestorablePushAndRemoveUntilExample extends StatefulWidget { } @pragma('vm:entry-point') -class _RestorablePushAndRemoveUntilExampleState extends State { +class _RestorablePushAndRemoveUntilExampleState + extends State { @pragma('vm:entry-point') static Route _myRouteBuilder(BuildContext context, Object? arguments) { return MaterialPageRoute( - builder: (BuildContext context) => const RestorablePushAndRemoveUntilExample(), + builder: (BuildContext context) => + const RestorablePushAndRemoveUntilExample(), ); } diff --git a/examples/api/lib/widgets/navigator/navigator.restorable_push_replacement.0.dart b/examples/api/lib/widgets/navigator/navigator.restorable_push_replacement.0.dart index da59ccaca9c..0678dddc00c 100644 --- a/examples/api/lib/widgets/navigator/navigator.restorable_push_replacement.0.dart +++ b/examples/api/lib/widgets/navigator/navigator.restorable_push_replacement.0.dart @@ -15,7 +15,10 @@ class RestorablePushReplacementExampleApp extends StatelessWidget { Widget build(BuildContext context) { return const RootRestorationScope( restorationId: 'app', - child: MaterialApp(restorationScopeId: 'app', home: RestorablePushReplacementExample()), + child: MaterialApp( + restorationScopeId: 'app', + home: RestorablePushReplacementExample(), + ), ); } } @@ -26,15 +29,18 @@ class RestorablePushReplacementExample extends StatefulWidget { final bool wasPushed; @override - State createState() => _RestorablePushReplacementExampleState(); + State createState() => + _RestorablePushReplacementExampleState(); } @pragma('vm:entry-point') -class _RestorablePushReplacementExampleState extends State { +class _RestorablePushReplacementExampleState + extends State { @pragma('vm:entry-point') static Route _myRouteBuilder(BuildContext context, Object? arguments) { return MaterialPageRoute( - builder: (BuildContext context) => const RestorablePushReplacementExample(wasPushed: true), + builder: (BuildContext context) => + const RestorablePushReplacementExample(wasPushed: true), ); } @@ -48,7 +54,8 @@ class _RestorablePushReplacementExampleState extends State Navigator.restorablePushReplacement(context, _myRouteBuilder), + onPressed: () => + Navigator.restorablePushReplacement(context, _myRouteBuilder), tooltip: 'Increment Counter', child: const Icon(Icons.add), ), diff --git a/examples/api/lib/widgets/navigator/navigator_state.restorable_push.0.dart b/examples/api/lib/widgets/navigator/navigator_state.restorable_push.0.dart index 8ad521ccab9..f550282f620 100644 --- a/examples/api/lib/widgets/navigator/navigator_state.restorable_push.0.dart +++ b/examples/api/lib/widgets/navigator/navigator_state.restorable_push.0.dart @@ -15,7 +15,10 @@ class RestorablePushExampleApp extends StatelessWidget { Widget build(BuildContext context) { return const RootRestorationScope( restorationId: 'app', - child: MaterialApp(restorationScopeId: 'app', home: RestorablePushExample()), + child: MaterialApp( + restorationScopeId: 'app', + home: RestorablePushExample(), + ), ); } } diff --git a/examples/api/lib/widgets/navigator/navigator_state.restorable_push_and_remove_until.0.dart b/examples/api/lib/widgets/navigator/navigator_state.restorable_push_and_remove_until.0.dart index aee5945161f..b85098d3594 100644 --- a/examples/api/lib/widgets/navigator/navigator_state.restorable_push_and_remove_until.0.dart +++ b/examples/api/lib/widgets/navigator/navigator_state.restorable_push_and_remove_until.0.dart @@ -15,7 +15,10 @@ class RestorablePushAndRemoveUntilExampleApp extends StatelessWidget { Widget build(BuildContext context) { return const RootRestorationScope( restorationId: 'app', - child: MaterialApp(restorationScopeId: 'app', home: RestorablePushAndRemoveUntilExample()), + child: MaterialApp( + restorationScopeId: 'app', + home: RestorablePushAndRemoveUntilExample(), + ), ); } } @@ -29,11 +32,13 @@ class RestorablePushAndRemoveUntilExample extends StatefulWidget { } @pragma('vm:entry-point') -class _RestorablePushAndRemoveUntilExampleState extends State { +class _RestorablePushAndRemoveUntilExampleState + extends State { @pragma('vm:entry-point') static Route _myRouteBuilder(BuildContext context, Object? arguments) { return MaterialPageRoute( - builder: (BuildContext context) => const RestorablePushAndRemoveUntilExample(), + builder: (BuildContext context) => + const RestorablePushAndRemoveUntilExample(), ); } @@ -42,9 +47,10 @@ class _RestorablePushAndRemoveUntilExampleState extends State Navigator.of( - context, - ).restorablePushAndRemoveUntil(_myRouteBuilder, ModalRoute.withName('/')), + onPressed: () => Navigator.of(context).restorablePushAndRemoveUntil( + _myRouteBuilder, + ModalRoute.withName('/'), + ), tooltip: 'Increment Counter', child: const Icon(Icons.add), ), diff --git a/examples/api/lib/widgets/navigator/navigator_state.restorable_push_replacement.0.dart b/examples/api/lib/widgets/navigator/navigator_state.restorable_push_replacement.0.dart index 2d88bf6f9dd..43c1d4bf771 100644 --- a/examples/api/lib/widgets/navigator/navigator_state.restorable_push_replacement.0.dart +++ b/examples/api/lib/widgets/navigator/navigator_state.restorable_push_replacement.0.dart @@ -15,7 +15,10 @@ class RestorablePushReplacementExampleApp extends StatelessWidget { Widget build(BuildContext context) { return const RootRestorationScope( restorationId: 'app', - child: MaterialApp(restorationScopeId: 'app', home: RestorablePushReplacementExample()), + child: MaterialApp( + restorationScopeId: 'app', + home: RestorablePushReplacementExample(), + ), ); } } @@ -26,15 +29,18 @@ class RestorablePushReplacementExample extends StatefulWidget { final bool wasPushed; @override - State createState() => _RestorablePushReplacementExampleState(); + State createState() => + _RestorablePushReplacementExampleState(); } @pragma('vm:entry-point') -class _RestorablePushReplacementExampleState extends State { +class _RestorablePushReplacementExampleState + extends State { @pragma('vm:entry-point') static Route _myRouteBuilder(BuildContext context, Object? arguments) { return MaterialPageRoute( - builder: (BuildContext context) => const RestorablePushReplacementExample(wasPushed: true), + builder: (BuildContext context) => + const RestorablePushReplacementExample(wasPushed: true), ); } @@ -48,7 +54,8 @@ class _RestorablePushReplacementExampleState extends State Navigator.of(context).restorablePushReplacement(_myRouteBuilder), + onPressed: () => + Navigator.of(context).restorablePushReplacement(_myRouteBuilder), tooltip: 'Increment Counter', child: const Icon(Icons.add), ), diff --git a/examples/api/lib/widgets/navigator/restorable_route_future.0.dart b/examples/api/lib/widgets/navigator/restorable_route_future.0.dart index 210589fd8d2..0acb8225ae7 100644 --- a/examples/api/lib/widgets/navigator/restorable_route_future.0.dart +++ b/examples/api/lib/widgets/navigator/restorable_route_future.0.dart @@ -45,7 +45,10 @@ class _MyHomeState extends State with RestorationMixin { onPresent: (NavigatorState navigator, Object? arguments) { // Defines what route should be shown (and how it should be added // to the navigator) when `RestorableRouteFuture.present` is called. - return navigator.restorablePush(_counterRouteBuilder, arguments: arguments); + return navigator.restorablePush( + _counterRouteBuilder, + arguments: arguments, + ); }, onComplete: (int count) { // Defines what should happen with the return value when the route @@ -74,9 +77,13 @@ class _MyHomeState extends State with RestorationMixin { // A static `RestorableRouteBuilder` that can re-create the route during // state restoration. @pragma('vm:entry-point') - static Route _counterRouteBuilder(BuildContext context, Object? arguments) { + static Route _counterRouteBuilder( + BuildContext context, + Object? arguments, + ) { return MaterialPageRoute( - builder: (BuildContext context) => MyCounter(title: arguments!.toString()), + builder: (BuildContext context) => + MyCounter(title: arguments!.toString()), ); } diff --git a/examples/api/lib/widgets/navigator_pop_handler/navigator_pop_handler.0.dart b/examples/api/lib/widgets/navigator_pop_handler/navigator_pop_handler.0.dart index dee59c4f6c8..69252e89bfa 100644 --- a/examples/api/lib/widgets/navigator_pop_handler/navigator_pop_handler.0.dart +++ b/examples/api/lib/widgets/navigator_pop_handler/navigator_pop_handler.0.dart @@ -80,7 +80,8 @@ class _NestedNavigatorsPage extends StatefulWidget { } class _NestedNavigatorsPageState extends State<_NestedNavigatorsPage> { - final GlobalKey _nestedNavigatorKey = GlobalKey(); + final GlobalKey _nestedNavigatorKey = + GlobalKey(); @override Widget build(BuildContext context) { @@ -105,7 +106,8 @@ class _NestedNavigatorsPageState extends State<_NestedNavigatorsPage> { ), 'nested_navigators/one/another_one' => MaterialPageRoute( settings: const RouteSettings(name: 'nested_navigators/one'), - builder: (BuildContext context) => const _NestedNavigatorsPageTwo(), + builder: (BuildContext context) => + const _NestedNavigatorsPageTwo(), ), _ => MaterialPageRoute( settings: const RouteSettings(name: 'unknown_page'), @@ -137,7 +139,9 @@ class _NestedNavigatorsPageOne extends StatelessWidget { const Text('A system back here returns to the home page.'), TextButton( onPressed: () { - Navigator.of(context).restorablePushNamed('nested_navigators/one/another_one'); + Navigator.of( + context, + ).restorablePushNamed('nested_navigators/one/another_one'); }, child: const Text('Go to another route in this nested Navigator'), ), @@ -167,7 +171,9 @@ class _NestedNavigatorsPageTwo extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ const Text('Nested Navigators Page Two'), - const Text('A system back here will go back to Nested Navigators Page One'), + const Text( + 'A system back here will go back to Nested Navigators Page One', + ), TextButton( onPressed: () { Navigator.of(context).pop(); @@ -189,7 +195,10 @@ class _UnknownPage extends StatelessWidget { return Scaffold( backgroundColor: Colors.grey.withBlue(180), body: const Center( - child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [Text('404')]), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [Text('404')], + ), ), ); } diff --git a/examples/api/lib/widgets/navigator_pop_handler/navigator_pop_handler.1.dart b/examples/api/lib/widgets/navigator_pop_handler/navigator_pop_handler.1.dart index b3f75798977..8728075b477 100644 --- a/examples/api/lib/widgets/navigator_pop_handler/navigator_pop_handler.1.dart +++ b/examples/api/lib/widgets/navigator_pop_handler/navigator_pop_handler.1.dart @@ -69,18 +69,30 @@ class _BottomNavPageState extends State<_BottomNavPage> with RestorationMixin { final GlobalKey _tabOneKey = GlobalKey(); final GlobalKey _tabTwoKey = GlobalKey(); - final _RestorableTabPageList _restorableTabHomePages = _RestorableTabPageList(); - final _RestorableTabPageList _restorableTabOnePages = _RestorableTabPageList(); - final _RestorableTabPageList _restorableTabTwoPages = _RestorableTabPageList(); + final _RestorableTabPageList _restorableTabHomePages = + _RestorableTabPageList(); + final _RestorableTabPageList _restorableTabOnePages = + _RestorableTabPageList(); + final _RestorableTabPageList _restorableTabTwoPages = + _RestorableTabPageList(); BottomNavigationBarItem _itemForPage(_Tab page) { switch (page) { case _Tab.home: - return const BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Go to Home'); + return const BottomNavigationBarItem( + icon: Icon(Icons.home), + label: 'Go to Home', + ); case _Tab.one: - return const BottomNavigationBarItem(icon: Icon(Icons.one_k), label: 'Go to One'); + return const BottomNavigationBarItem( + icon: Icon(Icons.one_k), + label: 'Go to One', + ); case _Tab.two: - return const BottomNavigationBarItem(icon: Icon(Icons.two_k), label: 'Go to Two'); + return const BottomNavigationBarItem( + icon: Icon(Icons.two_k), + label: 'Go to Two', + ); } } @@ -204,7 +216,8 @@ class _BottomNavTabState extends State<_BottomNavTab> { if (tabPage == null) { return; } - final List<_TabPage> nextPages = <_TabPage>[...widget.pages]..remove(tabPage); + final List<_TabPage> nextPages = <_TabPage>[...widget.pages] + ..remove(tabPage); if (nextPages.length < widget.pages.length) { widget.onChangePages(nextPages); } @@ -222,9 +235,14 @@ class _BottomNavTabState extends State<_BottomNavTab> { TextButton( onPressed: () { assert(!widget.pages.contains(_TabPage.one)); - widget.onChangePages(<_TabPage>[...widget.pages, _TabPage.one]); + widget.onChangePages(<_TabPage>[ + ...widget.pages, + _TabPage.one, + ]); }, - child: const Text('Go to another route in this nested Navigator'), + child: const Text( + 'Go to another route in this nested Navigator', + ), ), ], ), @@ -239,7 +257,9 @@ class _BottomNavTabState extends State<_BottomNavTab> { buttons: [ TextButton( onPressed: () { - widget.onChangePages(<_TabPage>[...widget.pages]..removeLast()); + widget.onChangePages( + <_TabPage>[...widget.pages]..removeLast(), + ); }, child: const Text('Go back'), ), @@ -286,7 +306,10 @@ class _UnknownPage extends StatelessWidget { return Scaffold( backgroundColor: Colors.grey.withBlue(180), body: const Center( - child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [Text('404')]), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [Text('404')], + ), ), ); } @@ -335,7 +358,9 @@ class _RestorableTabPageList extends RestorableValue> { final String dataString = data as String; final List listOfStrings = dataString.split(','); return listOfStrings.map((String tabPageName) { - return _TabPage.values.firstWhere((_TabPage tabPage) => tabPageName == tabPage.name); + return _TabPage.values.firstWhere( + (_TabPage tabPage) => tabPageName == tabPage.name, + ); }).toList(); } return <_TabPage>[]; diff --git a/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view.0.dart b/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view.0.dart index 70697f5f7ad..098c40a20fd 100644 --- a/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view.0.dart +++ b/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view.0.dart @@ -38,9 +38,13 @@ class NestedScrollViewExample extends StatelessWidget { // scroll view thinks it has not been scrolled. // This is not necessary if the "headerSliverBuilder" only builds // widgets that do not overlap the next sliver. - handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), + handle: NestedScrollView.sliverOverlapAbsorberHandleFor( + context, + ), sliver: SliverAppBar( - title: const Text('Books'), // This is the title in the app bar. + title: const Text( + 'Books', + ), // This is the title in the app bar. pinned: true, expandedHeight: 150.0, // The "forceElevated" property causes the SliverAppBar to show @@ -86,7 +90,10 @@ class NestedScrollViewExample extends StatelessWidget { SliverOverlapInjector( // This is the flip side of the SliverOverlapAbsorber // above. - handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), + handle: + NestedScrollView.sliverOverlapAbsorberHandleFor( + context, + ), ), SliverPadding( padding: const EdgeInsets.all(8.0), diff --git a/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view.1.dart b/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view.1.dart index ad96a4415a8..b9a8304773a 100644 --- a/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view.1.dart +++ b/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view.1.dart @@ -41,7 +41,10 @@ class NestedScrollViewExample extends StatelessWidget { padding: const EdgeInsets.all(8), itemCount: 30, itemBuilder: (BuildContext context, int index) { - return SizedBox(height: 50, child: Center(child: Text('Item $index'))); + return SizedBox( + height: 50, + child: Center(child: Text('Item $index')), + ); }, ), ), diff --git a/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view.2.dart b/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view.2.dart index 94b917f67cc..392cb0ad70a 100644 --- a/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view.2.dart +++ b/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view.2.dart @@ -47,7 +47,9 @@ class NestedScrollViewExample extends StatelessWidget { // be associated with the NestedScrollView. slivers: [ SliverOverlapInjector( - handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), + handle: NestedScrollView.sliverOverlapAbsorberHandleFor( + context, + ), ), SliverFixedExtentList.builder( itemExtent: 48.0, diff --git a/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view_state.0.dart b/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view_state.0.dart index eb52104d919..858c66be01b 100644 --- a/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view_state.0.dart +++ b/examples/api/lib/widgets/nested_scroll_view/nested_scroll_view_state.0.dart @@ -27,7 +27,9 @@ class NestedScrollViewStateExample extends StatelessWidget { return NestedScrollView( key: globalKey, headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { - return const [SliverAppBar(title: Text('NestedScrollViewState Demo!'))]; + return const [ + SliverAppBar(title: Text('NestedScrollViewState Demo!')), + ]; }, body: const CustomScrollView( // Body slivers go here! diff --git a/examples/api/lib/widgets/notification_listener/notification.0.dart b/examples/api/lib/widgets/notification_listener/notification.0.dart index 77a208971c5..6ac44296d40 100644 --- a/examples/api/lib/widgets/notification_listener/notification.0.dart +++ b/examples/api/lib/widgets/notification_listener/notification.0.dart @@ -41,16 +41,21 @@ class NotificationExample extends StatelessWidget { return true; }, child: NestedScrollView( - headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { - return [ - SliverAppBar( - title: const Text('Notification Sample'), - pinned: true, - floating: true, - bottom: TabBar(tabs: _tabs.map((String name) => Tab(text: name)).toList()), - ), - ]; - }, + headerSliverBuilder: + (BuildContext context, bool innerBoxIsScrolled) { + return [ + SliverAppBar( + title: const Text('Notification Sample'), + pinned: true, + floating: true, + bottom: TabBar( + tabs: _tabs + .map((String name) => Tab(text: name)) + .toList(), + ), + ), + ]; + }, body: TabBarView( children: [ ListView.builder( diff --git a/examples/api/lib/widgets/overflow_bar/overflow_bar.0.dart b/examples/api/lib/widgets/overflow_bar/overflow_bar.0.dart index 107e7973c8e..b8a443dbe64 100644 --- a/examples/api/lib/widgets/overflow_bar/overflow_bar.0.dart +++ b/examples/api/lib/widgets/overflow_bar/overflow_bar.0.dart @@ -34,7 +34,9 @@ class OverflowBarExample extends StatelessWidget { child: Material( color: Colors.white, elevation: 24, - shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(4))), + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(4)), + ), child: Padding( padding: const EdgeInsets.all(8), child: SingleChildScrollView( @@ -50,7 +52,10 @@ class OverflowBarExample extends StatelessWidget { overflowAlignment: OverflowBarAlignment.end, children: [ TextButton(child: const Text('Cancel'), onPressed: () {}), - TextButton(child: const Text('Really Really Cancel'), onPressed: () {}), + TextButton( + child: const Text('Really Really Cancel'), + onPressed: () {}, + ), OutlinedButton(child: const Text('OK'), onPressed: () {}), ], ), diff --git a/examples/api/lib/widgets/overlay/overlay_portal.0.dart b/examples/api/lib/widgets/overlay/overlay_portal.0.dart index 9c9817152f1..a3fcead6626 100644 --- a/examples/api/lib/widgets/overlay/overlay_portal.0.dart +++ b/examples/api/lib/widgets/overlay/overlay_portal.0.dart @@ -44,7 +44,10 @@ class ClickableTooltipWidgetState extends State { return const Positioned( right: 50, bottom: 50, - child: ColoredBox(color: Colors.amberAccent, child: Text('tooltip')), + child: ColoredBox( + color: Colors.amberAccent, + child: Text('tooltip'), + ), ); }, child: const Text('Press to show/hide tooltip'), diff --git a/examples/api/lib/widgets/overscroll_indicator/glowing_overscroll_indicator.0.dart b/examples/api/lib/widgets/overscroll_indicator/glowing_overscroll_indicator.0.dart index 40593da1882..32b449fcc77 100644 --- a/examples/api/lib/widgets/overscroll_indicator/glowing_overscroll_indicator.0.dart +++ b/examples/api/lib/widgets/overscroll_indicator/glowing_overscroll_indicator.0.dart @@ -25,7 +25,9 @@ class GlowingOverscrollIndicatorExampleApp extends StatelessWidget { } } -const Set allPointers = {...PointerDeviceKind.values}; +const Set allPointers = { + ...PointerDeviceKind.values, +}; // Passing this class into the MaterialApp constructor ensures that a // GlowingOverscrollIndicator is created, regardless of the target platform. @@ -36,7 +38,11 @@ class AlwaysGlow extends MaterialScrollBehavior { Set get dragDevices => allPointers; @override - Widget buildOverscrollIndicator(BuildContext context, Widget child, ScrollableDetails details) { + Widget buildOverscrollIndicator( + BuildContext context, + Widget child, + ScrollableDetails details, + ) { return GlowingOverscrollIndicator( axisDirection: details.direction, color: Colors.amberAccent, @@ -50,7 +56,8 @@ class GlowingOverscrollIndicatorExample extends StatelessWidget { @override Widget build(BuildContext context) { - final double leadingPaintOffset = MediaQuery.paddingOf(context).top + kToolbarHeight; + final double leadingPaintOffset = + MediaQuery.paddingOf(context).top + kToolbarHeight; return NotificationListener( onNotification: (OverscrollIndicatorNotification notification) { @@ -79,7 +86,9 @@ class GlowingOverscrollIndicatorExample extends StatelessWidget { ), ), ), - SliverFillRemaining(child: Icon(Icons.sunny, color: Colors.amberAccent, size: 128)), + SliverFillRemaining( + child: Icon(Icons.sunny, color: Colors.amberAccent, size: 128), + ), ], ), ); diff --git a/examples/api/lib/widgets/overscroll_indicator/glowing_overscroll_indicator.1.dart b/examples/api/lib/widgets/overscroll_indicator/glowing_overscroll_indicator.1.dart index aba7804d2c2..81ea4ab3d6f 100644 --- a/examples/api/lib/widgets/overscroll_indicator/glowing_overscroll_indicator.1.dart +++ b/examples/api/lib/widgets/overscroll_indicator/glowing_overscroll_indicator.1.dart @@ -25,7 +25,9 @@ class GlowingOverscrollIndicatorExampleApp extends StatelessWidget { } } -const Set allPointers = {...PointerDeviceKind.values}; +const Set allPointers = { + ...PointerDeviceKind.values, +}; // Passing this class into the MaterialApp constructor ensures that a // GlowingOverscrollIndicator is created, regardless of the target platform. @@ -36,7 +38,11 @@ class AlwaysGlow extends MaterialScrollBehavior { Set get dragDevices => allPointers; @override - Widget buildOverscrollIndicator(BuildContext context, Widget child, ScrollableDetails details) { + Widget buildOverscrollIndicator( + BuildContext context, + Widget child, + ScrollableDetails details, + ) { return GlowingOverscrollIndicator( axisDirection: details.direction, color: Colors.amberAccent, @@ -52,7 +58,9 @@ class GlowingOverscrollIndicatorExample extends StatelessWidget { Widget build(BuildContext context) { return NestedScrollView( headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { - return const [SliverAppBar(title: Text('Custom NestedScrollViews'))]; + return const [ + SliverAppBar(title: Text('Custom NestedScrollViews')), + ]; }, body: const CustomScrollView( slivers: [ @@ -73,7 +81,9 @@ class GlowingOverscrollIndicatorExample extends StatelessWidget { ), ), ), - SliverFillRemaining(child: Icon(Icons.sunny, color: Colors.amberAccent, size: 128)), + SliverFillRemaining( + child: Icon(Icons.sunny, color: Colors.amberAccent, size: 128), + ), ], ), ); diff --git a/examples/api/lib/widgets/page/page_can_pop.0.dart b/examples/api/lib/widgets/page/page_can_pop.0.dart index 7268b41255b..35187ae4705 100644 --- a/examples/api/lib/widgets/page/page_can_pop.0.dart +++ b/examples/api/lib/widgets/page/page_can_pop.0.dart @@ -29,7 +29,8 @@ class MyRouterDelegate extends RouterDelegate with PopNavigatorRouterDelegateMixin, ChangeNotifier { // This example doesn't use RouteInformationProvider. @override - Future setNewRoutePath(Object configuration) async => throw UnimplementedError(); + Future setNewRoutePath(Object configuration) async => + throw UnimplementedError(); @override final GlobalKey navigatorKey = GlobalKey(); @@ -87,7 +88,10 @@ class MyRouterDelegate extends RouterDelegate List> _getPages() { return >[ - const MaterialPage(key: ValueKey('home'), child: _HomePage()), + const MaterialPage( + key: ValueKey('home'), + child: _HomePage(), + ), if (showDetailPage) MaterialPage( key: const ValueKey('details'), diff --git a/examples/api/lib/widgets/page_transitions_builder/page_transitions_builder.0.dart b/examples/api/lib/widgets/page_transitions_builder/page_transitions_builder.0.dart index 439da131076..7824a2dc57e 100644 --- a/examples/api/lib/widgets/page_transitions_builder/page_transitions_builder.0.dart +++ b/examples/api/lib/widgets/page_transitions_builder/page_transitions_builder.0.dart @@ -91,7 +91,13 @@ class CustomPageRoute extends PageRoute { Animation secondaryAnimation, Widget child, ) { - return transitionsBuilder.buildTransitions(this, context, animation, secondaryAnimation, child); + return transitionsBuilder.buildTransitions( + this, + context, + animation, + secondaryAnimation, + child, + ); } } @@ -105,9 +111,11 @@ class HomePage extends StatelessWidget { body: Center( child: ElevatedButton( onPressed: () { - Navigator.of( - context, - ).push(CustomPageRoute(builder: (BuildContext context) => const SecondPage())); + Navigator.of(context).push( + CustomPageRoute( + builder: (BuildContext context) => const SecondPage(), + ), + ); }, child: const Text('Navigate with Custom Transition'), ), @@ -123,7 +131,9 @@ class SecondPage extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: const Text('Second Page')), - body: const Center(child: Text('This page appeared with a custom transition!')), + body: const Center( + child: Text('This page appeared with a custom transition!'), + ), ); } } diff --git a/examples/api/lib/widgets/page_view/page_view.0.dart b/examples/api/lib/widgets/page_view/page_view.0.dart index ebb0f129595..b6e36a6a0f5 100644 --- a/examples/api/lib/widgets/page_view/page_view.0.dart +++ b/examples/api/lib/widgets/page_view/page_view.0.dart @@ -30,7 +30,8 @@ class PageViewExample extends StatefulWidget { State createState() => _PageViewExampleState(); } -class _PageViewExampleState extends State with TickerProviderStateMixin { +class _PageViewExampleState extends State + with TickerProviderStateMixin { late PageController _pageViewController; late TabController _tabController; int _currentPageIndex = 0; @@ -99,8 +100,12 @@ class _PageViewExampleState extends State with TickerProviderSt bool get _isOnDesktopAndWeb => kIsWeb || switch (defaultTargetPlatform) { - TargetPlatform.macOS || TargetPlatform.linux || TargetPlatform.windows => true, - TargetPlatform.android || TargetPlatform.iOS || TargetPlatform.fuchsia => false, + TargetPlatform.macOS || + TargetPlatform.linux || + TargetPlatform.windows => true, + TargetPlatform.android || + TargetPlatform.iOS || + TargetPlatform.fuchsia => false, }; } diff --git a/examples/api/lib/widgets/page_view/page_view.1.dart b/examples/api/lib/widgets/page_view/page_view.1.dart index 294d9f2f3d8..56aef059a3d 100644 --- a/examples/api/lib/widgets/page_view/page_view.1.dart +++ b/examples/api/lib/widgets/page_view/page_view.1.dart @@ -40,7 +40,10 @@ class _PageViewExampleState extends State { child: PageView.custom( childrenDelegate: SliverChildBuilderDelegate( (BuildContext context, int index) { - return KeepAliveItem(data: items[index], key: ValueKey(items[index])); + return KeepAliveItem( + data: items[index], + key: ValueKey(items[index]), + ); }, childCount: items.length, findChildIndexCallback: (Key key) { @@ -59,7 +62,10 @@ class _PageViewExampleState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - TextButton(onPressed: () => _reverse(), child: const Text('Reverse items')), + TextButton( + onPressed: () => _reverse(), + child: const Text('Reverse items'), + ), ], ), ), @@ -76,7 +82,8 @@ class KeepAliveItem extends StatefulWidget { State createState() => _KeepAliveItemState(); } -class _KeepAliveItemState extends State with AutomaticKeepAliveClientMixin { +class _KeepAliveItemState extends State + with AutomaticKeepAliveClientMixin { @override bool get wantKeepAlive => true; diff --git a/examples/api/lib/widgets/pop_scope/pop_scope.0.dart b/examples/api/lib/widgets/pop_scope/pop_scope.0.dart index c6cd852271f..38890632358 100644 --- a/examples/api/lib/widgets/pop_scope/pop_scope.0.dart +++ b/examples/api/lib/widgets/pop_scope/pop_scope.0.dart @@ -75,14 +75,18 @@ class _PageTwoState extends State<_PageTwo> { content: const Text('Are you sure you want to leave this page?'), actions: [ TextButton( - style: TextButton.styleFrom(textStyle: Theme.of(context).textTheme.labelLarge), + style: TextButton.styleFrom( + textStyle: Theme.of(context).textTheme.labelLarge, + ), child: const Text('Nevermind'), onPressed: () { Navigator.pop(context, false); }, ), TextButton( - style: TextButton.styleFrom(textStyle: Theme.of(context).textTheme.labelLarge), + style: TextButton.styleFrom( + textStyle: Theme.of(context).textTheme.labelLarge, + ), child: const Text('Leave'), onPressed: () { Navigator.pop(context, true); diff --git a/examples/api/lib/widgets/pop_scope/pop_scope.1.dart b/examples/api/lib/widgets/pop_scope/pop_scope.1.dart index 510e0fecd49..2557e2a355d 100644 --- a/examples/api/lib/widgets/pop_scope/pop_scope.1.dart +++ b/examples/api/lib/widgets/pop_scope/pop_scope.1.dart @@ -21,7 +21,9 @@ class NavigatorPopHandlerApp extends StatelessWidget { '/two' => MaterialPageRoute( builder: (BuildContext context) => const _PageTwo(), ), - _ => MaterialPageRoute(builder: (BuildContext context) => const _HomePage()), + _ => MaterialPageRoute( + builder: (BuildContext context) => const _HomePage(), + ), }; }, ); @@ -47,11 +49,14 @@ class _HomePageState extends State<_HomePage> { children: [ const Text('Page One'), if (_formData != null) - Text('Hello ${_formData!.name}, whose favorite food is ${_formData!.favoriteFood}.'), + Text( + 'Hello ${_formData!.name}, whose favorite food is ${_formData!.favoriteFood}.', + ), TextButton( onPressed: () async { final FormData formData = - await Navigator.of(context).pushNamed('/two') ?? const FormData(); + await Navigator.of(context).pushNamed('/two') ?? + const FormData(); if (formData != _formData) { setState(() { _formData = formData; @@ -81,14 +86,18 @@ class _PopScopeWrapper extends StatelessWidget { content: const Text('Are you sure you want to leave this page?'), actions: [ TextButton( - style: TextButton.styleFrom(textStyle: Theme.of(context).textTheme.labelLarge), + style: TextButton.styleFrom( + textStyle: Theme.of(context).textTheme.labelLarge, + ), child: const Text('Never mind'), onPressed: () { Navigator.pop(context, false); }, ), TextButton( - style: TextButton.styleFrom(textStyle: Theme.of(context).textTheme.labelLarge), + style: TextButton.styleFrom( + textStyle: Theme.of(context).textTheme.labelLarge, + ), child: const Text('Leave'), onPressed: () { Navigator.pop(context, true); @@ -151,13 +160,17 @@ class _PageTwoBodyState extends State<_PageTwoBody> { child: Column( children: [ TextFormField( - decoration: const InputDecoration(hintText: 'Enter your name.'), + decoration: const InputDecoration( + hintText: 'Enter your name.', + ), onChanged: (String value) { _formData = _formData.copyWith(name: value); }, ), TextFormField( - decoration: const InputDecoration(hintText: 'Enter your favorite food.'), + decoration: const InputDecoration( + hintText: 'Enter your favorite food.', + ), onChanged: (String value) { _formData = _formData.copyWith(favoriteFood: value); }, @@ -186,7 +199,10 @@ class FormData { final String favoriteFood; FormData copyWith({String? name, String? favoriteFood}) { - return FormData(name: name ?? this.name, favoriteFood: favoriteFood ?? this.favoriteFood); + return FormData( + name: name ?? this.name, + favoriteFood: favoriteFood ?? this.favoriteFood, + ); } @override @@ -197,7 +213,9 @@ class FormData { if (other.runtimeType != runtimeType) { return false; } - return other is FormData && other.name == name && other.favoriteFood == favoriteFood; + return other is FormData && + other.name == name && + other.favoriteFood == favoriteFood; } @override diff --git a/examples/api/lib/widgets/preferred_size/preferred_size.0.dart b/examples/api/lib/widgets/preferred_size/preferred_size.0.dart index 996a4a00389..c42c7949793 100644 --- a/examples/api/lib/widgets/preferred_size/preferred_size.0.dart +++ b/examples/api/lib/widgets/preferred_size/preferred_size.0.dart @@ -29,7 +29,10 @@ class AppBarContent extends StatelessWidget { padding: const EdgeInsets.symmetric(horizontal: 10), child: Row( children: [ - const Text('PreferredSize Sample', style: TextStyle(color: Colors.white)), + const Text( + 'PreferredSize Sample', + style: TextStyle(color: Colors.white), + ), const Spacer(), IconButton( icon: const Icon(Icons.search, size: 20), diff --git a/examples/api/lib/widgets/radio_group/radio_group.0.dart b/examples/api/lib/widgets/radio_group/radio_group.0.dart index 519ede3d8c4..cf4cf75d313 100644 --- a/examples/api/lib/widgets/radio_group/radio_group.0.dart +++ b/examples/api/lib/widgets/radio_group/radio_group.0.dart @@ -31,7 +31,9 @@ class RadioExample extends StatelessWidget { @override Widget build(BuildContext context) { - return const Column(children: [SingingCharacterRadioGroup(), GenreRadioGroup()]); + return const Column( + children: [SingingCharacterRadioGroup(), GenreRadioGroup()], + ); } } @@ -39,10 +41,12 @@ class SingingCharacterRadioGroup extends StatefulWidget { const SingingCharacterRadioGroup({super.key}); @override - State createState() => SingingCharacterRadioGroupState(); + State createState() => + SingingCharacterRadioGroupState(); } -class SingingCharacterRadioGroupState extends State { +class SingingCharacterRadioGroupState + extends State { SingingCharacter? _character = SingingCharacter.lafayette; @override diff --git a/examples/api/lib/widgets/raw_menu_anchor/raw_menu_anchor.0.dart b/examples/api/lib/widgets/raw_menu_anchor/raw_menu_anchor.0.dart index 70246e3fb44..9e767b8cf4c 100644 --- a/examples/api/lib/widgets/raw_menu_anchor/raw_menu_anchor.0.dart +++ b/examples/api/lib/widgets/raw_menu_anchor/raw_menu_anchor.0.dart @@ -65,7 +65,10 @@ class _RawMenuAnchorExampleState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Expanded(flex: 3, child: Text(_selectedAnimal?.label ?? 'Select One')), + Expanded( + flex: 3, + child: Text(_selectedAnimal?.label ?? 'Select One'), + ), const Flexible(child: Icon(Icons.arrow_drop_down, size: 16)), ], ), @@ -107,12 +110,17 @@ class CustomMenu extends StatelessWidget { final MenuController controller; final FocusNode focusNode; - static const Map _shortcuts = { - SingleActivator(LogicalKeyboardKey.gameButtonA): ActivateIntent(), - SingleActivator(LogicalKeyboardKey.escape): DismissIntent(), - SingleActivator(LogicalKeyboardKey.arrowDown): DirectionalFocusIntent(TraversalDirection.down), - SingleActivator(LogicalKeyboardKey.arrowUp): DirectionalFocusIntent(TraversalDirection.up), - }; + static const Map _shortcuts = + { + SingleActivator(LogicalKeyboardKey.gameButtonA): ActivateIntent(), + SingleActivator(LogicalKeyboardKey.escape): DismissIntent(), + SingleActivator(LogicalKeyboardKey.arrowDown): DirectionalFocusIntent( + TraversalDirection.down, + ), + SingleActivator(LogicalKeyboardKey.arrowUp): DirectionalFocusIntent( + TraversalDirection.up, + ), + }; @override Widget build(BuildContext context) { @@ -163,20 +171,27 @@ class RawMenuAnchorApp extends StatelessWidget { const RawMenuAnchorApp({super.key}); static const ButtonStyle menuButtonStyle = ButtonStyle( - overlayColor: WidgetStatePropertyAll(Color.fromARGB(55, 139, 195, 255)), + overlayColor: WidgetStatePropertyAll( + Color.fromARGB(55, 139, 195, 255), + ), iconSize: WidgetStatePropertyAll(17), - padding: WidgetStatePropertyAll(EdgeInsets.symmetric(horizontal: 12)), + padding: WidgetStatePropertyAll( + EdgeInsets.symmetric(horizontal: 12), + ), ); @override Widget build(BuildContext context) { return MaterialApp( - theme: ThemeData.from( - colorScheme: ColorScheme.fromSeed( - seedColor: Colors.blue, - dynamicSchemeVariant: DynamicSchemeVariant.vibrant, - ), - ).copyWith(menuButtonTheme: const MenuButtonThemeData(style: menuButtonStyle)), + theme: + ThemeData.from( + colorScheme: ColorScheme.fromSeed( + seedColor: Colors.blue, + dynamicSchemeVariant: DynamicSchemeVariant.vibrant, + ), + ).copyWith( + menuButtonTheme: const MenuButtonThemeData(style: menuButtonStyle), + ), home: const Scaffold(body: Center(child: RawMenuAnchorExample())), ); } diff --git a/examples/api/lib/widgets/raw_menu_anchor/raw_menu_anchor.1.dart b/examples/api/lib/widgets/raw_menu_anchor/raw_menu_anchor.1.dart index cbf44c8567d..5851d991b9f 100644 --- a/examples/api/lib/widgets/raw_menu_anchor/raw_menu_anchor.1.dart +++ b/examples/api/lib/widgets/raw_menu_anchor/raw_menu_anchor.1.dart @@ -59,7 +59,8 @@ class RawMenuAnchorGroupExample extends StatefulWidget { const RawMenuAnchorGroupExample({super.key}); @override - State createState() => _RawMenuAnchorGroupExampleState(); + State createState() => + _RawMenuAnchorGroupExampleState(); } class _RawMenuAnchorGroupExampleState extends State { @@ -86,7 +87,8 @@ class _RawMenuAnchorGroupExampleState extends State { child: Column( mainAxisSize: MainAxisSize.min, children: [ - if (_selected != null) Text('Selected: ${_selected!.label}', style: titleStyle), + if (_selected != null) + Text('Selected: ${_selected!.label}', style: titleStyle), UnconstrainedBox( clipBehavior: Clip.hardEdge, child: RawMenuAnchorGroup( @@ -98,16 +100,20 @@ class _RawMenuAnchorGroupExampleState extends State { focusNode: focusNodes[i], anchor: Builder( builder: (BuildContext context) { - final MenuController submenuController = MenuController.maybeOf(context)!; + final MenuController submenuController = + MenuController.maybeOf(context)!; final MenuItem item = menuItems[i]; - final ButtonStyle openBackground = MenuItemButton.styleFrom( - backgroundColor: const Color(0x0D1A1A1A), - ); + final ButtonStyle openBackground = + MenuItemButton.styleFrom( + backgroundColor: const Color(0x0D1A1A1A), + ); return MergeSemantics( child: Semantics( expanded: controller.isOpen, child: MenuItemButton( - style: submenuController.isOpen ? openBackground : null, + style: submenuController.isOpen + ? openBackground + : null, onHover: (bool value) { // If any submenu in the menu bar is already open, other // submenus should open on hover. Otherwise, blur the menu item @@ -135,7 +141,8 @@ class _RawMenuAnchorGroupExampleState extends State { }, ), children: [ - for (final MenuItem child in menuItems[i].children ?? []) + for (final MenuItem child + in menuItems[i].children ?? []) MenuItemButton( onPressed: () { setState(() { @@ -172,12 +179,17 @@ class CustomSubmenu extends StatefulWidget { final Widget anchor; final FocusNode focusNode; - static const Map _shortcuts = { - SingleActivator(LogicalKeyboardKey.gameButtonA): ActivateIntent(), - SingleActivator(LogicalKeyboardKey.escape): DismissIntent(), - SingleActivator(LogicalKeyboardKey.arrowDown): DirectionalFocusIntent(TraversalDirection.down), - SingleActivator(LogicalKeyboardKey.arrowUp): DirectionalFocusIntent(TraversalDirection.up), - }; + static const Map _shortcuts = + { + SingleActivator(LogicalKeyboardKey.gameButtonA): ActivateIntent(), + SingleActivator(LogicalKeyboardKey.escape): DismissIntent(), + SingleActivator(LogicalKeyboardKey.arrowDown): DirectionalFocusIntent( + TraversalDirection.down, + ), + SingleActivator(LogicalKeyboardKey.arrowUp): DirectionalFocusIntent( + TraversalDirection.up, + ), + }; @override State createState() => _CustomSubmenuState(); @@ -242,7 +254,9 @@ class RawMenuAnchorGroupApp extends StatelessWidget { splashFactory: InkSparkle.splashFactory, iconSize: WidgetStatePropertyAll(17), overlayColor: WidgetStatePropertyAll(Color(0x0D1A1A1A)), - padding: WidgetStatePropertyAll(EdgeInsets.symmetric(horizontal: 12)), + padding: WidgetStatePropertyAll( + EdgeInsets.symmetric(horizontal: 12), + ), textStyle: WidgetStatePropertyAll(TextStyle(fontSize: 14)), visualDensity: VisualDensity( horizontal: VisualDensity.minimumDensity, @@ -253,9 +267,12 @@ class RawMenuAnchorGroupApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( - theme: ThemeData.from( - colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue), - ).copyWith(menuButtonTheme: const MenuButtonThemeData(style: menuButtonStyle)), + theme: + ThemeData.from( + colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue), + ).copyWith( + menuButtonTheme: const MenuButtonThemeData(style: menuButtonStyle), + ), home: const Scaffold(body: RawMenuAnchorGroupExample()), ); } diff --git a/examples/api/lib/widgets/raw_menu_anchor/raw_menu_anchor.2.dart b/examples/api/lib/widgets/raw_menu_anchor/raw_menu_anchor.2.dart index 971ca108c89..8f8f9e19998 100644 --- a/examples/api/lib/widgets/raw_menu_anchor/raw_menu_anchor.2.dart +++ b/examples/api/lib/widgets/raw_menu_anchor/raw_menu_anchor.2.dart @@ -18,10 +18,12 @@ class RawMenuAnchorAnimationExample extends StatefulWidget { const RawMenuAnchorAnimationExample({super.key}); @override - State createState() => _RawMenuAnchorAnimationExampleState(); + State createState() => + _RawMenuAnchorAnimationExampleState(); } -class _RawMenuAnchorAnimationExampleState extends State +class _RawMenuAnchorAnimationExampleState + extends State with SingleTickerProviderStateMixin { late final AnimationController animationController; final MenuController menuController = MenuController(); @@ -31,12 +33,14 @@ class _RawMenuAnchorAnimationExampleState extends State.fromCallback((double value) => clampDouble(value, 0, 1)), + Animatable.fromCallback( + (double value) => clampDouble(value, 0, 1), + ), ), child: Material( elevation: 8, @@ -113,7 +119,10 @@ class _RawMenuAnchorAnimationExampleState extends State with SingleTickerProviderStateMixin { void initState() { super.initState(); animationController = - AnimationController(vsync: this, duration: const Duration(milliseconds: 200)) - ..addStatusListener((AnimationStatus status) { - if (mounted) { - setState(() { - // Rebuild to reflect animation status changes. - }); - } - }); + AnimationController( + vsync: this, + duration: const Duration(milliseconds: 200), + )..addStatusListener((AnimationStatus status) { + if (mounted) { + setState(() { + // Rebuild to reflect animation status changes. + }); + } + }); - animation = CurvedAnimation(parent: animationController, curve: Curves.easeOutQuart); + animation = CurvedAnimation( + parent: animationController, + curve: Curves.easeOutQuart, + ); } @override @@ -217,9 +236,10 @@ class MenuState extends State with SingleTickerProviderStateMixin { ), ); }, - builder: (BuildContext context, MenuController controller, Widget? child) { - return widget.buttonBuilder(context, controller, animationStatus); - }, + builder: + (BuildContext context, MenuController controller, Widget? child) { + return widget.buttonBuilder(context, controller, animationStatus); + }, ), ); } @@ -237,7 +257,9 @@ class RawMenuAnchorSubmenuAnimationApp extends StatelessWidget { dynamicSchemeVariant: DynamicSchemeVariant.vibrant, ), ), - home: const Scaffold(body: Center(child: RawMenuAnchorSubmenuAnimationExample())), + home: const Scaffold( + body: Center(child: RawMenuAnchorSubmenuAnimationExample()), + ), ); } } diff --git a/examples/api/lib/widgets/repeating_animation_builder/repeating_animation_builder.0.dart b/examples/api/lib/widgets/repeating_animation_builder/repeating_animation_builder.0.dart index 868ad1c61d7..b0f5c7b41c3 100644 --- a/examples/api/lib/widgets/repeating_animation_builder/repeating_animation_builder.0.dart +++ b/examples/api/lib/widgets/repeating_animation_builder/repeating_animation_builder.0.dart @@ -17,7 +17,10 @@ class RepeatingAnimationBuilderExampleApp extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( theme: ThemeData.from( - colorScheme: ColorScheme.fromSeed(seedColor: Colors.purple, brightness: Brightness.dark), + colorScheme: ColorScheme.fromSeed( + seedColor: Colors.purple, + brightness: Brightness.dark, + ), useMaterial3: true, ), home: const RepeatingAnimationBuilderExample(), @@ -29,10 +32,12 @@ class RepeatingAnimationBuilderExample extends StatefulWidget { const RepeatingAnimationBuilderExample({super.key}); @override - State createState() => _RepeatingAnimationBuilderExampleState(); + State createState() => + _RepeatingAnimationBuilderExampleState(); } -class _RepeatingAnimationBuilderExampleState extends State { +class _RepeatingAnimationBuilderExampleState + extends State { bool _isPaused = false; bool _isReversing = false; @@ -56,7 +61,10 @@ class _RepeatingAnimationBuilderExampleState extends State[ Center( - child: Transform.rotate(angle: value * 0.5 * math.pi, child: child), + child: Transform.rotate( + angle: value * 0.5 * math.pi, + child: child, + ), ), _buildControls(colors, value), ], @@ -77,7 +85,7 @@ class _RepeatingAnimationBuilderExampleState extends State[ Container( decoration: ShapeDecoration( - color: colors.primaryContainer.withOpacity(0.5), + color: colors.primaryContainer.withValues(alpha: 0.5), shape: StarBorder( points: 8, innerRadiusRatio: 0.7, @@ -98,7 +106,10 @@ class _RepeatingAnimationBuilderExampleState extends State[ - BoxShadow(color: colors.primary.withOpacity(value * 0.7), blurRadius: 25), + BoxShadow( + color: colors.primary.withValues(alpha: value * 0.7), + blurRadius: 25, + ), ], ), child: child, @@ -164,17 +175,26 @@ class _RepeatingAnimationBuilderExampleState extends State with RestorationMixin { +class _RestorableCounterState extends State + with RestorationMixin { // The current value of the counter is stored in a [RestorableProperty]. // During state restoration it is automatically restored to its old value. // If no restoration data is available to restore the counter from, it is @@ -75,7 +76,10 @@ class _RestorableCounterState extends State with RestorationM mainAxisAlignment: MainAxisAlignment.center, children: [ const Text('You have pushed the button this many times:'), - Text('${_counter.value}', style: Theme.of(context).textTheme.headlineMedium), + Text( + '${_counter.value}', + style: Theme.of(context).textTheme.headlineMedium, + ), ], ), ), diff --git a/examples/api/lib/widgets/restoration_properties/restorable_value.0.dart b/examples/api/lib/widgets/restoration_properties/restorable_value.0.dart index db6c38c442c..e2a2ee9cc79 100644 --- a/examples/api/lib/widgets/restoration_properties/restorable_value.0.dart +++ b/examples/api/lib/widgets/restoration_properties/restorable_value.0.dart @@ -32,7 +32,8 @@ class RestorableValueExample extends StatefulWidget { } /// RestorationProperty objects can be used because of RestorationMixin. -class _RestorableValueExampleState extends State with RestorationMixin { +class _RestorableValueExampleState extends State + with RestorationMixin { // In this example, the restoration ID for the mixin is passed in through // the [StatefulWidget]'s constructor. @override @@ -70,7 +71,10 @@ class _RestorableValueExampleState extends State with Re @override Widget build(BuildContext context) { return Center( - child: OutlinedButton(onPressed: _incrementAnswer, child: Text('${_answer.value}')), + child: OutlinedButton( + onPressed: _incrementAnswer, + child: Text('${_answer.value}'), + ), ); } } diff --git a/examples/api/lib/widgets/routes/flexible_route_transitions.0.dart b/examples/api/lib/widgets/routes/flexible_route_transitions.0.dart index 80994b16afd..a94d81519ef 100644 --- a/examples/api/lib/widgets/routes/flexible_route_transitions.0.dart +++ b/examples/api/lib/widgets/routes/flexible_route_transitions.0.dart @@ -200,7 +200,10 @@ class _VerticalPageTransition extends StatelessWidget { end: const Offset(0.0, -1.0), ).chain(CurveTween(curve: _curve)); - return SlideTransition(position: secondaryAnimation.drive(tween), child: child); + return SlideTransition( + position: secondaryAnimation.drive(tween), + child: child, + ); } @override diff --git a/examples/api/lib/widgets/routes/flexible_route_transitions.1.dart b/examples/api/lib/widgets/routes/flexible_route_transitions.1.dart index 7010d4f8f91..7cacfc440ef 100644 --- a/examples/api/lib/widgets/routes/flexible_route_transitions.1.dart +++ b/examples/api/lib/widgets/routes/flexible_route_transitions.1.dart @@ -18,7 +18,8 @@ void main() { class FlexibleRouteTransitionsApp extends StatelessWidget { FlexibleRouteTransitionsApp({super.key}); - final _MyRouteInformationParser _routeInformationParser = _MyRouteInformationParser(); + final _MyRouteInformationParser _routeInformationParser = + _MyRouteInformationParser(); final MyRouterDelegate _routerDelegate = MyRouterDelegate(); @override @@ -43,11 +44,16 @@ class FlexibleRouteTransitionsApp extends StatelessWidget { } } -class _MyRouteInformationParser extends RouteInformationParser { +class _MyRouteInformationParser + extends RouteInformationParser { @override - SynchronousFuture parseRouteInformation(RouteInformation routeInformation) { + SynchronousFuture parseRouteInformation( + RouteInformation routeInformation, + ) { return SynchronousFuture( - MyPageConfiguration.values.firstWhere((MyPageConfiguration pageConfiguration) { + MyPageConfiguration.values.firstWhere(( + MyPageConfiguration pageConfiguration, + ) { return pageConfiguration.uriString == routeInformation.uri.toString(); }, orElse: () => MyPageConfiguration.unknown), ); @@ -128,10 +134,14 @@ class MyRouterDelegate extends RouterDelegate { .map( (MyPageConfiguration page) => switch (page) { MyPageConfiguration.unknown => _MyUnknownPage(), - MyPageConfiguration.home => _MyHomePage(routerDelegate: this), + MyPageConfiguration.home => _MyHomePage( + routerDelegate: this, + ), MyPageConfiguration.zoom => _ZoomPage(routerDelegate: this), MyPageConfiguration.iOS => _IOSPage(routerDelegate: this), - MyPageConfiguration.vertical => _VerticalPage(routerDelegate: this), + MyPageConfiguration.vertical => _VerticalPage( + routerDelegate: this, + ), }, ) .toList(), @@ -170,7 +180,10 @@ class _ZoomPage extends MaterialPage { _ZoomPage({required this.routerDelegate}) : super( restorationId: 'zoom-page', - child: _MyPageScaffold(title: 'Zoom Route', routerDelegate: routerDelegate), + child: _MyPageScaffold( + title: 'Zoom Route', + routerDelegate: routerDelegate, + ), ); final MyRouterDelegate routerDelegate; @@ -183,7 +196,10 @@ class _IOSPage extends CupertinoPage { _IOSPage({required this.routerDelegate}) : super( restorationId: 'ios-page', - child: _MyPageScaffold(title: 'Cupertino Route', routerDelegate: routerDelegate), + child: _MyPageScaffold( + title: 'Cupertino Route', + routerDelegate: routerDelegate, + ), ); final MyRouterDelegate routerDelegate; @@ -196,7 +212,10 @@ class _VerticalPage extends _VerticalTransitionPage { _VerticalPage({required this.routerDelegate}) : super( restorationId: 'vertical-page', - child: _MyPageScaffold(title: 'Vertical Route', routerDelegate: routerDelegate), + child: _MyPageScaffold( + title: 'Vertical Route', + routerDelegate: routerDelegate, + ), ); final MyRouterDelegate routerDelegate; @@ -278,10 +297,13 @@ class _VerticalTransitionPage extends Page { } class _PageBasedVerticalPageRoute extends PageRoute { - _PageBasedVerticalPageRoute({required _VerticalTransitionPage page, super.allowSnapshotting}) - : super(settings: page); + _PageBasedVerticalPageRoute({ + required _VerticalTransitionPage page, + super.allowSnapshotting, + }) : super(settings: page); - _VerticalTransitionPage get _page => settings as _VerticalTransitionPage; + _VerticalTransitionPage get _page => + settings as _VerticalTransitionPage; @override bool get maintainState => _page.maintainState; @@ -388,7 +410,10 @@ class _VerticalPageTransition extends StatelessWidget { end: const Offset(0.0, -1.0), ).chain(CurveTween(curve: _curve)); - return SlideTransition(position: secondaryAnimation.drive(tween), child: child); + return SlideTransition( + position: secondaryAnimation.drive(tween), + child: child, + ); } @override @@ -423,7 +448,9 @@ enum MyPageConfiguration { final String uriString; static MyPageConfiguration fromName(String testName) { - return values.firstWhere((MyPageConfiguration page) => page.name == testName); + return values.firstWhere( + (MyPageConfiguration page) => page.name == testName, + ); } Uri get uri => Uri.parse(uriString); diff --git a/examples/api/lib/widgets/routes/popup_route.0.dart b/examples/api/lib/widgets/routes/popup_route.0.dart index 379391a9b90..555efae0d7b 100644 --- a/examples/api/lib/widgets/routes/popup_route.0.dart +++ b/examples/api/lib/widgets/routes/popup_route.0.dart @@ -67,10 +67,16 @@ class DismissibleDialog extends PopupRoute { child: UnconstrainedBox( child: Container( padding: const EdgeInsets.all(20.0), - decoration: BoxDecoration(borderRadius: BorderRadius.circular(10), color: Colors.white), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.white, + ), child: Column( children: [ - Text('Dismissible Dialog', style: Theme.of(context).textTheme.headlineSmall), + Text( + 'Dismissible Dialog', + style: Theme.of(context).textTheme.headlineSmall, + ), const SizedBox(height: 20), const Text('Tap in the scrim or press escape key to dismiss.'), ], diff --git a/examples/api/lib/widgets/routes/route_observer.0.dart b/examples/api/lib/widgets/routes/route_observer.0.dart index 4a8002c62b6..fdb44fdce45 100644 --- a/examples/api/lib/widgets/routes/route_observer.0.dart +++ b/examples/api/lib/widgets/routes/route_observer.0.dart @@ -6,7 +6,8 @@ import 'package:flutter/material.dart'; /// Flutter code sample for [RouteObserver]. -final RouteObserver> routeObserver = RouteObserver>(); +final RouteObserver> routeObserver = + RouteObserver>(); void main() { runApp(const RouteObserverApp()); @@ -31,7 +32,8 @@ class RouteObserverExample extends StatefulWidget { State createState() => _RouteObserverExampleState(); } -class _RouteObserverExampleState extends State with RouteAware { +class _RouteObserverExampleState extends State + with RouteAware { List log = []; @override @@ -65,7 +67,10 @@ class _RouteObserverExampleState extends State with RouteA child: Column( mainAxisSize: MainAxisSize.min, children: [ - Text('RouteObserver log:', style: Theme.of(context).textTheme.headlineSmall), + Text( + 'RouteObserver log:', + style: Theme.of(context).textTheme.headlineSmall, + ), ConstrainedBox( constraints: const BoxConstraints(maxHeight: 300.0), child: ListView.builder( @@ -81,7 +86,9 @@ class _RouteObserverExampleState extends State with RouteA OutlinedButton( onPressed: () { Navigator.of(context).push( - MaterialPageRoute(builder: (BuildContext context) => const NextPage()), + MaterialPageRoute( + builder: (BuildContext context) => const NextPage(), + ), ); }, child: const Text('Go to next page'), diff --git a/examples/api/lib/widgets/routes/show_general_dialog.0.dart b/examples/api/lib/widgets/routes/show_general_dialog.0.dart index e5e962bacd8..0e1869a64ca 100644 --- a/examples/api/lib/widgets/routes/show_general_dialog.0.dart +++ b/examples/api/lib/widgets/routes/show_general_dialog.0.dart @@ -13,7 +13,10 @@ class GeneralDialogApp extends StatelessWidget { @override Widget build(BuildContext context) { - return const MaterialApp(restorationScopeId: 'app', home: GeneralDialogExample()); + return const MaterialApp( + restorationScopeId: 'app', + home: GeneralDialogExample(), + ); } } @@ -36,7 +39,10 @@ class GeneralDialogExample extends StatelessWidget { } @pragma('vm:entry-point') - static Route _dialogBuilder(BuildContext context, Object? arguments) { + static Route _dialogBuilder( + BuildContext context, + Object? arguments, + ) { return RawDialogRoute( pageBuilder: ( diff --git a/examples/api/lib/widgets/safe_area/safe_area.0.dart b/examples/api/lib/widgets/safe_area/safe_area.0.dart index 871e2fa05ed..74db27dd591 100644 --- a/examples/api/lib/widgets/safe_area/safe_area.0.dart +++ b/examples/api/lib/widgets/safe_area/safe_area.0.dart @@ -45,7 +45,11 @@ class SafeAreaExampleApp extends StatelessWidget { builder: (BuildContext context) => Scaffold( appBar: Toggle.appBar.of(context) ? appBar : null, body: const DefaultTextStyle( - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Colors.black), + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + color: Colors.black, + ), child: Center(child: SafeAreaExample()), ), ), @@ -90,7 +94,10 @@ sealed class Value implements Enum { List get controls; - static const List allValues = [...Inset.values, ...Toggle.values]; + static const List allValues = [ + ...Inset.values, + ...Toggle.values, + ]; } enum Inset implements Value { @@ -109,7 +116,8 @@ enum Inset implements Value { bottom => model.insets.bottom, }; - double of(BuildContext context) => _getValue(Model.of<_InsetModel>(context, this)); + double of(BuildContext context) => + _getValue(Model.of<_InsetModel>(context, this)); @override List get controls => [ @@ -141,7 +149,8 @@ enum Toggle implements Value { safeArea => model.buildSafeArea, }; - bool of(BuildContext context) => _getValue(Model.of<_ToggleModel>(context, this)); + bool of(BuildContext context) => + _getValue(Model.of<_ToggleModel>(context, this)); @override List get controls => [ @@ -169,7 +178,9 @@ abstract class Model extends InheritedModel { @override bool updateShouldNotifyDependent(Model oldWidget, Set dependencies) { - return dependencies.any((E data) => data._getValue(this) != data._getValue(oldWidget)); + return dependencies.any( + (E data) => data._getValue(this) != data._getValue(oldWidget), + ); } } diff --git a/examples/api/lib/widgets/scroll_end_notification/scroll_end_notification.0.dart b/examples/api/lib/widgets/scroll_end_notification/scroll_end_notification.0.dart index 43ce03215d5..5266089c8fe 100644 --- a/examples/api/lib/widgets/scroll_end_notification/scroll_end_notification.0.dart +++ b/examples/api/lib/widgets/scroll_end_notification/scroll_end_notification.0.dart @@ -24,10 +24,12 @@ class ScrollEndNotificationExample extends StatefulWidget { const ScrollEndNotificationExample({super.key}); @override - State createState() => _ScrollEndNotificationExampleState(); + State createState() => + _ScrollEndNotificationExampleState(); } -class _ScrollEndNotificationExampleState extends State { +class _ScrollEndNotificationExampleState + extends State { static const int itemCount = 25; static const double itemExtent = 100; @@ -58,13 +60,13 @@ class _ScrollEndNotificationExampleState extends State 0 && (scrollOffset - lastScrollOffset).abs() > itemExtent) { + if (scrollOffset > 0 && + (scrollOffset - lastScrollOffset).abs() > itemExtent) { SchedulerBinding.instance.addPostFrameCallback((Duration duration) { scrollController.animateTo( alignedScrollOffset, @@ -97,7 +99,11 @@ class _ScrollEndNotificationExampleState extends State createState() => _SliverAutoScrollExampleState(); + State createState() => + _SliverAutoScrollExampleState(); } class _SliverAutoScrollExampleState extends State { @@ -61,7 +62,8 @@ class _SliverAutoScrollExampleState extends State { final SliverGeometry geometry = alignedItem.geometry!; final double sliverOffset = constraints.scrollOffset; - if ((scrollController.offset - lastScrollOffset).abs() <= geometry.maxPaintExtent) { + if ((scrollController.offset - lastScrollOffset).abs() <= + geometry.maxPaintExtent) { // Ignore scrolls that are smaller than the aligned item's extent. return; } @@ -111,12 +113,18 @@ class _SliverAutoScrollExampleState extends State { child: CustomScrollView( controller: scrollController, slivers: [ - const SliverPadding(padding: horizontalPadding, sliver: ItemList(itemCount: 15)), + const SliverPadding( + padding: horizontalPadding, + sliver: ItemList(itemCount: 15), + ), SliverPadding( padding: horizontalPadding, sliver: BigOrangeSliver(sliverChildKey: alignedItemKey), ), - const SliverPadding(padding: horizontalPadding, sliver: ItemList(itemCount: 25)), + const SliverPadding( + padding: horizontalPadding, + sliver: ItemList(itemCount: 25), + ), ], ), ), diff --git a/examples/api/lib/widgets/scroll_notification_observer/scroll_notification_observer.0.dart b/examples/api/lib/widgets/scroll_notification_observer/scroll_notification_observer.0.dart index e8ff62b0777..c3c6e1f18c9 100644 --- a/examples/api/lib/widgets/scroll_notification_observer/scroll_notification_observer.0.dart +++ b/examples/api/lib/widgets/scroll_notification_observer/scroll_notification_observer.0.dart @@ -39,7 +39,8 @@ class ScrollNotificationObserverExample extends StatefulWidget { _ScrollNotificationObserverExampleState(); } -class _ScrollNotificationObserverExampleState extends State { +class _ScrollNotificationObserverExampleState + extends State { ScrollNotificationObserverState? _scrollNotificationObserver; ScrollController controller = ScrollController(); bool _scrolledDown = false; @@ -105,7 +106,10 @@ class _ScrollNotificationObserverExampleState extends State[Icon(Icons.arrow_upward_rounded), Text('Scroll to top')], + children: [ + Icon(Icons.arrow_upward_rounded), + Text('Scroll to top'), + ], ), ), ), diff --git a/examples/api/lib/widgets/scroll_position/is_scrolling_listener.0.dart b/examples/api/lib/widgets/scroll_position/is_scrolling_listener.0.dart index d8574ac813d..175e0644798 100644 --- a/examples/api/lib/widgets/scroll_position/is_scrolling_listener.0.dart +++ b/examples/api/lib/widgets/scroll_position/is_scrolling_listener.0.dart @@ -23,10 +23,12 @@ class IsScrollingListenerExample extends StatefulWidget { const IsScrollingListenerExample({super.key}); @override - State createState() => _IsScrollingListenerExampleState(); + State createState() => + _IsScrollingListenerExampleState(); } -class _IsScrollingListenerExampleState extends State { +class _IsScrollingListenerExampleState + extends State { static const int itemCount = 25; static const double itemExtent = 100; @@ -59,7 +61,8 @@ class _IsScrollingListenerExampleState extends State // zero or change the scroll offset by less than itemExtent don't trigger // an auto-scroll. void handleScrollChange() { - final bool isScrollingNow = scrollController.position.isScrollingNotifier.value; + final bool isScrollingNow = + scrollController.position.isScrollingNotifier.value; if (isScrolling == isScrollingNow) { return; } @@ -70,13 +73,13 @@ class _IsScrollingListenerExampleState extends State } else { // scroll-end final ScrollPosition p = scrollController.position; - final int lastIndex = ((p.extentBefore + p.extentInside) ~/ itemExtent).clamp( - 0, - itemCount - 1, - ); - final double alignedScrollOffset = itemExtent * (lastIndex + 1) - p.extentInside; + final int lastIndex = ((p.extentBefore + p.extentInside) ~/ itemExtent) + .clamp(0, itemCount - 1); + final double alignedScrollOffset = + itemExtent * (lastIndex + 1) - p.extentInside; final double scrollOffset = scrollController.position.pixels; - if (scrollOffset > 0 && (scrollOffset - lastScrollOffset).abs() > itemExtent) { + if (scrollOffset > 0 && + (scrollOffset - lastScrollOffset).abs() > itemExtent) { SchedulerBinding.instance.addPostFrameCallback((Duration duration) { scrollController.animateTo( alignedScrollOffset, @@ -106,7 +109,11 @@ class _IsScrollingListenerExampleState extends State itemBuilder: (BuildContext context, int index) { return Item( title: 'Item $index', - color: Color.lerp(Colors.red, Colors.blue, index / itemCount)!, + color: Color.lerp( + Colors.red, + Colors.blue, + index / itemCount, + )!, ); }, ), diff --git a/examples/api/lib/widgets/scroll_position/scroll_controller_notification.0.dart b/examples/api/lib/widgets/scroll_position/scroll_controller_notification.0.dart index e1878436455..8c24a5805fd 100644 --- a/examples/api/lib/widgets/scroll_position/scroll_controller_notification.0.dart +++ b/examples/api/lib/widgets/scroll_position/scroll_controller_notification.0.dart @@ -69,11 +69,15 @@ class _ScrollNotificationDemoState extends State { itemCount: 50, itemBuilder: (_, int index) { return Padding( - padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 20.0), + padding: const EdgeInsets.symmetric( + vertical: 8.0, + horizontal: 20.0, + ), child: Text('Item $index'), ); }, - separatorBuilder: (_, _) => const Divider(indent: 20, endIndent: 20, thickness: 2), + separatorBuilder: (_, _) => + const Divider(indent: 20, endIndent: 20, thickness: 2), ), ], ); @@ -89,7 +93,9 @@ class _ScrollNotificationDemoState extends State { } return MaterialApp( - theme: ThemeData.from(colorScheme: ColorScheme.fromSeed(seedColor: Colors.blueGrey)), + theme: ThemeData.from( + colorScheme: ColorScheme.fromSeed(seedColor: Colors.blueGrey), + ), home: Scaffold( appBar: AppBar( title: const Text('Listening to a ScrollPosition'), @@ -98,7 +104,8 @@ class _ScrollNotificationDemoState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - if (!_useController) Text('Last notification: ${_lastNotification.runtimeType}'), + if (!_useController) + Text('Last notification: ${_lastNotification.runtimeType}'), if (!_useController) const SizedBox.square(dimension: 10), Row( mainAxisAlignment: MainAxisAlignment.center, @@ -106,13 +113,25 @@ class _ScrollNotificationDemoState extends State { const Text('with:'), Radio( value: true, + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use groupValue: _useController, + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use onChanged: _handleRadioChange, ), const Text('ScrollController'), Radio( value: false, + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use groupValue: _useController, + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use onChanged: _handleRadioChange, ), const Text('NotificationListener'), diff --git a/examples/api/lib/widgets/scroll_position/scroll_controller_on_attach.0.dart b/examples/api/lib/widgets/scroll_position/scroll_controller_on_attach.0.dart index 4c341f4fb78..fd33ae3c532 100644 --- a/examples/api/lib/widgets/scroll_position/scroll_controller_on_attach.0.dart +++ b/examples/api/lib/widgets/scroll_position/scroll_controller_on_attach.0.dart @@ -60,8 +60,8 @@ class _ScrollControllerDemoState extends State { appBar: AppBar( title: Text(isScrolling ? 'Scrolling' : 'Not Scrolling'), backgroundColor: isScrolling - ? Colors.green[800]!.withOpacity(.85) - : Colors.redAccent[700]!.withOpacity(.85), + ? Colors.green[800]!.withValues(alpha: .85) + : Colors.redAccent[700]!.withValues(alpha: .85), ), // ListView.builder works very similarly to this example with // CustomScrollView & SliverList. @@ -79,12 +79,21 @@ class _ScrollControllerDemoState extends State { decoration: BoxDecoration( color: Colors.blueGrey[50], boxShadow: const [ - BoxShadow(color: Colors.black12, offset: Offset(5, 5), blurRadius: 5), + BoxShadow( + color: Colors.black12, + offset: Offset(5, 5), + blurRadius: 5, + ), ], - borderRadius: const BorderRadius.all(Radius.circular(10)), + borderRadius: const BorderRadius.all( + Radius.circular(10), + ), ), child: Padding( - padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 20.0), + padding: const EdgeInsets.symmetric( + vertical: 12.0, + horizontal: 20.0, + ), child: Text('Item $index'), ), ), diff --git a/examples/api/lib/widgets/scroll_position/scroll_metrics_notification.0.dart b/examples/api/lib/widgets/scroll_position/scroll_metrics_notification.0.dart index 74edb0051f9..558ca82a327 100644 --- a/examples/api/lib/widgets/scroll_position/scroll_metrics_notification.0.dart +++ b/examples/api/lib/widgets/scroll_position/scroll_metrics_notification.0.dart @@ -31,9 +31,9 @@ class ScrollMetricsDemoState extends State { ), body: NotificationListener( onNotification: (ScrollMetricsNotification notification) { - ScaffoldMessenger.of( - notification.context, - ).showSnackBar(const SnackBar(content: Text('Scroll metrics changed!'))); + ScaffoldMessenger.of(notification.context).showSnackBar( + const SnackBar(content: Text('Scroll metrics changed!')), + ); return false; }, child: Scrollbar( @@ -41,7 +41,10 @@ class ScrollMetricsDemoState extends State { child: SizedBox( height: windowSize, width: double.infinity, - child: const SingleChildScrollView(primary: true, child: FlutterLogo(size: 300.0)), + child: const SingleChildScrollView( + primary: true, + child: FlutterLogo(size: 300.0), + ), ), ), ), diff --git a/examples/api/lib/widgets/scroll_view/custom_scroll_view.1.dart b/examples/api/lib/widgets/scroll_view/custom_scroll_view.1.dart index 1b96f4203f0..fea93e53bd8 100644 --- a/examples/api/lib/widgets/scroll_view/custom_scroll_view.1.dart +++ b/examples/api/lib/widgets/scroll_view/custom_scroll_view.1.dart @@ -21,7 +21,8 @@ class CustomScrollViewExample extends StatefulWidget { const CustomScrollViewExample({super.key}); @override - State createState() => _CustomScrollViewExampleState(); + State createState() => + _CustomScrollViewExampleState(); } class _CustomScrollViewExampleState extends State { diff --git a/examples/api/lib/widgets/scroll_view/grid_view.0.dart b/examples/api/lib/widgets/scroll_view/grid_view.0.dart index be5ec3c3251..07c412494b6 100644 --- a/examples/api/lib/widgets/scroll_view/grid_view.0.dart +++ b/examples/api/lib/widgets/scroll_view/grid_view.0.dart @@ -30,18 +30,24 @@ class GridViewExampleApp extends StatelessWidget { final math.Random random = math.Random(index); return GridTile( header: GridTileBar( - title: Text('$index', style: const TextStyle(color: Colors.black)), + title: Text( + '$index', + style: const TextStyle(color: Colors.black), + ), ), child: Container( margin: const EdgeInsets.all(12.0), decoration: ShapeDecoration( - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12.0), + ), gradient: const RadialGradient( colors: [Color(0x0F88EEFF), Color(0x2F0099BB)], ), ), child: FlutterLogo( - style: FlutterLogoStyle.values[random.nextInt(FlutterLogoStyle.values.length)], + style: FlutterLogoStyle + .values[random.nextInt(FlutterLogoStyle.values.length)], ), ), ); @@ -72,7 +78,8 @@ class CustomGridDelegate extends SliverGridDelegate { final double squareDimension = constraints.crossAxisExtent / count; return CustomGridLayout( crossAxisCount: count, - fullRowPeriod: 3, // Number of rows per block (one of which is the full row). + fullRowPeriod: + 3, // Number of rows per block (one of which is the full row). dimension: squareDimension, ); } diff --git a/examples/api/lib/widgets/scroll_view/list_view.0.dart b/examples/api/lib/widgets/scroll_view/list_view.0.dart index b5a5d4b33da..e81463c20bf 100644 --- a/examples/api/lib/widgets/scroll_view/list_view.0.dart +++ b/examples/api/lib/widgets/scroll_view/list_view.0.dart @@ -85,12 +85,21 @@ class ListTileSelectExampleState extends State { if (isSelectionMode) TextButton( child: !_selectAll - ? const Text('select all', style: TextStyle(color: Colors.white)) - : const Text('unselect all', style: TextStyle(color: Colors.white)), + ? const Text( + 'select all', + style: TextStyle(color: Colors.white), + ) + : const Text( + 'unselect all', + style: TextStyle(color: Colors.white), + ), onPressed: () { _selectAll = !_selectAll; setState(() { - _selected = List.generate(listLength, (_) => _selectAll); + _selected = List.generate( + listLength, + (_) => _selectAll, + ); }); }, ), @@ -148,7 +157,9 @@ class GridBuilderState extends State { Widget build(BuildContext context) { return GridView.builder( itemCount: widget.selectedList.length, - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2), + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + ), itemBuilder: (_, int index) { return InkWell( onTap: () => _toggle(index), @@ -217,7 +228,10 @@ class _ListBuilderState extends State { } }, trailing: widget.isSelectionMode - ? Checkbox(value: widget.selectedList[index], onChanged: (bool? x) => _toggle(index)) + ? Checkbox( + value: widget.selectedList[index], + onChanged: (bool? x) => _toggle(index), + ) : const SizedBox.shrink(), title: Text('item $index'), ); diff --git a/examples/api/lib/widgets/scroll_view/list_view.1.dart b/examples/api/lib/widgets/scroll_view/list_view.1.dart index 2d943d105a8..485cdea7c85 100644 --- a/examples/api/lib/widgets/scroll_view/list_view.1.dart +++ b/examples/api/lib/widgets/scroll_view/list_view.1.dart @@ -39,7 +39,10 @@ class _ListViewExampleState extends State { child: ListView.custom( childrenDelegate: SliverChildBuilderDelegate( (BuildContext context, int index) { - return KeepAliveItem(data: items[index], key: ValueKey(items[index])); + return KeepAliveItem( + data: items[index], + key: ValueKey(items[index]), + ); }, childCount: items.length, findChildIndexCallback: (Key key) { @@ -58,7 +61,10 @@ class _ListViewExampleState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - TextButton(onPressed: () => _reverse(), child: const Text('Reverse items')), + TextButton( + onPressed: () => _reverse(), + child: const Text('Reverse items'), + ), ], ), ), @@ -75,7 +81,8 @@ class KeepAliveItem extends StatefulWidget { State createState() => _KeepAliveItemState(); } -class _KeepAliveItemState extends State with AutomaticKeepAliveClientMixin { +class _KeepAliveItemState extends State + with AutomaticKeepAliveClientMixin { @override bool get wantKeepAlive => true; diff --git a/examples/api/lib/widgets/scrollbar/raw_scrollbar.0.dart b/examples/api/lib/widgets/scrollbar/raw_scrollbar.0.dart index 0cd15bbc79e..0a961063e43 100644 --- a/examples/api/lib/widgets/scrollbar/raw_scrollbar.0.dart +++ b/examples/api/lib/widgets/scrollbar/raw_scrollbar.0.dart @@ -81,7 +81,9 @@ class _RawScrollbarExampleState extends State { itemBuilder: (BuildContext context, int index) { return Container( height: 50, - color: index.isEven ? Colors.amberAccent : Colors.blueAccent, + color: index.isEven + ? Colors.amberAccent + : Colors.blueAccent, child: Padding( padding: const EdgeInsets.all(8.0), child: Text('Scrollable 2 : Index $index'), diff --git a/examples/api/lib/widgets/scrollbar/raw_scrollbar.1.dart b/examples/api/lib/widgets/scrollbar/raw_scrollbar.1.dart index 0d62bcaa7f4..90bc7a1d7ec 100644 --- a/examples/api/lib/widgets/scrollbar/raw_scrollbar.1.dart +++ b/examples/api/lib/widgets/scrollbar/raw_scrollbar.1.dart @@ -30,7 +30,9 @@ class RawScrollbarExample extends StatelessWidget { return RawScrollbar( child: GridView.builder( itemCount: 120, - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3), + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, + ), itemBuilder: (BuildContext context, int index) { return Center(child: Text('item $index')); }, diff --git a/examples/api/lib/widgets/scrollbar/raw_scrollbar.2.dart b/examples/api/lib/widgets/scrollbar/raw_scrollbar.2.dart index c025628a559..b7ae22515cd 100644 --- a/examples/api/lib/widgets/scrollbar/raw_scrollbar.2.dart +++ b/examples/api/lib/widgets/scrollbar/raw_scrollbar.2.dart @@ -46,7 +46,9 @@ class _RawScrollbarExampleState extends State { child: GridView.builder( controller: _controller, itemCount: 120, - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3), + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, + ), itemBuilder: (BuildContext context, int index) { return Center(child: Text('item $index')); }, diff --git a/examples/api/lib/widgets/scrollbar/raw_scrollbar.desktop.0.dart b/examples/api/lib/widgets/scrollbar/raw_scrollbar.desktop.0.dart index 5125b7fbe3e..a363c64b255 100644 --- a/examples/api/lib/widgets/scrollbar/raw_scrollbar.desktop.0.dart +++ b/examples/api/lib/widgets/scrollbar/raw_scrollbar.desktop.0.dart @@ -78,7 +78,9 @@ class _DesktopExampleState extends State { thickness: 20.0, thumbVisibility: true, child: ScrollConfiguration( - behavior: ScrollConfiguration.of(context).copyWith(scrollbars: false), + behavior: ScrollConfiguration.of( + context, + ).copyWith(scrollbars: false), child: ListView.builder( primary: true, itemCount: 100, diff --git a/examples/api/lib/widgets/scrollbar/raw_scrollbar.shape.0.dart b/examples/api/lib/widgets/scrollbar/raw_scrollbar.shape.0.dart index d76de81cd6c..14d0b780d54 100644 --- a/examples/api/lib/widgets/scrollbar/raw_scrollbar.shape.0.dart +++ b/examples/api/lib/widgets/scrollbar/raw_scrollbar.shape.0.dart @@ -24,7 +24,9 @@ class ShapeExample extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( body: RawScrollbar( - shape: const StadiumBorder(side: BorderSide(color: Colors.brown, width: 3.0)), + shape: const StadiumBorder( + side: BorderSide(color: Colors.brown, width: 3.0), + ), thickness: 15.0, thumbColor: Colors.blue, thumbVisibility: true, @@ -35,7 +37,10 @@ class ShapeExample extends StatelessWidget { // PrimaryScrollController requires ScrollView.primary be set. primary: true, physics: const BouncingScrollPhysics(), - children: List.generate(100, (int index) => Text((index * index).toString())), + children: List.generate( + 100, + (int index) => Text((index * index).toString()), + ), ), ), ); diff --git a/examples/api/lib/widgets/shared_app_data/shared_app_data.1.dart b/examples/api/lib/widgets/shared_app_data/shared_app_data.1.dart index f518ffa3280..bef361743d4 100644 --- a/examples/api/lib/widgets/shared_app_data/shared_app_data.1.dart +++ b/examples/api/lib/widgets/shared_app_data/shared_app_data.1.dart @@ -63,7 +63,11 @@ class SharedObject { static void reset(BuildContext context) { // Calling SharedAppData.setValue() causes dependent widgets to be rebuilt. - SharedAppData.setValue(context, _sharedObjectKey, SharedObject._()); + SharedAppData.setValue( + context, + _sharedObjectKey, + SharedObject._(), + ); } static SharedObject of(BuildContext context) { diff --git a/examples/api/lib/widgets/shortcuts/callback_shortcuts.0.dart b/examples/api/lib/widgets/shortcuts/callback_shortcuts.0.dart index 5b958a335f1..c41f088a78a 100644 --- a/examples/api/lib/widgets/shortcuts/callback_shortcuts.0.dart +++ b/examples/api/lib/widgets/shortcuts/callback_shortcuts.0.dart @@ -27,7 +27,8 @@ class CallbackShortcutsExample extends StatefulWidget { const CallbackShortcutsExample({super.key}); @override - State createState() => _CallbackShortcutsExampleState(); + State createState() => + _CallbackShortcutsExampleState(); } class _CallbackShortcutsExampleState extends State { diff --git a/examples/api/lib/widgets/shortcuts/character_activator.0.dart b/examples/api/lib/widgets/shortcuts/character_activator.0.dart index 6e7a7fd1571..6f6ff1be7f2 100644 --- a/examples/api/lib/widgets/shortcuts/character_activator.0.dart +++ b/examples/api/lib/widgets/shortcuts/character_activator.0.dart @@ -30,28 +30,33 @@ class CharacterActivatorExample extends StatefulWidget { const CharacterActivatorExample({super.key}); @override - State createState() => _CharacterActivatorExampleState(); + State createState() => + _CharacterActivatorExampleState(); } class _CharacterActivatorExampleState extends State { @override Widget build(BuildContext context) { return Shortcuts( - shortcuts: const {CharacterActivator('?'): HelpMenuIntent()}, + shortcuts: const { + CharacterActivator('?'): HelpMenuIntent(), + }, child: Actions( actions: >{ HelpMenuIntent: CallbackAction( onInvoke: (HelpMenuIntent intent) { - ScaffoldMessenger.of( - context, - ).showSnackBar(const SnackBar(content: Text('Keep calm and carry on!'))); + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar(content: Text('Keep calm and carry on!')), + ); return null; }, ), }, child: const Focus( autofocus: true, - child: Column(children: [Text('Press question mark for help')]), + child: Column( + children: [Text('Press question mark for help')], + ), ), ), ); diff --git a/examples/api/lib/widgets/shortcuts/shortcuts.0.dart b/examples/api/lib/widgets/shortcuts/shortcuts.0.dart index 76c28ca1643..ea20dddabf1 100644 --- a/examples/api/lib/widgets/shortcuts/shortcuts.0.dart +++ b/examples/api/lib/widgets/shortcuts/shortcuts.0.dart @@ -66,7 +66,9 @@ class _ShortcutsExampleState extends State { child: Column( children: [ const Text('Add to the counter by pressing the up arrow key'), - const Text('Subtract from the counter by pressing the down arrow key'), + const Text( + 'Subtract from the counter by pressing the down arrow key', + ), Text('count: $count'), ], ), diff --git a/examples/api/lib/widgets/shortcuts/shortcuts.1.dart b/examples/api/lib/widgets/shortcuts/shortcuts.1.dart index f72d8aab5db..1b518db8452 100644 --- a/examples/api/lib/widgets/shortcuts/shortcuts.1.dart +++ b/examples/api/lib/widgets/shortcuts/shortcuts.1.dart @@ -97,7 +97,9 @@ class _ShortcutsExampleState extends State { child: Column( children: [ const Text('Add to the counter by pressing the up arrow key'), - const Text('Subtract from the counter by pressing the down arrow key'), + const Text( + 'Subtract from the counter by pressing the down arrow key', + ), ListenableBuilder( listenable: model, builder: (BuildContext context, Widget? child) { diff --git a/examples/api/lib/widgets/shortcuts/single_activator.0.dart b/examples/api/lib/widgets/shortcuts/single_activator.0.dart index a160a8ce689..b5b2267ee6e 100644 --- a/examples/api/lib/widgets/shortcuts/single_activator.0.dart +++ b/examples/api/lib/widgets/shortcuts/single_activator.0.dart @@ -41,7 +41,8 @@ class _SingleActivatorExampleState extends State { Widget build(BuildContext context) { return Shortcuts( shortcuts: const { - SingleActivator(LogicalKeyboardKey.keyC, control: true): IncrementIntent(), + SingleActivator(LogicalKeyboardKey.keyC, control: true): + IncrementIntent(), }, child: Actions( actions: >{ diff --git a/examples/api/lib/widgets/single_child_scroll_view/single_child_scroll_view.0.dart b/examples/api/lib/widgets/single_child_scroll_view/single_child_scroll_view.0.dart index 8fbf1898fd8..609b586d2f8 100644 --- a/examples/api/lib/widgets/single_child_scroll_view/single_child_scroll_view.0.dart +++ b/examples/api/lib/widgets/single_child_scroll_view/single_child_scroll_view.0.dart @@ -28,7 +28,9 @@ class SingleChildScrollViewExample extends StatelessWidget { builder: (BuildContext context, BoxConstraints viewportConstraints) { return SingleChildScrollView( child: ConstrainedBox( - constraints: BoxConstraints(minHeight: viewportConstraints.maxHeight), + constraints: BoxConstraints( + minHeight: viewportConstraints.maxHeight, + ), child: Column( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.spaceAround, diff --git a/examples/api/lib/widgets/single_child_scroll_view/single_child_scroll_view.1.dart b/examples/api/lib/widgets/single_child_scroll_view/single_child_scroll_view.1.dart index 0924e033e71..739d62efd18 100644 --- a/examples/api/lib/widgets/single_child_scroll_view/single_child_scroll_view.1.dart +++ b/examples/api/lib/widgets/single_child_scroll_view/single_child_scroll_view.1.dart @@ -28,7 +28,9 @@ class SingleChildScrollViewExample extends StatelessWidget { builder: (BuildContext context, BoxConstraints viewportConstraints) { return SingleChildScrollView( child: ConstrainedBox( - constraints: BoxConstraints(minHeight: viewportConstraints.maxHeight), + constraints: BoxConstraints( + minHeight: viewportConstraints.maxHeight, + ), child: IntrinsicHeight( child: Column( children: [ diff --git a/examples/api/lib/widgets/sliver/decorated_sliver.0.dart b/examples/api/lib/widgets/sliver/decorated_sliver.0.dart index 28fdd1c7fbe..562639ae3d2 100644 --- a/examples/api/lib/widgets/sliver/decorated_sliver.0.dart +++ b/examples/api/lib/widgets/sliver/decorated_sliver.0.dart @@ -13,7 +13,9 @@ class SliverDecorationExampleApp extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( theme: ThemeData( - textTheme: const TextTheme(titleLarge: TextStyle(fontSize: 24, color: Colors.white30)), + textTheme: const TextTheme( + titleLarge: TextStyle(fontSize: 24, color: Colors.white30), + ), ), home: Scaffold( appBar: AppBar(title: const Text('SliverDecoration Sample')), @@ -79,7 +81,10 @@ class SliverDecorationExample extends StatelessWidget { child: Container( alignment: Alignment.topCenter, padding: const EdgeInsets.only(top: 56.0), - child: Text('A blue sky', style: Theme.of(context).textTheme.titleLarge), + child: Text( + 'A blue sky', + style: Theme.of(context).textTheme.titleLarge, + ), ), ), ], diff --git a/examples/api/lib/widgets/sliver/decorated_sliver.1.dart b/examples/api/lib/widgets/sliver/decorated_sliver.1.dart index e81f95a55ac..bd11b8b202a 100644 --- a/examples/api/lib/widgets/sliver/decorated_sliver.1.dart +++ b/examples/api/lib/widgets/sliver/decorated_sliver.1.dart @@ -16,7 +16,9 @@ class DecoratedSliverClipExampleApp extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( title: 'DecoratedSliver Clip Example', - theme: ThemeData(colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple)), + theme: ThemeData( + colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), + ), home: const DecoratedSliverClipExample(), ); } @@ -26,10 +28,12 @@ class DecoratedSliverClipExample extends StatefulWidget { const DecoratedSliverClipExample({super.key}); @override - State createState() => _DecoratedSliverClipExampleState(); + State createState() => + _DecoratedSliverClipExampleState(); } -class _DecoratedSliverClipExampleState extends State { +class _DecoratedSliverClipExampleState + extends State { double _height = 225.0; bool _isClipped = false; @@ -44,7 +48,7 @@ class _DecoratedSliverClipExampleState extends State children: [ Switch( inactiveTrackColor: Colors.cyan, - activeColor: Colors.pink, + activeThumbColor: Colors.pink, onChanged: (bool value) { setState(() { _isClipped = value; @@ -108,9 +112,15 @@ class ResizableCustomScrollView extends StatelessWidget { DecoratedSliver( decoration: const ShapeDecoration( color: Color(0xFF2C2C2C), - shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(6))), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(6)), + ), shadows: [ - BoxShadow(color: Colors.cyan, offset: Offset(3, 3), blurRadius: 24), + BoxShadow( + color: Colors.cyan, + offset: Offset(3, 3), + blurRadius: 24, + ), ], ), sliver: SliverList.builder( @@ -121,7 +131,10 @@ class ResizableCustomScrollView extends StatelessWidget { children: [ const Icon(Icons.add_box, color: Color(0xFFA8A8A8)), Flexible( - child: Text('Item $index', style: const TextStyle(color: Color(0xFFA8A8A8))), + child: Text( + 'Item $index', + style: const TextStyle(color: Color(0xFFA8A8A8)), + ), ), ], ), diff --git a/examples/api/lib/widgets/sliver/pinned_header_sliver.0.dart b/examples/api/lib/widgets/sliver/pinned_header_sliver.0.dart index 479a3253915..f29b0b80e83 100644 --- a/examples/api/lib/widgets/sliver/pinned_header_sliver.0.dart +++ b/examples/api/lib/widgets/sliver/pinned_header_sliver.0.dart @@ -23,7 +23,8 @@ class PinnedHeaderSliverExample extends StatefulWidget { const PinnedHeaderSliverExample({super.key}); @override - State createState() => _PinnedHeaderSliverExampleState(); + State createState() => + _PinnedHeaderSliverExampleState(); } class _PinnedHeaderSliverExampleState extends State { @@ -60,8 +61,12 @@ class _PinnedHeaderSliverExampleState extends State { alignment: Alignment.center, padding: const EdgeInsets.symmetric(vertical: 48), child: Text( - count.isOdd ? 'Alternative Title\nWith Two Lines' : 'PinnedHeaderSliver', - style: theme.textTheme.headlineMedium!.copyWith(color: colorScheme.onPrimaryContainer), + count.isOdd + ? 'Alternative Title\nWith Two Lines' + : 'PinnedHeaderSliver', + style: theme.textTheme.headlineMedium!.copyWith( + color: colorScheme.onPrimaryContainer, + ), ), ), ), @@ -106,7 +111,10 @@ class ItemList extends StatelessWidget { itemBuilder: (BuildContext context, int index) { return Card( color: colorScheme.onSecondary, - child: ListTile(textColor: colorScheme.secondary, title: Text('Item $index')), + child: ListTile( + textColor: colorScheme.secondary, + title: Text('Item $index'), + ), ); }, ); diff --git a/examples/api/lib/widgets/sliver/pinned_header_sliver.1.dart b/examples/api/lib/widgets/sliver/pinned_header_sliver.1.dart index 46a8f0b78af..18e15cb86e9 100644 --- a/examples/api/lib/widgets/sliver/pinned_header_sliver.1.dart +++ b/examples/api/lib/widgets/sliver/pinned_header_sliver.1.dart @@ -62,9 +62,14 @@ class _SettingsAppBarExampleState extends State { bool handleScrollNotification(ScrollNotification notification) { final RenderSliver? headerSliver = keyToSliver(headerSliverKey); final RenderSliver? titleSliver = keyToSliver(titleSliverKey); - if (headerSliver != null && titleSliver != null && titleSliver.geometry != null) { + if (headerSliver != null && + titleSliver != null && + titleSliver.geometry != null) { final double opacity = - headerSliver.constraints.scrollOffset > titleSliver.geometry!.scrollExtent ? 1 : 0; + headerSliver.constraints.scrollOffset > + titleSliver.geometry!.scrollExtent + ? 1 + : 0; if (opacity != headerOpacity) { setState(() { headerOpacity = opacity; @@ -111,7 +116,10 @@ class _SettingsAppBarExampleState extends State { ), ), ), - const SliverPadding(padding: horizontalPadding, sliver: ItemList()), + const SliverPadding( + padding: horizontalPadding, + sliver: ItemList(), + ), ], ), ), @@ -138,7 +146,9 @@ class Header extends StatelessWidget { duration: const Duration(milliseconds: 300), padding: const EdgeInsets.symmetric(vertical: 12), decoration: ShapeDecoration( - color: opacity == 0 ? colorScheme.surfaceContainer : colorScheme.surfaceContainerLowest, + color: opacity == 0 + ? colorScheme.surfaceContainer + : colorScheme.surfaceContainerLowest, shape: LinearBorder.bottom( side: BorderSide( color: opacity == 0 @@ -189,7 +199,10 @@ class ItemList extends StatelessWidget { itemBuilder: (BuildContext context, int index) { return Card( color: colorScheme.onSecondary, - child: ListTile(textColor: colorScheme.secondary, title: Text('Item $index')), + child: ListTile( + textColor: colorScheme.secondary, + title: Text('Item $index'), + ), ); }, ); diff --git a/examples/api/lib/widgets/sliver/sliver_constrained_cross_axis.0.dart b/examples/api/lib/widgets/sliver/sliver_constrained_cross_axis.0.dart index 5000ba29f34..78f877aa16a 100644 --- a/examples/api/lib/widgets/sliver/sliver_constrained_cross_axis.0.dart +++ b/examples/api/lib/widgets/sliver/sliver_constrained_cross_axis.0.dart @@ -34,7 +34,12 @@ class SliverConstrainedCrossAxisExample extends StatelessWidget { return Container( color: index.isEven ? Colors.amber[300] : Colors.blue[300], height: 100.0, - child: Center(child: Text('Item $index', style: const TextStyle(fontSize: 24))), + child: Center( + child: Text( + 'Item $index', + style: const TextStyle(fontSize: 24), + ), + ), ); }, itemCount: 10, diff --git a/examples/api/lib/widgets/sliver/sliver_cross_axis_group.0.dart b/examples/api/lib/widgets/sliver/sliver_cross_axis_group.0.dart index e25d5c1b7c9..cf61981cc13 100644 --- a/examples/api/lib/widgets/sliver/sliver_cross_axis_group.0.dart +++ b/examples/api/lib/widgets/sliver/sliver_cross_axis_group.0.dart @@ -34,7 +34,12 @@ class SliverCrossAxisGroupExample extends StatelessWidget { return Container( color: index.isEven ? Colors.amber[300] : Colors.blue[300], height: 100.0, - child: Center(child: Text('Item $index', style: const TextStyle(fontSize: 24))), + child: Center( + child: Text( + 'Item $index', + style: const TextStyle(fontSize: 24), + ), + ), ); }, itemCount: 5, @@ -47,7 +52,10 @@ class SliverCrossAxisGroupExample extends StatelessWidget { color: index.isEven ? Colors.green[300] : Colors.red[300], height: 100.0, child: Center( - child: Text('Item ${index + 5}', style: const TextStyle(fontSize: 24)), + child: Text( + 'Item ${index + 5}', + style: const TextStyle(fontSize: 24), + ), ), ); }, @@ -59,10 +67,15 @@ class SliverCrossAxisGroupExample extends StatelessWidget { sliver: SliverList.builder( itemBuilder: (BuildContext context, int index) { return Container( - color: index.isEven ? Colors.purple[300] : Colors.orange[300], + color: index.isEven + ? Colors.purple[300] + : Colors.orange[300], height: 100.0, child: Center( - child: Text('Item ${index + 10}', style: const TextStyle(fontSize: 24)), + child: Text( + 'Item ${index + 10}', + style: const TextStyle(fontSize: 24), + ), ), ); }, diff --git a/examples/api/lib/widgets/sliver/sliver_ensure_semantics.0.dart b/examples/api/lib/widgets/sliver/sliver_ensure_semantics.0.dart index 8567c4eb92d..ddc8958ef2b 100644 --- a/examples/api/lib/widgets/sliver/sliver_ensure_semantics.0.dart +++ b/examples/api/lib/widgets/sliver/sliver_ensure_semantics.0.dart @@ -22,10 +22,12 @@ class SliverEnsureSemanticsExample extends StatefulWidget { const SliverEnsureSemanticsExample({super.key}); @override - State createState() => _SliverEnsureSemanticsExampleState(); + State createState() => + _SliverEnsureSemanticsExampleState(); } -class _SliverEnsureSemanticsExampleState extends State { +class _SliverEnsureSemanticsExampleState + extends State { @override Widget build(BuildContext context) { final ThemeData theme = Theme.of(context); @@ -51,33 +53,51 @@ class _SliverEnsureSemanticsExampleState extends State[ - TextButton(onPressed: () {}, child: const Text('Button 1')), - TextButton(onPressed: () {}, child: const Text('Button 2')), + TextButton( + onPressed: () {}, + child: const Text('Button 1'), + ), + TextButton( + onPressed: () {}, + child: const Text('Button 2'), + ), ], ), ), diff --git a/examples/api/lib/widgets/sliver/sliver_floating_header.0.dart b/examples/api/lib/widgets/sliver/sliver_floating_header.0.dart index fb80b929df7..f64d1204df6 100644 --- a/examples/api/lib/widgets/sliver/sliver_floating_header.0.dart +++ b/examples/api/lib/widgets/sliver/sliver_floating_header.0.dart @@ -74,7 +74,9 @@ class ListHeader extends StatelessWidget { child: Text( text, textAlign: TextAlign.center, - style: theme.textTheme.headlineMedium!.copyWith(color: colorScheme.onPrimaryContainer), + style: theme.textTheme.headlineMedium!.copyWith( + color: colorScheme.onPrimaryContainer, + ), ), ), ), @@ -96,7 +98,10 @@ class ItemList extends StatelessWidget { itemBuilder: (BuildContext context, int index) { return Card( color: colorScheme.onSecondary, - child: ListTile(textColor: colorScheme.secondary, title: Text('Item $index')), + child: ListTile( + textColor: colorScheme.secondary, + title: Text('Item $index'), + ), ); }, ); diff --git a/examples/api/lib/widgets/sliver/sliver_list.0.dart b/examples/api/lib/widgets/sliver/sliver_list.0.dart index 47b41ffa441..70da21259e9 100644 --- a/examples/api/lib/widgets/sliver/sliver_list.0.dart +++ b/examples/api/lib/widgets/sliver/sliver_list.0.dart @@ -40,7 +40,9 @@ class _SliverListExampleState extends State { body: CustomScrollView( slivers: [ const SliverToBoxAdapter( - child: ListTile(title: Text('Press on the button to add items to the list.')), + child: ListTile( + title: Text('Press on the button to add items to the list.'), + ), ), SliverList.builder( itemCount: _itemCount, diff --git a/examples/api/lib/widgets/sliver/sliver_main_axis_group.0.dart b/examples/api/lib/widgets/sliver/sliver_main_axis_group.0.dart index 3acba41020e..f829bd60f49 100644 --- a/examples/api/lib/widgets/sliver/sliver_main_axis_group.0.dart +++ b/examples/api/lib/widgets/sliver/sliver_main_axis_group.0.dart @@ -29,13 +29,22 @@ class SliverMainAxisGroupExample extends StatelessWidget { slivers: [ SliverMainAxisGroup( slivers: [ - const SliverAppBar(title: Text('Section Title'), expandedHeight: 70.0, pinned: true), + const SliverAppBar( + title: Text('Section Title'), + expandedHeight: 70.0, + pinned: true, + ), SliverList.builder( itemBuilder: (BuildContext context, int index) { return Container( color: index.isEven ? Colors.amber[300] : Colors.blue[300], height: 100.0, - child: Center(child: Text('Item $index', style: const TextStyle(fontSize: 24))), + child: Center( + child: Text( + 'Item $index', + style: const TextStyle(fontSize: 24), + ), + ), ); }, itemCount: 5, @@ -45,7 +54,10 @@ class SliverMainAxisGroupExample extends StatelessWidget { color: Colors.cyan, height: 100, child: const Center( - child: Text('Another sliver child', style: TextStyle(fontSize: 24)), + child: Text( + 'Another sliver child', + style: TextStyle(fontSize: 24), + ), ), ), ), @@ -55,7 +67,9 @@ class SliverMainAxisGroupExample extends StatelessWidget { child: Container( height: 1000, decoration: const BoxDecoration(color: Colors.greenAccent), - child: const Center(child: Text('Hello World!', style: TextStyle(fontSize: 24))), + child: const Center( + child: Text('Hello World!', style: TextStyle(fontSize: 24)), + ), ), ), ], diff --git a/examples/api/lib/widgets/sliver/sliver_opacity.1.dart b/examples/api/lib/widgets/sliver/sliver_opacity.1.dart index 87d61bdf9e5..476fbefabd4 100644 --- a/examples/api/lib/widgets/sliver/sliver_opacity.1.dart +++ b/examples/api/lib/widgets/sliver/sliver_opacity.1.dart @@ -39,14 +39,20 @@ class _SliverOpacityExampleState extends State { body: CustomScrollView( slivers: [ const SliverToBoxAdapter( - child: ListTile(title: Text('Press on the button to toggle the list visibility.')), + child: ListTile( + title: Text('Press on the button to toggle the list visibility.'), + ), + ), + const SliverToBoxAdapter( + child: ListTile(title: Text('Before the list...')), ), - const SliverToBoxAdapter(child: ListTile(title: Text('Before the list...'))), SliverOpacity( opacity: _visible ? 1.0 : 0.0, sliver: SliverList.list(children: _listItems), ), - const SliverToBoxAdapter(child: ListTile(title: Text('After the list...'))), + const SliverToBoxAdapter( + child: ListTile(title: Text('After the list...')), + ), ], ), floatingActionButton: FloatingActionButton( diff --git a/examples/api/lib/widgets/sliver/sliver_resizing_header.0.dart b/examples/api/lib/widgets/sliver/sliver_resizing_header.0.dart index 6ff0f8a968e..8d186c8ef27 100644 --- a/examples/api/lib/widgets/sliver/sliver_resizing_header.0.dart +++ b/examples/api/lib/widgets/sliver/sliver_resizing_header.0.dart @@ -53,7 +53,10 @@ class _ResizingHeaderExampleState extends State { SliverResizingHeader( minExtentPrototype: ListHeader(text: 'One'), maxExtentPrototype: ListHeader(text: 'One\nTwo\nThree'), - child: ListHeader(text: 'SliverResizingHeader\nWith Two Optional\nLines of Text'), + child: ListHeader( + text: + 'SliverResizingHeader\nWith Two Optional\nLines of Text', + ), ), ItemList(), ], @@ -91,7 +94,9 @@ class ListHeader extends StatelessWidget { child: Text( text, textAlign: TextAlign.center, - style: theme.textTheme.headlineMedium!.copyWith(color: colorScheme.onPrimaryContainer), + style: theme.textTheme.headlineMedium!.copyWith( + color: colorScheme.onPrimaryContainer, + ), ), ), ), @@ -113,7 +118,10 @@ class ItemList extends StatelessWidget { itemBuilder: (BuildContext context, int index) { return Card( color: colorScheme.onSecondary, - child: ListTile(textColor: colorScheme.secondary, title: Text('Item $index')), + child: ListTile( + textColor: colorScheme.secondary, + title: Text('Item $index'), + ), ); }, ); diff --git a/examples/api/lib/widgets/sliver/sliver_tree.0.dart b/examples/api/lib/widgets/sliver/sliver_tree.0.dart index d888951c0f4..69cc40d2b15 100644 --- a/examples/api/lib/widgets/sliver/sliver_tree.0.dart +++ b/examples/api/lib/widgets/sliver/sliver_tree.0.dart @@ -79,10 +79,17 @@ class _TreeSliverExampleState extends State { _selectedNode = node as TreeSliverNode; }); }, - child: TreeSliver.defaultTreeNodeBuilder(context, node, animationStyle), + child: TreeSliver.defaultTreeNodeBuilder( + context, + node, + animationStyle, + ), ); if (_selectedNode == node as TreeSliverNode) { - child = ColoredBox(color: Colors.purple[100]!, child: child); + child = ColoredBox( + color: Colors.purple[100]!, + child: child, + ); } return child; }, diff --git a/examples/api/lib/widgets/sliver/sliver_tree.1.dart b/examples/api/lib/widgets/sliver/sliver_tree.1.dart index c46e4ffca21..8bb964f7980 100644 --- a/examples/api/lib/widgets/sliver/sliver_tree.1.dart +++ b/examples/api/lib/widgets/sliver/sliver_tree.1.dart @@ -83,7 +83,9 @@ class _TreeSliverExampleState extends State { SizedBox(width: 10.0 * node.depth! + 8.0), DecoratedBox( decoration: BoxDecoration( - border: node.parent != null ? Border(left: border, bottom: border) : null, + border: node.parent != null + ? Border(left: border, bottom: border) + : null, ), child: const SizedBox(height: 50.0, width: 20.0), ), @@ -93,7 +95,10 @@ class _TreeSliverExampleState extends State { decoration: BoxDecoration(border: Border.all()), child: SizedBox.square( dimension: 20.0, - child: Icon(node.isExpanded ? Icons.remove : Icons.add, size: 14), + child: Icon( + node.isExpanded ? Icons.remove : Icons.add, + size: 14, + ), ), ), // Spacer @@ -117,7 +122,10 @@ class _TreeSliverExampleState extends State { }, treeNodeBuilder: _treeNodeBuilder, treeRowExtentBuilder: - (TreeSliverNode node, SliverLayoutDimensions layoutDimensions) { + ( + TreeSliverNode node, + SliverLayoutDimensions layoutDimensions, + ) { // This gives more space to parent nodes. return node.children.isNotEmpty ? 60.0 : 50.0; }, @@ -136,7 +144,11 @@ class _TreeSliverExampleState extends State { if (_selectedNode != null) { selectedChildren.addAll([ const Spacer(), - Icon(_selectedNode!.children.isEmpty ? Icons.file_open_outlined : Icons.folder_outlined), + Icon( + _selectedNode!.children.isEmpty + ? Icons.file_open_outlined + : Icons.folder_outlined, + ), const SizedBox(height: 16.0), Text(_selectedNode!.content), const Spacer(), diff --git a/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.0.dart b/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.0.dart index 9a0ee3cc9ef..114fdb1a320 100644 --- a/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.0.dart +++ b/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.0.dart @@ -29,12 +29,18 @@ class SliverFillRemainingExample extends StatelessWidget { Widget build(BuildContext context) { return CustomScrollView( slivers: [ - SliverToBoxAdapter(child: Container(color: Colors.amber[300], height: 150.0)), + SliverToBoxAdapter( + child: Container(color: Colors.amber[300], height: 150.0), + ), SliverFillRemaining( hasScrollBody: false, child: Container( color: Colors.blue[100], - child: Icon(Icons.sentiment_very_satisfied, size: 75, color: Colors.blue[900]), + child: Icon( + Icons.sentiment_very_satisfied, + size: 75, + color: Colors.blue[900], + ), ), ), ], diff --git a/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.1.dart b/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.1.dart index 34b20f29c4e..f40970d4252 100644 --- a/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.1.dart +++ b/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.1.dart @@ -33,14 +33,19 @@ class SliverFillRemainingExample extends StatelessWidget { itemExtent: 100.0, itemCount: 3, itemBuilder: (BuildContext context, int index) { - return Container(color: index.isEven ? Colors.amber[200] : Colors.blue[200]); + return Container( + color: index.isEven ? Colors.amber[200] : Colors.blue[200], + ); }, ), SliverFillRemaining( hasScrollBody: false, child: Container( color: Colors.orange[300], - child: const Padding(padding: EdgeInsets.all(50.0), child: FlutterLogo(size: 100)), + child: const Padding( + padding: EdgeInsets.all(50.0), + child: FlutterLogo(size: 100), + ), ), ), ], diff --git a/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.2.dart b/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.2.dart index c2b70d6b0e0..60564684046 100644 --- a/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.2.dart +++ b/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.2.dart @@ -33,7 +33,9 @@ class SliverFillRemainingExample extends StatelessWidget { itemExtent: 130.0, itemCount: 5, itemBuilder: (BuildContext context, int index) { - return Container(color: index.isEven ? Colors.indigo[200] : Colors.orange[200]); + return Container( + color: index.isEven ? Colors.indigo[200] : Colors.orange[200], + ); }, ), const SliverFillRemaining( diff --git a/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.3.dart b/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.3.dart index be7db41fce2..fead5e7dabb 100644 --- a/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.3.dart +++ b/examples/api/lib/widgets/sliver_fill/sliver_fill_remaining.3.dart @@ -35,9 +35,13 @@ class SliverFillRemainingExample extends StatelessWidget { // example, which are provided by default on the iOS platform. // BouncingScrollPhysics is combined with AlwaysScrollableScrollPhysics to // allow for the overscroll, regardless of the depth of the scrollable. - physics: const BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics()), + physics: const BouncingScrollPhysics( + parent: AlwaysScrollableScrollPhysics(), + ), slivers: [ - SliverToBoxAdapter(child: Container(color: Colors.tealAccent[700], height: 150.0)), + SliverToBoxAdapter( + child: Container(color: Colors.tealAccent[700], height: 150.0), + ), SliverFillRemaining( hasScrollBody: false, // Switch for different overscroll behavior in your layout. If your diff --git a/examples/api/lib/widgets/slotted_render_object_widget/slotted_multi_child_render_object_widget_mixin.0.dart b/examples/api/lib/widgets/slotted_render_object_widget/slotted_multi_child_render_object_widget_mixin.0.dart index b977b366c73..afce94c063f 100644 --- a/examples/api/lib/widgets/slotted_render_object_widget/slotted_multi_child_render_object_widget_mixin.0.dart +++ b/examples/api/lib/widgets/slotted_render_object_widget/slotted_multi_child_render_object_widget_mixin.0.dart @@ -13,8 +13,14 @@ enum DiagonalSlot { topLeft, bottomRight } /// A widget that demonstrates the usage of /// [SlottedMultiChildRenderObjectWidget] by providing slots for two /// children that will be arranged diagonally. -class Diagonal extends SlottedMultiChildRenderObjectWidget { - const Diagonal({super.key, this.topLeft, this.bottomRight, this.backgroundColor}); +class Diagonal + extends SlottedMultiChildRenderObjectWidget { + const Diagonal({ + super.key, + this.topLeft, + this.bottomRight, + this.backgroundColor, + }); final Widget? topLeft; final Widget? bottomRight; @@ -58,7 +64,9 @@ class Diagonal extends SlottedMultiChildRenderObjectWidget, DebugOverflowIndicatorMixin { + with + SlottedContainerRenderObjectMixin, + DebugOverflowIndicatorMixin { RenderDiagonal({Color? backgroundColor}) : _backgroundColor = backgroundColor; // Getters and setters to configure the [RenderObject] with the configuration @@ -111,7 +119,10 @@ class RenderDiagonal extends RenderBox final RenderBox? bottomRight = _bottomRight; if (bottomRight != null) { bottomRight.layout(childConstraints, parentUsesSize: true); - _positionChild(bottomRight, Offset(topLeftSize.width, topLeftSize.height)); + _positionChild( + bottomRight, + Offset(topLeftSize.width, topLeftSize.height), + ); bottomRightSize = bottomRight.size; } @@ -155,7 +166,12 @@ class RenderDiagonal extends RenderBox // Paint an overflow indicator in debug mode if the children want to be // larger than the incoming constraints allow. assert(() { - paintOverflowIndicator(context, offset, Offset.zero & size, Offset.zero & _childrenSize); + paintOverflowIndicator( + context, + offset, + Offset.zero & size, + Offset.zero & _childrenSize, + ); return true; }()); } @@ -187,39 +203,52 @@ class RenderDiagonal extends RenderBox @override double computeMinIntrinsicWidth(double height) { - final double topLeftWidth = _topLeft?.getMinIntrinsicWidth(double.infinity) ?? 0; - final double bottomRightWith = _bottomRight?.getMinIntrinsicWidth(double.infinity) ?? 0; + final double topLeftWidth = + _topLeft?.getMinIntrinsicWidth(double.infinity) ?? 0; + final double bottomRightWith = + _bottomRight?.getMinIntrinsicWidth(double.infinity) ?? 0; return topLeftWidth + bottomRightWith; } @override double computeMaxIntrinsicWidth(double height) { - final double topLeftWidth = _topLeft?.getMaxIntrinsicWidth(double.infinity) ?? 0; - final double bottomRightWith = _bottomRight?.getMaxIntrinsicWidth(double.infinity) ?? 0; + final double topLeftWidth = + _topLeft?.getMaxIntrinsicWidth(double.infinity) ?? 0; + final double bottomRightWith = + _bottomRight?.getMaxIntrinsicWidth(double.infinity) ?? 0; return topLeftWidth + bottomRightWith; } @override double computeMinIntrinsicHeight(double width) { - final double topLeftHeight = _topLeft?.getMinIntrinsicHeight(double.infinity) ?? 0; - final double bottomRightHeight = _bottomRight?.getMinIntrinsicHeight(double.infinity) ?? 0; + final double topLeftHeight = + _topLeft?.getMinIntrinsicHeight(double.infinity) ?? 0; + final double bottomRightHeight = + _bottomRight?.getMinIntrinsicHeight(double.infinity) ?? 0; return topLeftHeight + bottomRightHeight; } @override double computeMaxIntrinsicHeight(double width) { - final double topLeftHeight = _topLeft?.getMaxIntrinsicHeight(double.infinity) ?? 0; - final double bottomRightHeight = _bottomRight?.getMaxIntrinsicHeight(double.infinity) ?? 0; + final double topLeftHeight = + _topLeft?.getMaxIntrinsicHeight(double.infinity) ?? 0; + final double bottomRightHeight = + _bottomRight?.getMaxIntrinsicHeight(double.infinity) ?? 0; return topLeftHeight + bottomRightHeight; } @override Size computeDryLayout(BoxConstraints constraints) { const BoxConstraints childConstraints = BoxConstraints(); - final Size topLeftSize = _topLeft?.getDryLayout(childConstraints) ?? Size.zero; - final Size bottomRightSize = _bottomRight?.getDryLayout(childConstraints) ?? Size.zero; + final Size topLeftSize = + _topLeft?.getDryLayout(childConstraints) ?? Size.zero; + final Size bottomRightSize = + _bottomRight?.getDryLayout(childConstraints) ?? Size.zero; return constraints.constrain( - Size(topLeftSize.width + bottomRightSize.width, topLeftSize.height + bottomRightSize.height), + Size( + topLeftSize.width + bottomRightSize.width, + topLeftSize.height + bottomRightSize.height, + ), ); } } diff --git a/examples/api/lib/widgets/system_context_menu/system_context_menu.0.dart b/examples/api/lib/widgets/system_context_menu/system_context_menu.0.dart index a689f5012de..3a996b7f011 100644 --- a/examples/api/lib/widgets/system_context_menu/system_context_menu.0.dart +++ b/examples/api/lib/widgets/system_context_menu/system_context_menu.0.dart @@ -18,17 +18,20 @@ class SystemContextMenuExampleApp extends StatelessWidget { appBar: AppBar(title: const Text('SystemContextMenu Basic Example')), body: Center( child: TextField( - contextMenuBuilder: (BuildContext context, EditableTextState editableTextState) { - // If supported, show the system context menu. - if (SystemContextMenu.isSupported(context)) { - return SystemContextMenu.editableText(editableTextState: editableTextState); - } - // Otherwise, show the flutter-rendered context menu for the current - // platform. - return AdaptiveTextSelectionToolbar.editableText( - editableTextState: editableTextState, - ); - }, + contextMenuBuilder: + (BuildContext context, EditableTextState editableTextState) { + // If supported, show the system context menu. + if (SystemContextMenu.isSupported(context)) { + return SystemContextMenu.editableText( + editableTextState: editableTextState, + ); + } + // Otherwise, show the flutter-rendered context menu for the current + // platform. + return AdaptiveTextSelectionToolbar.editableText( + editableTextState: editableTextState, + ); + }, ), ), ), diff --git a/examples/api/lib/widgets/system_context_menu/system_context_menu.1.dart b/examples/api/lib/widgets/system_context_menu/system_context_menu.1.dart index df58a57d2c9..8029ff3d1cf 100644 --- a/examples/api/lib/widgets/system_context_menu/system_context_menu.1.dart +++ b/examples/api/lib/widgets/system_context_menu/system_context_menu.1.dart @@ -27,7 +27,8 @@ class SystemContextMenuExample extends StatefulWidget { const SystemContextMenuExample({super.key}); @override - State createState() => _SystemContextMenuExampleState(); + State createState() => + _SystemContextMenuExampleState(); } class _SystemContextMenuExampleState extends State { @@ -42,7 +43,9 @@ class _SystemContextMenuExampleState extends State { } void _showMessage(String message) { - ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(message))); + ScaffoldMessenger.of( + context, + ).showSnackBar(SnackBar(content: Text(message))); } @override @@ -57,54 +60,63 @@ class _SystemContextMenuExampleState extends State { labelText: 'Text Field with Custom Context Menu', helperText: 'Long press to see custom menu items (iOS 16.0+)', ), - contextMenuBuilder: (BuildContext context, EditableTextState editableTextState) { - if (!MediaQuery.of(context).supportsShowingSystemContextMenu) { - return AdaptiveTextSelectionToolbar.editableText(editableTextState: editableTextState); - } + contextMenuBuilder: + (BuildContext context, EditableTextState editableTextState) { + if (!MediaQuery.of(context).supportsShowingSystemContextMenu) { + return AdaptiveTextSelectionToolbar.editableText( + editableTextState: editableTextState, + ); + } - return SystemContextMenu.editableText( - editableTextState: editableTextState, - items: [ - IOSSystemContextMenuItemCustom( - title: 'Clear Text', - onPressed: () { - _controller.clear(); - _showMessage('Text cleared'); - }, - ), - IOSSystemContextMenuItemCustom( - title: 'Add Heart', - onPressed: () { - final TextSelection selection = _controller.selection; - final String text = _controller.text; - _controller.value = TextEditingValue( - text: text.replaceRange(selection.start, selection.end, '❤️'), - selection: TextSelection.collapsed(offset: selection.start + 2), - ); - _showMessage('Heart added'); - }, - ), - IOSSystemContextMenuItemCustom( - title: 'Uppercase', - onPressed: () { - final TextSelection selection = _controller.selection; - if (selection.isValid && !selection.isCollapsed) { - final String selectedText = _controller.text.substring( - selection.start, - selection.end, - ); - _controller.text = _controller.text.replaceRange( - selection.start, - selection.end, - selectedText.toUpperCase(), - ); - _showMessage('Text converted to uppercase'); - } - }, - ), - ], - ); - }, + return SystemContextMenu.editableText( + editableTextState: editableTextState, + items: [ + IOSSystemContextMenuItemCustom( + title: 'Clear Text', + onPressed: () { + _controller.clear(); + _showMessage('Text cleared'); + }, + ), + IOSSystemContextMenuItemCustom( + title: 'Add Heart', + onPressed: () { + final TextSelection selection = _controller.selection; + final String text = _controller.text; + _controller.value = TextEditingValue( + text: text.replaceRange( + selection.start, + selection.end, + '❤️', + ), + selection: TextSelection.collapsed( + offset: selection.start + 2, + ), + ); + _showMessage('Heart added'); + }, + ), + IOSSystemContextMenuItemCustom( + title: 'Uppercase', + onPressed: () { + final TextSelection selection = _controller.selection; + if (selection.isValid && !selection.isCollapsed) { + final String selectedText = _controller.text.substring( + selection.start, + selection.end, + ); + _controller.text = _controller.text.replaceRange( + selection.start, + selection.end, + selectedText.toUpperCase(), + ); + _showMessage('Text converted to uppercase'); + } + }, + ), + ], + ); + }, ), ); } diff --git a/examples/api/lib/widgets/table/table.0.dart b/examples/api/lib/widgets/table/table.0.dart index dece4774c08..18735866f75 100644 --- a/examples/api/lib/widgets/table/table.0.dart +++ b/examples/api/lib/widgets/table/table.0.dart @@ -51,7 +51,9 @@ class TableExample extends StatelessWidget { children: [ Container(height: 64, width: 128, color: Colors.purple), Container(height: 32, color: Colors.yellow), - Center(child: Container(height: 32, width: 32, color: Colors.orange)), + Center( + child: Container(height: 32, width: 32, color: Colors.orange), + ), ], ), ], diff --git a/examples/api/lib/widgets/tap_region/text_field_tap_region.0.dart b/examples/api/lib/widgets/tap_region/text_field_tap_region.0.dart index 8c627cba359..133c9d37b4f 100644 --- a/examples/api/lib/widgets/tap_region/text_field_tap_region.0.dart +++ b/examples/api/lib/widgets/tap_region/text_field_tap_region.0.dart @@ -27,7 +27,8 @@ class TextFieldTapRegionExample extends StatefulWidget { const TextFieldTapRegionExample({super.key}); @override - State createState() => _TextFieldTapRegionExampleState(); + State createState() => + _TextFieldTapRegionExampleState(); } class _TextFieldTapRegionExampleState extends State { @@ -93,7 +94,10 @@ class IntegerSpinnerField extends StatelessWidget { // Add a text formatter that only allows integer values and a leading // minus sign. inputFormatters: [ - TextInputFormatter.withFunction((TextEditingValue oldValue, TextEditingValue newValue) { + TextInputFormatter.withFunction(( + TextEditingValue oldValue, + TextEditingValue newValue, + ) { String newString; if (newValue.text.startsWith('-')) { newString = '-${newValue.text.replaceAll(RegExp(r'\D'), '')}'; @@ -103,8 +107,14 @@ class IntegerSpinnerField extends StatelessWidget { return newValue.copyWith( text: newString, selection: newValue.selection.copyWith( - baseOffset: newValue.selection.baseOffset.clamp(0, newString.length), - extentOffset: newValue.selection.extentOffset.clamp(0, newString.length), + baseOffset: newValue.selection.baseOffset.clamp( + 0, + newString.length, + ), + extentOffset: newValue.selection.extentOffset.clamp( + 0, + newString.length, + ), ), ); }), @@ -162,7 +172,8 @@ class _SpinnerFieldState extends State> { @override void didUpdateWidget(covariant SpinnerField oldWidget) { super.didUpdateWidget(oldWidget); - if (oldWidget.asString != widget.asString || oldWidget.value != widget.value) { + if (oldWidget.asString != widget.asString || + oldWidget.value != widget.value) { final String newText = widget.asString(widget.value); _updateText(newText); } @@ -210,7 +221,8 @@ class _SpinnerFieldState extends State> { autofocus: widget.autofocus, inputFormatters: widget.inputFormatters, decoration: const InputDecoration(border: OutlineInputBorder()), - onChanged: (String value) => widget.onChanged?.call(widget.fromString(value)), + onChanged: (String value) => + widget.onChanged?.call(widget.fromString(value)), controller: controller, textAlign: TextAlign.center, ), @@ -225,10 +237,16 @@ class _SpinnerFieldState extends State> { mainAxisAlignment: MainAxisAlignment.center, children: [ Expanded( - child: OutlinedButton(onPressed: _increment, child: const Icon(Icons.add)), + child: OutlinedButton( + onPressed: _increment, + child: const Icon(Icons.add), + ), ), Expanded( - child: OutlinedButton(onPressed: _decrement, child: const Icon(Icons.remove)), + child: OutlinedButton( + onPressed: _decrement, + child: const Icon(Icons.remove), + ), ), ], ), diff --git a/examples/api/lib/widgets/text/text.0.dart b/examples/api/lib/widgets/text/text.0.dart index 3013ffb1711..bb6e51b45a8 100644 --- a/examples/api/lib/widgets/text/text.0.dart +++ b/examples/api/lib/widgets/text/text.0.dart @@ -14,7 +14,10 @@ class DefaultTextStyleApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( - theme: ThemeData(brightness: Brightness.light, colorSchemeSeed: Colors.purple), + theme: ThemeData( + brightness: Brightness.light, + colorSchemeSeed: Colors.purple, + ), home: const DefaultTextStyleExample(), ); } diff --git a/examples/api/lib/widgets/text/ui_testing_with_text.dart b/examples/api/lib/widgets/text/ui_testing_with_text.dart index caf61331c9a..6dc7d357c7b 100644 --- a/examples/api/lib/widgets/text/ui_testing_with_text.dart +++ b/examples/api/lib/widgets/text/ui_testing_with_text.dart @@ -73,7 +73,8 @@ class _MyAppState extends State { semanticsIdentifier: 'Hello to the automation tool', ), TextSpan( - text: ' this text contains neither identifier nor label.', + text: + ' this text contains neither identifier nor label.', style: customStyle2, ), ], diff --git a/examples/api/lib/widgets/text_editing_intents/editable_text_tap_up_outside_intent.0.dart b/examples/api/lib/widgets/text_editing_intents/editable_text_tap_up_outside_intent.0.dart index 0d7a6cd50fd..491360a2af9 100644 --- a/examples/api/lib/widgets/text_editing_intents/editable_text_tap_up_outside_intent.0.dart +++ b/examples/api/lib/widgets/text_editing_intents/editable_text_tap_up_outside_intent.0.dart @@ -65,7 +65,9 @@ class _EditableTextTapUpOutsideIntentExampleState case ui.PointerDeviceKind.unknown: intent.focusNode.unfocus(); case ui.PointerDeviceKind.trackpad: - throw UnimplementedError('Unexpected pointer down event for trackpad'); + throw UnimplementedError( + 'Unexpected pointer down event for trackpad', + ); } case TargetPlatform.linux: case TargetPlatform.macOS: @@ -80,7 +82,8 @@ class _EditableTextTapUpOutsideIntentExampleState } final double distance = - (latestPointerDownEvent!.position - intent.pointerUpEvent.position).distance; + (latestPointerDownEvent!.position - intent.pointerUpEvent.position) + .distance; // Unfocus on taps but not scrolls. // kTouchSlop is a framework constant that is used to determine if a @@ -97,12 +100,14 @@ class _EditableTextTapUpOutsideIntentExampleState padding: const EdgeInsets.all(20), child: Actions( actions: >{ - EditableTextTapOutsideIntent: CallbackAction( - onInvoke: _handlePointerDown, - ), - EditableTextTapUpOutsideIntent: CallbackAction( - onInvoke: _handlePointerUp, - ), + EditableTextTapOutsideIntent: + CallbackAction( + onInvoke: _handlePointerDown, + ), + EditableTextTapUpOutsideIntent: + CallbackAction( + onInvoke: _handlePointerUp, + ), }, child: ListView( children: [ diff --git a/examples/api/lib/widgets/text_magnifier/text_magnifier.0.dart b/examples/api/lib/widgets/text_magnifier/text_magnifier.0.dart index de498c76a62..155c8af98b7 100644 --- a/examples/api/lib/widgets/text_magnifier/text_magnifier.0.dart +++ b/examples/api/lib/widgets/text_magnifier/text_magnifier.0.dart @@ -29,8 +29,9 @@ class TextMagnifierExampleApp extends StatelessWidget { // Create a custom magnifier configuration that // this `TextField` will use to build a magnifier with. magnifierConfiguration: TextMagnifierConfiguration( - magnifierBuilder: (_, _, ValueNotifier magnifierInfo) => - CustomMagnifier(magnifierInfo: magnifierInfo), + magnifierBuilder: + (_, _, ValueNotifier magnifierInfo) => + CustomMagnifier(magnifierInfo: magnifierInfo), ), controller: TextEditingController(text: text), ), @@ -93,7 +94,9 @@ class CustomMagnifier extends StatelessWidget { focalPointOffset: Offset(0, magnifierSize.height / 2), // Decorate it however we'd like! decoration: const MagnifierDecoration( - shape: StarBorder(side: BorderSide(color: Colors.green, width: 2)), + shape: StarBorder( + side: BorderSide(color: Colors.green, width: 2), + ), ), size: magnifierSize, ), diff --git a/examples/api/lib/widgets/transitions/align_transition.0.dart b/examples/api/lib/widgets/transitions/align_transition.0.dart index c6d39a7b1ae..9155f06decd 100644 --- a/examples/api/lib/widgets/transitions/align_transition.0.dart +++ b/examples/api/lib/widgets/transitions/align_transition.0.dart @@ -51,7 +51,10 @@ class _AlignTransitionExampleState extends State color: Colors.white, child: AlignTransition( alignment: _animation, - child: const Padding(padding: EdgeInsets.all(8.0), child: FlutterLogo(size: 150.0)), + child: const Padding( + padding: EdgeInsets.all(8.0), + child: FlutterLogo(size: 150.0), + ), ), ); } diff --git a/examples/api/lib/widgets/transitions/animated_builder.0.dart b/examples/api/lib/widgets/transitions/animated_builder.0.dart index 0fdf7feb908..27c558564d5 100644 --- a/examples/api/lib/widgets/transitions/animated_builder.0.dart +++ b/examples/api/lib/widgets/transitions/animated_builder.0.dart @@ -52,7 +52,10 @@ class _AnimatedBuilderExampleState extends State child: const Center(child: Text('Whee!')), ), builder: (BuildContext context, Widget? child) { - return Transform.rotate(angle: _controller.value * 2.0 * math.pi, child: child); + return Transform.rotate( + angle: _controller.value * 2.0 * math.pi, + child: child, + ); }, ); } diff --git a/examples/api/lib/widgets/transitions/decorated_box_transition.0.dart b/examples/api/lib/widgets/transitions/decorated_box_transition.0.dart index 0812ef81a9f..cc700519f83 100644 --- a/examples/api/lib/widgets/transitions/decorated_box_transition.0.dart +++ b/examples/api/lib/widgets/transitions/decorated_box_transition.0.dart @@ -21,12 +21,14 @@ class DecoratedBoxTransitionExample extends StatefulWidget { const DecoratedBoxTransitionExample({super.key}); @override - State createState() => _DecoratedBoxTransitionExampleState(); + State createState() => + _DecoratedBoxTransitionExampleState(); } /// [AnimationController]s can be created with `vsync: this` because of /// [TickerProviderStateMixin]. -class _DecoratedBoxTransitionExampleState extends State +class _DecoratedBoxTransitionExampleState + extends State with TickerProviderStateMixin { final DecorationTween decorationTween = DecorationTween( begin: BoxDecoration( diff --git a/examples/api/lib/widgets/transitions/default_text_style_transition.0.dart b/examples/api/lib/widgets/transitions/default_text_style_transition.0.dart index 22f72c38595..a2bfb62e21b 100644 --- a/examples/api/lib/widgets/transitions/default_text_style_transition.0.dart +++ b/examples/api/lib/widgets/transitions/default_text_style_transition.0.dart @@ -27,7 +27,8 @@ class DefaultTextStyleTransitionExample extends StatefulWidget { /// [AnimationController]s can be created with `vsync: this` because of /// [TickerProviderStateMixin]. -class _DefaultTextStyleTransitionExampleState extends State +class _DefaultTextStyleTransitionExampleState + extends State with TickerProviderStateMixin { late AnimationController _controller; late TextStyleTween _styleTween; @@ -36,13 +37,26 @@ class _DefaultTextStyleTransitionExampleState extends State duration: widget.duration, vsync: this, )..repeat(reverse: true); - late final CurvedAnimation _animation = CurvedAnimation(parent: _controller, curve: widget.curve); + late final CurvedAnimation _animation = CurvedAnimation( + parent: _controller, + curve: widget.curve, + ); @override void didUpdateWidget(FadeTransitionExample oldWidget) { diff --git a/examples/api/lib/widgets/transitions/listenable_builder.0.dart b/examples/api/lib/widgets/transitions/listenable_builder.0.dart index 3405f4e9a43..113a63a4b27 100644 --- a/examples/api/lib/widgets/transitions/listenable_builder.0.dart +++ b/examples/api/lib/widgets/transitions/listenable_builder.0.dart @@ -58,7 +58,8 @@ class _FocusListenerContainerState extends State { @override Widget build(BuildContext context) { - final OutlinedBorder effectiveBorder = widget.border ?? const RoundedRectangleBorder(); + final OutlinedBorder effectiveBorder = + widget.border ?? const RoundedRectangleBorder(); return ListenableBuilder( listenable: _focusNode, child: Focus( @@ -72,7 +73,9 @@ class _FocusListenerContainerState extends State { padding: widget.padding, decoration: ShapeDecoration( color: _focusNode.hasFocus ? widget.focusedColor : null, - shape: effectiveBorder.copyWith(side: _focusNode.hasFocus ? widget.focusedSide : null), + shape: effectiveBorder.copyWith( + side: _focusNode.hasFocus ? widget.focusedSide : null, + ), ), child: child, ); @@ -103,7 +106,9 @@ class _MyFieldState extends State { child: TextField( controller: controller, onEditingComplete: () { - debugPrint('Field ${widget.label} changed to ${controller.value}'); + debugPrint( + 'Field ${widget.label} changed to ${controller.value}', + ); }, ), ), @@ -135,7 +140,9 @@ class ListenableBuilderExample extends StatelessWidget { FocusListenerContainer( padding: const EdgeInsets.all(8), border: const RoundedRectangleBorder( - side: BorderSide(strokeAlign: BorderSide.strokeAlignOutside), + side: BorderSide( + strokeAlign: BorderSide.strokeAlignOutside, + ), borderRadius: BorderRadius.all(Radius.circular(5)), ), // The border side will get wider when the subtree has focus. diff --git a/examples/api/lib/widgets/transitions/listenable_builder.1.dart b/examples/api/lib/widgets/transitions/listenable_builder.1.dart index 4d83badcdb1..bff39a80730 100644 --- a/examples/api/lib/widgets/transitions/listenable_builder.1.dart +++ b/examples/api/lib/widgets/transitions/listenable_builder.1.dart @@ -14,7 +14,8 @@ class ListenableBuilderExample extends StatefulWidget { const ListenableBuilderExample({super.key}); @override - State createState() => _ListenableBuilderExampleState(); + State createState() => + _ListenableBuilderExampleState(); } class _ListenableBuilderExampleState extends State { diff --git a/examples/api/lib/widgets/transitions/listenable_builder.2.dart b/examples/api/lib/widgets/transitions/listenable_builder.2.dart index f417bfc46f4..186b6aa057e 100644 --- a/examples/api/lib/widgets/transitions/listenable_builder.2.dart +++ b/examples/api/lib/widgets/transitions/listenable_builder.2.dart @@ -24,7 +24,8 @@ class ListenableBuilderExample extends StatefulWidget { const ListenableBuilderExample({super.key}); @override - State createState() => _ListenableBuilderExampleState(); + State createState() => + _ListenableBuilderExampleState(); } class _ListenableBuilderExampleState extends State { diff --git a/examples/api/lib/widgets/transitions/listenable_builder.3.dart b/examples/api/lib/widgets/transitions/listenable_builder.3.dart index 70c08f39d14..82456df74a1 100644 --- a/examples/api/lib/widgets/transitions/listenable_builder.3.dart +++ b/examples/api/lib/widgets/transitions/listenable_builder.3.dart @@ -25,7 +25,8 @@ class ListenableBuilderExample extends StatefulWidget { const ListenableBuilderExample({super.key}); @override - State createState() => _ListenableBuilderExampleState(); + State createState() => + _ListenableBuilderExampleState(); } class _ListenableBuilderExampleState extends State { @@ -39,8 +40,9 @@ class _ListenableBuilderExampleState extends State { appBar: AppBar(title: const Text('ListenableBuilder Example')), body: ListBody(listNotifier: _listNotifier), floatingActionButton: FloatingActionButton( - onPressed: () => - _listNotifier.add(_random.nextInt(1 << 31)), // 1 << 31 is the maximum supported value + onPressed: () => _listNotifier.add( + _random.nextInt(1 << 31), + ), // 1 << 31 is the maximum supported value child: const Icon(Icons.add), ), ), diff --git a/examples/api/lib/widgets/transitions/matrix_transition.0.dart b/examples/api/lib/widgets/transitions/matrix_transition.0.dart index 542afc64a88..fb5ca3651ef 100644 --- a/examples/api/lib/widgets/transitions/matrix_transition.0.dart +++ b/examples/api/lib/widgets/transitions/matrix_transition.0.dart @@ -23,7 +23,8 @@ class MatrixTransitionExample extends StatefulWidget { const MatrixTransitionExample({super.key}); @override - State createState() => _MatrixTransitionExampleState(); + State createState() => + _MatrixTransitionExampleState(); } /// [AnimationController]s can be created with `vsync: this` because of @@ -36,7 +37,10 @@ class _MatrixTransitionExampleState extends State @override void initState() { super.initState(); - _controller = AnimationController(duration: const Duration(seconds: 2), vsync: this)..repeat(); + _controller = AnimationController( + duration: const Duration(seconds: 2), + vsync: this, + )..repeat(); _animation = CurvedAnimation(parent: _controller, curve: Curves.linear); } @@ -52,7 +56,10 @@ class _MatrixTransitionExampleState extends State body: Center( child: MatrixTransition( animation: _animation, - child: const Padding(padding: EdgeInsets.all(8.0), child: FlutterLogo(size: 150.0)), + child: const Padding( + padding: EdgeInsets.all(8.0), + child: FlutterLogo(size: 150.0), + ), onTransform: (double value) { return Matrix4.identity() ..setEntry(3, 2, 0.004) diff --git a/examples/api/lib/widgets/transitions/positioned_transition.0.dart b/examples/api/lib/widgets/transitions/positioned_transition.0.dart index 45a9523865d..64ddfd972de 100644 --- a/examples/api/lib/widgets/transitions/positioned_transition.0.dart +++ b/examples/api/lib/widgets/transitions/positioned_transition.0.dart @@ -21,12 +21,14 @@ class PositionedTransitionExample extends StatefulWidget { const PositionedTransitionExample({super.key}); @override - State createState() => _PositionedTransitionExampleState(); + State createState() => + _PositionedTransitionExampleState(); } /// [AnimationController]s can be created with `vsync: this` because of /// [TickerProviderStateMixin]. -class _PositionedTransitionExampleState extends State +class _PositionedTransitionExampleState + extends State with TickerProviderStateMixin { late final AnimationController _controller = AnimationController( duration: const Duration(seconds: 2), @@ -50,22 +52,31 @@ class _PositionedTransitionExampleState extends State[ PositionedTransition( - rect: RelativeRectTween( - begin: RelativeRect.fromSize( - const Rect.fromLTWH(0, 0, smallLogo, smallLogo), - biggest, - ), - end: RelativeRect.fromSize( - Rect.fromLTWH( - biggest.width - bigLogo, - biggest.height - bigLogo, - bigLogo, - bigLogo, + rect: + RelativeRectTween( + begin: RelativeRect.fromSize( + const Rect.fromLTWH(0, 0, smallLogo, smallLogo), + biggest, + ), + end: RelativeRect.fromSize( + Rect.fromLTWH( + biggest.width - bigLogo, + biggest.height - bigLogo, + bigLogo, + bigLogo, + ), + biggest, + ), + ).animate( + CurvedAnimation( + parent: _controller, + curve: Curves.elasticInOut, + ), ), - biggest, - ), - ).animate(CurvedAnimation(parent: _controller, curve: Curves.elasticInOut)), - child: const Padding(padding: EdgeInsets.all(8), child: FlutterLogo()), + child: const Padding( + padding: EdgeInsets.all(8), + child: FlutterLogo(), + ), ), ], ); diff --git a/examples/api/lib/widgets/transitions/relative_positioned_transition.0.dart b/examples/api/lib/widgets/transitions/relative_positioned_transition.0.dart index 4ad94c8e609..d04b76d4118 100644 --- a/examples/api/lib/widgets/transitions/relative_positioned_transition.0.dart +++ b/examples/api/lib/widgets/transitions/relative_positioned_transition.0.dart @@ -27,7 +27,8 @@ class RelativePositionedTransitionExample extends StatefulWidget { /// [AnimationController]s can be created with `vsync: this` because of /// [TickerProviderStateMixin]. -class _RelativePositionedTransitionExampleState extends State +class _RelativePositionedTransitionExampleState + extends State with TickerProviderStateMixin { late final AnimationController _controller = AnimationController( duration: const Duration(seconds: 2), @@ -52,16 +53,25 @@ class _RelativePositionedTransitionExampleState extends State[ RelativePositionedTransition( size: biggest, - rect: RectTween( - begin: const Rect.fromLTWH(0, 0, bigLogo, bigLogo), - end: Rect.fromLTWH( - biggest.width - smallLogo, - biggest.height - smallLogo, - smallLogo, - smallLogo, - ), - ).animate(CurvedAnimation(parent: _controller, curve: Curves.elasticInOut)), - child: const Padding(padding: EdgeInsets.all(8), child: FlutterLogo()), + rect: + RectTween( + begin: const Rect.fromLTWH(0, 0, bigLogo, bigLogo), + end: Rect.fromLTWH( + biggest.width - smallLogo, + biggest.height - smallLogo, + smallLogo, + smallLogo, + ), + ).animate( + CurvedAnimation( + parent: _controller, + curve: Curves.elasticInOut, + ), + ), + child: const Padding( + padding: EdgeInsets.all(8), + child: FlutterLogo(), + ), ), ], ); diff --git a/examples/api/lib/widgets/transitions/rotation_transition.0.dart b/examples/api/lib/widgets/transitions/rotation_transition.0.dart index de2f59bd073..e77a3ea6a2d 100644 --- a/examples/api/lib/widgets/transitions/rotation_transition.0.dart +++ b/examples/api/lib/widgets/transitions/rotation_transition.0.dart @@ -21,7 +21,8 @@ class RotationTransitionExample extends StatefulWidget { const RotationTransitionExample({super.key}); @override - State createState() => _RotationTransitionExampleState(); + State createState() => + _RotationTransitionExampleState(); } /// [AnimationController]s can be created with `vsync: this` because of @@ -49,7 +50,10 @@ class _RotationTransitionExampleState extends State body: Center( child: RotationTransition( turns: _animation, - child: const Padding(padding: EdgeInsets.all(8.0), child: FlutterLogo(size: 150.0)), + child: const Padding( + padding: EdgeInsets.all(8.0), + child: FlutterLogo(size: 150.0), + ), ), ), ); diff --git a/examples/api/lib/widgets/transitions/scale_transition.0.dart b/examples/api/lib/widgets/transitions/scale_transition.0.dart index 1b51d127d26..2438d59c295 100644 --- a/examples/api/lib/widgets/transitions/scale_transition.0.dart +++ b/examples/api/lib/widgets/transitions/scale_transition.0.dart @@ -49,7 +49,10 @@ class _ScaleTransitionExampleState extends State body: Center( child: ScaleTransition( scale: _animation, - child: const Padding(padding: EdgeInsets.all(8.0), child: FlutterLogo(size: 150.0)), + child: const Padding( + padding: EdgeInsets.all(8.0), + child: FlutterLogo(size: 150.0), + ), ), ), ); diff --git a/examples/api/lib/widgets/transitions/slide_transition.0.dart b/examples/api/lib/widgets/transitions/slide_transition.0.dart index 738d83e3016..b64312983e5 100644 --- a/examples/api/lib/widgets/transitions/slide_transition.0.dart +++ b/examples/api/lib/widgets/transitions/slide_transition.0.dart @@ -50,7 +50,10 @@ class _SlideTransitionExampleState extends State Widget build(BuildContext context) { return SlideTransition( position: _offsetAnimation, - child: const Padding(padding: EdgeInsets.all(8.0), child: FlutterLogo(size: 150.0)), + child: const Padding( + padding: EdgeInsets.all(8.0), + child: FlutterLogo(size: 150.0), + ), ); } } diff --git a/examples/api/lib/widgets/transitions/sliver_fade_transition.0.dart b/examples/api/lib/widgets/transitions/sliver_fade_transition.0.dart index 1ef66c5975a..698cd8bb3ea 100644 --- a/examples/api/lib/widgets/transitions/sliver_fade_transition.0.dart +++ b/examples/api/lib/widgets/transitions/sliver_fade_transition.0.dart @@ -26,10 +26,12 @@ class SliverFadeTransitionExample extends StatefulWidget { const SliverFadeTransitionExample({super.key}); @override - State createState() => _SliverFadeTransitionExampleState(); + State createState() => + _SliverFadeTransitionExampleState(); } -class _SliverFadeTransitionExampleState extends State +class _SliverFadeTransitionExampleState + extends State with SingleTickerProviderStateMixin { late final AnimationController controller = AnimationController( duration: const Duration(milliseconds: 1000), @@ -69,7 +71,9 @@ class _SliverFadeTransitionExampleState extends State createState() => _TweenAnimationBuilderExampleState(); + State createState() => + _TweenAnimationBuilderExampleState(); } -class _TweenAnimationBuilderExampleState extends State { +class _TweenAnimationBuilderExampleState + extends State { double _targetValue = 24.0; @override diff --git a/examples/api/lib/widgets/undo_history/undo_history_controller.0.dart b/examples/api/lib/widgets/undo_history/undo_history_controller.0.dart index c7d4b9818f8..f46008778c2 100644 --- a/examples/api/lib/widgets/undo_history/undo_history_controller.0.dart +++ b/examples/api/lib/widgets/undo_history/undo_history_controller.0.dart @@ -50,24 +50,35 @@ class _MyHomePageState extends State { ), ValueListenableBuilder( valueListenable: _undoController, - builder: (BuildContext context, UndoHistoryValue value, Widget? child) { - return Row( - children: [ - TextButton( - child: Text('Undo', style: value.canUndo ? enabledStyle : disabledStyle), - onPressed: () { - _undoController.undo(); - }, - ), - TextButton( - child: Text('Redo', style: value.canRedo ? enabledStyle : disabledStyle), - onPressed: () { - _undoController.redo(); - }, - ), - ], - ); - }, + builder: + ( + BuildContext context, + UndoHistoryValue value, + Widget? child, + ) { + return Row( + children: [ + TextButton( + child: Text( + 'Undo', + style: value.canUndo ? enabledStyle : disabledStyle, + ), + onPressed: () { + _undoController.undo(); + }, + ), + TextButton( + child: Text( + 'Redo', + style: value.canRedo ? enabledStyle : disabledStyle, + ), + onPressed: () { + _undoController.redo(); + }, + ), + ], + ); + }, ), ], ), diff --git a/examples/api/lib/widgets/value_listenable_builder/value_listenable_builder.0.dart b/examples/api/lib/widgets/value_listenable_builder/value_listenable_builder.0.dart index b4b8ddacaa9..f5de911f72b 100644 --- a/examples/api/lib/widgets/value_listenable_builder/value_listenable_builder.0.dart +++ b/examples/api/lib/widgets/value_listenable_builder/value_listenable_builder.0.dart @@ -21,10 +21,12 @@ class ValueListenableBuilderExample extends StatefulWidget { const ValueListenableBuilderExample({super.key}); @override - State createState() => _ValueListenableBuilderExampleState(); + State createState() => + _ValueListenableBuilderExampleState(); } -class _ValueListenableBuilderExampleState extends State { +class _ValueListenableBuilderExampleState + extends State { final ValueNotifier _counter = ValueNotifier(0); @override @@ -55,7 +57,11 @@ class _ValueListenableBuilderExampleState extends State createState() => _WidgetStateBorderSideExampleState(); + State createState() => + _WidgetStateBorderSideExampleState(); } -class _WidgetStateBorderSideExampleState extends State { +class _WidgetStateBorderSideExampleState + extends State { bool _isSelected = true; @override @@ -44,13 +46,15 @@ class _WidgetStateBorderSideExampleState extends State{ - WidgetState.pressed: BorderSide(color: Colors.green), - WidgetState.hovered: BorderSide(color: Colors.blue), - WidgetState.selected: BorderSide(color: Colors.red), - // Resolves to null if no keys match, deferring to the default value - // of the theme or widget. - }), + side: const WidgetStateBorderSide.fromMap( + { + WidgetState.pressed: BorderSide(color: Colors.green), + WidgetState.hovered: BorderSide(color: Colors.blue), + WidgetState.selected: BorderSide(color: Colors.red), + // Resolves to null if no keys match, deferring to the default value + // of the theme or widget. + }, + ), ); } } diff --git a/examples/api/lib/widgets/widget_state/widget_state_mouse_cursor.0.dart b/examples/api/lib/widgets/widget_state/widget_state_mouse_cursor.0.dart index 446f85635ef..6cf7d008d79 100644 --- a/examples/api/lib/widgets/widget_state/widget_state_mouse_cursor.0.dart +++ b/examples/api/lib/widgets/widget_state/widget_state_mouse_cursor.0.dart @@ -44,10 +44,12 @@ class WidgetStateMouseCursorExample extends StatefulWidget { const WidgetStateMouseCursorExample({super.key}); @override - State createState() => _WidgetStateMouseCursorExampleState(); + State createState() => + _WidgetStateMouseCursorExampleState(); } -class _WidgetStateMouseCursorExampleState extends State { +class _WidgetStateMouseCursorExampleState + extends State { bool _enabled = false; @override diff --git a/examples/api/lib/widgets/widget_state/widget_state_outlined_border.0.dart b/examples/api/lib/widgets/widget_state/widget_state_outlined_border.0.dart index e7a7f9a507a..d53bf183af8 100644 --- a/examples/api/lib/widgets/widget_state/widget_state_outlined_border.0.dart +++ b/examples/api/lib/widgets/widget_state/widget_state_outlined_border.0.dart @@ -17,12 +17,13 @@ class WidgetStateOutlinedBorderExampleApp extends StatelessWidget { } } -class SelectedBorder extends RoundedRectangleBorder implements WidgetStateOutlinedBorder { +class SelectedBorder extends RoundedRectangleBorder + implements WidgetStateOutlinedBorder { const SelectedBorder(); @override - OutlinedBorder? resolve(Set states) { - if (states.contains(MaterialState.selected)) { + OutlinedBorder? resolve(Set states) { + if (states.contains(WidgetState.selected)) { return const RoundedRectangleBorder(); } return null; // Defer to default value on the theme or widget. @@ -33,10 +34,12 @@ class WidgetStateOutlinedBorderExample extends StatefulWidget { const WidgetStateOutlinedBorderExample({super.key}); @override - State createState() => _WidgetStateOutlinedBorderExampleState(); + State createState() => + _WidgetStateOutlinedBorderExampleState(); } -class _WidgetStateOutlinedBorderExampleState extends State { +class _WidgetStateOutlinedBorderExampleState + extends State { bool isSelected = true; @override diff --git a/examples/api/lib/widgets/widget_state/widget_state_property.0.dart b/examples/api/lib/widgets/widget_state/widget_state_property.0.dart index db33dda8933..837ee311884 100644 --- a/examples/api/lib/widgets/widget_state/widget_state_property.0.dart +++ b/examples/api/lib/widgets/widget_state/widget_state_property.0.dart @@ -31,11 +31,12 @@ class WidgetStatePropertyExample extends StatelessWidget { Widget build(BuildContext context) { return TextButton( style: ButtonStyle( - foregroundColor: WidgetStateProperty.fromMap({ - WidgetState.focused: Colors.blueAccent, - WidgetState.pressed | WidgetState.hovered: Colors.blue, - WidgetState.any: Colors.red, - }), + foregroundColor: + WidgetStateProperty.fromMap({ + WidgetState.focused: Colors.blueAccent, + WidgetState.pressed | WidgetState.hovered: Colors.blue, + WidgetState.any: Colors.red, + }), ), onPressed: () {}, child: const Text('TextButton'), diff --git a/examples/api/lib/widgets/windows/tooltip.0.dart b/examples/api/lib/widgets/windows/tooltip.0.dart index 0de42af4c9c..388622c8f1d 100644 --- a/examples/api/lib/widgets/windows/tooltip.0.dart +++ b/examples/api/lib/widgets/windows/tooltip.0.dart @@ -18,7 +18,10 @@ void main() { RegularWindow( controller: RegularWindowController( preferredSize: const Size(800, 600), - preferredConstraints: const BoxConstraints(minWidth: 640, minHeight: 480), + preferredConstraints: const BoxConstraints( + minWidth: 640, + minHeight: 480, + ), title: 'Example Window', ), child: const MaterialApp(home: MyApp()), @@ -65,7 +68,10 @@ class _MyAppState extends State { child: Container( padding: const EdgeInsets.all(8), color: Colors.black, - child: const Text('This is a tooltip', style: TextStyle(color: Colors.white)), + child: const Text( + 'This is a tooltip', + style: TextStyle(color: Colors.white), + ), ), ), ); @@ -97,7 +103,8 @@ class _MyAppState extends State { } Rect? _getAnchorRect() { - final RenderBox? renderBox = _key.currentContext?.findRenderObject() as RenderBox?; + final RenderBox? renderBox = + _key.currentContext?.findRenderObject() as RenderBox?; if (renderBox != null) { final Offset position = renderBox.localToGlobal(Offset.zero); final Size size = renderBox.size; diff --git a/examples/api/test/animation/animation_controller/animated_digit.0_test.dart b/examples/api/test/animation/animation_controller/animated_digit.0_test.dart index da02508d65d..c94e049dc65 100644 --- a/examples/api/test/animation/animation_controller/animated_digit.0_test.dart +++ b/examples/api/test/animation/animation_controller/animated_digit.0_test.dart @@ -12,7 +12,10 @@ void main() { await tester.pumpWidget(const example.AnimatedDigitApp()); Finder findVisibleDigit(int digit) { - return find.descendant(of: find.byType(SlideTransition).last, matching: find.text('$digit')); + return find.descendant( + of: find.byType(SlideTransition).last, + matching: find.text('$digit'), + ); } expect(findVisibleDigit(0), findsOneWidget); @@ -26,7 +29,9 @@ void main() { expect(findVisibleDigit(2), findsOneWidget); await tester.tap(find.byType(FloatingActionButton)); - await tester.pump(const Duration(milliseconds: 100)); // Animation duration is 300ms + await tester.pump( + const Duration(milliseconds: 100), + ); // Animation duration is 300ms await tester.tap(find.byType(FloatingActionButton)); await tester.pumpAndSettle(); expect(findVisibleDigit(4), findsOneWidget); diff --git a/examples/api/test/animation/curves/curve2_d.0_test.dart b/examples/api/test/animation/curves/curve2_d.0_test.dart index 3c6fdde2565..062163bcf38 100644 --- a/examples/api/test/animation/curves/curve2_d.0_test.dart +++ b/examples/api/test/animation/curves/curve2_d.0_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/animation/curves/curve2_d.0.dart' as example; +import 'package:flutter_api_samples/animation/curves/curve2_d.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('The buzz widget should move around', (WidgetTester tester) async { + testWidgets('The buzz widget should move around', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.Curve2DExampleApp()); final Finder textFinder = find.widgetWithText(CircleAvatar, 'B'); diff --git a/examples/api/test/cupertino/activity_indicator/cupertino_activity_indicator.0_test.dart b/examples/api/test/cupertino/activity_indicator/cupertino_activity_indicator.0_test.dart index 497080b6b75..a5de0449927 100644 --- a/examples/api/test/cupertino/activity_indicator/cupertino_activity_indicator.0_test.dart +++ b/examples/api/test/cupertino/activity_indicator/cupertino_activity_indicator.0_test.dart @@ -8,18 +8,34 @@ import 'package:flutter_api_samples/cupertino/activity_indicator/cupertino_activ import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Default and customized cupertino activity indicators', (WidgetTester tester) async { + testWidgets('Default and customized cupertino activity indicators', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.CupertinoIndicatorApp()); // Cupertino activity indicator with default properties. final Finder firstIndicator = find.byType(CupertinoActivityIndicator).at(0); - expect(tester.widget(firstIndicator).animating, true); - expect(tester.widget(firstIndicator).radius, 10.0); + expect( + tester.widget(firstIndicator).animating, + true, + ); + expect( + tester.widget(firstIndicator).radius, + 10.0, + ); // Cupertino activity indicator with custom radius and color. - final Finder secondIndicator = find.byType(CupertinoActivityIndicator).at(1); - expect(tester.widget(secondIndicator).animating, true); - expect(tester.widget(secondIndicator).radius, 20.0); + final Finder secondIndicator = find + .byType(CupertinoActivityIndicator) + .at(1); + expect( + tester.widget(secondIndicator).animating, + true, + ); + expect( + tester.widget(secondIndicator).radius, + 20.0, + ); expect( tester.widget(secondIndicator).color, CupertinoColors.activeBlue, @@ -27,7 +43,13 @@ void main() { // Cupertino activity indicator with custom radius and disabled animation. final Finder thirdIndicator = find.byType(CupertinoActivityIndicator).at(2); - expect(tester.widget(thirdIndicator).animating, false); - expect(tester.widget(thirdIndicator).radius, 20.0); + expect( + tester.widget(thirdIndicator).animating, + false, + ); + expect( + tester.widget(thirdIndicator).radius, + 20.0, + ); }); } diff --git a/examples/api/test/cupertino/activity_indicator/cupertino_linear_activity_indicator.0_test.dart b/examples/api/test/cupertino/activity_indicator/cupertino_linear_activity_indicator.0_test.dart index d22ca2002f8..a20fbaf5b8d 100644 --- a/examples/api/test/cupertino/activity_indicator/cupertino_linear_activity_indicator.0_test.dart +++ b/examples/api/test/cupertino/activity_indicator/cupertino_linear_activity_indicator.0_test.dart @@ -8,31 +8,43 @@ import 'package:flutter_api_samples/cupertino/activity_indicator/cupertino_linea import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Default and customized cupertino activity indicators', (WidgetTester tester) async { - await tester.pumpWidget(const example.CupertinoLinearActivityIndicatorApp()); + testWidgets('Default and customized cupertino activity indicators', ( + WidgetTester tester, + ) async { + await tester.pumpWidget( + const example.CupertinoLinearActivityIndicatorApp(), + ); - final Finder firstIndicator = find.byType(CupertinoLinearActivityIndicator).first; + final Finder firstIndicator = find + .byType(CupertinoLinearActivityIndicator) + .first; final CupertinoLinearActivityIndicator firstWidget = tester .widget(firstIndicator); expect(firstWidget.progress, 0); expect(firstWidget.height, 4.5); expect(firstWidget.color, isNull); - final Finder secondIndicator = find.byType(CupertinoLinearActivityIndicator).at(1); + final Finder secondIndicator = find + .byType(CupertinoLinearActivityIndicator) + .at(1); final CupertinoLinearActivityIndicator secondWidget = tester .widget(secondIndicator); expect(secondWidget.progress, 0.2); expect(secondWidget.height, 4.5); expect(secondWidget.color, isNull); - final Finder thirdIndicator = find.byType(CupertinoLinearActivityIndicator).at(2); + final Finder thirdIndicator = find + .byType(CupertinoLinearActivityIndicator) + .at(2); final CupertinoLinearActivityIndicator thirdWidget = tester .widget(thirdIndicator); expect(thirdWidget.progress, 0.4); expect(thirdWidget.height, 10); expect(thirdWidget.color, isNull); - final Finder lastIndicator = find.byType(CupertinoLinearActivityIndicator).last; + final Finder lastIndicator = find + .byType(CupertinoLinearActivityIndicator) + .last; final CupertinoLinearActivityIndicator lastWidget = tester .widget(lastIndicator); expect(lastWidget.progress, 0.6); diff --git a/examples/api/test/cupertino/bottom_tab_bar/cupertino_tab_bar.0_test.dart b/examples/api/test/cupertino/bottom_tab_bar/cupertino_tab_bar.0_test.dart index 796437d5d09..d80429a96e5 100644 --- a/examples/api/test/cupertino/bottom_tab_bar/cupertino_tab_bar.0_test.dart +++ b/examples/api/test/cupertino/bottom_tab_bar/cupertino_tab_bar.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter_api_samples/cupertino/bottom_tab_bar/cupertino_tab_bar.0.dart' as example; +import 'package:flutter_api_samples/cupertino/bottom_tab_bar/cupertino_tab_bar.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/cupertino/button/cupertino_button.0_test.dart b/examples/api/test/cupertino/button/cupertino_button.0_test.dart index a54ee5be83c..83e661cc013 100644 --- a/examples/api/test/cupertino/button/cupertino_button.0_test.dart +++ b/examples/api/test/cupertino/button/cupertino_button.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter_api_samples/cupertino/button/cupertino_button.0.dart' as example; +import 'package:flutter_api_samples/cupertino/button/cupertino_button.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -12,11 +13,17 @@ void main() { expect(find.byType(CupertinoButton), findsNWidgets(4)); expect( - find.ancestor(of: find.text('Enabled'), matching: find.byType(CupertinoButton)), + find.ancestor( + of: find.text('Enabled'), + matching: find.byType(CupertinoButton), + ), findsNWidgets(2), ); expect( - find.ancestor(of: find.text('Disabled'), matching: find.byType(CupertinoButton)), + find.ancestor( + of: find.text('Disabled'), + matching: find.byType(CupertinoButton), + ), findsNWidgets(2), ); }); diff --git a/examples/api/test/cupertino/checkbox/cupertino_checkbox.0_test.dart b/examples/api/test/cupertino/checkbox/cupertino_checkbox.0_test.dart index 6275d368e52..08b7f0dc716 100644 --- a/examples/api/test/cupertino/checkbox/cupertino_checkbox.0_test.dart +++ b/examples/api/test/cupertino/checkbox/cupertino_checkbox.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter_api_samples/cupertino/checkbox/cupertino_checkbox.0.dart' as example; +import 'package:flutter_api_samples/cupertino/checkbox/cupertino_checkbox.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/cupertino/date_picker/cupertino_date_picker.0_test.dart b/examples/api/test/cupertino/date_picker/cupertino_date_picker.0_test.dart index a328778d552..df7b218e797 100644 --- a/examples/api/test/cupertino/date_picker/cupertino_date_picker.0_test.dart +++ b/examples/api/test/cupertino/date_picker/cupertino_date_picker.0_test.dart @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:flutter_api_samples/cupertino/date_picker/cupertino_date_picker.0.dart' as example; +import 'package:flutter_api_samples/cupertino/date_picker/cupertino_date_picker.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; const Offset _kRowOffset = Offset(0.0, -50.0); diff --git a/examples/api/test/cupertino/date_picker/cupertino_timer_picker.0_test.dart b/examples/api/test/cupertino/date_picker/cupertino_timer_picker.0_test.dart index e1671cac9e8..f5e051cf5db 100644 --- a/examples/api/test/cupertino/date_picker/cupertino_timer_picker.0_test.dart +++ b/examples/api/test/cupertino/date_picker/cupertino_timer_picker.0_test.dart @@ -2,13 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:flutter_api_samples/cupertino/date_picker/cupertino_timer_picker.0.dart' as example; +import 'package:flutter_api_samples/cupertino/date_picker/cupertino_timer_picker.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; const Offset _kRowOffset = Offset(0.0, -50.0); void main() { - testWidgets('Can pick a duration from CupertinoTimerPicker', (WidgetTester tester) async { + testWidgets('Can pick a duration from CupertinoTimerPicker', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.TimerPickerApp()); // Launch the timer picker. diff --git a/examples/api/test/cupertino/dialog/cupertino_action_sheet.0_test.dart b/examples/api/test/cupertino/dialog/cupertino_action_sheet.0_test.dart index 5092d8fa3ed..e2e860ee05a 100644 --- a/examples/api/test/cupertino/dialog/cupertino_action_sheet.0_test.dart +++ b/examples/api/test/cupertino/dialog/cupertino_action_sheet.0_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter_api_samples/cupertino/dialog/cupertino_action_sheet.0.dart' as example; +import 'package:flutter_api_samples/cupertino/dialog/cupertino_action_sheet.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Perform an action on CupertinoActionSheet', (WidgetTester tester) async { + testWidgets('Perform an action on CupertinoActionSheet', ( + WidgetTester tester, + ) async { const String actionText = 'Destructive Action'; await tester.pumpWidget(const example.ActionSheetApp()); diff --git a/examples/api/test/cupertino/dialog/cupertino_alert_dialog.0_test.dart b/examples/api/test/cupertino/dialog/cupertino_alert_dialog.0_test.dart index 3bb81e10854..32d0236502e 100644 --- a/examples/api/test/cupertino/dialog/cupertino_alert_dialog.0_test.dart +++ b/examples/api/test/cupertino/dialog/cupertino_alert_dialog.0_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter_api_samples/cupertino/dialog/cupertino_alert_dialog.0.dart' as example; +import 'package:flutter_api_samples/cupertino/dialog/cupertino_alert_dialog.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Perform an action on CupertinoAlertDialog', (WidgetTester tester) async { + testWidgets('Perform an action on CupertinoAlertDialog', ( + WidgetTester tester, + ) async { const String actionText = 'Yes'; await tester.pumpWidget(const example.AlertDialogApp()); diff --git a/examples/api/test/cupertino/dialog/cupertino_popup_surface.0_test.dart b/examples/api/test/cupertino/dialog/cupertino_popup_surface.0_test.dart index d26de099e38..c2b53444359 100644 --- a/examples/api/test/cupertino/dialog/cupertino_popup_surface.0_test.dart +++ b/examples/api/test/cupertino/dialog/cupertino_popup_surface.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter_api_samples/cupertino/dialog/cupertino_popup_surface.0.dart' as example; +import 'package:flutter_api_samples/cupertino/dialog/cupertino_popup_surface.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -25,7 +26,10 @@ void main() { await tester.pumpWidget(const example.PopupSurfaceApp()); // CupertinoSwitch is toggled on by default. - expect(tester.widget(find.byType(CupertinoSwitch)).value, isTrue); + expect( + tester.widget(find.byType(CupertinoSwitch)).value, + isTrue, + ); // Tap on the CupertinoButton to show the CupertinoPopupSurface. await tester.tap(find.byType(CupertinoButton)); diff --git a/examples/api/test/cupertino/expansion_tile/cupertino_expansion_tile.0_test.dart b/examples/api/test/cupertino/expansion_tile/cupertino_expansion_tile.0_test.dart index b8666a6ee64..8c73ff13c87 100644 --- a/examples/api/test/cupertino/expansion_tile/cupertino_expansion_tile.0_test.dart +++ b/examples/api/test/cupertino/expansion_tile/cupertino_expansion_tile.0_test.dart @@ -6,7 +6,9 @@ import 'package:flutter_api_samples/cupertino/expansion_tile/cupertino_expansion import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('CupertinoExpansionTile transition modes test', (WidgetTester tester) async { + testWidgets('CupertinoExpansionTile transition modes test', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const CupertinoExpansionTileApp()); // Check initial labels. diff --git a/examples/api/test/cupertino/form_row/cupertino_form_row.0_test.dart b/examples/api/test/cupertino/form_row/cupertino_form_row.0_test.dart index 46b2118fc76..1727782588a 100644 --- a/examples/api/test/cupertino/form_row/cupertino_form_row.0_test.dart +++ b/examples/api/test/cupertino/form_row/cupertino_form_row.0_test.dart @@ -3,19 +3,31 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter_api_samples/cupertino/form_row/cupertino_form_row.0.dart' as example; +import 'package:flutter_api_samples/cupertino/form_row/cupertino_form_row.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Cupertino form section displays cupertino form rows', (WidgetTester tester) async { + testWidgets('Cupertino form section displays cupertino form rows', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.CupertinoFormRowApp()); expect(find.byType(CupertinoFormSection), findsOneWidget); expect(find.byType(CupertinoFormRow), findsNWidgets(4)); - expect(find.widgetWithText(CupertinoFormSection, 'Connectivity'), findsOneWidget); - expect(find.widgetWithText(CupertinoFormRow, 'Airplane Mode'), findsOneWidget); + expect( + find.widgetWithText(CupertinoFormSection, 'Connectivity'), + findsOneWidget, + ); + expect( + find.widgetWithText(CupertinoFormRow, 'Airplane Mode'), + findsOneWidget, + ); expect(find.widgetWithText(CupertinoFormRow, 'Wi-Fi'), findsOneWidget); expect(find.widgetWithText(CupertinoFormRow, 'Bluetooth'), findsOneWidget); - expect(find.widgetWithText(CupertinoFormRow, 'Mobile Data'), findsOneWidget); + expect( + find.widgetWithText(CupertinoFormRow, 'Mobile Data'), + findsOneWidget, + ); }); } diff --git a/examples/api/test/cupertino/list_section/list_section_base.0_test.dart b/examples/api/test/cupertino/list_section/list_section_base.0_test.dart index bf8dccad557..7b4eeb22718 100644 --- a/examples/api/test/cupertino/list_section/list_section_base.0_test.dart +++ b/examples/api/test/cupertino/list_section/list_section_base.0_test.dart @@ -3,23 +3,27 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter_api_samples/cupertino/list_section/list_section_base.0.dart' as example; +import 'package:flutter_api_samples/cupertino/list_section/list_section_base.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Has exactly 1 CupertinoListSection base widget', (WidgetTester tester) async { + testWidgets('Has exactly 1 CupertinoListSection base widget', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.CupertinoListSectionBaseApp()); final Finder listSectionFinder = find.byType(CupertinoListSection); expect(listSectionFinder, findsOneWidget); - final CupertinoListSection listSectionWidget = tester.widget( - listSectionFinder, - ); + final CupertinoListSection listSectionWidget = tester + .widget(listSectionFinder); expect(listSectionWidget.type, equals(CupertinoListSectionType.base)); }); - testWidgets('CupertinoListSection has 3 CupertinoListTile children', (WidgetTester tester) async { + testWidgets('CupertinoListSection has 3 CupertinoListTile children', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.CupertinoListSectionBaseApp()); expect(find.byType(CupertinoListTile), findsNWidgets(3)); diff --git a/examples/api/test/cupertino/list_section/list_section_inset.0_test.dart b/examples/api/test/cupertino/list_section/list_section_inset.0_test.dart index 10a01c0365f..d3adff63db1 100644 --- a/examples/api/test/cupertino/list_section/list_section_inset.0_test.dart +++ b/examples/api/test/cupertino/list_section/list_section_inset.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter_api_samples/cupertino/list_section/list_section_inset.0.dart' as example; +import 'package:flutter_api_samples/cupertino/list_section/list_section_inset.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -15,13 +16,17 @@ void main() { final Finder listSectionFinder = find.byType(CupertinoListSection); expect(listSectionFinder, findsOneWidget); - final CupertinoListSection listSectionWidget = tester.widget( - listSectionFinder, + final CupertinoListSection listSectionWidget = tester + .widget(listSectionFinder); + expect( + listSectionWidget.type, + equals(CupertinoListSectionType.insetGrouped), ); - expect(listSectionWidget.type, equals(CupertinoListSectionType.insetGrouped)); }); - testWidgets('CupertinoListSection has 3 CupertinoListTile children', (WidgetTester tester) async { + testWidgets('CupertinoListSection has 3 CupertinoListTile children', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.CupertinoListSectionInsetApp()); expect(find.byType(CupertinoListTile), findsNWidgets(3)); diff --git a/examples/api/test/cupertino/list_tile/cupertino_list_tile.0_test.dart b/examples/api/test/cupertino/list_tile/cupertino_list_tile.0_test.dart index 5616f68483c..89d1a48b697 100644 --- a/examples/api/test/cupertino/list_tile/cupertino_list_tile.0_test.dart +++ b/examples/api/test/cupertino/list_tile/cupertino_list_tile.0_test.dart @@ -4,11 +4,14 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/cupertino/list_tile/cupertino_list_tile.0.dart' as example; +import 'package:flutter_api_samples/cupertino/list_tile/cupertino_list_tile.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('CupertinoListTile respects properties', (WidgetTester tester) async { + testWidgets('CupertinoListTile respects properties', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.CupertinoListTileApp()); expect(find.text('CupertinoListTile Sample'), findsOne); @@ -30,7 +33,9 @@ void main() { const Key('CupertinoListTile with background color'), ); expect( - tester.firstWidget(tileWithBackgroundFinder).backgroundColor, + tester + .firstWidget(tileWithBackgroundFinder) + .backgroundColor, Colors.lightBlue, ); }); diff --git a/examples/api/test/cupertino/nav_bar/cupertino_navigation_bar.0_test.dart b/examples/api/test/cupertino/nav_bar/cupertino_navigation_bar.0_test.dart index 03f45250eaa..a6f885716d6 100644 --- a/examples/api/test/cupertino/nav_bar/cupertino_navigation_bar.0_test.dart +++ b/examples/api/test/cupertino/nav_bar/cupertino_navigation_bar.0_test.dart @@ -3,18 +3,20 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter_api_samples/cupertino/nav_bar/cupertino_navigation_bar.0.dart' as example; +import 'package:flutter_api_samples/cupertino/nav_bar/cupertino_navigation_bar.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('CupertinoNavigationBar is semi transparent', (WidgetTester tester) async { + testWidgets('CupertinoNavigationBar is semi transparent', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.NavBarApp()); final Finder navBarFinder = find.byType(CupertinoNavigationBar); expect(navBarFinder, findsOneWidget); - final CupertinoNavigationBar cupertinoNavigationBar = tester.widget( - navBarFinder, - ); + final CupertinoNavigationBar cupertinoNavigationBar = tester + .widget(navBarFinder); expect( cupertinoNavigationBar.backgroundColor, CupertinoColors.systemGrey.withValues(alpha: 0.5), diff --git a/examples/api/test/cupertino/nav_bar/cupertino_navigation_bar.1_test.dart b/examples/api/test/cupertino/nav_bar/cupertino_navigation_bar.1_test.dart index ea8375da775..7eaab500f6a 100644 --- a/examples/api/test/cupertino/nav_bar/cupertino_navigation_bar.1_test.dart +++ b/examples/api/test/cupertino/nav_bar/cupertino_navigation_bar.1_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter_api_samples/cupertino/nav_bar/cupertino_navigation_bar.1.dart' as example; +import 'package:flutter_api_samples/cupertino/nav_bar/cupertino_navigation_bar.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('CupertinoNavigationBar with bottom widget', (WidgetTester tester) async { + testWidgets('CupertinoNavigationBar with bottom widget', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.NavBarApp()); final Finder navBarFinder = find.byType(CupertinoNavigationBar); diff --git a/examples/api/test/cupertino/nav_bar/cupertino_navigation_bar.2_test.dart b/examples/api/test/cupertino/nav_bar/cupertino_navigation_bar.2_test.dart index b2557159b92..ed152d05cc5 100644 --- a/examples/api/test/cupertino/nav_bar/cupertino_navigation_bar.2_test.dart +++ b/examples/api/test/cupertino/nav_bar/cupertino_navigation_bar.2_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter_api_samples/cupertino/nav_bar/cupertino_navigation_bar.2.dart' as example; +import 'package:flutter_api_samples/cupertino/nav_bar/cupertino_navigation_bar.2.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/cupertino/nav_bar/cupertino_sliver_nav_bar.0_test.dart b/examples/api/test/cupertino/nav_bar/cupertino_sliver_nav_bar.0_test.dart index e31796241c1..faed824a055 100644 --- a/examples/api/test/cupertino/nav_bar/cupertino_sliver_nav_bar.0_test.dart +++ b/examples/api/test/cupertino/nav_bar/cupertino_sliver_nav_bar.0_test.dart @@ -3,80 +3,87 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter_api_samples/cupertino/nav_bar/cupertino_sliver_nav_bar.0.dart' as example; +import 'package:flutter_api_samples/cupertino/nav_bar/cupertino_sliver_nav_bar.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; const Offset dragUp = Offset(0.0, -150.0); -void setWindowToPortrait(WidgetTester tester, {Size size = const Size(2400.0, 3000.0)}) { +void setWindowToPortrait( + WidgetTester tester, { + Size size = const Size(2400.0, 3000.0), +}) { tester.view.physicalSize = size; addTearDown(tester.view.reset); } void main() { - testWidgets('Collapse and expand CupertinoSliverNavigationBar changes title position', ( - WidgetTester tester, - ) async { - setWindowToPortrait(tester); - await tester.pumpWidget(const example.SliverNavBarApp()); + testWidgets( + 'Collapse and expand CupertinoSliverNavigationBar changes title position', + (WidgetTester tester) async { + setWindowToPortrait(tester); + await tester.pumpWidget(const example.SliverNavBarApp()); - // Large title is visible and at lower position. - expect(tester.getBottomLeft(find.text('Contacts').first).dy, 88.0); - await tester.fling(find.text('Drag me up'), dragUp, 500.0); - await tester.pumpAndSettle(); + // Large title is visible and at lower position. + expect(tester.getBottomLeft(find.text('Contacts').first).dy, 88.0); + await tester.fling(find.text('Drag me up'), dragUp, 500.0); + await tester.pumpAndSettle(); - // Large title is hidden and at higher position. - expect( - tester.getBottomLeft(find.text('Contacts').first).dy, - 36.0 + 8.0, - ); // Static part + _kNavBarBottomPadding. - }); + // Large title is hidden and at higher position. + expect( + tester.getBottomLeft(find.text('Contacts').first).dy, + 36.0 + 8.0, + ); // Static part + _kNavBarBottomPadding. + }, + ); - testWidgets('Middle widget is visible in both collapsed and expanded states', ( - WidgetTester tester, - ) async { - setWindowToPortrait(tester); - await tester.pumpWidget(const example.SliverNavBarApp()); + testWidgets( + 'Middle widget is visible in both collapsed and expanded states', + (WidgetTester tester) async { + setWindowToPortrait(tester); + await tester.pumpWidget(const example.SliverNavBarApp()); - // Navigate to a page that has both middle and large titles. - final Finder nextButton = find.text('Go to Next Page'); - expect(nextButton, findsOneWidget); - await tester.tap(nextButton); - await tester.pumpAndSettle(); + // Navigate to a page that has both middle and large titles. + final Finder nextButton = find.text('Go to Next Page'); + expect(nextButton, findsOneWidget); + await tester.tap(nextButton); + await tester.pumpAndSettle(); - // Both middle and large titles are visible. - expect(tester.getBottomLeft(find.text('Contacts Group').first).dy, 30.5); - expect(tester.getBottomLeft(find.text('Family').first).dy, 88.0); + // Both middle and large titles are visible. + expect(tester.getBottomLeft(find.text('Contacts Group').first).dy, 30.5); + expect(tester.getBottomLeft(find.text('Family').first).dy, 88.0); - await tester.fling(find.text('Drag me up'), dragUp, 500.0); - await tester.pumpAndSettle(); + await tester.fling(find.text('Drag me up'), dragUp, 500.0); + await tester.pumpAndSettle(); - // Large title is hidden and middle title is visible. - expect(tester.getBottomLeft(find.text('Contacts Group').first).dy, 30.5); - expect( - tester.getBottomLeft(find.text('Family').first).dy, - 36.0 + 8.0, - ); // Static part + _kNavBarBottomPadding. - }); + // Large title is hidden and middle title is visible. + expect(tester.getBottomLeft(find.text('Contacts Group').first).dy, 30.5); + expect( + tester.getBottomLeft(find.text('Family').first).dy, + 36.0 + 8.0, + ); // Static part + _kNavBarBottomPadding. + }, + ); - testWidgets('CupertinoSliverNavigationBar with previous route has back button', ( - WidgetTester tester, - ) async { - setWindowToPortrait(tester); - await tester.pumpWidget(const example.SliverNavBarApp()); + testWidgets( + 'CupertinoSliverNavigationBar with previous route has back button', + (WidgetTester tester) async { + setWindowToPortrait(tester); + await tester.pumpWidget(const example.SliverNavBarApp()); - // Navigate to a page that has back button - final Finder nextButton = find.text('Go to Next Page'); - expect(nextButton, findsOneWidget); - await tester.tap(nextButton); - await tester.pumpAndSettle(); - expect(nextButton, findsNothing); + // Navigate to a page that has back button + final Finder nextButton = find.text('Go to Next Page'); + expect(nextButton, findsOneWidget); + await tester.tap(nextButton); + await tester.pumpAndSettle(); + expect(nextButton, findsNothing); - // Go back to the previous page. - final Finder backButton = find.byType(CupertinoButton); - expect(backButton, findsOneWidget); - await tester.tap(backButton); - await tester.pumpAndSettle(); - expect(nextButton, findsOneWidget); - }); + // Go back to the previous page. + final Finder backButton = find.byType(CupertinoButton); + expect(backButton, findsOneWidget); + await tester.tap(backButton); + await tester.pumpAndSettle(); + expect(nextButton, findsOneWidget); + }, + ); } diff --git a/examples/api/test/cupertino/nav_bar/cupertino_sliver_nav_bar.1_test.dart b/examples/api/test/cupertino/nav_bar/cupertino_sliver_nav_bar.1_test.dart index e65a128a821..fd5d3222d34 100644 --- a/examples/api/test/cupertino/nav_bar/cupertino_sliver_nav_bar.1_test.dart +++ b/examples/api/test/cupertino/nav_bar/cupertino_sliver_nav_bar.1_test.dart @@ -3,40 +3,47 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter_api_samples/cupertino/nav_bar/cupertino_sliver_nav_bar.1.dart' as example; +import 'package:flutter_api_samples/cupertino/nav_bar/cupertino_sliver_nav_bar.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; const Offset titleDragUp = Offset(0.0, -100.0); const Offset bottomDragUp = Offset(0.0, -50.0); -void setWindowToPortrait(WidgetTester tester, {Size size = const Size(2400.0, 3000.0)}) { +void setWindowToPortrait( + WidgetTester tester, { + Size size = const Size(2400.0, 3000.0), +}) { tester.view.physicalSize = size; addTearDown(tester.view.reset); } void main() { - testWidgets('Collapse and expand CupertinoSliverNavigationBar changes title position', ( + testWidgets( + 'Collapse and expand CupertinoSliverNavigationBar changes title position', + (WidgetTester tester) async { + setWindowToPortrait(tester); + await tester.pumpWidget(const example.SliverNavBarApp()); + + // Large title is visible and at lower position. + expect(tester.getBottomLeft(find.text('Contacts').first).dy, 88.0); + await tester.fling(find.text('Drag me up'), titleDragUp, 500.0); + await tester.pumpAndSettle(); + + // Large title is hidden and at higher position. + expect( + tester.getBottomLeft(find.text('Contacts').first).dy, + 36.0 + 8.0, + ); // Static part + _kNavBarBottomPadding. + }, + ); + + testWidgets('Search field is hidden in bottom automatic mode', ( WidgetTester tester, ) async { setWindowToPortrait(tester); await tester.pumpWidget(const example.SliverNavBarApp()); - // Large title is visible and at lower position. - expect(tester.getBottomLeft(find.text('Contacts').first).dy, 88.0); - await tester.fling(find.text('Drag me up'), titleDragUp, 500.0); - await tester.pumpAndSettle(); - - // Large title is hidden and at higher position. - expect( - tester.getBottomLeft(find.text('Contacts').first).dy, - 36.0 + 8.0, - ); // Static part + _kNavBarBottomPadding. - }); - - testWidgets('Search field is hidden in bottom automatic mode', (WidgetTester tester) async { - setWindowToPortrait(tester); - await tester.pumpWidget(const example.SliverNavBarApp()); - // Navigate to a page with bottom automatic mode. final Finder nextButton = find.text('Bottom Automatic mode'); expect(nextButton, findsOneWidget); @@ -47,7 +54,10 @@ void main() { expect(tester.getBottomLeft(find.text('Contacts Group').first).dy, 30.5); expect(tester.getBottomLeft(find.text('Family').first).dy, 88.0); expect(tester.getTopLeft(find.byType(CupertinoSearchTextField)).dy, 96.0); - expect(tester.getBottomLeft(find.byType(CupertinoSearchTextField)).dy, 132.0); + expect( + tester.getBottomLeft(find.byType(CupertinoSearchTextField)).dy, + 132.0, + ); await tester.fling(find.text('Drag me up'), bottomDragUp, 50.0); await tester.pumpAndSettle(); @@ -56,7 +66,10 @@ void main() { expect(tester.getBottomLeft(find.text('Contacts Group').first).dy, 30.5); expect(tester.getBottomLeft(find.text('Family').first).dy, 88.0); expect(tester.getTopLeft(find.byType(CupertinoSearchTextField)).dy, 96.0); - expect(tester.getBottomLeft(find.byType(CupertinoSearchTextField)).dy, 96.0); + expect( + tester.getBottomLeft(find.byType(CupertinoSearchTextField)).dy, + 96.0, + ); await tester.fling(find.text('Drag me up'), titleDragUp, 50.0); await tester.pumpAndSettle(); @@ -67,10 +80,15 @@ void main() { tester.getBottomLeft(find.text('Family').first).dy, 36.0 + 8.0, ); // Static part + _kNavBarBottomPadding. - expect(tester.getBottomLeft(find.byType(CupertinoSearchTextField)).dy, 44.0); + expect( + tester.getBottomLeft(find.byType(CupertinoSearchTextField)).dy, + 44.0, + ); }); - testWidgets('Search field is always shown in bottom always mode', (WidgetTester tester) async { + testWidgets('Search field is always shown in bottom always mode', ( + WidgetTester tester, + ) async { setWindowToPortrait(tester); await tester.pumpWidget(const example.SliverNavBarApp()); @@ -84,7 +102,10 @@ void main() { expect(tester.getBottomLeft(find.text('Contacts Group').first).dy, 30.5); expect(tester.getBottomLeft(find.text('Family').first).dy, 88.0); expect(tester.getTopLeft(find.byType(CupertinoSearchTextField)).dy, 96.0); - expect(tester.getBottomLeft(find.byType(CupertinoSearchTextField)).dy, 132.0); + expect( + tester.getBottomLeft(find.byType(CupertinoSearchTextField)).dy, + 132.0, + ); await tester.fling(find.text('Drag me up'), titleDragUp, 50.0); await tester.pumpAndSettle(); @@ -96,10 +117,15 @@ void main() { 36.0 + 8.0, ); // Static part + _kNavBarBottomPadding. expect(tester.getTopLeft(find.byType(CupertinoSearchTextField)).dy, 44.0); - expect(tester.getBottomLeft(find.byType(CupertinoSearchTextField)).dy, 80.0); + expect( + tester.getBottomLeft(find.byType(CupertinoSearchTextField)).dy, + 80.0, + ); }); - testWidgets('Opens the search view when the search field is tapped', (WidgetTester tester) async { + testWidgets('Opens the search view when the search field is tapped', ( + WidgetTester tester, + ) async { setWindowToPortrait(tester); await tester.pumpWidget(const example.SliverNavBarApp()); @@ -109,17 +135,32 @@ void main() { await tester.tap(nextButton); await tester.pumpAndSettle(); - expect(find.widgetWithText(CupertinoSearchTextField, 'Search'), findsOneWidget); - expect(find.text('Tap on the search field to open the search view'), findsOneWidget); + expect( + find.widgetWithText(CupertinoSearchTextField, 'Search'), + findsOneWidget, + ); + expect( + find.text('Tap on the search field to open the search view'), + findsOneWidget, + ); // A decoy 'Cancel' button used in the animation. expect(find.widgetWithText(CupertinoButton, 'Cancel'), findsOneWidget); // Tap on the search field to open the search view. - await tester.tap(find.byType(CupertinoSearchTextField), warnIfMissed: false); + await tester.tap( + find.byType(CupertinoSearchTextField), + warnIfMissed: false, + ); await tester.pumpAndSettle(); - expect(find.widgetWithText(CupertinoSearchTextField, 'Enter search text'), findsOneWidget); - expect(find.text('Tap on the search field to open the search view'), findsNothing); + expect( + find.widgetWithText(CupertinoSearchTextField, 'Enter search text'), + findsOneWidget, + ); + expect( + find.text('Tap on the search field to open the search view'), + findsNothing, + ); expect(find.widgetWithText(CupertinoButton, 'Cancel'), findsOneWidget); await tester.enterText(find.byType(CupertinoSearchTextField), 'a'); @@ -131,44 +172,51 @@ void main() { await tester.tap(find.widgetWithText(CupertinoButton, 'Cancel')); await tester.pumpAndSettle(); - expect(find.widgetWithText(CupertinoSearchTextField, 'Search'), findsOneWidget); - expect(find.text('Tap on the search field to open the search view'), findsOneWidget); + expect( + find.widgetWithText(CupertinoSearchTextField, 'Search'), + findsOneWidget, + ); + expect( + find.text('Tap on the search field to open the search view'), + findsOneWidget, + ); // A decoy 'Cancel' button used in the animation. expect(find.widgetWithText(CupertinoButton, 'Cancel'), findsOneWidget); }); - testWidgets('CupertinoSliverNavigationBar with previous route has back button', ( - WidgetTester tester, - ) async { - setWindowToPortrait(tester); - await tester.pumpWidget(const example.SliverNavBarApp()); + testWidgets( + 'CupertinoSliverNavigationBar with previous route has back button', + (WidgetTester tester) async { + setWindowToPortrait(tester); + await tester.pumpWidget(const example.SliverNavBarApp()); - // Navigate to the first page. - final Finder nextButton1 = find.text('Bottom Automatic mode'); - expect(nextButton1, findsOneWidget); - await tester.tap(nextButton1); - await tester.pumpAndSettle(); - expect(nextButton1, findsNothing); + // Navigate to the first page. + final Finder nextButton1 = find.text('Bottom Automatic mode'); + expect(nextButton1, findsOneWidget); + await tester.tap(nextButton1); + await tester.pumpAndSettle(); + expect(nextButton1, findsNothing); - // Go back to the previous page. - final Finder backButton1 = find.byType(CupertinoButton).first; - expect(backButton1, findsOneWidget); - await tester.tap(backButton1); - await tester.pumpAndSettle(); - expect(nextButton1, findsOneWidget); + // Go back to the previous page. + final Finder backButton1 = find.byType(CupertinoButton).first; + expect(backButton1, findsOneWidget); + await tester.tap(backButton1); + await tester.pumpAndSettle(); + expect(nextButton1, findsOneWidget); - // Navigate to the second page. - final Finder nextButton2 = find.text('Bottom Always mode'); - expect(nextButton2, findsOneWidget); - await tester.tap(nextButton2); - await tester.pumpAndSettle(); - expect(nextButton2, findsNothing); + // Navigate to the second page. + final Finder nextButton2 = find.text('Bottom Always mode'); + expect(nextButton2, findsOneWidget); + await tester.tap(nextButton2); + await tester.pumpAndSettle(); + expect(nextButton2, findsNothing); - // Go back to the previous page. - final Finder backButton2 = find.byType(CupertinoButton).first; - expect(backButton2, findsOneWidget); - await tester.tap(backButton2); - await tester.pumpAndSettle(); - expect(nextButton2, findsOneWidget); - }); + // Go back to the previous page. + final Finder backButton2 = find.byType(CupertinoButton).first; + expect(backButton2, findsOneWidget); + await tester.tap(backButton2); + await tester.pumpAndSettle(); + expect(nextButton2, findsOneWidget); + }, + ); } diff --git a/examples/api/test/cupertino/nav_bar/cupertino_sliver_nav_bar.2_test.dart b/examples/api/test/cupertino/nav_bar/cupertino_sliver_nav_bar.2_test.dart index 4477383a262..b978d3b3cf6 100644 --- a/examples/api/test/cupertino/nav_bar/cupertino_sliver_nav_bar.2_test.dart +++ b/examples/api/test/cupertino/nav_bar/cupertino_sliver_nav_bar.2_test.dart @@ -3,23 +3,32 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter_api_samples/cupertino/nav_bar/cupertino_sliver_nav_bar.2.dart' as example; +import 'package:flutter_api_samples/cupertino/nav_bar/cupertino_sliver_nav_bar.2.dart' + as example; import 'package:flutter_test/flutter_test.dart'; const Offset dragUp = Offset(0.0, -150.0); -void setWindowToPortrait(WidgetTester tester, {Size size = const Size(2400.0, 3000.0)}) { +void setWindowToPortrait( + WidgetTester tester, { + Size size = const Size(2400.0, 3000.0), +}) { tester.view.physicalSize = size; addTearDown(tester.view.reset); } void main() { - testWidgets('CupertinoSliverNavigationBar bottom widget', (WidgetTester tester) async { + testWidgets('CupertinoSliverNavigationBar bottom widget', ( + WidgetTester tester, + ) async { setWindowToPortrait(tester); await tester.pumpWidget(const example.SliverNavBarApp()); final Finder preferredSize = find.byType(PreferredSize); - final Finder coloredBox = find.descendant(of: preferredSize, matching: find.byType(ColoredBox)); + final Finder coloredBox = find.descendant( + of: preferredSize, + matching: find.byType(ColoredBox), + ); final Finder text = find.text('Bottom Widget'); expect(preferredSize, findsOneWidget); @@ -27,69 +36,72 @@ void main() { expect(text, findsOneWidget); }); - testWidgets('Collapse and expand CupertinoSliverNavigationBar changes title position', ( - WidgetTester tester, - ) async { - setWindowToPortrait(tester); - await tester.pumpWidget(const example.SliverNavBarApp()); + testWidgets( + 'Collapse and expand CupertinoSliverNavigationBar changes title position', + (WidgetTester tester) async { + setWindowToPortrait(tester); + await tester.pumpWidget(const example.SliverNavBarApp()); - // Large title is visible and at lower position. - expect(tester.getBottomLeft(find.text('Contacts').first).dy, 88.0); - await tester.fling(find.text('Drag me up'), dragUp, 500.0); - await tester.pumpAndSettle(); + // Large title is visible and at lower position. + expect(tester.getBottomLeft(find.text('Contacts').first).dy, 88.0); + await tester.fling(find.text('Drag me up'), dragUp, 500.0); + await tester.pumpAndSettle(); - // Large title is hidden and at higher position. - expect( - tester.getBottomLeft(find.text('Contacts').first).dy, - 36.0 + 8.0, - ); // Static part + _kNavBarBottomPadding. - }); + // Large title is hidden and at higher position. + expect( + tester.getBottomLeft(find.text('Contacts').first).dy, + 36.0 + 8.0, + ); // Static part + _kNavBarBottomPadding. + }, + ); - testWidgets('Middle widget is visible in both collapsed and expanded states', ( - WidgetTester tester, - ) async { - setWindowToPortrait(tester); - await tester.pumpWidget(const example.SliverNavBarApp()); + testWidgets( + 'Middle widget is visible in both collapsed and expanded states', + (WidgetTester tester) async { + setWindowToPortrait(tester); + await tester.pumpWidget(const example.SliverNavBarApp()); - // Navigate to a page that has both middle and large titles. - final Finder nextButton = find.text('Go to Next Page'); - expect(nextButton, findsOneWidget); - await tester.tap(nextButton); - await tester.pumpAndSettle(); + // Navigate to a page that has both middle and large titles. + final Finder nextButton = find.text('Go to Next Page'); + expect(nextButton, findsOneWidget); + await tester.tap(nextButton); + await tester.pumpAndSettle(); - // Both middle and large titles are visible. - expect(tester.getBottomLeft(find.text('Contacts Group').first).dy, 30.5); - expect(tester.getBottomLeft(find.text('Family').first).dy, 88.0); + // Both middle and large titles are visible. + expect(tester.getBottomLeft(find.text('Contacts Group').first).dy, 30.5); + expect(tester.getBottomLeft(find.text('Family').first).dy, 88.0); - await tester.fling(find.text('Drag me up'), dragUp, 500.0); - await tester.pumpAndSettle(); + await tester.fling(find.text('Drag me up'), dragUp, 500.0); + await tester.pumpAndSettle(); - // Large title is hidden and middle title is visible. - expect(tester.getBottomLeft(find.text('Contacts Group').first).dy, 30.5); - expect( - tester.getBottomLeft(find.text('Family').first).dy, - 36.0 + 8.0, - ); // Static part + _kNavBarBottomPadding. - }); + // Large title is hidden and middle title is visible. + expect(tester.getBottomLeft(find.text('Contacts Group').first).dy, 30.5); + expect( + tester.getBottomLeft(find.text('Family').first).dy, + 36.0 + 8.0, + ); // Static part + _kNavBarBottomPadding. + }, + ); - testWidgets('CupertinoSliverNavigationBar with previous route has back button', ( - WidgetTester tester, - ) async { - setWindowToPortrait(tester); - await tester.pumpWidget(const example.SliverNavBarApp()); + testWidgets( + 'CupertinoSliverNavigationBar with previous route has back button', + (WidgetTester tester) async { + setWindowToPortrait(tester); + await tester.pumpWidget(const example.SliverNavBarApp()); - // Navigate to a page that has a back button. - final Finder nextButton = find.text('Go to Next Page'); - expect(nextButton, findsOneWidget); - await tester.tap(nextButton); - await tester.pumpAndSettle(); - expect(nextButton, findsNothing); + // Navigate to a page that has a back button. + final Finder nextButton = find.text('Go to Next Page'); + expect(nextButton, findsOneWidget); + await tester.tap(nextButton); + await tester.pumpAndSettle(); + expect(nextButton, findsNothing); - // Go back to the previous page. - final Finder backButton = find.byType(CupertinoButton); - expect(backButton, findsOneWidget); - await tester.tap(backButton); - await tester.pumpAndSettle(); - expect(nextButton, findsOneWidget); - }); + // Go back to the previous page. + final Finder backButton = find.byType(CupertinoButton); + expect(backButton, findsOneWidget); + await tester.tap(backButton); + await tester.pumpAndSettle(); + expect(nextButton, findsOneWidget); + }, + ); } diff --git a/examples/api/test/cupertino/picker/cupertino_picker.0_test.dart b/examples/api/test/cupertino/picker/cupertino_picker.0_test.dart index 1225ebe1850..306cc0b28b6 100644 --- a/examples/api/test/cupertino/picker/cupertino_picker.0_test.dart +++ b/examples/api/test/cupertino/picker/cupertino_picker.0_test.dart @@ -3,13 +3,16 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter_api_samples/cupertino/picker/cupertino_picker.0.dart' as example; +import 'package:flutter_api_samples/cupertino/picker/cupertino_picker.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; const Offset _kRowOffset = Offset(0.0, -50.0); void main() { - testWidgets('Change selected fruit using CupertinoPicker', (WidgetTester tester) async { + testWidgets('Change selected fruit using CupertinoPicker', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.CupertinoPickerApp()); // Open the Cupertino picker. @@ -17,7 +20,9 @@ void main() { await tester.pumpAndSettle(); // Test the initial item. - CupertinoPicker picker = tester.widget(find.byType(CupertinoPicker)); + CupertinoPicker picker = tester.widget( + find.byType(CupertinoPicker), + ); expect(picker.scrollController!.initialItem, 0); // Drag the wheel to change fruit selection. diff --git a/examples/api/test/cupertino/radio/cupertino_radio.0_test.dart b/examples/api/test/cupertino/radio/cupertino_radio.0_test.dart index c95dba6bb87..c35220f0a62 100644 --- a/examples/api/test/cupertino/radio/cupertino_radio.0_test.dart +++ b/examples/api/test/cupertino/radio/cupertino_radio.0_test.dart @@ -3,21 +3,27 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter_api_samples/cupertino/radio/cupertino_radio.0.dart' as example; +import 'package:flutter_api_samples/cupertino/radio/cupertino_radio.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('Has 2 CupertinoRadio widgets', (WidgetTester tester) async { await tester.pumpWidget(const example.CupertinoRadioApp()); - expect(find.byType(CupertinoRadio), findsNWidgets(2)); + expect( + find.byType(CupertinoRadio), + findsNWidgets(2), + ); RadioGroup group = tester.widget( find.byType(RadioGroup), ); expect(group.groupValue, example.SingingCharacter.lafayette); - await tester.tap(find.byType(CupertinoRadio).last); + await tester.tap( + find.byType(CupertinoRadio).last, + ); await tester.pumpAndSettle(); group = tester.widget(find.byType(RadioGroup)); diff --git a/examples/api/test/cupertino/radio/cupertino_radio.toggleable.0_test.dart b/examples/api/test/cupertino/radio/cupertino_radio.toggleable.0_test.dart index 2b46237fc13..d1c73a0a05d 100644 --- a/examples/api/test/cupertino/radio/cupertino_radio.toggleable.0_test.dart +++ b/examples/api/test/cupertino/radio/cupertino_radio.toggleable.0_test.dart @@ -3,27 +3,37 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter_api_samples/cupertino/radio/cupertino_radio.toggleable.0.dart' as example; +import 'package:flutter_api_samples/cupertino/radio/cupertino_radio.toggleable.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Has 2 CupertinoRadio widgets that can be toggled off', (WidgetTester tester) async { + testWidgets('Has 2 CupertinoRadio widgets that can be toggled off', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.CupertinoRadioApp()); - expect(find.byType(CupertinoRadio), findsNWidgets(2)); + expect( + find.byType(CupertinoRadio), + findsNWidgets(2), + ); RadioGroup group = tester.widget( find.byType(RadioGroup), ); expect(group.groupValue, example.SingingCharacter.mulligan); - await tester.tap(find.byType(CupertinoRadio).last); + await tester.tap( + find.byType(CupertinoRadio).last, + ); await tester.pumpAndSettle(); group = tester.widget(find.byType(RadioGroup)); expect(group.groupValue, example.SingingCharacter.hamilton); - await tester.tap(find.byType(CupertinoRadio).last); + await tester.tap( + find.byType(CupertinoRadio).last, + ); await tester.pumpAndSettle(); group = tester.widget(find.byType(RadioGroup)); diff --git a/examples/api/test/cupertino/refresh/cupertino_sliver_refresh_control.0_test.dart b/examples/api/test/cupertino/refresh/cupertino_sliver_refresh_control.0_test.dart index b1f4ea3114c..1a7166df0c0 100644 --- a/examples/api/test/cupertino/refresh/cupertino_sliver_refresh_control.0_test.dart +++ b/examples/api/test/cupertino/refresh/cupertino_sliver_refresh_control.0_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/cupertino/refresh/cupertino_sliver_refresh_c import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Can pull down to reveal CupertinoSliverRefreshControl', (WidgetTester tester) async { + testWidgets('Can pull down to reveal CupertinoSliverRefreshControl', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.RefreshControlApp()); expect(find.byType(CupertinoSliverRefreshControl), findsNothing); diff --git a/examples/api/test/cupertino/route/show_cupertino_dialog.0_test.dart b/examples/api/test/cupertino/route/show_cupertino_dialog.0_test.dart index d81618f68e5..3771ba73007 100644 --- a/examples/api/test/cupertino/route/show_cupertino_dialog.0_test.dart +++ b/examples/api/test/cupertino/route/show_cupertino_dialog.0_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter_api_samples/cupertino/route/show_cupertino_dialog.0.dart' as example; +import 'package:flutter_api_samples/cupertino/route/show_cupertino_dialog.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Tap on button displays cupertino dialog', (WidgetTester tester) async { + testWidgets('Tap on button displays cupertino dialog', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.CupertinoDialogApp()); final Finder dialogTitle = find.text('Title'); diff --git a/examples/api/test/cupertino/route/show_cupertino_modal_popup.0_test.dart b/examples/api/test/cupertino/route/show_cupertino_modal_popup.0_test.dart index 074bdde6e17..c899954b47b 100644 --- a/examples/api/test/cupertino/route/show_cupertino_modal_popup.0_test.dart +++ b/examples/api/test/cupertino/route/show_cupertino_modal_popup.0_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter_api_samples/cupertino/route/show_cupertino_modal_popup.0.dart' as example; +import 'package:flutter_api_samples/cupertino/route/show_cupertino_modal_popup.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Tap on button displays cupertino modal dialog', (WidgetTester tester) async { + testWidgets('Tap on button displays cupertino modal dialog', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ModalPopupApp()); final Finder actionOne = find.text('Action One'); diff --git a/examples/api/test/cupertino/scrollbar/cupertino_scrollbar.0_test.dart b/examples/api/test/cupertino/scrollbar/cupertino_scrollbar.0_test.dart index bf262b08a4c..c0ae2456818 100644 --- a/examples/api/test/cupertino/scrollbar/cupertino_scrollbar.0_test.dart +++ b/examples/api/test/cupertino/scrollbar/cupertino_scrollbar.0_test.dart @@ -3,15 +3,20 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter_api_samples/cupertino/scrollbar/cupertino_scrollbar.0.dart' as example; +import 'package:flutter_api_samples/cupertino/scrollbar/cupertino_scrollbar.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('List view displays CupertinoScrollbar', (WidgetTester tester) async { + testWidgets('List view displays CupertinoScrollbar', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ScrollbarApp()); expect(find.text('Item 0'), findsOneWidget); - final TestGesture gesture = await tester.startGesture(tester.getCenter(find.byType(ListView))); + final TestGesture gesture = await tester.startGesture( + tester.getCenter(find.byType(ListView)), + ); await gesture.moveBy(const Offset(0.0, -100.0)); await tester.pumpAndSettle(); expect(find.text('Item 0'), findsNothing); diff --git a/examples/api/test/cupertino/scrollbar/cupertino_scrollbar.1_test.dart b/examples/api/test/cupertino/scrollbar/cupertino_scrollbar.1_test.dart index a8930d13744..1f3a2e663d7 100644 --- a/examples/api/test/cupertino/scrollbar/cupertino_scrollbar.1_test.dart +++ b/examples/api/test/cupertino/scrollbar/cupertino_scrollbar.1_test.dart @@ -3,15 +3,20 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter_api_samples/cupertino/scrollbar/cupertino_scrollbar.1.dart' as example; +import 'package:flutter_api_samples/cupertino/scrollbar/cupertino_scrollbar.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('List view displays CupertinoScrollbar', (WidgetTester tester) async { + testWidgets('List view displays CupertinoScrollbar', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ScrollbarApp()); expect(find.text('Item 0'), findsOneWidget); - final TestGesture gesture = await tester.startGesture(tester.getCenter(find.byType(ListView))); + final TestGesture gesture = await tester.startGesture( + tester.getCenter(find.byType(ListView)), + ); await gesture.moveBy(const Offset(0.0, -100.0)); await tester.pumpAndSettle(); expect(find.text('Item 0'), findsNothing); diff --git a/examples/api/test/cupertino/search_field/cupertino_search_field.0_test.dart b/examples/api/test/cupertino/search_field/cupertino_search_field.0_test.dart index fe9e6aff2a5..d283723b7b7 100644 --- a/examples/api/test/cupertino/search_field/cupertino_search_field.0_test.dart +++ b/examples/api/test/cupertino/search_field/cupertino_search_field.0_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/cupertino/search_field/cupertino_search_fiel import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('CupertinoTextField has initial text', (WidgetTester tester) async { + testWidgets('CupertinoTextField has initial text', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.SearchTextFieldApp()); expect(find.byType(CupertinoSearchTextField), findsOneWidget); diff --git a/examples/api/test/cupertino/search_field/cupertino_search_field.1_test.dart b/examples/api/test/cupertino/search_field/cupertino_search_field.1_test.dart index 76dc9c74eac..54f9037e044 100644 --- a/examples/api/test/cupertino/search_field/cupertino_search_field.1_test.dart +++ b/examples/api/test/cupertino/search_field/cupertino_search_field.1_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/cupertino/search_field/cupertino_search_fiel import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Value changed callback updates entered text', (WidgetTester tester) async { + testWidgets('Value changed callback updates entered text', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.SearchTextFieldApp()); expect(find.byType(CupertinoSearchTextField), findsOneWidget); @@ -17,7 +19,10 @@ void main() { await tester.pump(); expect(find.text('The text has changed to: photos'), findsOneWidget); - await tester.enterText(find.byType(CupertinoSearchTextField), 'photos from vacation'); + await tester.enterText( + find.byType(CupertinoSearchTextField), + 'photos from vacation', + ); await tester.showKeyboard(find.byType(CupertinoTextField)); await tester.testTextInput.receiveAction(TextInputAction.done); await tester.pump(); diff --git a/examples/api/test/cupertino/segmented_control/cupertino_segmented_control.0_test.dart b/examples/api/test/cupertino/segmented_control/cupertino_segmented_control.0_test.dart index 74b6c21185f..501abcd055d 100644 --- a/examples/api/test/cupertino/segmented_control/cupertino_segmented_control.0_test.dart +++ b/examples/api/test/cupertino/segmented_control/cupertino_segmented_control.0_test.dart @@ -29,16 +29,22 @@ void main() { // Verify that the first CupertinoSwitch is off. final Finder firstSwitchFinder = find.byType(CupertinoSwitch).first; - final CupertinoSwitch firstSwitch = tester.widget(firstSwitchFinder); + final CupertinoSwitch firstSwitch = tester.widget( + firstSwitchFinder, + ); expect(firstSwitch.value, false); // Verify that the second CupertinoSwitch is on. final Finder secondSwitchFinder = find.byType(CupertinoSwitch).last; - final CupertinoSwitch secondSwitch = tester.widget(secondSwitchFinder); + final CupertinoSwitch secondSwitch = tester.widget( + secondSwitchFinder, + ); expect(secondSwitch.value, true); }); - testWidgets('Can change a selected segmented control', (WidgetTester tester) async { + testWidgets('Can change a selected segmented control', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.SegmentedControlApp()); expect(find.text('Selected Segment: midnight'), findsOneWidget); @@ -49,14 +55,18 @@ void main() { expect(find.text('Selected Segment: cerulean'), findsOneWidget); }); - testWidgets('Can not select on a disabled segment', (WidgetTester tester) async { + testWidgets('Can not select on a disabled segment', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.SegmentedControlApp()); // Toggle on the first CupertinoSwitch to disable the first segment. final Finder firstSwitchFinder = find.byType(CupertinoSwitch).first; await tester.tap(firstSwitchFinder); await tester.pumpAndSettle(); - final CupertinoSwitch firstSwitch = tester.widget(firstSwitchFinder); + final CupertinoSwitch firstSwitch = tester.widget( + firstSwitchFinder, + ); expect(firstSwitch.value, true); // Tap on the second segment then tap back on the first segment. @@ -70,14 +80,18 @@ void main() { expect(find.text('Selected Segment: viridian'), findsOneWidget); }); - testWidgets('Can not select on all disabled segments', (WidgetTester tester) async { + testWidgets('Can not select on all disabled segments', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.SegmentedControlApp()); // Toggle off the second CupertinoSwitch to disable all segments. final Finder secondSwitchFinder = find.byType(CupertinoSwitch).last; await tester.tap(secondSwitchFinder); await tester.pumpAndSettle(); - final CupertinoSwitch secondSwitch = tester.widget(secondSwitchFinder); + final CupertinoSwitch secondSwitch = tester.widget( + secondSwitchFinder, + ); expect(secondSwitch.value, false); // Tap on the second segment and verify that the selected segment is still the first segment. diff --git a/examples/api/test/cupertino/segmented_control/cupertino_sliding_segmented_control.0_test.dart b/examples/api/test/cupertino/segmented_control/cupertino_sliding_segmented_control.0_test.dart index 28ac73edb6b..10f9cd42d93 100644 --- a/examples/api/test/cupertino/segmented_control/cupertino_sliding_segmented_control.0_test.dart +++ b/examples/api/test/cupertino/segmented_control/cupertino_sliding_segmented_control.0_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/cupertino/segmented_control/cupertino_slidin import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Can change a selected segmented control', (WidgetTester tester) async { + testWidgets('Can change a selected segmented control', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.SegmentedControlApp()); expect(find.text('Selected Segment: midnight'), findsOneWidget); @@ -22,7 +24,9 @@ void main() { // Verify momentary mode is initially off. expect(find.text('Momentary mode: '), findsOneWidget); - final CupertinoSwitch momentarySwitch = tester.widget(find.byType(CupertinoSwitch)); + final CupertinoSwitch momentarySwitch = tester.widget( + find.byType(CupertinoSwitch), + ); expect(momentarySwitch.value, isFalse); // Toggle momentary mode on. @@ -30,7 +34,9 @@ void main() { await tester.pumpAndSettle(); // Verify switch is now on. - final CupertinoSwitch updatedSwitch = tester.widget(find.byType(CupertinoSwitch)); + final CupertinoSwitch updatedSwitch = tester.widget( + find.byType(CupertinoSwitch), + ); expect(updatedSwitch.value, isTrue); // In momentary mode, tapping a segment should change the selection. diff --git a/examples/api/test/cupertino/sheet/cupertino_sheet.0_test.dart b/examples/api/test/cupertino/sheet/cupertino_sheet.0_test.dart index 83adb56fbcd..36aa099c041 100644 --- a/examples/api/test/cupertino/sheet/cupertino_sheet.0_test.dart +++ b/examples/api/test/cupertino/sheet/cupertino_sheet.0_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter_api_samples/cupertino/sheet/cupertino_sheet.0.dart' as example; +import 'package:flutter_api_samples/cupertino/sheet/cupertino_sheet.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Tap on button displays cupertino sheet', (WidgetTester tester) async { + testWidgets('Tap on button displays cupertino sheet', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.CupertinoSheetApp()); final Finder dialogTitle = find.text('CupertinoSheetRoute'); diff --git a/examples/api/test/cupertino/sheet/cupertino_sheet.1_test.dart b/examples/api/test/cupertino/sheet/cupertino_sheet.1_test.dart index add165ad943..b4adb58d020 100644 --- a/examples/api/test/cupertino/sheet/cupertino_sheet.1_test.dart +++ b/examples/api/test/cupertino/sheet/cupertino_sheet.1_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter_api_samples/cupertino/sheet/cupertino_sheet.1.dart' as example; +import 'package:flutter_api_samples/cupertino/sheet/cupertino_sheet.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Tap on button displays cupertino sheet', (WidgetTester tester) async { + testWidgets('Tap on button displays cupertino sheet', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.CupertinoSheetApp()); final Finder dialogTitle = find.text('CupertinoSheetRoute'); @@ -42,7 +45,9 @@ void main() { expect(nextPageTitle, findsNothing); }); - testWidgets('Go Back button uses maybePop and handles edge cases', (WidgetTester tester) async { + testWidgets('Go Back button uses maybePop and handles edge cases', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.CupertinoSheetApp()); await tester.tap(find.byType(CupertinoButton)); diff --git a/examples/api/test/cupertino/sheet/cupertino_sheet.2_test.dart b/examples/api/test/cupertino/sheet/cupertino_sheet.2_test.dart index 3a3d49c3897..b30af2e9dff 100644 --- a/examples/api/test/cupertino/sheet/cupertino_sheet.2_test.dart +++ b/examples/api/test/cupertino/sheet/cupertino_sheet.2_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter_api_samples/cupertino/sheet/cupertino_sheet.2.dart' as example; +import 'package:flutter_api_samples/cupertino/sheet/cupertino_sheet.2.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Tap on button displays cupertino sheet', (WidgetTester tester) async { + testWidgets('Tap on button displays cupertino sheet', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.RestorableSheetExampleApp()); final Finder dialogTitle = find.text('Current Count: 0'); diff --git a/examples/api/test/cupertino/slider/cupertino_slider.0_test.dart b/examples/api/test/cupertino/slider/cupertino_slider.0_test.dart index 7fde5f8082f..481339d0ab8 100644 --- a/examples/api/test/cupertino/slider/cupertino_slider.0_test.dart +++ b/examples/api/test/cupertino/slider/cupertino_slider.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter_api_samples/cupertino/slider/cupertino_slider.0.dart' as example; +import 'package:flutter_api_samples/cupertino/slider/cupertino_slider.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -11,10 +12,15 @@ void main() { final Offset topLeft = tester.getTopLeft(find.byKey(sliderKey)); const double unit = CupertinoThumbPainter.radius; const double delta = 3.0 * unit; - return tester.dragFrom(topLeft + const Offset(unit, unit), const Offset(delta, 0.0)); + return tester.dragFrom( + topLeft + const Offset(unit, unit), + const Offset(delta, 0.0), + ); } - testWidgets('Can change value using CupertinoSlider', (WidgetTester tester) async { + testWidgets('Can change value using CupertinoSlider', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.CupertinoSliderApp()); // Check for the initial slider value. diff --git a/examples/api/test/cupertino/switch/cupertino_switch.0_test.dart b/examples/api/test/cupertino/switch/cupertino_switch.0_test.dart index dcc6d011093..eb2aec06197 100644 --- a/examples/api/test/cupertino/switch/cupertino_switch.0_test.dart +++ b/examples/api/test/cupertino/switch/cupertino_switch.0_test.dart @@ -3,15 +3,20 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter_api_samples/cupertino/switch/cupertino_switch.0.dart' as example; +import 'package:flutter_api_samples/cupertino/switch/cupertino_switch.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Toggling cupertino switch updates icon', (WidgetTester tester) async { + testWidgets('Toggling cupertino switch updates icon', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.CupertinoSwitchApp()); final Finder switchFinder = find.byType(CupertinoSwitch); - CupertinoSwitch cupertinoSwitch = tester.widget(switchFinder); + CupertinoSwitch cupertinoSwitch = tester.widget( + switchFinder, + ); expect(cupertinoSwitch.value, true); await tester.tap(switchFinder); diff --git a/examples/api/test/cupertino/tab_scaffold/cupertino_tab_controller.0_test.dart b/examples/api/test/cupertino/tab_scaffold/cupertino_tab_controller.0_test.dart index 9dc5f6e4ddb..a031a4cf58c 100644 --- a/examples/api/test/cupertino/tab_scaffold/cupertino_tab_controller.0_test.dart +++ b/examples/api/test/cupertino/tab_scaffold/cupertino_tab_controller.0_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/cupertino/tab_scaffold/cupertino_tab_control import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Can switch tabs using CupertinoTabController', (WidgetTester tester) async { + testWidgets('Can switch tabs using CupertinoTabController', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.TabControllerApp()); expect(find.text('Content of tab 0'), findsOneWidget); diff --git a/examples/api/test/cupertino/tab_scaffold/cupertino_tab_scaffold.0_test.dart b/examples/api/test/cupertino/tab_scaffold/cupertino_tab_scaffold.0_test.dart index 5d4eb85013b..bda6ef7ff07 100644 --- a/examples/api/test/cupertino/tab_scaffold/cupertino_tab_scaffold.0_test.dart +++ b/examples/api/test/cupertino/tab_scaffold/cupertino_tab_scaffold.0_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/cupertino/tab_scaffold/cupertino_tab_scaffol import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Can use CupertinoTabView as the root widget', (WidgetTester tester) async { + testWidgets('Can use CupertinoTabView as the root widget', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.TabScaffoldApp()); expect(find.text('Page 1 of tab 0'), findsOneWidget); diff --git a/examples/api/test/cupertino/text_field/cupertino_text_field.0_test.dart b/examples/api/test/cupertino/text_field/cupertino_text_field.0_test.dart index c2de53ed1a0..8a9142dc460 100644 --- a/examples/api/test/cupertino/text_field/cupertino_text_field.0_test.dart +++ b/examples/api/test/cupertino/text_field/cupertino_text_field.0_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter_api_samples/cupertino/text_field/cupertino_text_field.0.dart' as example; +import 'package:flutter_api_samples/cupertino/text_field/cupertino_text_field.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('CupertinoTextField has initial text', (WidgetTester tester) async { + testWidgets('CupertinoTextField has initial text', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.CupertinoTextFieldApp()); expect(find.byType(CupertinoTextField), findsOneWidget); diff --git a/examples/api/test/cupertino/text_form_field_row/cupertino_text_form_field_row.1_test.dart b/examples/api/test/cupertino/text_form_field_row/cupertino_text_form_field_row.1_test.dart index 4a28f154623..b0e0c4ee7f1 100644 --- a/examples/api/test/cupertino/text_form_field_row/cupertino_text_form_field_row.1_test.dart +++ b/examples/api/test/cupertino/text_form_field_row/cupertino_text_form_field_row.1_test.dart @@ -8,15 +8,26 @@ import 'package:flutter_api_samples/cupertino/text_form_field_row/cupertino_text import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Can enter text in CupertinoTextFormFieldRow', (WidgetTester tester) async { + testWidgets('Can enter text in CupertinoTextFormFieldRow', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.FormSectionApp()); expect(find.byType(CupertinoFormSection), findsOneWidget); expect(find.byType(CupertinoTextFormFieldRow), findsNWidgets(5)); - expect(find.widgetWithText(CupertinoTextFormFieldRow, 'abcd'), findsNothing); - await tester.enterText(find.byType(CupertinoTextFormFieldRow).first, 'abcd'); + expect( + find.widgetWithText(CupertinoTextFormFieldRow, 'abcd'), + findsNothing, + ); + await tester.enterText( + find.byType(CupertinoTextFormFieldRow).first, + 'abcd', + ); await tester.pump(); - expect(find.widgetWithText(CupertinoTextFormFieldRow, 'abcd'), findsOneWidget); + expect( + find.widgetWithText(CupertinoTextFormFieldRow, 'abcd'), + findsOneWidget, + ); }); } diff --git a/examples/api/test/flutter_test_config.dart b/examples/api/test/flutter_test_config.dart index 64eca02ed51..6c504acee03 100644 --- a/examples/api/test/flutter_test_config.dart +++ b/examples/api/test/flutter_test_config.dart @@ -4,7 +4,9 @@ import 'dart:async'; -import 'goldens_io.dart' if (dart.library.js_interop) 'goldens_web.dart' as flutter_goldens; +import 'goldens_io.dart' + if (dart.library.js_interop) 'goldens_web.dart' + as flutter_goldens; Future testExecutable(FutureOr Function() testMain) { // Enable golden file testing using Skia Gold. diff --git a/examples/api/test/gestures/pointer_signal_resolver/pointer_signal_resolver.0_test.dart b/examples/api/test/gestures/pointer_signal_resolver/pointer_signal_resolver.0_test.dart index b356c7079d5..5e0744deeae 100644 --- a/examples/api/test/gestures/pointer_signal_resolver/pointer_signal_resolver.0_test.dart +++ b/examples/api/test/gestures/pointer_signal_resolver/pointer_signal_resolver.0_test.dart @@ -10,7 +10,9 @@ import 'package:flutter_test/flutter_test.dart'; void main() { ({Color outer, Color inner}) getColors(WidgetTester tester) { - final DecoratedBox outerBox = tester.widget(find.byType(DecoratedBox).first); + final DecoratedBox outerBox = tester.widget( + find.byType(DecoratedBox).first, + ); final DecoratedBox innerBox = tester.widget(find.byType(DecoratedBox).last); return ( outer: (outerBox.decoration as BoxDecoration).color!, @@ -18,10 +20,15 @@ void main() { ); } - testWidgets('Scrolling on the boxes changes their color', (WidgetTester tester) async { + testWidgets('Scrolling on the boxes changes their color', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.PointerSignalResolverExampleApp()); - expect(getColors(tester), (outer: const Color(0x3300ff00), inner: const Color(0xffffff00))); + expect(getColors(tester), ( + outer: const Color(0x3300ff00), + inner: const Color(0xffffff00), + )); // Scroll on the outer box. final TestPointer pointer = TestPointer(1, PointerDeviceKind.mouse); diff --git a/examples/api/test/gestures/tap_and_drag/tap_and_drag.0_test.dart b/examples/api/test/gestures/tap_and_drag/tap_and_drag.0_test.dart index 633606b6576..5e43d43de49 100644 --- a/examples/api/test/gestures/tap_and_drag/tap_and_drag.0_test.dart +++ b/examples/api/test/gestures/tap_and_drag/tap_and_drag.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/gestures/tap_and_drag/tap_and_drag.0.dart' as example; +import 'package:flutter_api_samples/gestures/tap_and_drag/tap_and_drag.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/goldens_web.dart b/examples/api/test/goldens_web.dart index 57c0fbad759..a13ec9295c1 100644 --- a/examples/api/test/goldens_web.dart +++ b/examples/api/test/goldens_web.dart @@ -5,4 +5,5 @@ import 'dart:async'; // package:flutter_goldens is not used as part of the test process for web. -Future testExecutable(FutureOr Function() testMain) async => testMain(); +Future testExecutable(FutureOr Function() testMain) async => + testMain(); diff --git a/examples/api/test/material/about/about_list_tile.0_test.dart b/examples/api/test/material/about/about_list_tile.0_test.dart index c154b4a5fb3..14279ab16bd 100644 --- a/examples/api/test/material/about/about_list_tile.0_test.dart +++ b/examples/api/test/material/about/about_list_tile.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/about/about_list_tile.0.dart' as example; +import 'package:flutter_api_samples/material/about/about_list_tile.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -34,37 +35,41 @@ void main() { ); }); - testWidgets('It should show the about dialog after clicking on about list tile in the drawer', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.AboutListTileExampleApp()); + testWidgets( + 'It should show the about dialog after clicking on about list tile in the drawer', + (WidgetTester tester) async { + await tester.pumpWidget(const example.AboutListTileExampleApp()); - expect(find.widgetWithText(AppBar, 'Show About Example'), findsOne); + expect(find.widgetWithText(AppBar, 'Show About Example'), findsOne); - await tester.tap(find.byType(DrawerButton)); - await tester.pumpAndSettle(); + await tester.tap(find.byType(DrawerButton)); + await tester.pumpAndSettle(); - expect(find.byType(Drawer), findsOne); - expect(find.widgetWithText(AboutListTile, 'About Show About Example'), findsOne); - expect(find.widgetWithIcon(AboutListTile, Icons.info), findsOne); + expect(find.byType(Drawer), findsOne); + expect( + find.widgetWithText(AboutListTile, 'About Show About Example'), + findsOne, + ); + expect(find.widgetWithIcon(AboutListTile, Icons.info), findsOne); - await tester.tap(find.widgetWithIcon(AboutListTile, Icons.info)); - await tester.pumpAndSettle(); + await tester.tap(find.widgetWithIcon(AboutListTile, Icons.info)); + await tester.pumpAndSettle(); - expect(find.byType(AboutDialog), findsOne); - expect(find.widgetWithText(AboutDialog, 'Show About Example'), findsOne); - expect(find.text('August 2019'), findsOne); - expect(find.byType(FlutterLogo), findsOne); - expect(find.text('\u{a9} 2014 The Flutter Authors'), findsOne); - expect( - find.text( - "Flutter is Google's UI toolkit for building beautiful, " - 'natively compiled applications for mobile, web, and desktop ' - 'from a single codebase. Learn more about Flutter at ' - 'https://flutter.dev.', - findRichText: true, - ), - findsOne, - ); - }); + expect(find.byType(AboutDialog), findsOne); + expect(find.widgetWithText(AboutDialog, 'Show About Example'), findsOne); + expect(find.text('August 2019'), findsOne); + expect(find.byType(FlutterLogo), findsOne); + expect(find.text('\u{a9} 2014 The Flutter Authors'), findsOne); + expect( + find.text( + "Flutter is Google's UI toolkit for building beautiful, " + 'natively compiled applications for mobile, web, and desktop ' + 'from a single codebase. Learn more about Flutter at ' + 'https://flutter.dev.', + findRichText: true, + ), + findsOne, + ); + }, + ); } diff --git a/examples/api/test/material/action_buttons/action_icon_theme.0_test.dart b/examples/api/test/material/action_buttons/action_icon_theme.0_test.dart index eb943a70630..68cf66fa58d 100644 --- a/examples/api/test/material/action_buttons/action_icon_theme.0_test.dart +++ b/examples/api/test/material/action_buttons/action_icon_theme.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/action_buttons/action_icon_theme.0.dart' as example; +import 'package:flutter_api_samples/material/action_buttons/action_icon_theme.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -12,7 +13,10 @@ void main() { expect(find.byType(DrawerButton), findsOneWidget); final Icon drawerButtonIcon = tester.widget( - find.descendant(of: find.byType(DrawerButton), matching: find.byType(Icon)), + find.descendant( + of: find.byType(DrawerButton), + matching: find.byType(Icon), + ), ); expect(drawerButtonIcon.icon, Icons.segment); @@ -22,7 +26,10 @@ void main() { expect(find.byType(EndDrawerButton), findsOneWidget); final Icon endDrawerButtonIcon = tester.widget( - find.descendant(of: find.byType(EndDrawerButton), matching: find.byType(Icon)), + find.descendant( + of: find.byType(EndDrawerButton), + matching: find.byType(Icon), + ), ); expect(endDrawerButtonIcon.icon, Icons.more_horiz); diff --git a/examples/api/test/material/action_chip/action_chip.0_test.dart b/examples/api/test/material/action_chip/action_chip.0_test.dart index b7c12f86de4..e1bfa1fc77e 100644 --- a/examples/api/test/material/action_chip/action_chip.0_test.dart +++ b/examples/api/test/material/action_chip/action_chip.0_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/action_chip/action_chip.0.dart' as example; +import 'package:flutter_api_samples/material/action_chip/action_chip.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('ActionChip updates avatar when tapped', (WidgetTester tester) async { + testWidgets('ActionChip updates avatar when tapped', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ChipApp()); expect(find.byIcon(Icons.favorite_border), findsOneWidget); diff --git a/examples/api/test/material/animated_icon/animated_icon.0_test.dart b/examples/api/test/material/animated_icon/animated_icon.0_test.dart index 533ab7f145b..242283972ff 100644 --- a/examples/api/test/material/animated_icon/animated_icon.0_test.dart +++ b/examples/api/test/material/animated_icon/animated_icon.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/animated_icon/animated_icon.0.dart' as example; +import 'package:flutter_api_samples/material/animated_icon/animated_icon.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/animated_icon/animated_icons_data.0_test.dart b/examples/api/test/material/animated_icon/animated_icons_data.0_test.dart index 1b32a9c9aad..1513b69737a 100644 --- a/examples/api/test/material/animated_icon/animated_icons_data.0_test.dart +++ b/examples/api/test/material/animated_icon/animated_icons_data.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/animated_icon/animated_icons_data.0.dart' as example; +import 'package:flutter_api_samples/material/animated_icon/animated_icons_data.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -11,7 +12,10 @@ void main() { await tester.pumpWidget(const example.AnimatedIconApp()); // Check if the total number of AnimatedIcons matches the icons list. - expect(find.byType(AnimatedIcon, skipOffstage: false), findsNWidgets(example.iconsList.length)); + expect( + find.byType(AnimatedIcon, skipOffstage: false), + findsNWidgets(example.iconsList.length), + ); // Test the AnimatedIcon size. final Size iconSize = tester.getSize(find.byType(AnimatedIcon).first); diff --git a/examples/api/test/material/app/app.0_test.dart b/examples/api/test/material/app/app.0_test.dart index 9ab43e741d2..5d0990d2029 100644 --- a/examples/api/test/material/app/app.0_test.dart +++ b/examples/api/test/material/app/app.0_test.dart @@ -14,7 +14,10 @@ void main() { Material getScaffoldMaterial() { return tester.widget( - find.descendant(of: find.byType(Scaffold), matching: find.byType(Material).first), + find.descendant( + of: find.byType(Scaffold), + matching: find.byType(Material).first, + ), ); } @@ -35,7 +38,11 @@ void main() { // The Scaffold background color is updated. expect( getScaffoldMaterial().color, - Color.lerp(lightTheme.colorScheme.surface, darkTheme.colorScheme.surface, 0.5), + Color.lerp( + lightTheme.colorScheme.surface, + darkTheme.colorScheme.surface, + 0.5, + ), ); await tester.pumpAndSettle(); diff --git a/examples/api/test/material/app_bar/app_bar.1_test.dart b/examples/api/test/material/app_bar/app_bar.1_test.dart index c8e2104ea9b..670a13dc42b 100644 --- a/examples/api/test/material/app_bar/app_bar.1_test.dart +++ b/examples/api/test/material/app_bar/app_bar.1_test.dart @@ -17,7 +17,12 @@ void main() { expect(appbarMaterial.shadowColor, Colors.transparent); expect(appbarMaterial.elevation, 0); - await tester.drag(find.text('Item 4'), _kOffset, touchSlopY: 0, warnIfMissed: false); + await tester.drag( + find.text('Item 4'), + _kOffset, + touchSlopY: 0, + warnIfMissed: false, + ); await tester.pump(); await tester.pump(const Duration(milliseconds: 500)); diff --git a/examples/api/test/material/app_bar/app_bar.3_test.dart b/examples/api/test/material/app_bar/app_bar.3_test.dart index a36bc09cccf..a45a711e394 100644 --- a/examples/api/test/material/app_bar/app_bar.3_test.dart +++ b/examples/api/test/material/app_bar/app_bar.3_test.dart @@ -7,22 +7,32 @@ import 'package:flutter_api_samples/material/app_bar/app_bar.3.dart' as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('AppBar elevates when nested scroll view is scrolled underneath the AppBar', ( - WidgetTester tester, - ) async { - Material getMaterial() => tester.widget( - find.descendant(of: find.byType(AppBar), matching: find.byType(Material)).first, - ); + testWidgets( + 'AppBar elevates when nested scroll view is scrolled underneath the AppBar', + (WidgetTester tester) async { + Material getMaterial() => tester.widget( + find + .descendant( + of: find.byType(AppBar), + matching: find.byType(Material), + ) + .first, + ); - await tester.pumpWidget(const example.AppBarApp()); + await tester.pumpWidget(const example.AppBarApp()); - // Starts with the base elevation. - expect(getMaterial().elevation, 0.0); + // Starts with the base elevation. + expect(getMaterial().elevation, 0.0); - await tester.fling(find.text('Beach 3'), const Offset(0.0, -600.0), 2000.0); - await tester.pumpAndSettle(); + await tester.fling( + find.text('Beach 3'), + const Offset(0.0, -600.0), + 2000.0, + ); + await tester.pumpAndSettle(); - // After scrolling it should be the scrolledUnderElevation. - expect(getMaterial().elevation, 4.0); - }); + // After scrolling it should be the scrolledUnderElevation. + expect(getMaterial().elevation, 4.0); + }, + ); } diff --git a/examples/api/test/material/app_bar/sliver_app_bar.1_test.dart b/examples/api/test/material/app_bar/sliver_app_bar.1_test.dart index 7fbd65c2192..6c5a47a4e2e 100644 --- a/examples/api/test/material/app_bar/sliver_app_bar.1_test.dart +++ b/examples/api/test/material/app_bar/sliver_app_bar.1_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/app_bar/sliver_app_bar.1.dart' as example; +import 'package:flutter_api_samples/material/app_bar/sliver_app_bar.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; const Offset _kOffset = Offset(0.0, -200.0); @@ -15,7 +16,12 @@ void main() { expect(find.widgetWithText(SliverAppBar, 'SliverAppBar'), findsOneWidget); expect(tester.getBottomLeft(find.text('SliverAppBar')).dy, 144.0); - await tester.drag(find.text('0'), _kOffset, touchSlopY: 0, warnIfMissed: false); + await tester.drag( + find.text('0'), + _kOffset, + touchSlopY: 0, + warnIfMissed: false, + ); await tester.pump(); await tester.pump(const Duration(milliseconds: 500)); expect(tester.getBottomLeft(find.text('SliverAppBar')).dy, 40.0); diff --git a/examples/api/test/material/app_bar/sliver_app_bar.2_test.dart b/examples/api/test/material/app_bar/sliver_app_bar.2_test.dart index 066e5eba736..41fa96e5161 100644 --- a/examples/api/test/material/app_bar/sliver_app_bar.2_test.dart +++ b/examples/api/test/material/app_bar/sliver_app_bar.2_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/app_bar/sliver_app_bar.2.dart' as example; +import 'package:flutter_api_samples/material/app_bar/sliver_app_bar.2.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Visibility and interaction of crucial widgets', (WidgetTester tester) async { + testWidgets('Visibility and interaction of crucial widgets', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.AppBarMediumApp()); const String title = 'Medium App Bar'; @@ -21,18 +24,25 @@ void main() { ); expect( - find.descendant(of: find.byType(SliverAppBar), matching: find.byType(IconButton)), + find.descendant( + of: find.byType(SliverAppBar), + matching: find.byType(IconButton), + ), findsExactly(2), ); // Based on https://m3.material.io/components/top-app-bar/specs the title of // the SliverAppBar.medium widget is formatted with the headlineSmall style. final BuildContext context = tester.element(find.byType(MaterialApp)); - final TextStyle expectedTitleStyle = Theme.of(context).textTheme.headlineSmall!; + final TextStyle expectedTitleStyle = Theme.of( + context, + ).textTheme.headlineSmall!; // There are two Text widgets: expanded and collapsed. The expanded is first. final Finder titleFinder = find.text(title).first; - final TextStyle actualTitleStyle = DefaultTextStyle.of(tester.element(titleFinder)).style; + final TextStyle actualTitleStyle = DefaultTextStyle.of( + tester.element(titleFinder), + ).style; expect(actualTitleStyle, expectedTitleStyle); diff --git a/examples/api/test/material/app_bar/sliver_app_bar.3_test.dart b/examples/api/test/material/app_bar/sliver_app_bar.3_test.dart index 34d060783b5..f124a5d920d 100644 --- a/examples/api/test/material/app_bar/sliver_app_bar.3_test.dart +++ b/examples/api/test/material/app_bar/sliver_app_bar.3_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/app_bar/sliver_app_bar.3.dart' as example; +import 'package:flutter_api_samples/material/app_bar/sliver_app_bar.3.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Visibility and interaction of crucial widgets', (WidgetTester tester) async { + testWidgets('Visibility and interaction of crucial widgets', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.AppBarLargeApp()); const String title = 'Large App Bar'; @@ -21,18 +24,25 @@ void main() { ); expect( - find.descendant(of: find.byType(SliverAppBar), matching: find.byType(IconButton)), + find.descendant( + of: find.byType(SliverAppBar), + matching: find.byType(IconButton), + ), findsExactly(2), ); // Based on https://m3.material.io/components/top-app-bar/specs the title of // the SliverAppBar.large widget is formatted with the headlineMedium style. final BuildContext context = tester.element(find.byType(MaterialApp)); - final TextStyle expectedTitleStyle = Theme.of(context).textTheme.headlineMedium!; + final TextStyle expectedTitleStyle = Theme.of( + context, + ).textTheme.headlineMedium!; // There are two Text widgets: expanded and collapsed. The expanded is first. final Finder titleFinder = find.text(title).first; - final TextStyle actualTitleStyle = DefaultTextStyle.of(tester.element(titleFinder)).style; + final TextStyle actualTitleStyle = DefaultTextStyle.of( + tester.element(titleFinder), + ).style; expect(actualTitleStyle, expectedTitleStyle); diff --git a/examples/api/test/material/app_bar/sliver_app_bar.4_test.dart b/examples/api/test/material/app_bar/sliver_app_bar.4_test.dart index 1f4508c9c34..c22c1992961 100644 --- a/examples/api/test/material/app_bar/sliver_app_bar.4_test.dart +++ b/examples/api/test/material/app_bar/sliver_app_bar.4_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/app_bar/sliver_app_bar.4.dart' as example; +import 'package:flutter_api_samples/material/app_bar/sliver_app_bar.4.dart' + as example; import 'package:flutter_test/flutter_test.dart'; const Offset _kOffset = Offset(0.0, 200.0); @@ -19,18 +20,31 @@ void main() { expect(find.widgetWithText(SliverAppBar, 'SliverAppBar'), findsOneWidget); expect(tester.getBottomLeft(find.text('SliverAppBar')).dy, 184.0); - await tester.drag(find.text('0'), _kOffset, touchSlopY: 0, warnIfMissed: false); + await tester.drag( + find.text('0'), + _kOffset, + touchSlopY: 0, + warnIfMissed: false, + ); await tester.pump(); await tester.pump(const Duration(milliseconds: 500)); expect(find.widgetWithText(SliverAppBar, 'SliverAppBar'), findsOneWidget); - expect(tester.getBottomLeft(find.text('SliverAppBar')).dy, 187.63506380825314); + expect( + tester.getBottomLeft(find.text('SliverAppBar')).dy, + 187.63506380825314, + ); await tester.tap(switchFinder); await tester.pumpAndSettle(); materialSwitch = tester.widget(switchFinder); expect(materialSwitch.value, false); - await tester.drag(find.text('0'), _kOffset, touchSlopY: 0, warnIfMissed: false); + await tester.drag( + find.text('0'), + _kOffset, + touchSlopY: 0, + warnIfMissed: false, + ); await tester.pump(); await tester.pump(const Duration(milliseconds: 500)); diff --git a/examples/api/test/material/autocomplete/autocomplete.0_test.dart b/examples/api/test/material/autocomplete/autocomplete.0_test.dart index 70d12aecc7b..9f55945c9f9 100644 --- a/examples/api/test/material/autocomplete/autocomplete.0_test.dart +++ b/examples/api/test/material/autocomplete/autocomplete.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/autocomplete/autocomplete.0.dart' as example; +import 'package:flutter_api_samples/material/autocomplete/autocomplete.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/autocomplete/autocomplete.1_test.dart b/examples/api/test/material/autocomplete/autocomplete.1_test.dart index 9dc0510ec6d..669dc8d4ede 100644 --- a/examples/api/test/material/autocomplete/autocomplete.1_test.dart +++ b/examples/api/test/material/autocomplete/autocomplete.1_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/autocomplete/autocomplete.1.dart' as example; +import 'package:flutter_api_samples/material/autocomplete/autocomplete.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('can search and find options by email and name', (WidgetTester tester) async { + testWidgets('can search and find options by email and name', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.AutocompleteExampleApp()); expect(find.text('Alice'), findsNothing); diff --git a/examples/api/test/material/autocomplete/autocomplete.2_test.dart b/examples/api/test/material/autocomplete/autocomplete.2_test.dart index 797ca811187..1fcd23233bb 100644 --- a/examples/api/test/material/autocomplete/autocomplete.2_test.dart +++ b/examples/api/test/material/autocomplete/autocomplete.2_test.dart @@ -3,31 +3,33 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/autocomplete/autocomplete.2.dart' as example; +import 'package:flutter_api_samples/material/autocomplete/autocomplete.2.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('can search and find options after waiting for fake network delay', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.AutocompleteExampleApp()); + testWidgets( + 'can search and find options after waiting for fake network delay', + (WidgetTester tester) async { + await tester.pumpWidget(const example.AutocompleteExampleApp()); - expect(find.text('aardvark'), findsNothing); - expect(find.text('bobcat'), findsNothing); - expect(find.text('chameleon'), findsNothing); + expect(find.text('aardvark'), findsNothing); + expect(find.text('bobcat'), findsNothing); + expect(find.text('chameleon'), findsNothing); - await tester.enterText(find.byType(TextFormField), 'a'); - await tester.pump(example.fakeAPIDuration); + await tester.enterText(find.byType(TextFormField), 'a'); + await tester.pump(example.fakeAPIDuration); - expect(find.text('aardvark'), findsOneWidget); - expect(find.text('bobcat'), findsOneWidget); - expect(find.text('chameleon'), findsOneWidget); + expect(find.text('aardvark'), findsOneWidget); + expect(find.text('bobcat'), findsOneWidget); + expect(find.text('chameleon'), findsOneWidget); - await tester.enterText(find.byType(TextFormField), 'aa'); - await tester.pump(example.fakeAPIDuration); + await tester.enterText(find.byType(TextFormField), 'aa'); + await tester.pump(example.fakeAPIDuration); - expect(find.text('aardvark'), findsOneWidget); - expect(find.text('bobcat'), findsNothing); - expect(find.text('chameleon'), findsNothing); - }); + expect(find.text('aardvark'), findsOneWidget); + expect(find.text('bobcat'), findsNothing); + expect(find.text('chameleon'), findsNothing); + }, + ); } diff --git a/examples/api/test/material/autocomplete/autocomplete.3_test.dart b/examples/api/test/material/autocomplete/autocomplete.3_test.dart index 2f28493b934..53a47004c84 100644 --- a/examples/api/test/material/autocomplete/autocomplete.3_test.dart +++ b/examples/api/test/material/autocomplete/autocomplete.3_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/autocomplete/autocomplete.3.dart' as example; +import 'package:flutter_api_samples/material/autocomplete/autocomplete.3.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -39,32 +40,42 @@ void main() { }, ); - testWidgets('debounce is reset each time a character is entered', (WidgetTester tester) async { + testWidgets('debounce is reset each time a character is entered', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.AutocompleteExampleApp()); await tester.enterText(find.byType(TextFormField), 'c'); - await tester.pump(example.debounceDuration - const Duration(milliseconds: 100)); + await tester.pump( + example.debounceDuration - const Duration(milliseconds: 100), + ); expect(find.text('aardvark'), findsNothing); expect(find.text('bobcat'), findsNothing); expect(find.text('chameleon'), findsNothing); await tester.enterText(find.byType(TextFormField), 'ch'); - await tester.pump(example.debounceDuration - const Duration(milliseconds: 100)); + await tester.pump( + example.debounceDuration - const Duration(milliseconds: 100), + ); expect(find.text('aardvark'), findsNothing); expect(find.text('bobcat'), findsNothing); expect(find.text('chameleon'), findsNothing); await tester.enterText(find.byType(TextFormField), 'cha'); - await tester.pump(example.debounceDuration - const Duration(milliseconds: 100)); + await tester.pump( + example.debounceDuration - const Duration(milliseconds: 100), + ); expect(find.text('aardvark'), findsNothing); expect(find.text('bobcat'), findsNothing); expect(find.text('chameleon'), findsNothing); await tester.enterText(find.byType(TextFormField), 'cham'); - await tester.pump(example.debounceDuration - const Duration(milliseconds: 100)); + await tester.pump( + example.debounceDuration - const Duration(milliseconds: 100), + ); // Despite the total elapsed time being greater than debounceDuration + // fakeAPIDuration, the search has not yet completed, because the debounce diff --git a/examples/api/test/material/autocomplete/autocomplete.4_test.dart b/examples/api/test/material/autocomplete/autocomplete.4_test.dart index 21911100584..eebd3643969 100644 --- a/examples/api/test/material/autocomplete/autocomplete.4_test.dart +++ b/examples/api/test/material/autocomplete/autocomplete.4_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/autocomplete/autocomplete.4.dart' as example; +import 'package:flutter_api_samples/material/autocomplete/autocomplete.4.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -39,32 +40,42 @@ void main() { }, ); - testWidgets('debounce is reset each time a character is entered', (WidgetTester tester) async { + testWidgets('debounce is reset each time a character is entered', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.AutocompleteExampleApp()); await tester.enterText(find.byType(TextFormField), 'c'); - await tester.pump(example.debounceDuration - const Duration(milliseconds: 100)); + await tester.pump( + example.debounceDuration - const Duration(milliseconds: 100), + ); expect(find.text('aardvark'), findsNothing); expect(find.text('bobcat'), findsNothing); expect(find.text('chameleon'), findsNothing); await tester.enterText(find.byType(TextFormField), 'ch'); - await tester.pump(example.debounceDuration - const Duration(milliseconds: 100)); + await tester.pump( + example.debounceDuration - const Duration(milliseconds: 100), + ); expect(find.text('aardvark'), findsNothing); expect(find.text('bobcat'), findsNothing); expect(find.text('chameleon'), findsNothing); await tester.enterText(find.byType(TextFormField), 'cha'); - await tester.pump(example.debounceDuration - const Duration(milliseconds: 100)); + await tester.pump( + example.debounceDuration - const Duration(milliseconds: 100), + ); expect(find.text('aardvark'), findsNothing); expect(find.text('bobcat'), findsNothing); expect(find.text('chameleon'), findsNothing); await tester.enterText(find.byType(TextFormField), 'cham'); - await tester.pump(example.debounceDuration - const Duration(milliseconds: 100)); + await tester.pump( + example.debounceDuration - const Duration(milliseconds: 100), + ); // Despite the total elapsed time being greater than debounceDuration + // fakeAPIDuration, the search has not yet completed, because the debounce @@ -81,7 +92,9 @@ void main() { expect(find.text('chameleon'), findsOneWidget); }); - testWidgets('shows an error message for network errors', (WidgetTester tester) async { + testWidgets('shows an error message for network errors', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.AutocompleteExampleApp()); await tester.enterText(find.byType(TextFormField), 'chame'); diff --git a/examples/api/test/material/badge/badge.0_test.dart b/examples/api/test/material/badge/badge.0_test.dart index 13ed45da106..ba9ed720b91 100644 --- a/examples/api/test/material/badge/badge.0_test.dart +++ b/examples/api/test/material/badge/badge.0_test.dart @@ -7,7 +7,9 @@ import 'package:flutter_api_samples/material/badge/badge.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Verify Badges have label and count', (WidgetTester tester) async { + testWidgets('Verify Badges have label and count', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.BadgeExampleApp()); // Verify that two Badge(s) are present expect(find.byType(Badge), findsNWidgets(2)); diff --git a/examples/api/test/material/banner/material_banner.0_test.dart b/examples/api/test/material/banner/material_banner.0_test.dart index c0b0c29da57..25a67a6fa6f 100644 --- a/examples/api/test/material/banner/material_banner.0_test.dart +++ b/examples/api/test/material/banner/material_banner.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/banner/material_banner.0.dart' as example; +import 'package:flutter_api_samples/material/banner/material_banner.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -20,7 +21,9 @@ void main() { expect(find.byIcon(Icons.agriculture_outlined), findsOneWidget); }); - testWidgets('BottomNavigationBar Updates Screen Content', (WidgetTester tester) async { + testWidgets('BottomNavigationBar Updates Screen Content', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.MaterialBannerExampleApp()); expect(find.byType(MaterialBanner), findsOne); @@ -30,13 +33,17 @@ void main() { expect(find.widgetWithText(TextButton, 'DISMISS'), findsOne); }); - testWidgets('The banner is below the text saying so', (WidgetTester tester) async { + testWidgets('The banner is below the text saying so', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.MaterialBannerExampleApp()); expect(find.byType(MaterialBanner), findsOneWidget); expect(find.text('The MaterialBanner is below'), findsOneWidget); final double bannerY = tester.getCenter(find.byType(MaterialBanner)).dy; - final double textY = tester.getCenter(find.text('The MaterialBanner is below')).dy; + final double textY = tester + .getCenter(find.text('The MaterialBanner is below')) + .dy; expect(bannerY, greaterThan(textY)); }); } diff --git a/examples/api/test/material/banner/material_banner.1_test.dart b/examples/api/test/material/banner/material_banner.1_test.dart index 616609d3645..e13727bb0a8 100644 --- a/examples/api/test/material/banner/material_banner.1_test.dart +++ b/examples/api/test/material/banner/material_banner.1_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/banner/material_banner.1.dart' as example; +import 'package:flutter_api_samples/material/banner/material_banner.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -22,15 +23,21 @@ void main() { expect(find.text('DISMISS'), findsOneWidget); expect(find.byIcon(Icons.agriculture_outlined), findsOneWidget); - final MaterialBanner banner = tester.widget(find.byType(MaterialBanner)); + final MaterialBanner banner = tester.widget( + find.byType(MaterialBanner), + ); expect(banner.backgroundColor, Colors.green); }); - testWidgets('BottomNavigationBar Updates Screen Content', (WidgetTester tester) async { + testWidgets('BottomNavigationBar Updates Screen Content', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.MaterialBannerExampleApp()); expect(find.byType(MaterialBanner), findsNothing); - await tester.tap(find.widgetWithText(ElevatedButton, 'Show MaterialBanner')); + await tester.tap( + find.widgetWithText(ElevatedButton, 'Show MaterialBanner'), + ); await tester.pumpAndSettle(); expect(find.byType(MaterialBanner), findsOne); @@ -39,7 +46,9 @@ void main() { expect(find.widgetWithText(TextButton, 'DISMISS'), findsOne); }); - testWidgets('The banner is below the text saying so', (WidgetTester tester) async { + testWidgets('The banner is below the text saying so', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.MaterialBannerExampleApp()); await tester.tap(find.text('Show MaterialBanner')); await tester.pumpAndSettle(); @@ -47,7 +56,9 @@ void main() { expect(find.byType(MaterialBanner), findsOneWidget); expect(find.text('The MaterialBanner is below'), findsOneWidget); final double bannerY = tester.getCenter(find.byType(MaterialBanner)).dy; - final double textY = tester.getCenter(find.text('The MaterialBanner is below')).dy; + final double textY = tester + .getCenter(find.text('The MaterialBanner is below')) + .dy; expect(bannerY, greaterThan(textY)); }); } diff --git a/examples/api/test/material/bottom_app_bar/bottom_app_bar.1_test.dart b/examples/api/test/material/bottom_app_bar/bottom_app_bar.1_test.dart index e709aca2472..59d74c3af8b 100644 --- a/examples/api/test/material/bottom_app_bar/bottom_app_bar.1_test.dart +++ b/examples/api/test/material/bottom_app_bar/bottom_app_bar.1_test.dart @@ -3,23 +3,25 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/bottom_app_bar/bottom_app_bar.1.dart' as example; +import 'package:flutter_api_samples/material/bottom_app_bar/bottom_app_bar.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('BottomAppBarDemo shows FloatingActionButton and responds to toggle', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.BottomAppBarDemo()); + testWidgets( + 'BottomAppBarDemo shows FloatingActionButton and responds to toggle', + (WidgetTester tester) async { + await tester.pumpWidget(const example.BottomAppBarDemo()); - expect(find.byType(FloatingActionButton), findsOneWidget); + expect(find.byType(FloatingActionButton), findsOneWidget); - // Tap the 'Floating Action Button' switch to hide the FAB. - await tester.tap(find.byType(SwitchListTile).first); - await tester.pumpAndSettle(); + // Tap the 'Floating Action Button' switch to hide the FAB. + await tester.tap(find.byType(SwitchListTile).first); + await tester.pumpAndSettle(); - expect(find.byType(FloatingActionButton), findsNothing); - }); + expect(find.byType(FloatingActionButton), findsNothing); + }, + ); testWidgets('Notch can be toggled on and off', (WidgetTester tester) async { await tester.pumpWidget(const example.BottomAppBarDemo()); @@ -39,7 +41,9 @@ void main() { testWidgets('FAB location can be changed', (WidgetTester tester) async { await tester.pumpWidget(const example.BottomAppBarDemo()); - final Offset initialPosition = tester.getCenter(find.byType(FloatingActionButton)); + final Offset initialPosition = tester.getCenter( + find.byType(FloatingActionButton), + ); // Verify the initial position is near the right side (docked to the end). final Size screenSize = tester.getSize(find.byType(Scaffold)); @@ -50,7 +54,9 @@ void main() { await tester.pumpAndSettle(); // Get the new FAB position (centerDocked). - final Offset newPosition = tester.getCenter(find.byType(FloatingActionButton)); + final Offset newPosition = tester.getCenter( + find.byType(FloatingActionButton), + ); expect( newPosition.dx, diff --git a/examples/api/test/material/bottom_app_bar/bottom_app_bar.2_test.dart b/examples/api/test/material/bottom_app_bar/bottom_app_bar.2_test.dart index c28ffcc7236..b72818a9e06 100644 --- a/examples/api/test/material/bottom_app_bar/bottom_app_bar.2_test.dart +++ b/examples/api/test/material/bottom_app_bar/bottom_app_bar.2_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/bottom_app_bar/bottom_app_bar.2.dart' as example; +import 'package:flutter_api_samples/material/bottom_app_bar/bottom_app_bar.2.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Floating Action Button visibility can be toggled', (WidgetTester tester) async { + testWidgets('Floating Action Button visibility can be toggled', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.BottomAppBarDemo()); expect(find.byType(FloatingActionButton), findsOneWidget); @@ -19,7 +22,9 @@ void main() { expect(find.byType(FloatingActionButton), findsNothing); }); - testWidgets('BottomAppBar elevation can be toggled', (WidgetTester tester) async { + testWidgets('BottomAppBar elevation can be toggled', ( + WidgetTester tester, + ) async { // Build the app. await tester.pumpWidget(const example.BottomAppBarDemo()); @@ -59,7 +64,9 @@ void main() { expect(visibleSize.height, equals(80.0)); }); - testWidgets('SnackBar is shown when Open popup menu is pressed', (WidgetTester tester) async { + testWidgets('SnackBar is shown when Open popup menu is pressed', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.BottomAppBarDemo()); // Trigger the SnackBar. diff --git a/examples/api/test/material/bottom_navigation_bar/bottom_navigation_bar.0_test.dart b/examples/api/test/material/bottom_navigation_bar/bottom_navigation_bar.0_test.dart index a7c78932694..f6eee9f273c 100644 --- a/examples/api/test/material/bottom_navigation_bar/bottom_navigation_bar.0_test.dart +++ b/examples/api/test/material/bottom_navigation_bar/bottom_navigation_bar.0_test.dart @@ -8,10 +8,15 @@ import 'package:flutter_api_samples/material/bottom_navigation_bar/bottom_naviga import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('BottomNavigationBar Updates Screen Content', (WidgetTester tester) async { + testWidgets('BottomNavigationBar Updates Screen Content', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.BottomNavigationBarExampleApp()); - expect(find.widgetWithText(AppBar, 'BottomNavigationBar Sample'), findsOneWidget); + expect( + find.widgetWithText(AppBar, 'BottomNavigationBar Sample'), + findsOneWidget, + ); expect(find.byType(BottomNavigationBar), findsOneWidget); expect(find.widgetWithText(Center, 'Index 0: Home'), findsOneWidget); diff --git a/examples/api/test/material/bottom_navigation_bar/bottom_navigation_bar.1_test.dart b/examples/api/test/material/bottom_navigation_bar/bottom_navigation_bar.1_test.dart index 66f60c85c07..d5dd87894a7 100644 --- a/examples/api/test/material/bottom_navigation_bar/bottom_navigation_bar.1_test.dart +++ b/examples/api/test/material/bottom_navigation_bar/bottom_navigation_bar.1_test.dart @@ -8,10 +8,15 @@ import 'package:flutter_api_samples/material/bottom_navigation_bar/bottom_naviga import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('BottomNavigationBar Updates Screen Content', (WidgetTester tester) async { + testWidgets('BottomNavigationBar Updates Screen Content', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.BottomNavigationBarExampleApp()); - expect(find.widgetWithText(AppBar, 'BottomNavigationBar Sample'), findsOneWidget); + expect( + find.widgetWithText(AppBar, 'BottomNavigationBar Sample'), + findsOneWidget, + ); expect(find.byType(BottomNavigationBar), findsOneWidget); expect(find.widgetWithText(Center, 'Index 0: Home'), findsOneWidget); diff --git a/examples/api/test/material/bottom_navigation_bar/bottom_navigation_bar.2_test.dart b/examples/api/test/material/bottom_navigation_bar/bottom_navigation_bar.2_test.dart index 0486e7e4863..7f305525f3f 100644 --- a/examples/api/test/material/bottom_navigation_bar/bottom_navigation_bar.2_test.dart +++ b/examples/api/test/material/bottom_navigation_bar/bottom_navigation_bar.2_test.dart @@ -8,14 +8,22 @@ import 'package:flutter_api_samples/material/bottom_navigation_bar/bottom_naviga import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('BottomNavigationBar Updates Screen Content', (WidgetTester tester) async { + testWidgets('BottomNavigationBar Updates Screen Content', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.BottomNavigationBarExampleApp()); - expect(find.widgetWithText(AppBar, 'BottomNavigationBar Sample'), findsOneWidget); + expect( + find.widgetWithText(AppBar, 'BottomNavigationBar Sample'), + findsOneWidget, + ); expect(find.byType(BottomNavigationBar), findsOneWidget); expect(find.widgetWithText(Center, 'Item 0'), findsOneWidget); - await tester.scrollUntilVisible(find.widgetWithText(Center, 'Item 49'), 100); + await tester.scrollUntilVisible( + find.widgetWithText(Center, 'Item 49'), + 100, + ); await tester.pumpAndSettle(); expect(find.widgetWithText(Center, 'Item 49'), findsOneWidget); diff --git a/examples/api/test/material/bottom_sheet/show_bottom_sheet.0_test.dart b/examples/api/test/material/bottom_sheet/show_bottom_sheet.0_test.dart index 88d59a01b2e..fb5b931e9f9 100644 --- a/examples/api/test/material/bottom_sheet/show_bottom_sheet.0_test.dart +++ b/examples/api/test/material/bottom_sheet/show_bottom_sheet.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/bottom_sheet/show_bottom_sheet.0.dart' as example; +import 'package:flutter_api_samples/material/bottom_sheet/show_bottom_sheet.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/bottom_sheet/show_modal_bottom_sheet.0_test.dart b/examples/api/test/material/bottom_sheet/show_modal_bottom_sheet.0_test.dart index 8109c4f95b1..701e3d82162 100644 --- a/examples/api/test/material/bottom_sheet/show_modal_bottom_sheet.0_test.dart +++ b/examples/api/test/material/bottom_sheet/show_modal_bottom_sheet.0_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/material/bottom_sheet/show_modal_bottom_shee import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('BottomSheet can be opened and closed', (WidgetTester tester) async { + testWidgets('BottomSheet can be opened and closed', ( + WidgetTester tester, + ) async { const String titleText = 'Modal BottomSheet'; const String closeText = 'Close BottomSheet'; @@ -18,7 +20,9 @@ void main() { expect(find.text(closeText), findsNothing); // Open the bottom sheet. - await tester.tap(find.widgetWithText(ElevatedButton, 'showModalBottomSheet')); + await tester.tap( + find.widgetWithText(ElevatedButton, 'showModalBottomSheet'), + ); await tester.pumpAndSettle(); // Verify that the bottom sheet is open. diff --git a/examples/api/test/material/bottom_sheet/show_modal_bottom_sheet.1_test.dart b/examples/api/test/material/bottom_sheet/show_modal_bottom_sheet.1_test.dart index f650e1e2eb1..b7eda850320 100644 --- a/examples/api/test/material/bottom_sheet/show_modal_bottom_sheet.1_test.dart +++ b/examples/api/test/material/bottom_sheet/show_modal_bottom_sheet.1_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/material/bottom_sheet/show_modal_bottom_shee import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('BottomSheet can be opened and closed', (WidgetTester tester) async { + testWidgets('BottomSheet can be opened and closed', ( + WidgetTester tester, + ) async { const String titleText = 'Modal BottomSheet'; const String closeText = 'Close BottomSheet'; @@ -18,7 +20,9 @@ void main() { expect(find.text(closeText), findsNothing); // Open the bottom sheet. - await tester.tap(find.widgetWithText(ElevatedButton, 'showModalBottomSheet')); + await tester.tap( + find.widgetWithText(ElevatedButton, 'showModalBottomSheet'), + ); await tester.pumpAndSettle(); // Verify that the bottom sheet is open. diff --git a/examples/api/test/material/bottom_sheet/show_modal_bottom_sheet.2_test.dart b/examples/api/test/material/bottom_sheet/show_modal_bottom_sheet.2_test.dart index 97db8e08028..962267b8530 100644 --- a/examples/api/test/material/bottom_sheet/show_modal_bottom_sheet.2_test.dart +++ b/examples/api/test/material/bottom_sheet/show_modal_bottom_sheet.2_test.dart @@ -8,60 +8,73 @@ import 'package:flutter_api_samples/material/bottom_sheet/show_modal_bottom_shee import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Modal bottom sheet animation can be customized using AnimationStyle', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.ModalBottomSheetApp()); + testWidgets( + 'Modal bottom sheet animation can be customized using AnimationStyle', + (WidgetTester tester) async { + await tester.pumpWidget(const example.ModalBottomSheetApp()); - // Show the bottom sheet with default animation style. - await tester.tap(find.widgetWithText(ElevatedButton, 'showModalBottomSheet')); - await tester.pump(); - // Advance the animation by 1/2 of the default forward duration. - await tester.pump(const Duration(milliseconds: 125)); + // Show the bottom sheet with default animation style. + await tester.tap( + find.widgetWithText(ElevatedButton, 'showModalBottomSheet'), + ); + await tester.pump(); + // Advance the animation by 1/2 of the default forward duration. + await tester.pump(const Duration(milliseconds: 125)); - // The bottom sheet is partially visible. - expect(tester.getTopLeft(find.byType(BottomSheet)).dy, closeTo(316.7, 0.1)); + // The bottom sheet is partially visible. + expect( + tester.getTopLeft(find.byType(BottomSheet)).dy, + closeTo(316.7, 0.1), + ); - // Advance the animation by 1/2 of the default forward duration. - await tester.pump(const Duration(milliseconds: 125)); + // Advance the animation by 1/2 of the default forward duration. + await tester.pump(const Duration(milliseconds: 125)); - // The bottom sheet is fully visible. - expect(tester.getTopLeft(find.byType(BottomSheet)).dy, equals(262.5)); + // The bottom sheet is fully visible. + expect(tester.getTopLeft(find.byType(BottomSheet)).dy, equals(262.5)); - // Dismiss the bottom sheet. - await tester.tap(find.widgetWithText(ElevatedButton, 'Close')); - await tester.pumpAndSettle(); + // Dismiss the bottom sheet. + await tester.tap(find.widgetWithText(ElevatedButton, 'Close')); + await tester.pumpAndSettle(); - // Select custom animation style. - await tester.tap(find.text('Custom')); - await tester.pumpAndSettle(); + // Select custom animation style. + await tester.tap(find.text('Custom')); + await tester.pumpAndSettle(); - // Show the bottom sheet with custom animation style. - await tester.tap(find.widgetWithText(ElevatedButton, 'showModalBottomSheet')); - await tester.pump(); - // Advance the animation by 1/2 of the custom forward duration. - await tester.pump(const Duration(milliseconds: 1500)); + // Show the bottom sheet with custom animation style. + await tester.tap( + find.widgetWithText(ElevatedButton, 'showModalBottomSheet'), + ); + await tester.pump(); + // Advance the animation by 1/2 of the custom forward duration. + await tester.pump(const Duration(milliseconds: 1500)); - // The bottom sheet is partially visible. - expect(tester.getTopLeft(find.byType(BottomSheet)).dy, closeTo(316.7, 0.1)); + // The bottom sheet is partially visible. + expect( + tester.getTopLeft(find.byType(BottomSheet)).dy, + closeTo(316.7, 0.1), + ); - // Advance the animation by 1/2 of the custom forward duration. - await tester.pump(const Duration(milliseconds: 1500)); + // Advance the animation by 1/2 of the custom forward duration. + await tester.pump(const Duration(milliseconds: 1500)); - // The bottom sheet is fully visible. - expect(tester.getTopLeft(find.byType(BottomSheet)).dy, equals(262.5)); + // The bottom sheet is fully visible. + expect(tester.getTopLeft(find.byType(BottomSheet)).dy, equals(262.5)); - // Dismiss the bottom sheet. - await tester.tap(find.widgetWithText(ElevatedButton, 'Close')); - await tester.pumpAndSettle(); + // Dismiss the bottom sheet. + await tester.tap(find.widgetWithText(ElevatedButton, 'Close')); + await tester.pumpAndSettle(); - // Select no animation style. - await tester.tap(find.text('None')); - await tester.pumpAndSettle(); + // Select no animation style. + await tester.tap(find.text('None')); + await tester.pumpAndSettle(); - // Show the bottom sheet with no animation style. - await tester.tap(find.widgetWithText(ElevatedButton, 'showModalBottomSheet')); - await tester.pump(); - expect(tester.getTopLeft(find.byType(BottomSheet)).dy, equals(262.5)); - }); + // Show the bottom sheet with no animation style. + await tester.tap( + find.widgetWithText(ElevatedButton, 'showModalBottomSheet'), + ); + await tester.pump(); + expect(tester.getTopLeft(find.byType(BottomSheet)).dy, equals(262.5)); + }, + ); } diff --git a/examples/api/test/material/button_style/button_style.0_test.dart b/examples/api/test/material/button_style/button_style.0_test.dart index 6fc3f378c5b..e7f38a60ae8 100644 --- a/examples/api/test/material/button_style/button_style.0_test.dart +++ b/examples/api/test/material/button_style/button_style.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/button_style/button_style.0.dart' as example; +import 'package:flutter_api_samples/material/button_style/button_style.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/button_style_button/button_style_button.icon_alignment.0_test.dart b/examples/api/test/material/button_style_button/button_style_button.icon_alignment.0_test.dart index 283c1823181..a3d5ec6aa9b 100644 --- a/examples/api/test/material/button_style_button/button_style_button.icon_alignment.0_test.dart +++ b/examples/api/test/material/button_style_button/button_style_button.icon_alignment.0_test.dart @@ -8,93 +8,100 @@ import 'package:flutter_api_samples/material/button_style_button/button_style_bu import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('ButtonStyleButton.iconAlignment updates button icons alignment', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.ButtonStyleButtonIconAlignmentApp()); - - Finder findButtonMaterial(String text) { - return find.ancestor(of: find.text(text), matching: find.byType(Material)).first; - } - - void expectedLeftIconPosition({ - required double iconOffset, - required double textButtonIconOffset, - }) { - expect( - tester.getTopLeft(findButtonMaterial('ElevatedButton')).dx, - tester.getTopLeft(find.byIcon(Icons.sunny)).dx - iconOffset, + testWidgets( + 'ButtonStyleButton.iconAlignment updates button icons alignment', + (WidgetTester tester) async { + await tester.pumpWidget( + const example.ButtonStyleButtonIconAlignmentApp(), ); - expect( - tester.getTopLeft(findButtonMaterial('FilledButton')).dx, - tester.getTopLeft(find.byIcon(Icons.beach_access)).dx - iconOffset, - ); - expect( - tester.getTopLeft(findButtonMaterial('FilledButton Tonal')).dx, - tester.getTopLeft(find.byIcon(Icons.cloud)).dx - iconOffset, - ); - expect( - tester.getTopLeft(findButtonMaterial('OutlinedButton')).dx, - tester.getTopLeft(find.byIcon(Icons.light)).dx - iconOffset, - ); - expect( - tester.getTopLeft(findButtonMaterial('TextButton')).dx, - tester.getTopLeft(find.byIcon(Icons.flight_takeoff)).dx - textButtonIconOffset, - ); - } - void expectedRightIconPosition({ - required double iconOffset, - required double textButtonIconOffset, - }) { - expect( - tester.getTopRight(findButtonMaterial('ElevatedButton')).dx, - tester.getTopRight(find.byIcon(Icons.sunny)).dx + iconOffset, - ); - expect( - tester.getTopRight(findButtonMaterial('FilledButton')).dx, - tester.getTopRight(find.byIcon(Icons.beach_access)).dx + iconOffset, - ); - expect( - tester.getTopRight(findButtonMaterial('FilledButton Tonal')).dx, - tester.getTopRight(find.byIcon(Icons.cloud)).dx + iconOffset, - ); - expect( - tester.getTopRight(findButtonMaterial('OutlinedButton')).dx, - tester.getTopRight(find.byIcon(Icons.light)).dx + iconOffset, - ); - expect( - tester.getTopRight(findButtonMaterial('TextButton')).dx, - tester.getTopRight(find.byIcon(Icons.flight_takeoff)).dx + textButtonIconOffset, - ); - } + Finder findButtonMaterial(String text) { + return find + .ancestor(of: find.text(text), matching: find.byType(Material)) + .first; + } - // Test initial icon alignment in LTR. - expectedLeftIconPosition(iconOffset: 16, textButtonIconOffset: 12); + void expectedLeftIconPosition({ + required double iconOffset, + required double textButtonIconOffset, + }) { + expect( + tester.getTopLeft(findButtonMaterial('ElevatedButton')).dx, + tester.getTopLeft(find.byIcon(Icons.sunny)).dx - iconOffset, + ); + expect( + tester.getTopLeft(findButtonMaterial('FilledButton')).dx, + tester.getTopLeft(find.byIcon(Icons.beach_access)).dx - iconOffset, + ); + expect( + tester.getTopLeft(findButtonMaterial('FilledButton Tonal')).dx, + tester.getTopLeft(find.byIcon(Icons.cloud)).dx - iconOffset, + ); + expect( + tester.getTopLeft(findButtonMaterial('OutlinedButton')).dx, + tester.getTopLeft(find.byIcon(Icons.light)).dx - iconOffset, + ); + expect( + tester.getTopLeft(findButtonMaterial('TextButton')).dx, + tester.getTopLeft(find.byIcon(Icons.flight_takeoff)).dx - + textButtonIconOffset, + ); + } - // Update icon alignment to end. - await tester.tap(find.text('end')); - await tester.pumpAndSettle(); + void expectedRightIconPosition({ + required double iconOffset, + required double textButtonIconOffset, + }) { + expect( + tester.getTopRight(findButtonMaterial('ElevatedButton')).dx, + tester.getTopRight(find.byIcon(Icons.sunny)).dx + iconOffset, + ); + expect( + tester.getTopRight(findButtonMaterial('FilledButton')).dx, + tester.getTopRight(find.byIcon(Icons.beach_access)).dx + iconOffset, + ); + expect( + tester.getTopRight(findButtonMaterial('FilledButton Tonal')).dx, + tester.getTopRight(find.byIcon(Icons.cloud)).dx + iconOffset, + ); + expect( + tester.getTopRight(findButtonMaterial('OutlinedButton')).dx, + tester.getTopRight(find.byIcon(Icons.light)).dx + iconOffset, + ); + expect( + tester.getTopRight(findButtonMaterial('TextButton')).dx, + tester.getTopRight(find.byIcon(Icons.flight_takeoff)).dx + + textButtonIconOffset, + ); + } - // Test icon alignment end in LTR. - expectedRightIconPosition(iconOffset: 24, textButtonIconOffset: 16); + // Test initial icon alignment in LTR. + expectedLeftIconPosition(iconOffset: 16, textButtonIconOffset: 12); - // Reset icon alignment to start. - await tester.tap(find.text('start')); - await tester.pumpAndSettle(); + // Update icon alignment to end. + await tester.tap(find.text('end')); + await tester.pumpAndSettle(); - // Change text direction to RTL. - await tester.tap(find.text('RTL')); - await tester.pumpAndSettle(); + // Test icon alignment end in LTR. + expectedRightIconPosition(iconOffset: 24, textButtonIconOffset: 16); - // Test icon alignment start in LTR. - expectedRightIconPosition(iconOffset: 16, textButtonIconOffset: 12); + // Reset icon alignment to start. + await tester.tap(find.text('start')); + await tester.pumpAndSettle(); - // Update icon alignment to end. - await tester.tap(find.text('end')); - await tester.pumpAndSettle(); + // Change text direction to RTL. + await tester.tap(find.text('RTL')); + await tester.pumpAndSettle(); - // Test icon alignment end in LTR. - expectedLeftIconPosition(iconOffset: 24, textButtonIconOffset: 16); - }); + // Test icon alignment start in LTR. + expectedRightIconPosition(iconOffset: 16, textButtonIconOffset: 12); + + // Update icon alignment to end. + await tester.tap(find.text('end')); + await tester.pumpAndSettle(); + + // Test icon alignment end in LTR. + expectedLeftIconPosition(iconOffset: 24, textButtonIconOffset: 16); + }, + ); } diff --git a/examples/api/test/material/card/card.0_test.dart b/examples/api/test/material/card/card.0_test.dart index 7014cc62494..f2349236638 100644 --- a/examples/api/test/material/card/card.0_test.dart +++ b/examples/api/test/material/card/card.0_test.dart @@ -11,9 +11,15 @@ void main() { await tester.pumpWidget(const example.CardExampleApp()); expect(find.byType(Card), findsOneWidget); expect(find.widgetWithIcon(Card, Icons.album), findsOneWidget); - expect(find.widgetWithText(Card, 'The Enchanted Nightingale'), findsOneWidget); expect( - find.widgetWithText(Card, 'Music by Julie Gable. Lyrics by Sidney Stein.'), + find.widgetWithText(Card, 'The Enchanted Nightingale'), + findsOneWidget, + ); + expect( + find.widgetWithText( + Card, + 'Music by Julie Gable. Lyrics by Sidney Stein.', + ), findsOneWidget, ); expect(find.widgetWithText(Card, 'BUY TICKETS'), findsOneWidget); diff --git a/examples/api/test/material/card/card.2_test.dart b/examples/api/test/material/card/card.2_test.dart index d7953556525..0fc51370676 100644 --- a/examples/api/test/material/card/card.2_test.dart +++ b/examples/api/test/material/card/card.2_test.dart @@ -18,7 +18,10 @@ void main() { Material getCardMaterial(WidgetTester tester, int cardIndex) { return tester.widget( - find.descendant(of: find.byType(Card).at(cardIndex), matching: find.byType(Material)), + find.descendant( + of: find.byType(Card).at(cardIndex), + matching: find.byType(Material), + ), ); } @@ -27,7 +30,9 @@ void main() { expect(defaultCard.elevation, 1.0); expect( defaultCard.shape, - const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(12.0))), + const RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(12.0)), + ), ); expect(defaultCard.color, const Color(0xfff7f2fa)); expect(defaultCard.shadowColor, const Color(0xff000000)); @@ -38,7 +43,9 @@ void main() { expect(filledCard.elevation, 0.0); expect( filledCard.shape, - const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(12.0))), + const RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(12.0)), + ), ); expect(filledCard.color, const Color(0xffe6e0e9)); expect(filledCard.shadowColor, const Color(0xff000000)); diff --git a/examples/api/test/material/carousel/carousel.0_test.dart b/examples/api/test/material/carousel/carousel.0_test.dart index 96902d4600e..6225e17af97 100644 --- a/examples/api/test/material/carousel/carousel.0_test.dart +++ b/examples/api/test/material/carousel/carousel.0_test.dart @@ -5,7 +5,8 @@ import 'dart:io'; import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/carousel/carousel.0.dart' as example; +import 'package:flutter_api_samples/material/carousel/carousel.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -18,11 +19,17 @@ void main() { testWidgets('Carousel Smoke Test', (WidgetTester tester) async { await tester.pumpWidget(const example.CarouselExampleApp()); - expect(find.widgetWithText(example.HeroLayoutCard, 'Through the Pane'), findsOneWidget); + expect( + find.widgetWithText(example.HeroLayoutCard, 'Through the Pane'), + findsOneWidget, + ); final Finder firstCarousel = find.byType(CarouselView).first; await tester.drag(firstCarousel, const Offset(150, 0)); await tester.pumpAndSettle(); - expect(find.widgetWithText(example.HeroLayoutCard, 'The Flow'), findsOneWidget); + expect( + find.widgetWithText(example.HeroLayoutCard, 'The Flow'), + findsOneWidget, + ); await tester.drag(firstCarousel, const Offset(0, -200)); await tester.pumpAndSettle(); @@ -32,7 +39,10 @@ void main() { expect(find.widgetWithText(CarouselView, 'Climate'), findsOneWidget); expect(find.widgetWithText(CarouselView, 'Wifi'), findsOneWidget); - await tester.drag(find.widgetWithText(CarouselView, 'Cameras'), const Offset(0, -200)); + await tester.drag( + find.widgetWithText(CarouselView, 'Cameras'), + const Offset(0, -200), + ); await tester.pumpAndSettle(); expect(find.text('Uncontained layout'), findsOneWidget); diff --git a/examples/api/test/material/carousel/carousel.1_test.dart b/examples/api/test/material/carousel/carousel.1_test.dart index 9fa313f077e..dde9b237047 100644 --- a/examples/api/test/material/carousel/carousel.1_test.dart +++ b/examples/api/test/material/carousel/carousel.1_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/carousel/carousel.1.dart' as example; +import 'package:flutter_api_samples/material/carousel/carousel.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('CarouselView.builder creates items lazily', (WidgetTester tester) async { + testWidgets('CarouselView.builder creates items lazily', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.CarouselBuilderExampleApp()); expect(find.byType(CarouselView), findsOneWidget); diff --git a/examples/api/test/material/checkbox/checkbox.0_test.dart b/examples/api/test/material/checkbox/checkbox.0_test.dart index 1b2bdab0341..1b3be8bef64 100644 --- a/examples/api/test/material/checkbox/checkbox.0_test.dart +++ b/examples/api/test/material/checkbox/checkbox.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/checkbox/checkbox.0.dart' as example; +import 'package:flutter_api_samples/material/checkbox/checkbox.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -32,8 +33,17 @@ void main() { expect(checkbox.checkColor, Colors.white); expect(checkbox.fillColor!.resolve({}), Colors.red); - expect(checkbox.fillColor!.resolve({WidgetState.pressed}), Colors.blue); - expect(checkbox.fillColor!.resolve({WidgetState.hovered}), Colors.blue); - expect(checkbox.fillColor!.resolve({WidgetState.focused}), Colors.blue); + expect( + checkbox.fillColor!.resolve({WidgetState.pressed}), + Colors.blue, + ); + expect( + checkbox.fillColor!.resolve({WidgetState.hovered}), + Colors.blue, + ); + expect( + checkbox.fillColor!.resolve({WidgetState.focused}), + Colors.blue, + ); }); } diff --git a/examples/api/test/material/checkbox/checkbox.1_test.dart b/examples/api/test/material/checkbox/checkbox.1_test.dart index 4b98c4f0fe7..ac2c68f4733 100644 --- a/examples/api/test/material/checkbox/checkbox.1_test.dart +++ b/examples/api/test/material/checkbox/checkbox.1_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/checkbox/checkbox.1.dart' as example; +import 'package:flutter_api_samples/material/checkbox/checkbox.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/checkbox_list_tile/checkbox_list_tile.0_test.dart b/examples/api/test/material/checkbox_list_tile/checkbox_list_tile.0_test.dart index bf66034beba..61bffd59601 100644 --- a/examples/api/test/material/checkbox_list_tile/checkbox_list_tile.0_test.dart +++ b/examples/api/test/material/checkbox_list_tile/checkbox_list_tile.0_test.dart @@ -12,7 +12,9 @@ void main() { testWidgets('CheckboxListTile can be checked', (WidgetTester tester) async { await tester.pumpWidget(const example.CheckboxListTileApp()); - CheckboxListTile checkboxListTile = tester.widget(find.byType(CheckboxListTile)); + CheckboxListTile checkboxListTile = tester.widget( + find.byType(CheckboxListTile), + ); expect(checkboxListTile.value, isFalse); await tester.tap(find.byType(CheckboxListTile)); diff --git a/examples/api/test/material/checkbox_list_tile/custom_labeled_checkbox.0_test.dart b/examples/api/test/material/checkbox_list_tile/custom_labeled_checkbox.0_test.dart index 08df3dfc440..e27ee04188f 100644 --- a/examples/api/test/material/checkbox_list_tile/custom_labeled_checkbox.0_test.dart +++ b/examples/api/test/material/checkbox_list_tile/custom_labeled_checkbox.0_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/material/checkbox_list_tile/custom_labeled_c import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('LinkedLabelCheckbox contains RichText and Checkbox', (WidgetTester tester) async { + testWidgets('LinkedLabelCheckbox contains RichText and Checkbox', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.LabeledCheckboxApp()); // Label text is in a RichText widget with the correct text. diff --git a/examples/api/test/material/checkbox_list_tile/custom_labeled_checkbox.1_test.dart b/examples/api/test/material/checkbox_list_tile/custom_labeled_checkbox.1_test.dart index 75df7f96302..3563643e9fa 100644 --- a/examples/api/test/material/checkbox_list_tile/custom_labeled_checkbox.1_test.dart +++ b/examples/api/test/material/checkbox_list_tile/custom_labeled_checkbox.1_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/material/checkbox_list_tile/custom_labeled_c import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Tapping LabeledCheckbox toggles the checkbox', (WidgetTester tester) async { + testWidgets('Tapping LabeledCheckbox toggles the checkbox', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.LabeledCheckboxApp()); // Checkbox is initially unchecked. diff --git a/examples/api/test/material/chip/chip_attributes.avatar_box_constraints.0_test.dart b/examples/api/test/material/chip/chip_attributes.avatar_box_constraints.0_test.dart index 625ab9c2a03..ae34951082d 100644 --- a/examples/api/test/material/chip/chip_attributes.avatar_box_constraints.0_test.dart +++ b/examples/api/test/material/chip/chip_attributes.avatar_box_constraints.0_test.dart @@ -23,7 +23,10 @@ void main() { Offset chipTopLeft = tester.getTopLeft( find.byWidget( tester.widget( - find.descendant(of: find.byType(RawChip).at(0), matching: find.byType(Material)), + find.descendant( + of: find.byType(RawChip).at(0), + matching: find.byType(Material), + ), ), ), ); @@ -36,7 +39,10 @@ void main() { chipTopLeft = tester.getTopLeft( find.byWidget( tester.widget( - find.descendant(of: find.byType(RawChip).at(1), matching: find.byType(Material)), + find.descendant( + of: find.byType(RawChip).at(1), + matching: find.byType(Material), + ), ), ), ); @@ -49,7 +55,10 @@ void main() { chipTopLeft = tester.getTopLeft( find.byWidget( tester.widget( - find.descendant(of: find.byType(RawChip).at(2), matching: find.byType(Material)), + find.descendant( + of: find.byType(RawChip).at(2), + matching: find.byType(Material), + ), ), ), ); diff --git a/examples/api/test/material/chip/chip_attributes.chip_animation_style.0_test.dart b/examples/api/test/material/chip/chip_attributes.chip_animation_style.0_test.dart index 0f1d2bc229c..505381e7551 100644 --- a/examples/api/test/material/chip/chip_attributes.chip_animation_style.0_test.dart +++ b/examples/api/test/material/chip/chip_attributes.chip_animation_style.0_test.dart @@ -8,129 +8,195 @@ import 'package:flutter_api_samples/material/chip/chip_attributes.chip_animation import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('ChipAnimationStyle.enableAnimation overrides chip enable animation', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.ChipAnimationStyleExampleApp()); + testWidgets( + 'ChipAnimationStyle.enableAnimation overrides chip enable animation', + (WidgetTester tester) async { + await tester.pumpWidget(const example.ChipAnimationStyleExampleApp()); - final RenderBox materialBox = tester.firstRenderObject( - find.descendant( - of: find.widgetWithText(RawChip, 'Enabled'), - matching: find.byType(CustomPaint), - ), - ); + final RenderBox materialBox = tester.firstRenderObject( + find.descendant( + of: find.widgetWithText(RawChip, 'Enabled'), + matching: find.byType(CustomPaint), + ), + ); - expect(materialBox, paints..rrect(color: const Color(0xffffc107))); + expect(materialBox, paints..rrect(color: const Color(0xffffc107))); - await tester.tap(find.widgetWithText(ElevatedButton, 'Disable')); - await tester.pump(); - await tester.pump(const Duration(milliseconds: 500)); // Advance enable animation by 500ms. + await tester.tap(find.widgetWithText(ElevatedButton, 'Disable')); + await tester.pump(); + await tester.pump( + const Duration(milliseconds: 500), + ); // Advance enable animation by 500ms. - expect(materialBox, paints..rrect(color: const Color(0x1f882f2b))); + expect(materialBox, paints..rrect(color: const Color(0x1f882f2b))); - await tester.pump(const Duration(milliseconds: 500)); // Advance enable animation by 500ms. + await tester.pump( + const Duration(milliseconds: 500), + ); // Advance enable animation by 500ms. - expect(materialBox, paints..rrect(color: const Color(0x1ff44336))); + expect(materialBox, paints..rrect(color: const Color(0x1ff44336))); - await tester.tap(find.widgetWithText(ElevatedButton, 'Enable')); - await tester.pump(); - await tester.pump(const Duration(milliseconds: 1500)); // Advance enable animation by 1500ms. + await tester.tap(find.widgetWithText(ElevatedButton, 'Enable')); + await tester.pump(); + await tester.pump( + const Duration(milliseconds: 1500), + ); // Advance enable animation by 1500ms. - expect(materialBox, paints..rrect(color: const Color(0xfffbd980))); + expect(materialBox, paints..rrect(color: const Color(0xfffbd980))); - await tester.pump(const Duration(milliseconds: 1500)); // Advance enable animation by 1500ms. + await tester.pump( + const Duration(milliseconds: 1500), + ); // Advance enable animation by 1500ms. - expect(materialBox, paints..rrect(color: const Color(0xffffc107))); - }); + expect(materialBox, paints..rrect(color: const Color(0xffffc107))); + }, + ); - testWidgets('ChipAnimationStyle.selectAnimation overrides chip select animation', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.ChipAnimationStyleExampleApp()); + testWidgets( + 'ChipAnimationStyle.selectAnimation overrides chip select animation', + (WidgetTester tester) async { + await tester.pumpWidget(const example.ChipAnimationStyleExampleApp()); - final RenderBox materialBox = tester.firstRenderObject( - find.descendant( - of: find.widgetWithText(RawChip, 'Unselected'), - matching: find.byType(CustomPaint), - ), - ); + final RenderBox materialBox = tester.firstRenderObject( + find.descendant( + of: find.widgetWithText(RawChip, 'Unselected'), + matching: find.byType(CustomPaint), + ), + ); - expect(materialBox, paints..rrect(color: const Color(0xffffc107))); + expect(materialBox, paints..rrect(color: const Color(0xffffc107))); - await tester.tap(find.widgetWithText(ElevatedButton, 'Select')); - await tester.pump(); - await tester.pump(const Duration(milliseconds: 1500)); // Advance select animation by 1500ms. + await tester.tap(find.widgetWithText(ElevatedButton, 'Select')); + await tester.pump(); + await tester.pump( + const Duration(milliseconds: 1500), + ); // Advance select animation by 1500ms. - expect(materialBox, paints..rrect(color: const Color(0xff4da6f4))); + expect(materialBox, paints..rrect(color: const Color(0xff4da6f4))); - await tester.pump(const Duration(milliseconds: 1500)); // Advance select animation by 1500ms. + await tester.pump( + const Duration(milliseconds: 1500), + ); // Advance select animation by 1500ms. - expect(materialBox, paints..rrect(color: const Color(0xff2196f3))); + expect(materialBox, paints..rrect(color: const Color(0xff2196f3))); - await tester.tap(find.widgetWithText(ElevatedButton, 'Unselect')); - await tester.pump(); - await tester.pump(const Duration(milliseconds: 500)); // Advance select animation by 500ms. + await tester.tap(find.widgetWithText(ElevatedButton, 'Unselect')); + await tester.pump(); + await tester.pump( + const Duration(milliseconds: 500), + ); // Advance select animation by 500ms. - expect(materialBox, paints..rrect(color: const Color(0xfff8e7c3))); + expect(materialBox, paints..rrect(color: const Color(0xfff8e7c3))); - await tester.pump(const Duration(milliseconds: 500)); // Advance select animation by 500ms. + await tester.pump( + const Duration(milliseconds: 500), + ); // Advance select animation by 500ms. - expect(materialBox, paints..rrect(color: const Color(0xffffc107))); - }); + expect(materialBox, paints..rrect(color: const Color(0xffffc107))); + }, + ); - testWidgets('ChipAnimationStyle.avatarDrawerAnimation overrides chip checkmark animation', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.ChipAnimationStyleExampleApp()); + testWidgets( + 'ChipAnimationStyle.avatarDrawerAnimation overrides chip checkmark animation', + (WidgetTester tester) async { + await tester.pumpWidget(const example.ChipAnimationStyleExampleApp()); - expect(tester.getSize(find.widgetWithText(RawChip, 'Checked')).width, closeTo(152.6, 0.1)); + expect( + tester.getSize(find.widgetWithText(RawChip, 'Checked')).width, + closeTo(152.6, 0.1), + ); - await tester.tap(find.widgetWithText(ElevatedButton, 'Hide checkmark')); - await tester.pump(); - await tester.pump(const Duration(milliseconds: 500)); // Advance avatar animation by 500ms. + await tester.tap(find.widgetWithText(ElevatedButton, 'Hide checkmark')); + await tester.pump(); + await tester.pump( + const Duration(milliseconds: 500), + ); // Advance avatar animation by 500ms. - expect(tester.getSize(find.widgetWithText(RawChip, 'Unchecked')).width, closeTo(160.9, 0.1)); + expect( + tester.getSize(find.widgetWithText(RawChip, 'Unchecked')).width, + closeTo(160.9, 0.1), + ); - await tester.pump(const Duration(milliseconds: 500)); // Advance avatar animation by 500ms. + await tester.pump( + const Duration(milliseconds: 500), + ); // Advance avatar animation by 500ms. - expect(tester.getSize(find.widgetWithText(RawChip, 'Unchecked')).width, closeTo(160.9, 0.1)); + expect( + tester.getSize(find.widgetWithText(RawChip, 'Unchecked')).width, + closeTo(160.9, 0.1), + ); - await tester.tap(find.widgetWithText(ElevatedButton, 'Show checkmark')); - await tester.pump(); - await tester.pump(const Duration(seconds: 1)); // Advance avatar animation by 1sec. + await tester.tap(find.widgetWithText(ElevatedButton, 'Show checkmark')); + await tester.pump(); + await tester.pump( + const Duration(seconds: 1), + ); // Advance avatar animation by 1sec. - expect(tester.getSize(find.widgetWithText(RawChip, 'Checked')).width, closeTo(132.7, 0.1)); + expect( + tester.getSize(find.widgetWithText(RawChip, 'Checked')).width, + closeTo(132.7, 0.1), + ); - await tester.pump(const Duration(seconds: 1)); // Advance avatar animation by 1sec. + await tester.pump( + const Duration(seconds: 1), + ); // Advance avatar animation by 1sec. - expect(tester.getSize(find.widgetWithText(RawChip, 'Checked')).width, closeTo(152.6, 0.1)); - }); + expect( + tester.getSize(find.widgetWithText(RawChip, 'Checked')).width, + closeTo(152.6, 0.1), + ); + }, + ); - testWidgets('ChipAnimationStyle.deleteDrawerAnimation overrides chip delete icon animation', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.ChipAnimationStyleExampleApp()); + testWidgets( + 'ChipAnimationStyle.deleteDrawerAnimation overrides chip delete icon animation', + (WidgetTester tester) async { + await tester.pumpWidget(const example.ChipAnimationStyleExampleApp()); - expect(tester.getSize(find.widgetWithText(RawChip, 'Deletable')).width, closeTo(180.9, 0.1)); + expect( + tester.getSize(find.widgetWithText(RawChip, 'Deletable')).width, + closeTo(180.9, 0.1), + ); - await tester.tap(find.widgetWithText(ElevatedButton, 'Hide delete icon')); - await tester.pump(); - await tester.pump(const Duration(milliseconds: 500)); // Advance delete icon animation by 500ms. + await tester.tap(find.widgetWithText(ElevatedButton, 'Hide delete icon')); + await tester.pump(); + await tester.pump( + const Duration(milliseconds: 500), + ); // Advance delete icon animation by 500ms. - expect(tester.getSize(find.widgetWithText(RawChip, 'Undeletable')).width, closeTo(204.6, 0.1)); + expect( + tester.getSize(find.widgetWithText(RawChip, 'Undeletable')).width, + closeTo(204.6, 0.1), + ); - await tester.pump(const Duration(milliseconds: 500)); // Advance delete icon animation by 500ms. + await tester.pump( + const Duration(milliseconds: 500), + ); // Advance delete icon animation by 500ms. - expect(tester.getSize(find.widgetWithText(RawChip, 'Undeletable')).width, closeTo(189.1, 0.1)); + expect( + tester.getSize(find.widgetWithText(RawChip, 'Undeletable')).width, + closeTo(189.1, 0.1), + ); - await tester.tap(find.widgetWithText(ElevatedButton, 'Show delete icon')); - await tester.pump(); - await tester.pump(const Duration(seconds: 1)); // Advance delete icon animation by 1sec. + await tester.tap(find.widgetWithText(ElevatedButton, 'Show delete icon')); + await tester.pump(); + await tester.pump( + const Duration(seconds: 1), + ); // Advance delete icon animation by 1sec. - expect(tester.getSize(find.widgetWithText(RawChip, 'Deletable')).width, closeTo(176.4, 0.1)); + expect( + tester.getSize(find.widgetWithText(RawChip, 'Deletable')).width, + closeTo(176.4, 0.1), + ); - await tester.pump(const Duration(seconds: 1)); // Advance delete icon animation by 1sec. + await tester.pump( + const Duration(seconds: 1), + ); // Advance delete icon animation by 1sec. - expect(tester.getSize(find.widgetWithText(RawChip, 'Deletable')).width, closeTo(180.9, 0.1)); - }); + expect( + tester.getSize(find.widgetWithText(RawChip, 'Deletable')).width, + closeTo(180.9, 0.1), + ); + }, + ); } diff --git a/examples/api/test/material/chip/deletable_chip_attributes.delete_icon_box_constraints.0_test.dart b/examples/api/test/material/chip/deletable_chip_attributes.delete_icon_box_constraints.0_test.dart index b499d1ad126..3dd753c0080 100644 --- a/examples/api/test/material/chip/deletable_chip_attributes.delete_icon_box_constraints.0_test.dart +++ b/examples/api/test/material/chip/deletable_chip_attributes.delete_icon_box_constraints.0_test.dart @@ -8,52 +8,73 @@ import 'package:flutter_api_samples/material/chip/deletable_chip_attributes.dele import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('RawChip.deleteIconBoxConstraints updates delete icon size constraints', ( - WidgetTester tester, - ) async { - const double border = 1.0; - const double iconSize = 18.0; - const double padding = 8.0; + testWidgets( + 'RawChip.deleteIconBoxConstraints updates delete icon size constraints', + (WidgetTester tester) async { + const double border = 1.0; + const double iconSize = 18.0; + const double padding = 8.0; - await tester.pumpWidget(const example.DeleteIconBoxConstraintsApp()); + await tester.pumpWidget(const example.DeleteIconBoxConstraintsApp()); - expect(tester.getSize(find.byType(RawChip).at(0)).width, equals(202.0)); - expect(tester.getSize(find.byType(RawChip).at(0)).height, equals(58.0)); + expect(tester.getSize(find.byType(RawChip).at(0)).width, equals(202.0)); + expect(tester.getSize(find.byType(RawChip).at(0)).height, equals(58.0)); - Offset chipToRight = tester.getTopRight( - find.byWidget( - tester.widget( - find.descendant(of: find.byType(RawChip).at(0), matching: find.byType(Material)), + Offset chipToRight = tester.getTopRight( + find.byWidget( + tester.widget( + find.descendant( + of: find.byType(RawChip).at(0), + matching: find.byType(Material), + ), + ), ), - ), - ); - Offset deleteIconCenter = tester.getCenter(find.byIcon(Icons.cancel).at(0)); - expect(chipToRight.dx, deleteIconCenter.dx + (iconSize / 2) + padding + border); + ); + Offset deleteIconCenter = tester.getCenter( + find.byIcon(Icons.cancel).at(0), + ); + expect( + chipToRight.dx, + deleteIconCenter.dx + (iconSize / 2) + padding + border, + ); - expect(tester.getSize(find.byType(RawChip).at(1)).width, equals(202.0)); - expect(tester.getSize(find.byType(RawChip).at(1)).height, equals(78.0)); + expect(tester.getSize(find.byType(RawChip).at(1)).width, equals(202.0)); + expect(tester.getSize(find.byType(RawChip).at(1)).height, equals(78.0)); - chipToRight = tester.getTopRight( - find.byWidget( - tester.widget( - find.descendant(of: find.byType(RawChip).at(1), matching: find.byType(Material)), + chipToRight = tester.getTopRight( + find.byWidget( + tester.widget( + find.descendant( + of: find.byType(RawChip).at(1), + matching: find.byType(Material), + ), + ), ), - ), - ); - deleteIconCenter = tester.getCenter(find.byIcon(Icons.cancel).at(1)); - expect(chipToRight.dx, deleteIconCenter.dx + (iconSize / 2) + padding + border); + ); + deleteIconCenter = tester.getCenter(find.byIcon(Icons.cancel).at(1)); + expect( + chipToRight.dx, + deleteIconCenter.dx + (iconSize / 2) + padding + border, + ); - expect(tester.getSize(find.byType(RawChip).at(2)).width, equals(202.0)); - expect(tester.getSize(find.byType(RawChip).at(2)).height, equals(78.0)); + expect(tester.getSize(find.byType(RawChip).at(2)).width, equals(202.0)); + expect(tester.getSize(find.byType(RawChip).at(2)).height, equals(78.0)); - chipToRight = tester.getTopRight( - find.byWidget( - tester.widget( - find.descendant(of: find.byType(RawChip).at(2), matching: find.byType(Material)), + chipToRight = tester.getTopRight( + find.byWidget( + tester.widget( + find.descendant( + of: find.byType(RawChip).at(2), + matching: find.byType(Material), + ), + ), ), - ), - ); - deleteIconCenter = tester.getCenter(find.byIcon(Icons.cancel).at(2)); - expect(chipToRight.dx, deleteIconCenter.dx + (iconSize / 2) + padding + border); - }); + ); + deleteIconCenter = tester.getCenter(find.byIcon(Icons.cancel).at(2)); + expect( + chipToRight.dx, + deleteIconCenter.dx + (iconSize / 2) + padding + border, + ); + }, + ); } diff --git a/examples/api/test/material/chip/deletable_chip_attributes.on_deleted.0_test.dart b/examples/api/test/material/chip/deletable_chip_attributes.on_deleted.0_test.dart index 37acdf6ab3f..5d54394032e 100644 --- a/examples/api/test/material/chip/deletable_chip_attributes.on_deleted.0_test.dart +++ b/examples/api/test/material/chip/deletable_chip_attributes.on_deleted.0_test.dart @@ -8,10 +8,15 @@ import 'package:flutter_api_samples/material/chip/deletable_chip_attributes.on_d import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Chip.onDeleted can be used to delete chips', (WidgetTester tester) async { + testWidgets('Chip.onDeleted can be used to delete chips', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.OnDeletedExampleApp()); - expect(find.widgetWithText(AppBar, 'DeletableChipAttributes.onDeleted Sample'), findsOne); + expect( + find.widgetWithText(AppBar, 'DeletableChipAttributes.onDeleted Sample'), + findsOne, + ); expect(find.widgetWithText(Chip, 'Aaron Burr'), findsOne); expect(find.widgetWithText(Chip, 'Alexander Hamilton'), findsOne); expect(find.widgetWithText(Chip, 'Eliza Hamilton'), findsOne); diff --git a/examples/api/test/material/choice_chip/choice_chip.0_test.dart b/examples/api/test/material/choice_chip/choice_chip.0_test.dart index 72c8960f328..69fe639af28 100644 --- a/examples/api/test/material/choice_chip/choice_chip.0_test.dart +++ b/examples/api/test/material/choice_chip/choice_chip.0_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/choice_chip/choice_chip.0.dart' as example; +import 'package:flutter_api_samples/material/choice_chip/choice_chip.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Can choose an item using ChoiceChip', (WidgetTester tester) async { + testWidgets('Can choose an item using ChoiceChip', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ChipApp()); ChoiceChip chosenChip = tester.widget(find.byType(ChoiceChip).at(1)); diff --git a/examples/api/test/material/color_scheme/color_scheme.0_test.dart b/examples/api/test/material/color_scheme/color_scheme.0_test.dart index 72614ffe085..4afcf187ea1 100644 --- a/examples/api/test/material/color_scheme/color_scheme.0_test.dart +++ b/examples/api/test/material/color_scheme/color_scheme.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/color_scheme/color_scheme.0.dart' as example; +import 'package:flutter_api_samples/material/color_scheme/color_scheme.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/color_scheme/dynamic_content_color.0_test.dart b/examples/api/test/material/color_scheme/dynamic_content_color.0_test.dart index 6ee853ff5bb..90cccf4e6f0 100644 --- a/examples/api/test/material/color_scheme/dynamic_content_color.0_test.dart +++ b/examples/api/test/material/color_scheme/dynamic_content_color.0_test.dart @@ -6,7 +6,8 @@ import 'dart:io'; import 'dart:math'; import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/color_scheme/dynamic_content_color.0.dart' as example; +import 'package:flutter_api_samples/material/color_scheme/dynamic_content_color.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -20,7 +21,10 @@ void main() { loadColorSchemeCalls.add((provider, brightness)); final int index = example.DynamicColorExample.images.indexOf(provider); final int seedColor = 0xf * pow(0x10, index).toInt(); - return ColorScheme.fromSeed(seedColor: Color(seedColor), brightness: brightness); + return ColorScheme.fromSeed( + seedColor: Color(seedColor), + brightness: brightness, + ); } setUp(() { @@ -34,10 +38,15 @@ void main() { }); testWidgets('The content is visible', (WidgetTester tester) async { - await tester.pumpWidget(example.DynamicColorExample(loadColorScheme: fakeColorSchemeLoader)); + await tester.pumpWidget( + example.DynamicColorExample(loadColorScheme: fakeColorSchemeLoader), + ); await tester.pump(); - expect(find.widgetWithText(AppBar, 'Content Based Dynamic Color'), findsOne); + expect( + find.widgetWithText(AppBar, 'Content Based Dynamic Color'), + findsOne, + ); expect(find.byType(Switch), findsOne); expect(find.byIcon(Icons.light_mode), findsOne); @@ -83,7 +92,9 @@ void main() { }); testWidgets('The brightness can be changed', (WidgetTester tester) async { - await tester.pumpWidget(example.DynamicColorExample(loadColorScheme: fakeColorSchemeLoader)); + await tester.pumpWidget( + example.DynamicColorExample(loadColorScheme: fakeColorSchemeLoader), + ); await tester.pump(); expect(loadColorSchemeCalls, hasLength(1)); @@ -126,8 +137,12 @@ void main() { expect(themeData.colorScheme.secondary, const Color(0xffc5c4dd)); }); - testWidgets('Tapping an image loads a new color scheme', (WidgetTester tester) async { - await tester.pumpWidget(example.DynamicColorExample(loadColorScheme: fakeColorSchemeLoader)); + testWidgets('Tapping an image loads a new color scheme', ( + WidgetTester tester, + ) async { + await tester.pumpWidget( + example.DynamicColorExample(loadColorScheme: fakeColorSchemeLoader), + ); await tester.pump(); await tester.tapAt(tester.getCenter(find.byType(Image).at(3))); diff --git a/examples/api/test/material/context_menu/editable_text_toolbar_builder.0_test.dart b/examples/api/test/material/context_menu/editable_text_toolbar_builder.0_test.dart index 79d8e6c9531..3ea1623f820 100644 --- a/examples/api/test/material/context_menu/editable_text_toolbar_builder.0_test.dart +++ b/examples/api/test/material/context_menu/editable_text_toolbar_builder.0_test.dart @@ -11,31 +11,34 @@ import 'package:flutter_api_samples/material/context_menu/editable_text_toolbar_ import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('showing and hiding the context menu in TextField with custom buttons', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.EditableTextToolbarBuilderExampleApp()); + testWidgets( + 'showing and hiding the context menu in TextField with custom buttons', + (WidgetTester tester) async { + await tester.pumpWidget( + const example.EditableTextToolbarBuilderExampleApp(), + ); - expect(BrowserContextMenu.enabled, !kIsWeb); + expect(BrowserContextMenu.enabled, !kIsWeb); - await tester.tap(find.byType(EditableText)); - await tester.pump(); + await tester.tap(find.byType(EditableText)); + await tester.pump(); - expect(find.byType(AdaptiveTextSelectionToolbar), findsNothing); + expect(find.byType(AdaptiveTextSelectionToolbar), findsNothing); - // Long pressing the field shows the default context menu but with custom - // buttons. - await tester.longPress(find.byType(EditableText)); - await tester.pumpAndSettle(); + // Long pressing the field shows the default context menu but with custom + // buttons. + await tester.longPress(find.byType(EditableText)); + await tester.pumpAndSettle(); - expect(find.byType(AdaptiveTextSelectionToolbar), findsOneWidget); - expect(find.byType(CupertinoButton), findsAtLeastNWidgets(1)); + expect(find.byType(AdaptiveTextSelectionToolbar), findsOneWidget); + expect(find.byType(CupertinoButton), findsAtLeastNWidgets(1)); - // Tap to dismiss. - await tester.tapAt(tester.getTopLeft(find.byType(EditableText))); - await tester.pumpAndSettle(); + // Tap to dismiss. + await tester.tapAt(tester.getTopLeft(find.byType(EditableText))); + await tester.pumpAndSettle(); - expect(find.byType(AdaptiveTextSelectionToolbar), findsNothing); - expect(find.byType(CupertinoButton), findsNothing); - }); + expect(find.byType(AdaptiveTextSelectionToolbar), findsNothing); + expect(find.byType(CupertinoButton), findsNothing); + }, + ); } diff --git a/examples/api/test/material/context_menu/editable_text_toolbar_builder.1_test.dart b/examples/api/test/material/context_menu/editable_text_toolbar_builder.1_test.dart index acf834aaa0c..9fcf3956a73 100644 --- a/examples/api/test/material/context_menu/editable_text_toolbar_builder.1_test.dart +++ b/examples/api/test/material/context_menu/editable_text_toolbar_builder.1_test.dart @@ -11,65 +11,70 @@ import 'package:flutter_api_samples/material/context_menu/editable_text_toolbar_ import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('showing and hiding the custom context menu in TextField with a specific selection', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.EditableTextToolbarBuilderExampleApp()); + testWidgets( + 'showing and hiding the custom context menu in TextField with a specific selection', + (WidgetTester tester) async { + await tester.pumpWidget( + const example.EditableTextToolbarBuilderExampleApp(), + ); - expect(BrowserContextMenu.enabled, !kIsWeb); + expect(BrowserContextMenu.enabled, !kIsWeb); - expect(find.byType(AdaptiveTextSelectionToolbar), findsNothing); + expect(find.byType(AdaptiveTextSelectionToolbar), findsNothing); - // Right clicking the Text in the TextField shows the custom context menu, - // but no email button since no email address is selected. - TestGesture gesture = await tester.startGesture( - tester.getTopLeft(find.text(example.text)), - kind: PointerDeviceKind.mouse, - buttons: kSecondaryMouseButton, - ); - await tester.pump(); - await gesture.up(); - await tester.pumpAndSettle(); + // Right clicking the Text in the TextField shows the custom context menu, + // but no email button since no email address is selected. + TestGesture gesture = await tester.startGesture( + tester.getTopLeft(find.text(example.text)), + kind: PointerDeviceKind.mouse, + buttons: kSecondaryMouseButton, + ); + await tester.pump(); + await gesture.up(); + await tester.pumpAndSettle(); - expect(find.byType(AdaptiveTextSelectionToolbar), findsOneWidget); - expect(find.text('Send email'), findsNothing); + expect(find.byType(AdaptiveTextSelectionToolbar), findsOneWidget); + expect(find.text('Send email'), findsNothing); - // Tap to dismiss. - await tester.tapAt(tester.getTopLeft(find.byType(EditableText))); - await tester.pumpAndSettle(); + // Tap to dismiss. + await tester.tapAt(tester.getTopLeft(find.byType(EditableText))); + await tester.pumpAndSettle(); - expect(find.byType(AdaptiveTextSelectionToolbar), findsNothing); + expect(find.byType(AdaptiveTextSelectionToolbar), findsNothing); - // Select the email address. - final EditableTextState state = tester.state(find.byType(EditableText)); - state.updateEditingValue( - state.textEditingValue.copyWith( - selection: TextSelection( - baseOffset: example.text.indexOf(example.emailAddress), - extentOffset: example.text.length, + // Select the email address. + final EditableTextState state = tester.state( + find.byType(EditableText), + ); + state.updateEditingValue( + state.textEditingValue.copyWith( + selection: TextSelection( + baseOffset: example.text.indexOf(example.emailAddress), + extentOffset: example.text.length, + ), ), - ), - ); - await tester.pump(); + ); + await tester.pump(); - // Right clicking the Text in the TextField shows the custom context menu - // with the email button. - gesture = await tester.startGesture( - tester.getCenter(find.text(example.text)), - kind: PointerDeviceKind.mouse, - buttons: kSecondaryMouseButton, - ); - await tester.pump(); - await gesture.up(); - await tester.pumpAndSettle(); + // Right clicking the Text in the TextField shows the custom context menu + // with the email button. + gesture = await tester.startGesture( + tester.getCenter(find.text(example.text)), + kind: PointerDeviceKind.mouse, + buttons: kSecondaryMouseButton, + ); + await tester.pump(); + await gesture.up(); + await tester.pumpAndSettle(); - expect(find.byType(AdaptiveTextSelectionToolbar), findsOneWidget); - expect(find.text('Send email'), findsOneWidget); + expect(find.byType(AdaptiveTextSelectionToolbar), findsOneWidget); + expect(find.text('Send email'), findsOneWidget); - // Tap to dismiss. - await tester.tapAt(tester.getTopLeft(find.byType(EditableText))); - await tester.pumpAndSettle(); + // Tap to dismiss. + await tester.tapAt(tester.getTopLeft(find.byType(EditableText))); + await tester.pumpAndSettle(); - expect(find.byType(AdaptiveTextSelectionToolbar), findsNothing); - }); + expect(find.byType(AdaptiveTextSelectionToolbar), findsNothing); + }, + ); } diff --git a/examples/api/test/material/context_menu/editable_text_toolbar_builder.2_test.dart b/examples/api/test/material/context_menu/editable_text_toolbar_builder.2_test.dart index ad4dcf38840..1e4c7802334 100644 --- a/examples/api/test/material/context_menu/editable_text_toolbar_builder.2_test.dart +++ b/examples/api/test/material/context_menu/editable_text_toolbar_builder.2_test.dart @@ -11,54 +11,72 @@ import 'package:flutter_api_samples/material/context_menu/editable_text_toolbar_ import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('showing and hiding the context menu in TextField with a custom toolbar', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.EditableTextToolbarBuilderExampleApp()); + testWidgets( + 'showing and hiding the context menu in TextField with a custom toolbar', + (WidgetTester tester) async { + await tester.pumpWidget( + const example.EditableTextToolbarBuilderExampleApp(), + ); - expect(BrowserContextMenu.enabled, !kIsWeb); + expect(BrowserContextMenu.enabled, !kIsWeb); - await tester.tap(find.byType(EditableText)); - await tester.pump(); + await tester.tap(find.byType(EditableText)); + await tester.pump(); - expect(find.byType(AdaptiveTextSelectionToolbar), findsNothing); + expect(find.byType(AdaptiveTextSelectionToolbar), findsNothing); - // Long pressing the field shows the custom context menu. - await tester.longPress(find.byType(EditableText)); - await tester.pumpAndSettle(); + // Long pressing the field shows the custom context menu. + await tester.longPress(find.byType(EditableText)); + await tester.pumpAndSettle(); - expect(find.byType(AdaptiveTextSelectionToolbar), findsNothing); + expect(find.byType(AdaptiveTextSelectionToolbar), findsNothing); - // The buttons use the default widgets but with custom labels. - switch (defaultTargetPlatform) { - case TargetPlatform.iOS: - expect(find.byType(CupertinoTextSelectionToolbarButton), findsAtLeastNWidgets(1)); - case TargetPlatform.android: - case TargetPlatform.fuchsia: - expect(find.byType(TextSelectionToolbarTextButton), findsAtLeastNWidgets(1)); - case TargetPlatform.linux: - case TargetPlatform.windows: - expect(find.byType(DesktopTextSelectionToolbarButton), findsAtLeastNWidgets(1)); - case TargetPlatform.macOS: - expect(find.byType(CupertinoDesktopTextSelectionToolbarButton), findsAtLeastNWidgets(1)); - } - expect(find.text('Copy'), findsNothing); - expect(find.text('Cut'), findsNothing); - expect(find.text('Paste'), findsNothing); - expect(find.text('Select all'), findsNothing); + // The buttons use the default widgets but with custom labels. + switch (defaultTargetPlatform) { + case TargetPlatform.iOS: + expect( + find.byType(CupertinoTextSelectionToolbarButton), + findsAtLeastNWidgets(1), + ); + case TargetPlatform.android: + case TargetPlatform.fuchsia: + expect( + find.byType(TextSelectionToolbarTextButton), + findsAtLeastNWidgets(1), + ); + case TargetPlatform.linux: + case TargetPlatform.windows: + expect( + find.byType(DesktopTextSelectionToolbarButton), + findsAtLeastNWidgets(1), + ); + case TargetPlatform.macOS: + expect( + find.byType(CupertinoDesktopTextSelectionToolbarButton), + findsAtLeastNWidgets(1), + ); + } + expect(find.text('Copy'), findsNothing); + expect(find.text('Cut'), findsNothing); + expect(find.text('Paste'), findsNothing); + expect(find.text('Select all'), findsNothing); - // Tap to dismiss. - await tester.tapAt(tester.getTopLeft(find.byType(EditableText))); - await tester.pumpAndSettle(); + // Tap to dismiss. + await tester.tapAt(tester.getTopLeft(find.byType(EditableText))); + await tester.pumpAndSettle(); - expect(find.byType(AdaptiveTextSelectionToolbar), findsNothing); - expect(find.byType(CupertinoTextSelectionToolbarButton), findsNothing); - expect(find.byType(TextSelectionToolbarTextButton), findsNothing); - expect(find.byType(DesktopTextSelectionToolbarButton), findsNothing); - expect(find.byType(CupertinoDesktopTextSelectionToolbarButton), findsNothing); - expect(find.text('Copy'), findsNothing); - expect(find.text('Cut'), findsNothing); - expect(find.text('Paste'), findsNothing); - expect(find.text('Select all'), findsNothing); - }); + expect(find.byType(AdaptiveTextSelectionToolbar), findsNothing); + expect(find.byType(CupertinoTextSelectionToolbarButton), findsNothing); + expect(find.byType(TextSelectionToolbarTextButton), findsNothing); + expect(find.byType(DesktopTextSelectionToolbarButton), findsNothing); + expect( + find.byType(CupertinoDesktopTextSelectionToolbarButton), + findsNothing, + ); + expect(find.text('Copy'), findsNothing); + expect(find.text('Cut'), findsNothing); + expect(find.text('Paste'), findsNothing); + expect(find.text('Select all'), findsNothing); + }, + ); } diff --git a/examples/api/test/material/context_menu/selectable_region_toolbar_builder.0_test.dart b/examples/api/test/material/context_menu/selectable_region_toolbar_builder.0_test.dart index 196db42341a..dc26bd200e9 100644 --- a/examples/api/test/material/context_menu/selectable_region_toolbar_builder.0_test.dart +++ b/examples/api/test/material/context_menu/selectable_region_toolbar_builder.0_test.dart @@ -14,7 +14,9 @@ void main() { testWidgets('showing and hiding the custom context menu on SelectionArea', ( WidgetTester tester, ) async { - await tester.pumpWidget(const example.SelectableRegionToolbarBuilderExampleApp()); + await tester.pumpWidget( + const example.SelectableRegionToolbarBuilderExampleApp(), + ); expect(BrowserContextMenu.enabled, !kIsWeb); @@ -41,7 +43,9 @@ void main() { expect(find.text('Print'), findsOneWidget); // Tap to dismiss. - await primaryMouseButtonGesture.down(tester.getCenter(find.byType(Scaffold))); + await primaryMouseButtonGesture.down( + tester.getCenter(find.byType(Scaffold)), + ); await tester.pump(); await primaryMouseButtonGesture.up(); await tester.pumpAndSettle(); diff --git a/examples/api/test/material/data_table/data_table.0_test.dart b/examples/api/test/material/data_table/data_table.0_test.dart index 40562453960..26db728c7ea 100644 --- a/examples/api/test/material/data_table/data_table.0_test.dart +++ b/examples/api/test/material/data_table/data_table.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/data_table/data_table.0.dart' as example; +import 'package:flutter_api_samples/material/data_table/data_table.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -11,7 +12,9 @@ void main() { await tester.pumpWidget(const example.DataTableExampleApp()); expect(find.widgetWithText(AppBar, 'DataTable Sample'), findsOneWidget); expect(find.byType(DataTable), findsOneWidget); - final DataTable dataTable = tester.widget(find.byType(DataTable)); + final DataTable dataTable = tester.widget( + find.byType(DataTable), + ); expect(dataTable.columns.length, 3); expect(dataTable.rows.length, 3); for (int i = 0; i < dataTable.rows.length; i++) { diff --git a/examples/api/test/material/data_table/data_table.1_test.dart b/examples/api/test/material/data_table/data_table.1_test.dart index 47c0839fdd8..930c04ec644 100644 --- a/examples/api/test/material/data_table/data_table.1_test.dart +++ b/examples/api/test/material/data_table/data_table.1_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/data_table/data_table.1.dart' as example; +import 'package:flutter_api_samples/material/data_table/data_table.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -14,7 +15,10 @@ void main() { expect(tester.getTopLeft(find.text('Row 5')), const Offset(66.0, 366.0)); - await tester.drag(find.byType(SingleChildScrollView), const Offset(0.0, -200.0)); + await tester.drag( + find.byType(SingleChildScrollView), + const Offset(0.0, -200.0), + ); await tester.pumpAndSettle(); expect(tester.getTopLeft(find.text('Row 5')), const Offset(66.0, 186.0)); diff --git a/examples/api/test/material/date_picker/custom_calendar_date_picker.0_test.dart b/examples/api/test/material/date_picker/custom_calendar_date_picker.0_test.dart index b34c41fca30..3b571f2131b 100644 --- a/examples/api/test/material/date_picker/custom_calendar_date_picker.0_test.dart +++ b/examples/api/test/material/date_picker/custom_calendar_date_picker.0_test.dart @@ -9,11 +9,16 @@ import 'package:flutter_test/flutter_test.dart'; void main() { Text getLastDayText(WidgetTester tester) { - final Finder dayFinder = find.descendant(of: find.byType(Ink), matching: find.byType(Text)); + final Finder dayFinder = find.descendant( + of: find.byType(Ink), + matching: find.byType(Text), + ); return tester.widget(dayFinder.last); } - testWidgets('Days are based on the calendar delegate', (WidgetTester tester) async { + testWidgets('Days are based on the calendar delegate', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.CalendarDatePickerApp()); final Finder nextMonthButton = find.byIcon(Icons.chevron_right); diff --git a/examples/api/test/material/date_picker/date_picker_theme_day_shape.0_test.dart b/examples/api/test/material/date_picker/date_picker_theme_day_shape.0_test.dart index bc9ffc4fad2..be752ee5ff2 100644 --- a/examples/api/test/material/date_picker/date_picker_theme_day_shape.0_test.dart +++ b/examples/api/test/material/date_picker/date_picker_theme_day_shape.0_test.dart @@ -8,52 +8,59 @@ import 'package:flutter_api_samples/material/date_picker/date_picker_theme_day_s import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('DatePickerThemeData.dayShape updates day selection shape decoration', ( - WidgetTester tester, - ) async { - final ThemeData theme = ThemeData(); - final OutlinedBorder dayShape = RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8.0), - ); - const Color todayBackgroundColor = Colors.amber; - const Color todayForegroundColor = Colors.black; - const BorderSide todayBorder = BorderSide(width: 2); + testWidgets( + 'DatePickerThemeData.dayShape updates day selection shape decoration', + (WidgetTester tester) async { + final ThemeData theme = ThemeData(); + final OutlinedBorder dayShape = RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8.0), + ); + const Color todayBackgroundColor = Colors.amber; + const Color todayForegroundColor = Colors.black; + const BorderSide todayBorder = BorderSide(width: 2); - ShapeDecoration? findDayDecoration(WidgetTester tester, String day) { - return tester - .widget(find.ancestor(of: find.text(day), matching: find.byType(Ink))) - .decoration - as ShapeDecoration?; - } + ShapeDecoration? findDayDecoration(WidgetTester tester, String day) { + return tester + .widget( + find.ancestor(of: find.text(day), matching: find.byType(Ink)), + ) + .decoration + as ShapeDecoration?; + } - await tester.pumpWidget(const example.DatePickerApp()); + await tester.pumpWidget(const example.DatePickerApp()); - await tester.tap(find.text('Open Date Picker')); - await tester.pumpAndSettle(); + await tester.tap(find.text('Open Date Picker')); + await tester.pumpAndSettle(); - // Test the current day shape decoration. - ShapeDecoration dayShapeDecoration = findDayDecoration(tester, '15')!; - expect(dayShapeDecoration.color, todayBackgroundColor); - expect( - dayShapeDecoration.shape, - dayShape.copyWith(side: todayBorder.copyWith(color: todayForegroundColor)), - ); + // Test the current day shape decoration. + ShapeDecoration dayShapeDecoration = findDayDecoration(tester, '15')!; + expect(dayShapeDecoration.color, todayBackgroundColor); + expect( + dayShapeDecoration.shape, + dayShape.copyWith( + side: todayBorder.copyWith(color: todayForegroundColor), + ), + ); - // Test the selected day shape decoration. - dayShapeDecoration = findDayDecoration(tester, '20')!; - expect(dayShapeDecoration.color, theme.colorScheme.primary); - expect(dayShapeDecoration.shape, dayShape); + // Test the selected day shape decoration. + dayShapeDecoration = findDayDecoration(tester, '20')!; + expect(dayShapeDecoration.color, theme.colorScheme.primary); + expect(dayShapeDecoration.shape, dayShape); - // Tap to select current day as the selected day. - await tester.tap(find.text('15')); - await tester.pumpAndSettle(); + // Tap to select current day as the selected day. + await tester.tap(find.text('15')); + await tester.pumpAndSettle(); - // Test the selected day shape decoration. - dayShapeDecoration = findDayDecoration(tester, '15')!; - expect(dayShapeDecoration.color, todayBackgroundColor); - expect( - dayShapeDecoration.shape, - dayShape.copyWith(side: todayBorder.copyWith(color: todayForegroundColor)), - ); - }); + // Test the selected day shape decoration. + dayShapeDecoration = findDayDecoration(tester, '15')!; + expect(dayShapeDecoration.color, todayBackgroundColor); + expect( + dayShapeDecoration.shape, + dayShape.copyWith( + side: todayBorder.copyWith(color: todayForegroundColor), + ), + ); + }, + ); } diff --git a/examples/api/test/material/date_picker/show_date_picker.0_test.dart b/examples/api/test/material/date_picker/show_date_picker.0_test.dart index 9bd3219f328..609d09c4e63 100644 --- a/examples/api/test/material/date_picker/show_date_picker.0_test.dart +++ b/examples/api/test/material/date_picker/show_date_picker.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/date_picker/show_date_picker.0.dart' as example; +import 'package:flutter_api_samples/material/date_picker/show_date_picker.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/date_picker/show_date_picker.1_test.dart b/examples/api/test/material/date_picker/show_date_picker.1_test.dart index 5153471f59c..63476264882 100644 --- a/examples/api/test/material/date_picker/show_date_picker.1_test.dart +++ b/examples/api/test/material/date_picker/show_date_picker.1_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/date_picker/show_date_picker.1.dart' as example; +import 'package:flutter_api_samples/material/date_picker/show_date_picker.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/date_picker/show_date_range_picker.0_test.dart b/examples/api/test/material/date_picker/show_date_range_picker.0_test.dart index 252489cd90f..eaac985583e 100644 --- a/examples/api/test/material/date_picker/show_date_range_picker.0_test.dart +++ b/examples/api/test/material/date_picker/show_date_range_picker.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/date_picker/show_date_range_picker.0.dart' as example; +import 'package:flutter_api_samples/material/date_picker/show_date_range_picker.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/dialog/adaptive_alert_dialog.0_test.dart b/examples/api/test/material/dialog/adaptive_alert_dialog.0_test.dart index 5f27191c254..4e53e0475d4 100644 --- a/examples/api/test/material/dialog/adaptive_alert_dialog.0_test.dart +++ b/examples/api/test/material/dialog/adaptive_alert_dialog.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/dialog/adaptive_alert_dialog.0.dart' as example; +import 'package:flutter_api_samples/material/dialog/adaptive_alert_dialog.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/dialog/alert_dialog.0_test.dart b/examples/api/test/material/dialog/alert_dialog.0_test.dart index 755b7f9c4da..b1e8822d3d7 100644 --- a/examples/api/test/material/dialog/alert_dialog.0_test.dart +++ b/examples/api/test/material/dialog/alert_dialog.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/dialog/alert_dialog.0.dart' as example; +import 'package:flutter_api_samples/material/dialog/alert_dialog.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/dialog/alert_dialog.1_test.dart b/examples/api/test/material/dialog/alert_dialog.1_test.dart index ae5446546f9..7802bc9ee84 100644 --- a/examples/api/test/material/dialog/alert_dialog.1_test.dart +++ b/examples/api/test/material/dialog/alert_dialog.1_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/dialog/alert_dialog.1.dart' as example; +import 'package:flutter_api_samples/material/dialog/alert_dialog.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/dialog/show_dialog.0_test.dart b/examples/api/test/material/dialog/show_dialog.0_test.dart index 116fddd457e..f8de8319280 100644 --- a/examples/api/test/material/dialog/show_dialog.0_test.dart +++ b/examples/api/test/material/dialog/show_dialog.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/dialog/show_dialog.0.dart' as example; +import 'package:flutter_api_samples/material/dialog/show_dialog.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/dialog/show_dialog.1_test.dart b/examples/api/test/material/dialog/show_dialog.1_test.dart index bb0f927cf7c..a35491d1c4f 100644 --- a/examples/api/test/material/dialog/show_dialog.1_test.dart +++ b/examples/api/test/material/dialog/show_dialog.1_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/dialog/show_dialog.1.dart' as example; +import 'package:flutter_api_samples/material/dialog/show_dialog.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/dialog/show_dialog.2_test.dart b/examples/api/test/material/dialog/show_dialog.2_test.dart index f6627a7482f..02dcd75bdd0 100644 --- a/examples/api/test/material/dialog/show_dialog.2_test.dart +++ b/examples/api/test/material/dialog/show_dialog.2_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/dialog/show_dialog.2.dart' as example; +import 'package:flutter_api_samples/material/dialog/show_dialog.2.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/divider/divider.0_test.dart b/examples/api/test/material/divider/divider.0_test.dart index eb353e81a69..fe2fdc94f83 100644 --- a/examples/api/test/material/divider/divider.0_test.dart +++ b/examples/api/test/material/divider/divider.0_test.dart @@ -15,7 +15,10 @@ void main() { // Divider is positioned horizontally. final Offset container = tester.getBottomLeft( find - .descendant(of: find.byType(example.DividerExample), matching: find.byType(ColoredBox)) + .descendant( + of: find.byType(example.DividerExample), + matching: find.byType(ColoredBox), + ) .first, ); expect(container.dy, tester.getTopLeft(find.byType(Divider)).dy); diff --git a/examples/api/test/material/divider/vertical_divider.0_test.dart b/examples/api/test/material/divider/vertical_divider.0_test.dart index 7c312cca9e7..cb9f96b8827 100644 --- a/examples/api/test/material/divider/vertical_divider.0_test.dart +++ b/examples/api/test/material/divider/vertical_divider.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/divider/vertical_divider.0.dart' as example; +import 'package:flutter_api_samples/material/divider/vertical_divider.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/divider/vertical_divider.1_test.dart b/examples/api/test/material/divider/vertical_divider.1_test.dart index e60a9dec5a1..2f7d5ada089 100644 --- a/examples/api/test/material/divider/vertical_divider.1_test.dart +++ b/examples/api/test/material/divider/vertical_divider.1_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/divider/vertical_divider.1.dart' as example; +import 'package:flutter_api_samples/material/divider/vertical_divider.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/drawer/drawer.0_test.dart b/examples/api/test/material/drawer/drawer.0_test.dart index 213abda01e5..2213d817d67 100644 --- a/examples/api/test/material/drawer/drawer.0_test.dart +++ b/examples/api/test/material/drawer/drawer.0_test.dart @@ -7,7 +7,9 @@ import 'package:flutter_api_samples/material/drawer/drawer.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Navigation bar updates destination on tap', (WidgetTester tester) async { + testWidgets('Navigation bar updates destination on tap', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.DrawerApp()); await tester.tap(find.byIcon(Icons.menu)); @@ -22,17 +24,23 @@ void main() { expect(find.text('Page: '), findsOneWidget); /// Switch to second tab - await tester.tap(find.ancestor(of: find.text('Messages'), matching: find.byType(InkWell))); + await tester.tap( + find.ancestor(of: find.text('Messages'), matching: find.byType(InkWell)), + ); await tester.pumpAndSettle(); expect(find.text('Page: Messages'), findsOneWidget); /// Switch to third tab - await tester.tap(find.ancestor(of: find.text('Profile'), matching: find.byType(InkWell))); + await tester.tap( + find.ancestor(of: find.text('Profile'), matching: find.byType(InkWell)), + ); await tester.pumpAndSettle(); expect(find.text('Page: Profile'), findsOneWidget); /// Switch to fourth tab - await tester.tap(find.ancestor(of: find.text('Settings'), matching: find.byType(InkWell))); + await tester.tap( + find.ancestor(of: find.text('Settings'), matching: find.byType(InkWell)), + ); await tester.pumpAndSettle(); expect(find.text('Page: Settings'), findsOneWidget); }); diff --git a/examples/api/test/material/dropdown/dropdown_button.0_test.dart b/examples/api/test/material/dropdown/dropdown_button.0_test.dart index 90f430beb47..0777b9e3aec 100644 --- a/examples/api/test/material/dropdown/dropdown_button.0_test.dart +++ b/examples/api/test/material/dropdown/dropdown_button.0_test.dart @@ -2,11 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:flutter_api_samples/material/dropdown/dropdown_button.0.dart' as example; +import 'package:flutter_api_samples/material/dropdown/dropdown_button.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Select an item from DropdownButton', (WidgetTester tester) async { + testWidgets('Select an item from DropdownButton', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.DropdownButtonApp()); expect(find.text('One'), findsOneWidget); diff --git a/examples/api/test/material/dropdown/dropdown_button.selected_item_builder.0_test.dart b/examples/api/test/material/dropdown/dropdown_button.selected_item_builder.0_test.dart index 1282b3b0129..a0a55b3e26d 100644 --- a/examples/api/test/material/dropdown/dropdown_button.selected_item_builder.0_test.dart +++ b/examples/api/test/material/dropdown/dropdown_button.selected_item_builder.0_test.dart @@ -7,7 +7,9 @@ import 'package:flutter_api_samples/material/dropdown/dropdown_button.selected_i import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Select an item from DropdownButton', (WidgetTester tester) async { + testWidgets('Select an item from DropdownButton', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.DropdownButtonApp()); expect(find.text('NYC'), findsOneWidget); diff --git a/examples/api/test/material/dropdown/dropdown_button.style.0_test.dart b/examples/api/test/material/dropdown/dropdown_button.style.0_test.dart index a7255f17f55..13f413a07b1 100644 --- a/examples/api/test/material/dropdown/dropdown_button.style.0_test.dart +++ b/examples/api/test/material/dropdown/dropdown_button.style.0_test.dart @@ -2,11 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:flutter_api_samples/material/dropdown/dropdown_button.style.0.dart' as example; +import 'package:flutter_api_samples/material/dropdown/dropdown_button.style.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Select an item from DropdownButton', (WidgetTester tester) async { + testWidgets('Select an item from DropdownButton', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.DropdownButtonApp()); expect(find.text('One'), findsOneWidget); diff --git a/examples/api/test/material/dropdown_menu/dropdown_menu.0_test.dart b/examples/api/test/material/dropdown_menu/dropdown_menu.0_test.dart index 8e3ff6f5106..8cf962b8ae5 100644 --- a/examples/api/test/material/dropdown_menu/dropdown_menu.0_test.dart +++ b/examples/api/test/material/dropdown_menu/dropdown_menu.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/dropdown_menu/dropdown_menu.0.dart' as example; +import 'package:flutter_api_samples/material/dropdown_menu/dropdown_menu.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -51,7 +52,9 @@ void main() { expect(find.text('You selected a Blue Smile'), findsOneWidget); }); - testWidgets('DropdownMenu has focus when tapping on the text field', (WidgetTester tester) async { + testWidgets('DropdownMenu has focus when tapping on the text field', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.DropdownMenuExample()); // Make sure the dropdown menus are there. @@ -100,9 +103,9 @@ void main() { expect(find.text('You selected a Blue Smile'), findsOneWidget); // Resize the screen to small screen and make sure no overflowed error appears. - tester.binding.window.physicalSizeTestValue = const Size(200, 160); - tester.binding.window.devicePixelRatioTestValue = 1.0; - addTearDown(tester.binding.window.clearPhysicalSizeTestValue); + tester.view.physicalSize = const Size(200, 160); + tester.view.devicePixelRatio = 1.0; + addTearDown(tester.view.resetPhysicalSize); await tester.pump(); expect(tester.takeException(), isNull); diff --git a/examples/api/test/material/dropdown_menu/dropdown_menu.1_test.dart b/examples/api/test/material/dropdown_menu/dropdown_menu.1_test.dart index 460c76d380f..01fbc45740a 100644 --- a/examples/api/test/material/dropdown_menu/dropdown_menu.1_test.dart +++ b/examples/api/test/material/dropdown_menu/dropdown_menu.1_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/dropdown_menu/dropdown_menu.1.dart' as example; +import 'package:flutter_api_samples/material/dropdown_menu/dropdown_menu.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -40,7 +41,9 @@ void main() { }, ); - testWidgets('DropdownMenu has focus when tapping on the text field', (WidgetTester tester) async { + testWidgets('DropdownMenu has focus when tapping on the text field', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.DropdownMenuApp()); // Make sure the dropdown menus are there. diff --git a/examples/api/test/material/dropdown_menu/dropdown_menu.2_test.dart b/examples/api/test/material/dropdown_menu/dropdown_menu.2_test.dart index ed159695dd2..3a3d0022a41 100644 --- a/examples/api/test/material/dropdown_menu/dropdown_menu.2_test.dart +++ b/examples/api/test/material/dropdown_menu/dropdown_menu.2_test.dart @@ -6,7 +6,8 @@ import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; -import 'package:flutter_api_samples/material/dropdown_menu/dropdown_menu.2.dart' as example; +import 'package:flutter_api_samples/material/dropdown_menu/dropdown_menu.2.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/dropdown_menu/dropdown_menu_entry_label_widget.0_test.dart b/examples/api/test/material/dropdown_menu/dropdown_menu_entry_label_widget.0_test.dart index a0504af2d56..bf64b756253 100644 --- a/examples/api/test/material/dropdown_menu/dropdown_menu_entry_label_widget.0_test.dart +++ b/examples/api/test/material/dropdown_menu/dropdown_menu_entry_label_widget.0_test.dart @@ -9,7 +9,9 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('DropdownEntryLabelWidget appears', (WidgetTester tester) async { - await tester.pumpWidget(const example.DropdownMenuEntryLabelWidgetExampleApp()); + await tester.pumpWidget( + const example.DropdownMenuEntryLabelWidgetExampleApp(), + ); const String longText = 'is a color that sings of hope, A hue that shines like gold. It is the color of dreams, A shade that never grows old.'; diff --git a/examples/api/test/material/elevated_button/elevated_button.0_test.dart b/examples/api/test/material/elevated_button/elevated_button.0_test.dart index 8a930425cde..a6fb0f2cbf0 100644 --- a/examples/api/test/material/elevated_button/elevated_button.0_test.dart +++ b/examples/api/test/material/elevated_button/elevated_button.0_test.dart @@ -3,19 +3,32 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/elevated_button/elevated_button.0.dart' as example; +import 'package:flutter_api_samples/material/elevated_button/elevated_button.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('ElevatedButton Smoke Test', (WidgetTester tester) async { await tester.pumpWidget(const example.ElevatedButtonExampleApp()); - expect(find.widgetWithText(AppBar, 'ElevatedButton Sample'), findsOneWidget); - final Finder disabledButton = find.widgetWithText(ElevatedButton, 'Disabled'); + expect( + find.widgetWithText(AppBar, 'ElevatedButton Sample'), + findsOneWidget, + ); + final Finder disabledButton = find.widgetWithText( + ElevatedButton, + 'Disabled', + ); expect(disabledButton, findsOneWidget); - expect(tester.widget(disabledButton).onPressed.runtimeType, Null); + expect( + tester.widget(disabledButton).onPressed.runtimeType, + Null, + ); final Finder enabledButton = find.widgetWithText(ElevatedButton, 'Enabled'); expect(enabledButton, findsOneWidget); - expect(tester.widget(enabledButton).onPressed.runtimeType, VoidCallback); + expect( + tester.widget(enabledButton).onPressed.runtimeType, + VoidCallback, + ); }); } diff --git a/examples/api/test/material/expansion_panel/expansion_panel_list.0_test.dart b/examples/api/test/material/expansion_panel/expansion_panel_list.0_test.dart index 2b7c1ef9660..a1bf3c7f7d2 100644 --- a/examples/api/test/material/expansion_panel/expansion_panel_list.0_test.dart +++ b/examples/api/test/material/expansion_panel/expansion_panel_list.0_test.dart @@ -12,14 +12,20 @@ void main() { await tester.pumpWidget(const example.ExpansionPanelListExampleApp()); // Verify the first tile is collapsed. - expect(tester.widget(find.byType(ExpandIcon).first).isExpanded, false); + expect( + tester.widget(find.byType(ExpandIcon).first).isExpanded, + false, + ); // Tap to expand the first tile. await tester.tap(find.byType(ExpandIcon).first); await tester.pumpAndSettle(); // Verify that the first tile is expanded. - expect(tester.widget(find.byType(ExpandIcon).first).isExpanded, true); + expect( + tester.widget(find.byType(ExpandIcon).first).isExpanded, + true, + ); }); testWidgets('Tap to delete a ExpansionPanel', (WidgetTester tester) async { @@ -28,13 +34,19 @@ void main() { await tester.pumpWidget(const example.ExpansionPanelListExampleApp()); expect(find.widgetWithText(ListTile, 'Panel $index'), findsOneWidget); - expect(tester.widget(find.byType(ExpandIcon).at(index)).isExpanded, false); + expect( + tester.widget(find.byType(ExpandIcon).at(index)).isExpanded, + false, + ); // Tap to expand the tile at index 3. await tester.tap(find.byType(ExpandIcon).at(index)); await tester.pumpAndSettle(); - expect(tester.widget(find.byType(ExpandIcon).at(index)).isExpanded, true); + expect( + tester.widget(find.byType(ExpandIcon).at(index)).isExpanded, + true, + ); // Tap to delete the tile at index 3. await tester.tap(find.byIcon(Icons.delete).at(index)); @@ -56,15 +68,22 @@ void main() { await tester.pumpAndSettle(); // Check panel 3 tile position. - Offset tilePosition = tester.getBottomLeft(find.widgetWithText(ListTile, 'Panel 3')); + Offset tilePosition = tester.getBottomLeft( + find.widgetWithText(ListTile, 'Panel 3'), + ); expect(tilePosition.dy, 656.0); // Scroll up. - await tester.drag(find.byType(SingleChildScrollView), const Offset(0, -300)); + await tester.drag( + find.byType(SingleChildScrollView), + const Offset(0, -300), + ); await tester.pumpAndSettle(); // Verify panel 3 tile position is updated after scrolling. - tilePosition = tester.getBottomLeft(find.widgetWithText(ListTile, 'Panel 3')); + tilePosition = tester.getBottomLeft( + find.widgetWithText(ListTile, 'Panel 3'), + ); expect(tilePosition.dy, 376.0); }); } diff --git a/examples/api/test/material/expansion_panel/expansion_panel_list.expansion_panel_list_radio.0_test.dart b/examples/api/test/material/expansion_panel/expansion_panel_list.expansion_panel_list_radio.0_test.dart index 423aeb360d4..018698b0d25 100644 --- a/examples/api/test/material/expansion_panel/expansion_panel_list.expansion_panel_list_radio.0_test.dart +++ b/examples/api/test/material/expansion_panel/expansion_panel_list.expansion_panel_list_radio.0_test.dart @@ -13,7 +13,10 @@ void main() { ) async { await tester.pumpWidget(const example.ExpansionPanelListRadioExampleApp()); - expect(find.widgetWithText(AppBar, 'ExpansionPanelList.radio Sample'), findsOne); + expect( + find.widgetWithText(AppBar, 'ExpansionPanelList.radio Sample'), + findsOne, + ); expect(find.byType(ExpansionPanelList), findsOne); for (int i = 0; i < 8; i++) { expect(find.widgetWithText(ListTile, 'Panel $i'), findsOne); diff --git a/examples/api/test/material/expansion_tile/expansion_tile.0_test.dart b/examples/api/test/material/expansion_tile/expansion_tile.0_test.dart index 2f2462517bc..4c2ead663dd 100644 --- a/examples/api/test/material/expansion_tile/expansion_tile.0_test.dart +++ b/examples/api/test/material/expansion_tile/expansion_tile.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/expansion_tile/expansion_tile.0.dart' as example; +import 'package:flutter_api_samples/material/expansion_tile/expansion_tile.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/expansion_tile/expansion_tile.1_test.dart b/examples/api/test/material/expansion_tile/expansion_tile.1_test.dart index 289dad28acb..904e7cd1102 100644 --- a/examples/api/test/material/expansion_tile/expansion_tile.1_test.dart +++ b/examples/api/test/material/expansion_tile/expansion_tile.1_test.dart @@ -2,11 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:flutter_api_samples/material/expansion_tile/expansion_tile.1.dart' as example; +import 'package:flutter_api_samples/material/expansion_tile/expansion_tile.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Test the basics of ExpansionTileControllerApp', (WidgetTester tester) async { + testWidgets('Test the basics of ExpansionTileControllerApp', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ExpansionTileControllerApp()); expect(find.text('ExpansionTile Contents'), findsNothing); diff --git a/examples/api/test/material/expansion_tile/expansion_tile.2_test.dart b/examples/api/test/material/expansion_tile/expansion_tile.2_test.dart index a057ed1d2bb..c59e849efbc 100644 --- a/examples/api/test/material/expansion_tile/expansion_tile.2_test.dart +++ b/examples/api/test/material/expansion_tile/expansion_tile.2_test.dart @@ -3,61 +3,63 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/expansion_tile/expansion_tile.2.dart' as example; +import 'package:flutter_api_samples/material/expansion_tile/expansion_tile.2.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('ExpansionTile animation can be customized using AnimationStyle', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.ExpansionTileAnimationStyleApp()); + testWidgets( + 'ExpansionTile animation can be customized using AnimationStyle', + (WidgetTester tester) async { + await tester.pumpWidget(const example.ExpansionTileAnimationStyleApp()); - double getHeight(WidgetTester tester) { - return tester.getSize(find.byType(ExpansionTile)).height; - } + double getHeight(WidgetTester tester) { + return tester.getSize(find.byType(ExpansionTile)).height; + } - expect(getHeight(tester), 58.0); + expect(getHeight(tester), 58.0); - // Test the default animation style. - await tester.tap(find.text('ExpansionTile')); - await tester.pump(); - await tester.pump(const Duration(milliseconds: 100)); + // Test the default animation style. + await tester.tap(find.text('ExpansionTile')); + await tester.pump(); + await tester.pump(const Duration(milliseconds: 100)); - expect(getHeight(tester), closeTo(93.4, 0.1)); + expect(getHeight(tester), closeTo(93.4, 0.1)); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(); - expect(getHeight(tester), 170.0); + expect(getHeight(tester), 170.0); - // Tap to collapse. - await tester.tap(find.text('ExpansionTile')); - await tester.pumpAndSettle(); + // Tap to collapse. + await tester.tap(find.text('ExpansionTile')); + await tester.pumpAndSettle(); - // Test the custom animation style. - await tester.tap(find.text('Custom')); - await tester.pumpAndSettle(); + // Test the custom animation style. + await tester.tap(find.text('Custom')); + await tester.pumpAndSettle(); - await tester.tap(find.text('ExpansionTile')); - await tester.pump(); - await tester.pump(const Duration(milliseconds: 100)); + await tester.tap(find.text('ExpansionTile')); + await tester.pump(); + await tester.pump(const Duration(milliseconds: 100)); - expect(getHeight(tester), closeTo(59.2, 0.1)); + expect(getHeight(tester), closeTo(59.2, 0.1)); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(); - expect(getHeight(tester), 170.0); + expect(getHeight(tester), 170.0); - // Tap to collapse. - await tester.tap(find.text('ExpansionTile')); - await tester.pumpAndSettle(); + // Tap to collapse. + await tester.tap(find.text('ExpansionTile')); + await tester.pumpAndSettle(); - // Test the no animation style. - await tester.tap(find.text('None')); - await tester.pumpAndSettle(); + // Test the no animation style. + await tester.tap(find.text('None')); + await tester.pumpAndSettle(); - await tester.tap(find.text('ExpansionTile')); - await tester.pump(); + await tester.tap(find.text('ExpansionTile')); + await tester.pump(); - expect(getHeight(tester), 170.0); - }); + expect(getHeight(tester), 170.0); + }, + ); } diff --git a/examples/api/test/material/filled_button/filled_button.0_test.dart b/examples/api/test/material/filled_button/filled_button.0_test.dart index 119e0493a5b..adbb54340e5 100644 --- a/examples/api/test/material/filled_button/filled_button.0_test.dart +++ b/examples/api/test/material/filled_button/filled_button.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/filled_button/filled_button.0.dart' as example; +import 'package:flutter_api_samples/material/filled_button/filled_button.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -13,11 +14,23 @@ void main() { expect(find.widgetWithText(AppBar, 'FilledButton Sample'), findsOneWidget); final Finder disabledButton = find.widgetWithText(FilledButton, 'Disabled'); expect(disabledButton, findsNWidgets(2)); - expect(tester.widget(disabledButton.first).onPressed.runtimeType, Null); - expect(tester.widget(disabledButton.last).onPressed.runtimeType, Null); + expect( + tester.widget(disabledButton.first).onPressed.runtimeType, + Null, + ); + expect( + tester.widget(disabledButton.last).onPressed.runtimeType, + Null, + ); final Finder enabledButton = find.widgetWithText(FilledButton, 'Enabled'); expect(enabledButton, findsNWidgets(2)); - expect(tester.widget(enabledButton.first).onPressed.runtimeType, VoidCallback); - expect(tester.widget(enabledButton.last).onPressed.runtimeType, VoidCallback); + expect( + tester.widget(enabledButton.first).onPressed.runtimeType, + VoidCallback, + ); + expect( + tester.widget(enabledButton.last).onPressed.runtimeType, + VoidCallback, + ); }); } diff --git a/examples/api/test/material/filter_chip/filter_chip.0_test.dart b/examples/api/test/material/filter_chip/filter_chip.0_test.dart index dc9d2ca5ce6..69375804495 100644 --- a/examples/api/test/material/filter_chip/filter_chip.0_test.dart +++ b/examples/api/test/material/filter_chip/filter_chip.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/filter_chip/filter_chip.0.dart' as example; +import 'package:flutter_api_samples/material/filter_chip/filter_chip.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/flexible_space_bar/flexible_space_bar.0_test.dart b/examples/api/test/material/flexible_space_bar/flexible_space_bar.0_test.dart index 0e7c9253a88..91a90ffe496 100644 --- a/examples/api/test/material/flexible_space_bar/flexible_space_bar.0_test.dart +++ b/examples/api/test/material/flexible_space_bar/flexible_space_bar.0_test.dart @@ -16,26 +16,30 @@ void main() { HttpOverrides.global = null; }); - testWidgets('The app bar stretches when over-scrolled', (WidgetTester tester) async { - await tester.pumpWidget(const example.FlexibleSpaceBarExampleApp()); + testWidgets( + 'The app bar stretches when over-scrolled', + (WidgetTester tester) async { + await tester.pumpWidget(const example.FlexibleSpaceBarExampleApp()); - expect(find.text('Flight Report'), findsOne); + expect(find.text('Flight Report'), findsOne); - expect(find.widgetWithText(ListTile, 'Sunday'), findsOne); - expect(find.widgetWithText(ListTile, 'Monday'), findsOne); - expect(find.text('sunny, h: 80, l: 65'), findsExactly(2)); - expect(find.byIcon(Icons.wb_sunny), findsExactly(2)); + expect(find.widgetWithText(ListTile, 'Sunday'), findsOne); + expect(find.widgetWithText(ListTile, 'Monday'), findsOne); + expect(find.text('sunny, h: 80, l: 65'), findsExactly(2)); + expect(find.byIcon(Icons.wb_sunny), findsExactly(2)); - final Finder appBarContainer = find.byType(Image); - final Size sizeBeforeScroll = tester.getSize(appBarContainer); - final Offset target = tester.getCenter(find.byType(ListTile).first); - final TestGesture gesture = await tester.startGesture(target); - await gesture.moveBy(const Offset(0.0, 100.0)); - await tester.pump(const Duration(milliseconds: 10)); - await gesture.up(); - final Size sizeAfterScroll = tester.getSize(appBarContainer); + final Finder appBarContainer = find.byType(Image); + final Size sizeBeforeScroll = tester.getSize(appBarContainer); + final Offset target = tester.getCenter(find.byType(ListTile).first); + final TestGesture gesture = await tester.startGesture(target); + await gesture.moveBy(const Offset(0.0, 100.0)); + await tester.pump(const Duration(milliseconds: 10)); + await gesture.up(); + final Size sizeAfterScroll = tester.getSize(appBarContainer); - expect(sizeBeforeScroll.height, lessThan(sizeAfterScroll.height)); - // Verifies ScrollBehavior.dragDevices is correctly set. - }, variant: TargetPlatformVariant.all()); + expect(sizeBeforeScroll.height, lessThan(sizeAfterScroll.height)); + // Verifies ScrollBehavior.dragDevices is correctly set. + }, + variant: TargetPlatformVariant.all(), + ); } diff --git a/examples/api/test/material/floating_action_button/floating_action_button.0_test.dart b/examples/api/test/material/floating_action_button/floating_action_button.0_test.dart index 28c0eb2f3da..3ee7d16174a 100644 --- a/examples/api/test/material/floating_action_button/floating_action_button.0_test.dart +++ b/examples/api/test/material/floating_action_button/floating_action_button.0_test.dart @@ -20,7 +20,10 @@ void main() { Color? getIconColor() { final RichText iconRichText = tester.widget( - find.descendant(of: find.byIcon(Icons.navigation), matching: find.byType(RichText)), + find.descendant( + of: find.byIcon(Icons.navigation), + matching: find.byType(RichText), + ), ); return iconRichText.text.style?.color; } diff --git a/examples/api/test/material/floating_action_button/floating_action_button.1_test.dart b/examples/api/test/material/floating_action_button/floating_action_button.1_test.dart index 2d26a9db436..b44a8afe9be 100644 --- a/examples/api/test/material/floating_action_button/floating_action_button.1_test.dart +++ b/examples/api/test/material/floating_action_button/floating_action_button.1_test.dart @@ -21,7 +21,9 @@ void main() { expect(find.byIcon(Icons.add), findsNWidgets(4)); final Finder smallFabMaterialButton = find.byType(RawMaterialButton).at(0); - final RenderBox smallFabRenderBox = tester.renderObject(smallFabMaterialButton); + final RenderBox smallFabRenderBox = tester.renderObject( + smallFabMaterialButton, + ); expect(smallFabRenderBox.size, const Size(48.0, 48.0)); expect( getRawMaterialButtonWidget(smallFabMaterialButton).fillColor, @@ -32,8 +34,12 @@ void main() { RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)), ); - final Finder regularFABMaterialButton = find.byType(RawMaterialButton).at(1); - final RenderBox regularFABRenderBox = tester.renderObject(regularFABMaterialButton); + final Finder regularFABMaterialButton = find + .byType(RawMaterialButton) + .at(1); + final RenderBox regularFABRenderBox = tester.renderObject( + regularFABMaterialButton, + ); expect(regularFABRenderBox.size, const Size(56.0, 56.0)); expect( getRawMaterialButtonWidget(regularFABMaterialButton).fillColor, @@ -45,7 +51,9 @@ void main() { ); final Finder largeFABMaterialButton = find.byType(RawMaterialButton).at(2); - final RenderBox largeFABRenderBox = tester.renderObject(largeFABMaterialButton); + final RenderBox largeFABRenderBox = tester.renderObject( + largeFABMaterialButton, + ); expect(largeFABRenderBox.size, const Size(96.0, 96.0)); expect( getRawMaterialButtonWidget(largeFABMaterialButton).fillColor, @@ -56,9 +64,16 @@ void main() { RoundedRectangleBorder(borderRadius: BorderRadius.circular(28.0)), ); - final Finder extendedFABMaterialButton = find.byType(RawMaterialButton).at(3); - final RenderBox extendedFABRenderBox = tester.renderObject(extendedFABMaterialButton); - expect(extendedFABRenderBox.size, within(distance: 0.01, from: const Size(110.3, 56.0))); + final Finder extendedFABMaterialButton = find + .byType(RawMaterialButton) + .at(3); + final RenderBox extendedFABRenderBox = tester.renderObject( + extendedFABMaterialButton, + ); + expect( + extendedFABRenderBox.size, + within(distance: 0.01, from: const Size(110.3, 56.0)), + ); expect( getRawMaterialButtonWidget(extendedFABMaterialButton).fillColor, theme.colorScheme.primaryContainer, diff --git a/examples/api/test/material/floating_action_button_location/standard_fab_location.0_test.dart b/examples/api/test/material/floating_action_button_location/standard_fab_location.0_test.dart index 12da34f69a4..d763212cc6f 100644 --- a/examples/api/test/material/floating_action_button_location/standard_fab_location.0_test.dart +++ b/examples/api/test/material/floating_action_button_location/standard_fab_location.0_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/material/floating_action_button_location/sta import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('The FloatingActionButton should have a right padding', (WidgetTester tester) async { + testWidgets('The FloatingActionButton should have a right padding', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.StandardFabLocationExampleApp()); expect(find.widgetWithIcon(FloatingActionButton, Icons.add), findsOne); diff --git a/examples/api/test/material/icon_button/icon_button.0_test.dart b/examples/api/test/material/icon_button/icon_button.0_test.dart index db53fcb2da6..161a8e4ade2 100644 --- a/examples/api/test/material/icon_button/icon_button.0_test.dart +++ b/examples/api/test/material/icon_button/icon_button.0_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/icon_button/icon_button.0.dart' as example; +import 'package:flutter_api_samples/material/icon_button/icon_button.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('IconButton increments volume when tapped', (WidgetTester tester) async { + testWidgets('IconButton increments volume when tapped', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.IconButtonExampleApp()); expect(find.byIcon(Icons.volume_up), findsOneWidget); @@ -19,7 +22,9 @@ void main() { expect(find.text('Volume : 10.0'), findsOneWidget); }); - testWidgets('IconButton shows tooltip when long pressed', (WidgetTester tester) async { + testWidgets('IconButton shows tooltip when long pressed', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.IconButtonExampleApp()); expect(find.text('Increase volume by 10'), findsNothing); diff --git a/examples/api/test/material/icon_button/icon_button.1_test.dart b/examples/api/test/material/icon_button/icon_button.1_test.dart index 18777299a2c..18caa80d10d 100644 --- a/examples/api/test/material/icon_button/icon_button.1_test.dart +++ b/examples/api/test/material/icon_button/icon_button.1_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/icon_button/icon_button.1.dart' as example; +import 'package:flutter_api_samples/material/icon_button/icon_button.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/icon_button/icon_button.2_test.dart b/examples/api/test/material/icon_button/icon_button.2_test.dart index 4863a07ac0b..8c237729f97 100644 --- a/examples/api/test/material/icon_button/icon_button.2_test.dart +++ b/examples/api/test/material/icon_button/icon_button.2_test.dart @@ -3,16 +3,26 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/icon_button/icon_button.2.dart' as example; +import 'package:flutter_api_samples/material/icon_button/icon_button.2.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('IconButton Types', (WidgetTester tester) async { await tester.pumpWidget(const example.IconButtonApp()); - expect(find.widgetWithIcon(IconButton, Icons.filter_drama), findsNWidgets(8)); - final Finder iconButtons = find.widgetWithIcon(IconButton, Icons.filter_drama); + expect( + find.widgetWithIcon(IconButton, Icons.filter_drama), + findsNWidgets(8), + ); + final Finder iconButtons = find.widgetWithIcon( + IconButton, + Icons.filter_drama, + ); for (int i = 0; i <= 3; i++) { - expect(tester.widget(iconButtons.at(i)).onPressed is VoidCallback, isTrue); + expect( + tester.widget(iconButtons.at(i)).onPressed is VoidCallback, + isTrue, + ); } for (int i = 4; i <= 7; i++) { expect(tester.widget(iconButtons.at(i)).onPressed, isNull); diff --git a/examples/api/test/material/icon_button/icon_button.3_test.dart b/examples/api/test/material/icon_button/icon_button.3_test.dart index 6bafd411cff..d7d177ecb56 100644 --- a/examples/api/test/material/icon_button/icon_button.3_test.dart +++ b/examples/api/test/material/icon_button/icon_button.3_test.dart @@ -3,17 +3,28 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/icon_button/icon_button.3.dart' as example; +import 'package:flutter_api_samples/material/icon_button/icon_button.3.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('It should select and unselect the icon buttons', (WidgetTester tester) async { + testWidgets('It should select and unselect the icon buttons', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.IconButtonToggleApp()); - expect(find.widgetWithIcon(IconButton, Icons.settings_outlined), findsExactly(8)); - final Finder unselectedIconButtons = find.widgetWithIcon(IconButton, Icons.settings_outlined); + expect( + find.widgetWithIcon(IconButton, Icons.settings_outlined), + findsExactly(8), + ); + final Finder unselectedIconButtons = find.widgetWithIcon( + IconButton, + Icons.settings_outlined, + ); for (int i = 0; i <= 6; i++) { - final IconButton button = tester.widget(unselectedIconButtons.at(i)); + final IconButton button = tester.widget( + unselectedIconButtons.at(i), + ); expect(button.onPressed, i.isEven ? isA() : isNull); expect(button.isSelected, isFalse); } @@ -25,9 +36,14 @@ void main() { await tester.pump(); expect(find.widgetWithIcon(IconButton, Icons.settings), findsExactly(8)); - final Finder selectedIconButtons = find.widgetWithIcon(IconButton, Icons.settings); + final Finder selectedIconButtons = find.widgetWithIcon( + IconButton, + Icons.settings, + ); for (int i = 0; i <= 6; i++) { - final IconButton button = tester.widget(selectedIconButtons.at(i)); + final IconButton button = tester.widget( + selectedIconButtons.at(i), + ); expect(button.onPressed, i.isEven ? isA() : isNull); expect(button.isSelected, isTrue); } @@ -38,9 +54,14 @@ void main() { } await tester.pump(); - expect(find.widgetWithIcon(IconButton, Icons.settings_outlined), findsExactly(8)); + expect( + find.widgetWithIcon(IconButton, Icons.settings_outlined), + findsExactly(8), + ); for (int i = 0; i <= 6; i++) { - final IconButton button = tester.widget(unselectedIconButtons.at(i)); + final IconButton button = tester.widget( + unselectedIconButtons.at(i), + ); expect(button.onPressed, i.isEven ? isA() : isNull); expect(button.isSelected, isFalse); } diff --git a/examples/api/test/material/ink/ink.image_clip.0_test.dart b/examples/api/test/material/ink/ink.image_clip.0_test.dart index f3d6bc4d176..8a90570fb3b 100644 --- a/examples/api/test/material/ink/ink.image_clip.0_test.dart +++ b/examples/api/test/material/ink/ink.image_clip.0_test.dart @@ -5,7 +5,8 @@ import 'dart:typed_data'; import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/ink/ink.image_clip.0.dart' as example; +import 'package:flutter_api_samples/material/ink/ink.image_clip.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -76,11 +77,15 @@ void main() { 0xAE, ]; - testWidgets('Ink ancestor material is not clipped', (WidgetTester tester) async { + testWidgets('Ink ancestor material is not clipped', ( + WidgetTester tester, + ) async { await tester.pumpWidget( MaterialApp( home: Scaffold( - body: example.ImageClipExample(image: MemoryImage(Uint8List.fromList(kTransparentImage))), + body: example.ImageClipExample( + image: MemoryImage(Uint8List.fromList(kTransparentImage)), + ), ), ), ); @@ -89,6 +94,9 @@ void main() { of: find.byType(Ink), matching: find.byType(Material), ); - expect(find.ancestor(of: inkMaterialFinder, matching: find.byType(ClipRRect)), findsNothing); + expect( + find.ancestor(of: inkMaterialFinder, matching: find.byType(ClipRRect)), + findsNothing, + ); }); } diff --git a/examples/api/test/material/ink/ink.image_clip.1_test.dart b/examples/api/test/material/ink/ink.image_clip.1_test.dart index 6e0e74e58d4..c8eaf8079c7 100644 --- a/examples/api/test/material/ink/ink.image_clip.1_test.dart +++ b/examples/api/test/material/ink/ink.image_clip.1_test.dart @@ -5,7 +5,8 @@ import 'dart:typed_data'; import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/ink/ink.image_clip.1.dart' as example; +import 'package:flutter_api_samples/material/ink/ink.image_clip.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -80,7 +81,9 @@ void main() { await tester.pumpWidget( MaterialApp( home: Scaffold( - body: example.ImageClipExample(image: MemoryImage(Uint8List.fromList(kTransparentImage))), + body: example.ImageClipExample( + image: MemoryImage(Uint8List.fromList(kTransparentImage)), + ), ), ), ); @@ -89,6 +92,9 @@ void main() { of: find.byType(Ink), matching: find.byType(Material), ); - expect(find.ancestor(of: inkMaterialFinder, matching: find.byType(ClipRRect)), findsOneWidget); + expect( + find.ancestor(of: inkMaterialFinder, matching: find.byType(ClipRRect)), + findsOneWidget, + ); }); } diff --git a/examples/api/test/material/ink_well/ink_well.0_test.dart b/examples/api/test/material/ink_well/ink_well.0_test.dart index 37d5a0a8e95..24869b70916 100644 --- a/examples/api/test/material/ink_well/ink_well.0_test.dart +++ b/examples/api/test/material/ink_well/ink_well.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/ink_well/ink_well.0.dart' as example; +import 'package:flutter_api_samples/material/ink_well/ink_well.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -15,21 +16,24 @@ void main() { final Finder inkWell = find.byType(InkWell); final InkWell inkWellWidget = tester.widget(inkWell); final Finder animatedContainer = find.byType(AnimatedContainer); - AnimatedContainer animatedContainerWidget = tester.widget( - animatedContainer, - ); + AnimatedContainer animatedContainerWidget = tester + .widget(animatedContainer); expect(inkWell, findsOneWidget); expect(inkWellWidget.onTap.runtimeType, VoidCallback); expect(animatedContainerWidget.constraints?.minWidth, 50); expect(animatedContainerWidget.constraints?.minHeight, 50); await tester.tap(inkWell); await tester.pumpAndSettle(); - animatedContainerWidget = tester.widget(animatedContainer); + animatedContainerWidget = tester.widget( + animatedContainer, + ); expect(animatedContainerWidget.constraints?.minWidth, 100); expect(animatedContainerWidget.constraints?.minHeight, 100); await tester.tap(inkWell); await tester.pumpAndSettle(); - animatedContainerWidget = tester.widget(animatedContainer); + animatedContainerWidget = tester.widget( + animatedContainer, + ); expect(animatedContainerWidget.constraints?.minWidth, 50); expect(animatedContainerWidget.constraints?.minHeight, 50); }, diff --git a/examples/api/test/material/input_chip/input_chip.0_test.dart b/examples/api/test/material/input_chip/input_chip.0_test.dart index 4b55089f4d1..96b8b619588 100644 --- a/examples/api/test/material/input_chip/input_chip.0_test.dart +++ b/examples/api/test/material/input_chip/input_chip.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/input_chip/input_chip.0.dart' as example; +import 'package:flutter_api_samples/material/input_chip/input_chip.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/input_chip/input_chip.1_test.dart b/examples/api/test/material/input_chip/input_chip.1_test.dart index 4464e9b349f..841e642a136 100644 --- a/examples/api/test/material/input_chip/input_chip.1_test.dart +++ b/examples/api/test/material/input_chip/input_chip.1_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/input_chip/input_chip.1.dart' as example; +import 'package:flutter_api_samples/material/input_chip/input_chip.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -19,7 +20,9 @@ void main() { expect(find.byType(example.ChipsInput), findsOneWidget); expect(find.byType(InputChip), findsOneWidget); - example.ChipsInputState state = tester.state(find.byType(example.ChipsInput)); + example.ChipsInputState state = tester.state( + find.byType(example.ChipsInput), + ); expect(state.controller.textWithoutReplacements.isEmpty, true); await tester.tap(find.byType(example.ChipsInput)); @@ -43,13 +46,19 @@ void main() { // Simulate item deletion. await tester.tap( - find.descendant(of: find.byType(InputChip), matching: find.byType(InkWell).last), + find.descendant( + of: find.byType(InputChip), + matching: find.byType(InkWell).last, + ), ); await tester.pumpAndSettle(); expect(find.byType(InputChip), findsOneWidget); await tester.tap( - find.descendant(of: find.byType(InputChip), matching: find.byType(InkWell).last), + find.descendant( + of: find.byType(InputChip), + matching: find.byType(InkWell).last, + ), ); await tester.pumpAndSettle(); expect(find.byType(InputChip), findsNothing); diff --git a/examples/api/test/material/input_decorator/input_decoration.0_test.dart b/examples/api/test/material/input_decorator/input_decoration.0_test.dart index 637deebeea9..d98c6dc154f 100644 --- a/examples/api/test/material/input_decorator/input_decoration.0_test.dart +++ b/examples/api/test/material/input_decorator/input_decoration.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/input_decorator/input_decoration.0.dart' as example; +import 'package:flutter_api_samples/material/input_decorator/input_decoration.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/input_decorator/input_decoration.1_test.dart b/examples/api/test/material/input_decorator/input_decoration.1_test.dart index a7cd67bccef..4791f3f6398 100644 --- a/examples/api/test/material/input_decorator/input_decoration.1_test.dart +++ b/examples/api/test/material/input_decorator/input_decoration.1_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/input_decorator/input_decoration.1.dart' as example; +import 'package:flutter_api_samples/material/input_decorator/input_decoration.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -15,7 +16,10 @@ void main() { expect(find.text('Hint Text'), findsOneWidget); expect( - tester.widget(find.byType(TextField)).decoration?.contentPadding, + tester + .widget(find.byType(TextField)) + .decoration + ?.contentPadding, EdgeInsets.zero, ); expect( diff --git a/examples/api/test/material/input_decorator/input_decoration.2_test.dart b/examples/api/test/material/input_decorator/input_decoration.2_test.dart index 516a76413a5..543b73b7446 100644 --- a/examples/api/test/material/input_decorator/input_decoration.2_test.dart +++ b/examples/api/test/material/input_decorator/input_decoration.2_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/input_decorator/input_decoration.2.dart' as example; +import 'package:flutter_api_samples/material/input_decorator/input_decoration.2.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -15,6 +16,9 @@ void main() { expect(find.text('Hint Text'), findsOneWidget); expect(find.text('Error Text'), findsOneWidget); - expect(tester.widget(find.byType(TextField)).decoration?.border, isNotNull); + expect( + tester.widget(find.byType(TextField)).decoration?.border, + isNotNull, + ); }); } diff --git a/examples/api/test/material/input_decorator/input_decoration.3_test.dart b/examples/api/test/material/input_decorator/input_decoration.3_test.dart index 236ebe35c25..2a7dc9eed40 100644 --- a/examples/api/test/material/input_decorator/input_decoration.3_test.dart +++ b/examples/api/test/material/input_decorator/input_decoration.3_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/input_decorator/input_decoration.3.dart' as example; +import 'package:flutter_api_samples/material/input_decorator/input_decoration.3.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/input_decorator/input_decoration.floating_label_style_error.0_test.dart b/examples/api/test/material/input_decorator/input_decoration.floating_label_style_error.0_test.dart index 021fd33b6fe..5ded70149b9 100644 --- a/examples/api/test/material/input_decorator/input_decoration.floating_label_style_error.0_test.dart +++ b/examples/api/test/material/input_decorator/input_decoration.floating_label_style_error.0_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/material/input_decorator/input_decoration.fl import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('InputDecorator label uses error color', (WidgetTester tester) async { + testWidgets('InputDecorator label uses error color', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.FloatingLabelStyleErrorExampleApp()); final Theme theme = tester.firstWidget(find.byType(Theme)); @@ -16,7 +18,10 @@ void main() { await tester.pumpAndSettle(); final AnimatedDefaultTextStyle label = tester.firstWidget( - find.ancestor(of: find.text('Name'), matching: find.byType(AnimatedDefaultTextStyle)), + find.ancestor( + of: find.text('Name'), + matching: find.byType(AnimatedDefaultTextStyle), + ), ); expect(label.style.color, theme.data.colorScheme.error); }); diff --git a/examples/api/test/material/input_decorator/input_decoration.helper.0_test.dart b/examples/api/test/material/input_decorator/input_decoration.helper.0_test.dart index a3d0803a46f..c65f920ecfb 100644 --- a/examples/api/test/material/input_decorator/input_decoration.helper.0_test.dart +++ b/examples/api/test/material/input_decorator/input_decoration.helper.0_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/material/input_decorator/input_decoration.he import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Shows multi element InputDecorator help decoration', (WidgetTester tester) async { + testWidgets('Shows multi element InputDecorator help decoration', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.HelperExampleApp()); expect(find.byType(TextField), findsOneWidget); diff --git a/examples/api/test/material/input_decorator/input_decoration.label.0_test.dart b/examples/api/test/material/input_decorator/input_decoration.label.0_test.dart index 6ec59a2e06d..31b434678da 100644 --- a/examples/api/test/material/input_decorator/input_decoration.label.0_test.dart +++ b/examples/api/test/material/input_decorator/input_decoration.label.0_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/material/input_decorator/input_decoration.la import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Decorates TextField in sample app with label', (WidgetTester tester) async { + testWidgets('Decorates TextField in sample app with label', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.LabelExampleApp()); expect(find.text('InputDecoration.label Sample'), findsOneWidget); diff --git a/examples/api/test/material/input_decorator/input_decoration.label_style_error.0_test.dart b/examples/api/test/material/input_decorator/input_decoration.label_style_error.0_test.dart index b5eb8c6d553..e0a208ea3fc 100644 --- a/examples/api/test/material/input_decorator/input_decoration.label_style_error.0_test.dart +++ b/examples/api/test/material/input_decorator/input_decoration.label_style_error.0_test.dart @@ -8,12 +8,17 @@ import 'package:flutter_api_samples/material/input_decorator/input_decoration.la import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('InputDecorator label uses error color', (WidgetTester tester) async { + testWidgets('InputDecorator label uses error color', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.LabelStyleErrorExampleApp()); final Theme theme = tester.firstWidget(find.byType(Theme)); final AnimatedDefaultTextStyle label = tester.firstWidget( - find.ancestor(of: find.text('Name'), matching: find.byType(AnimatedDefaultTextStyle)), + find.ancestor( + of: find.text('Name'), + matching: find.byType(AnimatedDefaultTextStyle), + ), ); expect(label.style.color, theme.data.colorScheme.error); }); diff --git a/examples/api/test/material/input_decorator/input_decoration.prefix_icon.0_test.dart b/examples/api/test/material/input_decorator/input_decoration.prefix_icon.0_test.dart index ab7158ed7e5..156a04787a1 100644 --- a/examples/api/test/material/input_decorator/input_decoration.prefix_icon.0_test.dart +++ b/examples/api/test/material/input_decorator/input_decoration.prefix_icon.0_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/material/input_decorator/input_decoration.pr import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('InputDecorator prefixIcon alignment', (WidgetTester tester) async { + testWidgets('InputDecorator prefixIcon alignment', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.PrefixIconExampleApp()); expect(tester.getCenter(find.byIcon(Icons.person)).dy, 28.0); }); diff --git a/examples/api/test/material/input_decorator/input_decoration.prefix_icon_constraints.0_test.dart b/examples/api/test/material/input_decorator/input_decoration.prefix_icon_constraints.0_test.dart index 0c78d84a5b2..f988dc05f6c 100644 --- a/examples/api/test/material/input_decorator/input_decoration.prefix_icon_constraints.0_test.dart +++ b/examples/api/test/material/input_decorator/input_decoration.prefix_icon_constraints.0_test.dart @@ -8,42 +8,51 @@ import 'package:flutter_api_samples/material/input_decorator/input_decoration.pr import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Shows two TextFields decorated with prefix icon sizes matching their hint text', ( + testWidgets( + 'Shows two TextFields decorated with prefix icon sizes matching their hint text', + (WidgetTester tester) async { + await tester.pumpWidget(const example.PrefixIconConstraintsExampleApp()); + expect(find.text('InputDecoration Sample'), findsOneWidget); + + expect(find.byType(TextField), findsNWidgets(2)); + expect(find.byIcon(Icons.search), findsNWidgets(2)); + expect(find.text('Normal Icon Constraints'), findsOneWidget); + expect(find.text('Smaller Icon Constraints'), findsOneWidget); + + final Finder normalIcon = find.descendant( + of: find.ancestor( + of: find.text('Normal Icon Constraints'), + matching: find.byType(TextField), + ), + matching: find.byIcon(Icons.search), + ); + final Finder smallerIcon = find.descendant( + of: find.ancestor( + of: find.text('Smaller Icon Constraints'), + matching: find.byType(TextField), + ), + matching: find.byIcon(Icons.search), + ); + + expect( + tester.getSize(normalIcon).longestSide, + greaterThan(tester.getSize(smallerIcon).longestSide), + ); + }, + ); + + testWidgets('prefixIcons are placed left of hintText', ( WidgetTester tester, ) async { await tester.pumpWidget(const example.PrefixIconConstraintsExampleApp()); - expect(find.text('InputDecoration Sample'), findsOneWidget); - - expect(find.byType(TextField), findsNWidgets(2)); - expect(find.byIcon(Icons.search), findsNWidgets(2)); - expect(find.text('Normal Icon Constraints'), findsOneWidget); - expect(find.text('Smaller Icon Constraints'), findsOneWidget); final Finder normalIcon = find.descendant( - of: find.ancestor(of: find.text('Normal Icon Constraints'), matching: find.byType(TextField)), - matching: find.byIcon(Icons.search), - ); - final Finder smallerIcon = find.descendant( of: find.ancestor( - of: find.text('Smaller Icon Constraints'), + of: find.text('Normal Icon Constraints'), matching: find.byType(TextField), ), matching: find.byIcon(Icons.search), ); - - expect( - tester.getSize(normalIcon).longestSide, - greaterThan(tester.getSize(smallerIcon).longestSide), - ); - }); - - testWidgets('prefixIcons are placed left of hintText', (WidgetTester tester) async { - await tester.pumpWidget(const example.PrefixIconConstraintsExampleApp()); - - final Finder normalIcon = find.descendant( - of: find.ancestor(of: find.text('Normal Icon Constraints'), matching: find.byType(TextField)), - matching: find.byIcon(Icons.search), - ); final Finder smallerIcon = find.descendant( of: find.ancestor( of: find.text('Smaller Icon Constraints'), diff --git a/examples/api/test/material/input_decorator/input_decoration.suffix_icon.0_test.dart b/examples/api/test/material/input_decorator/input_decoration.suffix_icon.0_test.dart index d506a5cbe1b..afcaa6d4c69 100644 --- a/examples/api/test/material/input_decorator/input_decoration.suffix_icon.0_test.dart +++ b/examples/api/test/material/input_decorator/input_decoration.suffix_icon.0_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/material/input_decorator/input_decoration.su import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('InputDecorator suffixIcon alignment', (WidgetTester tester) async { + testWidgets('InputDecorator suffixIcon alignment', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.SuffixIconExampleApp()); expect(tester.getCenter(find.byIcon(Icons.remove_red_eye)).dy, 28.0); }); diff --git a/examples/api/test/material/input_decorator/input_decoration.suffix_icon_constraints.0_test.dart b/examples/api/test/material/input_decorator/input_decoration.suffix_icon_constraints.0_test.dart index b4010efad3b..cca1d2e4f49 100644 --- a/examples/api/test/material/input_decorator/input_decoration.suffix_icon_constraints.0_test.dart +++ b/examples/api/test/material/input_decorator/input_decoration.suffix_icon_constraints.0_test.dart @@ -8,42 +8,51 @@ import 'package:flutter_api_samples/material/input_decorator/input_decoration.su import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Shows two TextFields decorated with suffix icon sizes matching their hint text', ( + testWidgets( + 'Shows two TextFields decorated with suffix icon sizes matching their hint text', + (WidgetTester tester) async { + await tester.pumpWidget(const example.SuffixIconConstraintsExampleApp()); + expect(find.text('InputDecoration Sample'), findsOneWidget); + + expect(find.byType(TextField), findsNWidgets(2)); + expect(find.byIcon(Icons.search), findsNWidgets(2)); + expect(find.text('Normal Icon Constraints'), findsOneWidget); + expect(find.text('Smaller Icon Constraints'), findsOneWidget); + + final Finder normalIcon = find.descendant( + of: find.ancestor( + of: find.text('Normal Icon Constraints'), + matching: find.byType(TextField), + ), + matching: find.byIcon(Icons.search), + ); + final Finder smallerIcon = find.descendant( + of: find.ancestor( + of: find.text('Smaller Icon Constraints'), + matching: find.byType(TextField), + ), + matching: find.byIcon(Icons.search), + ); + + expect( + tester.getSize(normalIcon).longestSide, + greaterThan(tester.getSize(smallerIcon).longestSide), + ); + }, + ); + + testWidgets('suffixIcons are placed right of hintText', ( WidgetTester tester, ) async { await tester.pumpWidget(const example.SuffixIconConstraintsExampleApp()); - expect(find.text('InputDecoration Sample'), findsOneWidget); - - expect(find.byType(TextField), findsNWidgets(2)); - expect(find.byIcon(Icons.search), findsNWidgets(2)); - expect(find.text('Normal Icon Constraints'), findsOneWidget); - expect(find.text('Smaller Icon Constraints'), findsOneWidget); final Finder normalIcon = find.descendant( - of: find.ancestor(of: find.text('Normal Icon Constraints'), matching: find.byType(TextField)), - matching: find.byIcon(Icons.search), - ); - final Finder smallerIcon = find.descendant( of: find.ancestor( - of: find.text('Smaller Icon Constraints'), + of: find.text('Normal Icon Constraints'), matching: find.byType(TextField), ), matching: find.byIcon(Icons.search), ); - - expect( - tester.getSize(normalIcon).longestSide, - greaterThan(tester.getSize(smallerIcon).longestSide), - ); - }); - - testWidgets('suffixIcons are placed right of hintText', (WidgetTester tester) async { - await tester.pumpWidget(const example.SuffixIconConstraintsExampleApp()); - - final Finder normalIcon = find.descendant( - of: find.ancestor(of: find.text('Normal Icon Constraints'), matching: find.byType(TextField)), - matching: find.byIcon(Icons.search), - ); final Finder smallerIcon = find.descendant( of: find.ancestor( of: find.text('Smaller Icon Constraints'), diff --git a/examples/api/test/material/input_decorator/input_decoration.widget_state.0_test.dart b/examples/api/test/material/input_decorator/input_decoration.widget_state.0_test.dart index 355f383d422..30d012420af 100644 --- a/examples/api/test/material/input_decorator/input_decoration.widget_state.0_test.dart +++ b/examples/api/test/material/input_decorator/input_decoration.widget_state.0_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/material/input_decorator/input_decoration.wi import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('TextFormField updates decorations depending on state', (WidgetTester tester) async { + testWidgets('TextFormField updates decorations depending on state', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.MaterialStateExampleApp()); expect(find.text('InputDecoration Sample'), findsOneWidget); @@ -17,7 +19,10 @@ void main() { expect(find.byIcon(Icons.person), findsOneWidget); expect( - tester.widget(find.byType(TextField)).decoration?.prefixIconColor, + tester + .widget(find.byType(TextField)) + .decoration + ?.prefixIconColor, isA() .having( (WidgetStateColor color) => color.resolve({}), @@ -25,7 +30,8 @@ void main() { Colors.grey, ) .having( - (WidgetStateColor color) => color.resolve({WidgetState.focused}), + (WidgetStateColor color) => + color.resolve({WidgetState.focused}), 'focused', Colors.green, ), diff --git a/examples/api/test/material/input_decorator/input_decoration.widget_state.1_test.dart b/examples/api/test/material/input_decorator/input_decoration.widget_state.1_test.dart index 599346a7fbb..da562849aed 100644 --- a/examples/api/test/material/input_decorator/input_decoration.widget_state.1_test.dart +++ b/examples/api/test/material/input_decorator/input_decoration.widget_state.1_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/material/input_decorator/input_decoration.wi import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('TextFormField updates decorations depending on state', (WidgetTester tester) async { + testWidgets('TextFormField updates decorations depending on state', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.MaterialStateExampleApp()); expect(find.text('InputDecoration Sample'), findsOneWidget); @@ -17,7 +19,10 @@ void main() { expect(find.byIcon(Icons.web), findsOneWidget); expect( - tester.widget(find.byType(TextField)).decoration?.prefixIconColor, + tester + .widget(find.byType(TextField)) + .decoration + ?.prefixIconColor, isA() .having( (WidgetStateColor color) => color.resolve({}), @@ -25,18 +30,22 @@ void main() { Colors.grey, ) .having( - (WidgetStateColor color) => color.resolve({WidgetState.focused}), + (WidgetStateColor color) => + color.resolve({WidgetState.focused}), 'focused', Colors.blue, ) .having( - (WidgetStateColor color) => color.resolve({WidgetState.error}), + (WidgetStateColor color) => + color.resolve({WidgetState.error}), 'error', Colors.red, ) .having( - (WidgetStateColor color) => - color.resolve({WidgetState.error, WidgetState.focused}), + (WidgetStateColor color) => color.resolve({ + WidgetState.error, + WidgetState.focused, + }), 'error', Colors.red, ), diff --git a/examples/api/test/material/list_tile/custom_list_item.0_test.dart b/examples/api/test/material/list_tile/custom_list_item.0_test.dart index 7deb3b882c9..efc0cb2d97c 100644 --- a/examples/api/test/material/list_tile/custom_list_item.0_test.dart +++ b/examples/api/test/material/list_tile/custom_list_item.0_test.dart @@ -3,34 +3,49 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/list_tile/custom_list_item.0.dart' as example; +import 'package:flutter_api_samples/material/list_tile/custom_list_item.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Custom list item uses Expanded widgets for the layout', (WidgetTester tester) async { + testWidgets('Custom list item uses Expanded widgets for the layout', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.CustomListItemApp()); // The Expanded widget is used to control the size of the thumbnail. Expanded thumbnailExpanded = tester.widget( - find.ancestor(of: find.byType(Container).first, matching: find.byType(Expanded)), + find.ancestor( + of: find.byType(Container).first, + matching: find.byType(Expanded), + ), ); expect(thumbnailExpanded.flex, 2); // The Expanded widget is used to control the size of the text. Expanded textExpanded = tester.widget( - find.ancestor(of: find.text('The Flutter YouTube Channel'), matching: find.byType(Expanded)), + find.ancestor( + of: find.text('The Flutter YouTube Channel'), + matching: find.byType(Expanded), + ), ); expect(textExpanded.flex, 3); // The Expanded widget is used to control the size of the thumbnail. thumbnailExpanded = tester.widget( - find.ancestor(of: find.byType(Container).last, matching: find.byType(Expanded)), + find.ancestor( + of: find.byType(Container).last, + matching: find.byType(Expanded), + ), ); expect(thumbnailExpanded.flex, 2); // The Expanded widget is used to control the size of the text. textExpanded = tester.widget( - find.ancestor(of: find.text('Announcing Flutter 1.0'), matching: find.byType(Expanded)), + find.ancestor( + of: find.text('Announcing Flutter 1.0'), + matching: find.byType(Expanded), + ), ); expect(textExpanded.flex, 3); }); diff --git a/examples/api/test/material/list_tile/custom_list_item.1_test.dart b/examples/api/test/material/list_tile/custom_list_item.1_test.dart index 413ceedd1fa..b5b1a87b8df 100644 --- a/examples/api/test/material/list_tile/custom_list_item.1_test.dart +++ b/examples/api/test/material/list_tile/custom_list_item.1_test.dart @@ -3,31 +3,42 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/list_tile/custom_list_item.1.dart' as example; +import 'package:flutter_api_samples/material/list_tile/custom_list_item.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Custom list item uses AspectRatio and Expanded widgets for the layout', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.CustomListItemApp()); + testWidgets( + 'Custom list item uses AspectRatio and Expanded widgets for the layout', + (WidgetTester tester) async { + await tester.pumpWidget(const example.CustomListItemApp()); - // The AspectRatio widget is used to constrain the size of the thumbnail. - AspectRatio thumbnailAspectRatio = tester.widget( - find.ancestor(of: find.byType(Container).first, matching: find.byType(AspectRatio)), - ); - expect(thumbnailAspectRatio.aspectRatio, 1.0); + // The AspectRatio widget is used to constrain the size of the thumbnail. + AspectRatio thumbnailAspectRatio = tester.widget( + find.ancestor( + of: find.byType(Container).first, + matching: find.byType(AspectRatio), + ), + ); + expect(thumbnailAspectRatio.aspectRatio, 1.0); - // The Expanded widget is used to control the size of the text. - final Expanded textExpanded = tester.widget( - find.ancestor(of: find.text('Flutter 1.0 Launch'), matching: find.byType(Expanded).at(0)), - ); - expect(textExpanded.flex, 1); + // The Expanded widget is used to control the size of the text. + final Expanded textExpanded = tester.widget( + find.ancestor( + of: find.text('Flutter 1.0 Launch'), + matching: find.byType(Expanded).at(0), + ), + ); + expect(textExpanded.flex, 1); - // The AspectRatio widget is used to constrain the size of the thumbnail. - thumbnailAspectRatio = tester.widget( - find.ancestor(of: find.byType(Container).last, matching: find.byType(AspectRatio)), - ); - expect(thumbnailAspectRatio.aspectRatio, 1.0); - }); + // The AspectRatio widget is used to constrain the size of the thumbnail. + thumbnailAspectRatio = tester.widget( + find.ancestor( + of: find.byType(Container).last, + matching: find.byType(AspectRatio), + ), + ); + expect(thumbnailAspectRatio.aspectRatio, 1.0); + }, + ); } diff --git a/examples/api/test/material/list_tile/list_tile.0_test.dart b/examples/api/test/material/list_tile/list_tile.0_test.dart index cea0f07a233..b321eab0644 100644 --- a/examples/api/test/material/list_tile/list_tile.0_test.dart +++ b/examples/api/test/material/list_tile/list_tile.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/list_tile/list_tile.0.dart' as example; +import 'package:flutter_api_samples/material/list_tile/list_tile.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/list_tile/list_tile.1_test.dart b/examples/api/test/material/list_tile/list_tile.1_test.dart index 4d2106554da..0809d92311b 100644 --- a/examples/api/test/material/list_tile/list_tile.1_test.dart +++ b/examples/api/test/material/list_tile/list_tile.1_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/list_tile/list_tile.1.dart' as example; +import 'package:flutter_api_samples/material/list_tile/list_tile.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -17,7 +18,10 @@ void main() { // The ListTile widget is wrapped in a Card widget. for (int i = 0; i < totalTiles; i++) { expect( - find.ancestor(of: find.byType(ListTile).at(i), matching: find.byType(Card).at(i)), + find.ancestor( + of: find.byType(ListTile).at(i), + matching: find.byType(Card).at(i), + ), findsOneWidget, ); } diff --git a/examples/api/test/material/list_tile/list_tile.2_test.dart b/examples/api/test/material/list_tile/list_tile.2_test.dart index c1255beaa1f..2eae51a5cd3 100644 --- a/examples/api/test/material/list_tile/list_tile.2_test.dart +++ b/examples/api/test/material/list_tile/list_tile.2_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/list_tile/list_tile.2.dart' as example; +import 'package:flutter_api_samples/material/list_tile/list_tile.2.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/list_tile/list_tile.3_test.dart b/examples/api/test/material/list_tile/list_tile.3_test.dart index 0a0c758d754..d17af6b145b 100644 --- a/examples/api/test/material/list_tile/list_tile.3_test.dart +++ b/examples/api/test/material/list_tile/list_tile.3_test.dart @@ -4,7 +4,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; -import 'package:flutter_api_samples/material/list_tile/list_tile.3.dart' as example; +import 'package:flutter_api_samples/material/list_tile/list_tile.3.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -51,5 +52,7 @@ void main() { } RenderParagraph _getTextRenderObject(WidgetTester tester, String text) { - return tester.renderObject(find.descendant(of: find.byType(ListTile), matching: find.text(text))); + return tester.renderObject( + find.descendant(of: find.byType(ListTile), matching: find.text(text)), + ); } diff --git a/examples/api/test/material/list_tile/list_tile.4_test.dart b/examples/api/test/material/list_tile/list_tile.4_test.dart index 1d57bc9837a..5953d7a7131 100644 --- a/examples/api/test/material/list_tile/list_tile.4_test.dart +++ b/examples/api/test/material/list_tile/list_tile.4_test.dart @@ -3,16 +3,21 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/list_tile/list_tile.4.dart' as example; +import 'package:flutter_api_samples/material/list_tile/list_tile.4.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Can choose different title alignments from popup menu', (WidgetTester tester) async { + testWidgets('Can choose different title alignments from popup menu', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ListTileApp()); Offset titleOffset = tester.getTopLeft(find.text('Headline Text')); Offset leadingOffset = tester.getTopLeft(find.byType(Checkbox)); - Offset trailingOffset = tester.getTopRight(find.byIcon(Icons.adaptive.more)); + Offset trailingOffset = tester.getTopRight( + find.byIcon(Icons.adaptive.more), + ); // The default title alignment is threeLine. expect(leadingOffset.dy - titleOffset.dy, 48.0); diff --git a/examples/api/test/material/list_tile/list_tile.selected.0_test.dart b/examples/api/test/material/list_tile/list_tile.selected.0_test.dart index 74d49d707a2..3bd3225c0af 100644 --- a/examples/api/test/material/list_tile/list_tile.selected.0_test.dart +++ b/examples/api/test/material/list_tile/list_tile.selected.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/list_tile/list_tile.selected.0.dart' as example; +import 'package:flutter_api_samples/material/list_tile/list_tile.selected.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -20,7 +21,10 @@ void main() { await tester.pump(); // The first item is no longer selected. - expect(tester.widget(find.byType(ListTile).at(0)).selected, false); + expect( + tester.widget(find.byType(ListTile).at(0)).selected, + false, + ); expect(tester.widget(find.byType(ListTile).at(5)).selected, true); }); } diff --git a/examples/api/test/material/material_state/material_state_border_side.0_test.dart b/examples/api/test/material/material_state/material_state_border_side.0_test.dart index fd377a27a9f..9875c3c241c 100644 --- a/examples/api/test/material/material_state/material_state_border_side.0_test.dart +++ b/examples/api/test/material/material_state/material_state_border_side.0_test.dart @@ -21,7 +21,9 @@ void main() { }); } - testWidgets('FilterChip displays the correct border when selected', (WidgetTester tester) async { + testWidgets('FilterChip displays the correct border when selected', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.MaterialStateBorderSideExampleApp()); expect(findBorderColor(Colors.red), findsOne); diff --git a/examples/api/test/material/material_state/material_state_mouse_cursor.0_test.dart b/examples/api/test/material/material_state/material_state_mouse_cursor.0_test.dart index b4d455be224..76edb0285e3 100644 --- a/examples/api/test/material/material_state/material_state_mouse_cursor.0_test.dart +++ b/examples/api/test/material/material_state/material_state_mouse_cursor.0_test.dart @@ -11,21 +11,29 @@ import 'package:flutter_api_samples/material/material_state/material_state_mouse import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('MaterialStateMouseCursorExampleApp displays ListTile', (WidgetTester tester) async { + testWidgets('MaterialStateMouseCursorExampleApp displays ListTile', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.MaterialStateMouseCursorExampleApp()); expect(find.byType(ListTile), findsOneWidget); expect(find.text('ListTile'), findsOneWidget); }); - testWidgets('ListTile displays correct mouse cursor when enabled', (WidgetTester tester) async { + testWidgets('ListTile displays correct mouse cursor when enabled', ( + WidgetTester tester, + ) async { await tester.pumpWidget( const MaterialApp( - home: Scaffold(body: example.MaterialStateMouseCursorExample(enabled: true)), + home: Scaffold( + body: example.MaterialStateMouseCursorExample(enabled: true), + ), ), ); - final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); + final TestGesture gesture = await tester.createGesture( + kind: PointerDeviceKind.mouse, + ); await gesture.addPointer(location: tester.getCenter(find.byType(ListTile))); addTearDown(gesture.removePointer); @@ -35,14 +43,20 @@ void main() { ); }); - testWidgets('ListTile displays correct mouse cursor when disabled', (WidgetTester tester) async { + testWidgets('ListTile displays correct mouse cursor when disabled', ( + WidgetTester tester, + ) async { await tester.pumpWidget( const MaterialApp( - home: Scaffold(body: example.MaterialStateMouseCursorExample(enabled: false)), + home: Scaffold( + body: example.MaterialStateMouseCursorExample(enabled: false), + ), ), ); - final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); + final TestGesture gesture = await tester.createGesture( + kind: PointerDeviceKind.mouse, + ); await gesture.addPointer(location: tester.getCenter(find.byType(ListTile))); addTearDown(gesture.removePointer); diff --git a/examples/api/test/material/material_state/material_state_property.0_test.dart b/examples/api/test/material/material_state/material_state_property.0_test.dart index cef3b01f810..428c32df4e7 100644 --- a/examples/api/test/material/material_state/material_state_property.0_test.dart +++ b/examples/api/test/material/material_state/material_state_property.0_test.dart @@ -19,23 +19,29 @@ void main() { return widget.textStyle!.color!; } - testWidgets('The foreground color of the TextButton should be red by default', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.MaterialStatePropertyExampleApp()); + testWidgets( + 'The foreground color of the TextButton should be red by default', + (WidgetTester tester) async { + await tester.pumpWidget(const example.MaterialStatePropertyExampleApp()); - expect(getButtonForegroundColor(tester), Colors.red); - }); + expect(getButtonForegroundColor(tester), Colors.red); + }, + ); - testWidgets('The foreground color of the TextButton should be blue when hovered', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.MaterialStatePropertyExampleApp()); + testWidgets( + 'The foreground color of the TextButton should be blue when hovered', + (WidgetTester tester) async { + await tester.pumpWidget(const example.MaterialStatePropertyExampleApp()); - final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); - await gesture.addPointer(location: tester.getCenter(find.byType(TextButton))); - await tester.pump(); + final TestGesture gesture = await tester.createGesture( + kind: PointerDeviceKind.mouse, + ); + await gesture.addPointer( + location: tester.getCenter(find.byType(TextButton)), + ); + await tester.pump(); - expect(getButtonForegroundColor(tester), Colors.blue); - }); + expect(getButtonForegroundColor(tester), Colors.blue); + }, + ); } diff --git a/examples/api/test/material/menu_anchor/checkbox_menu_button.0_test.dart b/examples/api/test/material/menu_anchor/checkbox_menu_button.0_test.dart index 3a1a3439b73..2f98ffd24c1 100644 --- a/examples/api/test/material/menu_anchor/checkbox_menu_button.0_test.dart +++ b/examples/api/test/material/menu_anchor/checkbox_menu_button.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/menu_anchor/checkbox_menu_button.0.dart' as example; +import 'package:flutter_api_samples/material/menu_anchor/checkbox_menu_button.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -23,15 +24,22 @@ void main() { expect(find.text(example.MenuApp.kMessage), findsOneWidget); }); - testWidgets('MenuAnchor is wrapped in a SafeArea', (WidgetTester tester) async { + testWidgets('MenuAnchor is wrapped in a SafeArea', ( + WidgetTester tester, + ) async { const double safeAreaPadding = 100.0; await tester.pumpWidget( const MediaQuery( - data: MediaQueryData(padding: EdgeInsets.symmetric(vertical: safeAreaPadding)), + data: MediaQueryData( + padding: EdgeInsets.symmetric(vertical: safeAreaPadding), + ), child: example.MenuApp(), ), ); - expect(tester.getTopLeft(find.byType(MenuAnchor)), const Offset(0.0, safeAreaPadding)); + expect( + tester.getTopLeft(find.byType(MenuAnchor)), + const Offset(0.0, safeAreaPadding), + ); }); } diff --git a/examples/api/test/material/menu_anchor/menu_accelerator_label.0_test.dart b/examples/api/test/material/menu_anchor/menu_accelerator_label.0_test.dart index 419acabfe87..a924f967b2a 100644 --- a/examples/api/test/material/menu_anchor/menu_accelerator_label.0_test.dart +++ b/examples/api/test/material/menu_anchor/menu_accelerator_label.0_test.dart @@ -4,14 +4,18 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_api_samples/material/menu_anchor/menu_accelerator_label.0.dart' as example; +import 'package:flutter_api_samples/material/menu_anchor/menu_accelerator_label.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('Can open menu', (WidgetTester tester) async { Finder findMenu(String label) { return find - .ancestor(of: find.text(label, findRichText: true), matching: find.byType(FocusScope)) + .ancestor( + of: find.text(label, findRichText: true), + matching: find.byType(FocusScope), + ) .first; } @@ -54,11 +58,16 @@ void main() { const double safeAreaPadding = 100.0; await tester.pumpWidget( const MediaQuery( - data: MediaQueryData(padding: EdgeInsets.symmetric(vertical: safeAreaPadding)), + data: MediaQueryData( + padding: EdgeInsets.symmetric(vertical: safeAreaPadding), + ), child: example.MenuAcceleratorApp(), ), ); - expect(tester.getTopLeft(find.byType(MenuBar)), const Offset(0.0, safeAreaPadding)); + expect( + tester.getTopLeft(find.byType(MenuBar)), + const Offset(0.0, safeAreaPadding), + ); }); } diff --git a/examples/api/test/material/menu_anchor/menu_anchor.0_test.dart b/examples/api/test/material/menu_anchor/menu_anchor.0_test.dart index 5b31195ade4..20636f4a528 100644 --- a/examples/api/test/material/menu_anchor/menu_anchor.0_test.dart +++ b/examples/api/test/material/menu_anchor/menu_anchor.0_test.dart @@ -4,7 +4,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_api_samples/material/menu_anchor/menu_anchor.0.dart' as example; +import 'package:flutter_api_samples/material/menu_anchor/menu_anchor.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -45,7 +46,10 @@ void main() { await tester.pumpAndSettle(); expect(find.text(example.MenuApp.kMessage), findsOneWidget); - expect(find.text('Last Selected: ${example.MenuEntry.showMessage.label}'), findsOneWidget); + expect( + find.text('Last Selected: ${example.MenuEntry.showMessage.label}'), + findsOneWidget, + ); }); testWidgets('Shortcuts work', (WidgetTester tester) async { @@ -87,32 +91,48 @@ void main() { await tester.sendKeyUpEvent(LogicalKeyboardKey.controlLeft); await tester.pump(); - expect(find.text('Last Selected: ${example.MenuEntry.colorRed.label}'), findsOneWidget); + expect( + find.text('Last Selected: ${example.MenuEntry.colorRed.label}'), + findsOneWidget, + ); await tester.sendKeyDownEvent(LogicalKeyboardKey.controlLeft); await tester.sendKeyEvent(LogicalKeyboardKey.keyG); await tester.sendKeyUpEvent(LogicalKeyboardKey.controlLeft); await tester.pump(); - expect(find.text('Last Selected: ${example.MenuEntry.colorGreen.label}'), findsOneWidget); + expect( + find.text('Last Selected: ${example.MenuEntry.colorGreen.label}'), + findsOneWidget, + ); await tester.sendKeyDownEvent(LogicalKeyboardKey.controlLeft); await tester.sendKeyEvent(LogicalKeyboardKey.keyB); await tester.sendKeyUpEvent(LogicalKeyboardKey.controlLeft); await tester.pump(); - expect(find.text('Last Selected: ${example.MenuEntry.colorBlue.label}'), findsOneWidget); + expect( + find.text('Last Selected: ${example.MenuEntry.colorBlue.label}'), + findsOneWidget, + ); }); - testWidgets('MenuAnchor is wrapped in a SafeArea', (WidgetTester tester) async { + testWidgets('MenuAnchor is wrapped in a SafeArea', ( + WidgetTester tester, + ) async { const double safeAreaPadding = 100.0; await tester.pumpWidget( const MediaQuery( - data: MediaQueryData(padding: EdgeInsets.symmetric(vertical: safeAreaPadding)), + data: MediaQueryData( + padding: EdgeInsets.symmetric(vertical: safeAreaPadding), + ), child: example.MenuApp(), ), ); - expect(tester.getTopLeft(find.byType(MenuAnchor)), const Offset(0.0, safeAreaPadding)); + expect( + tester.getTopLeft(find.byType(MenuAnchor)), + const Offset(0.0, safeAreaPadding), + ); }); } diff --git a/examples/api/test/material/menu_anchor/menu_anchor.1_test.dart b/examples/api/test/material/menu_anchor/menu_anchor.1_test.dart index 1c92c278a01..fcdd2f6fc56 100644 --- a/examples/api/test/material/menu_anchor/menu_anchor.1_test.dart +++ b/examples/api/test/material/menu_anchor/menu_anchor.1_test.dart @@ -5,14 +5,18 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_api_samples/material/menu_anchor/menu_anchor.1.dart' as example; +import 'package:flutter_api_samples/material/menu_anchor/menu_anchor.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('Can open menu', (WidgetTester tester) async { Finder findMenu() { return find - .ancestor(of: find.text(example.MenuEntry.about.label), matching: find.byType(FocusScope)) + .ancestor( + of: find.text(example.MenuEntry.about.label), + matching: find.byType(FocusScope), + ) .first; } @@ -73,7 +77,10 @@ void main() { await tester.pumpAndSettle(); expect(find.text(example.ContextMenuApp.kMessage), findsOneWidget); - expect(find.text('Last Selected: ${example.MenuEntry.showMessage.label}'), findsOneWidget); + expect( + find.text('Last Selected: ${example.MenuEntry.showMessage.label}'), + findsOneWidget, + ); }); testWidgets('Shortcuts work', (WidgetTester tester) async { @@ -114,20 +121,29 @@ void main() { await tester.sendKeyUpEvent(LogicalKeyboardKey.controlLeft); await tester.pump(); - expect(find.text('Last Selected: ${example.MenuEntry.colorRed.label}'), findsOneWidget); + expect( + find.text('Last Selected: ${example.MenuEntry.colorRed.label}'), + findsOneWidget, + ); await tester.sendKeyDownEvent(LogicalKeyboardKey.controlLeft); await tester.sendKeyEvent(LogicalKeyboardKey.keyG); await tester.sendKeyUpEvent(LogicalKeyboardKey.controlLeft); await tester.pump(); - expect(find.text('Last Selected: ${example.MenuEntry.colorGreen.label}'), findsOneWidget); + expect( + find.text('Last Selected: ${example.MenuEntry.colorGreen.label}'), + findsOneWidget, + ); await tester.sendKeyDownEvent(LogicalKeyboardKey.controlLeft); await tester.sendKeyEvent(LogicalKeyboardKey.keyB); await tester.sendKeyUpEvent(LogicalKeyboardKey.controlLeft); await tester.pump(); - expect(find.text('Last Selected: ${example.MenuEntry.colorBlue.label}'), findsOneWidget); + expect( + find.text('Last Selected: ${example.MenuEntry.colorBlue.label}'), + findsOneWidget, + ); }); } diff --git a/examples/api/test/material/menu_anchor/menu_anchor.2_test.dart b/examples/api/test/material/menu_anchor/menu_anchor.2_test.dart index 627869dbb95..7628adff236 100644 --- a/examples/api/test/material/menu_anchor/menu_anchor.2_test.dart +++ b/examples/api/test/material/menu_anchor/menu_anchor.2_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/menu_anchor/menu_anchor.2.dart' as example; +import 'package:flutter_api_samples/material/menu_anchor/menu_anchor.2.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('The menu should display three items', (WidgetTester tester) async { + testWidgets('The menu should display three items', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.MenuAnchorApp()); expect(find.widgetWithText(AppBar, 'MenuAnchorButton'), findsOne); diff --git a/examples/api/test/material/menu_anchor/menu_anchor.3_test.dart b/examples/api/test/material/menu_anchor/menu_anchor.3_test.dart index 076be83170d..f895c46ad2a 100644 --- a/examples/api/test/material/menu_anchor/menu_anchor.3_test.dart +++ b/examples/api/test/material/menu_anchor/menu_anchor.3_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/menu_anchor/menu_anchor.3.dart' as example; +import 'package:flutter_api_samples/material/menu_anchor/menu_anchor.3.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Menu button opens and closes the menu', (WidgetTester tester) async { + testWidgets('Menu button opens and closes the menu', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.SimpleCascadingMenuApp()); // Find the menu button. diff --git a/examples/api/test/material/menu_anchor/menu_bar.0_test.dart b/examples/api/test/material/menu_anchor/menu_bar.0_test.dart index 043567c8318..0eb4e0d0e63 100644 --- a/examples/api/test/material/menu_anchor/menu_bar.0_test.dart +++ b/examples/api/test/material/menu_anchor/menu_bar.0_test.dart @@ -4,7 +4,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_api_samples/material/menu_anchor/menu_bar.0.dart' as example; +import 'package:flutter_api_samples/material/menu_anchor/menu_bar.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -93,11 +94,16 @@ void main() { const double safeAreaPadding = 100.0; await tester.pumpWidget( const MediaQuery( - data: MediaQueryData(padding: EdgeInsets.symmetric(vertical: safeAreaPadding)), + data: MediaQueryData( + padding: EdgeInsets.symmetric(vertical: safeAreaPadding), + ), child: example.MenuBarApp(), ), ); - expect(tester.getTopLeft(find.byType(MenuBar)), const Offset(0.0, safeAreaPadding)); + expect( + tester.getTopLeft(find.byType(MenuBar)), + const Offset(0.0, safeAreaPadding), + ); }); } diff --git a/examples/api/test/material/menu_anchor/radio_menu_button.0_test.dart b/examples/api/test/material/menu_anchor/radio_menu_button.0_test.dart index 7adf1747a92..3591c368652 100644 --- a/examples/api/test/material/menu_anchor/radio_menu_button.0_test.dart +++ b/examples/api/test/material/menu_anchor/radio_menu_button.0_test.dart @@ -4,7 +4,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_api_samples/material/menu_anchor/radio_menu_button.0.dart' as example; +import 'package:flutter_api_samples/material/menu_anchor/radio_menu_button.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -19,12 +20,18 @@ void main() { expect(find.text('Green Background'), findsOneWidget); expect(find.text('Blue Background'), findsOneWidget); expect(find.byType(Radio), findsNWidgets(3)); - expect(tester.widget(find.byType(Container)).color, equals(Colors.red)); + expect( + tester.widget(find.byType(Container)).color, + equals(Colors.red), + ); await tester.tap(find.text('Green Background')); await tester.pumpAndSettle(); - expect(tester.widget(find.byType(Container)).color, equals(Colors.green)); + expect( + tester.widget(find.byType(Container)).color, + equals(Colors.green), + ); }); testWidgets('Shortcuts work', (WidgetTester tester) async { @@ -39,7 +46,10 @@ void main() { expect(find.text('Green Background'), findsOneWidget); expect(find.text('Blue Background'), findsOneWidget); expect(find.byType(Radio), findsNWidgets(3)); - expect(tester.widget(find.byType(Container)).color, equals(Colors.red)); + expect( + tester.widget(find.byType(Container)).color, + equals(Colors.red), + ); await tester.sendKeyDownEvent(LogicalKeyboardKey.controlLeft); await tester.sendKeyEvent(LogicalKeyboardKey.keyG); @@ -57,10 +67,16 @@ void main() { matching: find.byType(Radio), ), ) + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use .groupValue, equals(Colors.green), ); - expect(tester.widget(find.byType(Container)).color, equals(Colors.green)); + expect( + tester.widget(find.byType(Container)).color, + equals(Colors.green), + ); await tester.sendKeyDownEvent(LogicalKeyboardKey.controlLeft); await tester.sendKeyEvent(LogicalKeyboardKey.keyR); @@ -76,10 +92,16 @@ void main() { matching: find.byType(Radio), ), ) + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use .groupValue, equals(Colors.red), ); - expect(tester.widget(find.byType(Container)).color, equals(Colors.red)); + expect( + tester.widget(find.byType(Container)).color, + equals(Colors.red), + ); await tester.sendKeyDownEvent(LogicalKeyboardKey.controlLeft); await tester.sendKeyEvent(LogicalKeyboardKey.keyB); @@ -95,21 +117,34 @@ void main() { matching: find.byType(Radio), ), ) + // TODO(loic-sharma): Migrate to RadioGroup. + // https://github.com/flutter/flutter/issues/179088 + // ignore: deprecated_member_use .groupValue, equals(Colors.blue), ); - expect(tester.widget(find.byType(Container)).color, equals(Colors.blue)); + expect( + tester.widget(find.byType(Container)).color, + equals(Colors.blue), + ); }); - testWidgets('MenuAnchor is wrapped in a SafeArea', (WidgetTester tester) async { + testWidgets('MenuAnchor is wrapped in a SafeArea', ( + WidgetTester tester, + ) async { const double safeAreaPadding = 100.0; await tester.pumpWidget( const MediaQuery( - data: MediaQueryData(padding: EdgeInsets.symmetric(vertical: safeAreaPadding)), + data: MediaQueryData( + padding: EdgeInsets.symmetric(vertical: safeAreaPadding), + ), child: example.MenuApp(), ), ); - expect(tester.getTopLeft(find.byType(MenuAnchor)), const Offset(0.0, safeAreaPadding)); + expect( + tester.getTopLeft(find.byType(MenuAnchor)), + const Offset(0.0, safeAreaPadding), + ); }); } diff --git a/examples/api/test/material/navigation_bar/navigation_bar.0_test.dart b/examples/api/test/material/navigation_bar/navigation_bar.0_test.dart index 644a2057f29..8b676f0bd80 100644 --- a/examples/api/test/material/navigation_bar/navigation_bar.0_test.dart +++ b/examples/api/test/material/navigation_bar/navigation_bar.0_test.dart @@ -3,13 +3,18 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/navigation_bar/navigation_bar.0.dart' as example; +import 'package:flutter_api_samples/material/navigation_bar/navigation_bar.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Navigation bar updates destination on tap', (WidgetTester tester) async { + testWidgets('Navigation bar updates destination on tap', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.NavigationBarApp()); - final NavigationBar navigationBarWidget = tester.firstWidget(find.byType(NavigationBar)); + final NavigationBar navigationBarWidget = tester.firstWidget( + find.byType(NavigationBar), + ); /// NavigationDestinations must be rendered expect(find.text('Home'), findsOneWidget); @@ -18,13 +23,19 @@ void main() { /// Test notification badge. final Badge notificationBadge = tester.firstWidget( - find.ancestor(of: find.byIcon(Icons.notifications_sharp), matching: find.byType(Badge)), + find.ancestor( + of: find.byIcon(Icons.notifications_sharp), + matching: find.byType(Badge), + ), ); expect(notificationBadge.label, null); /// Test messages badge. final Badge messagesBadge = tester.firstWidget( - find.ancestor(of: find.byIcon(Icons.messenger_sharp), matching: find.byType(Badge)), + find.ancestor( + of: find.byIcon(Icons.messenger_sharp), + matching: find.byType(Badge), + ), ); expect(messagesBadge.label, isNotNull); diff --git a/examples/api/test/material/navigation_bar/navigation_bar.1_test.dart b/examples/api/test/material/navigation_bar/navigation_bar.1_test.dart index 484a4cd0d2d..416509c379c 100644 --- a/examples/api/test/material/navigation_bar/navigation_bar.1_test.dart +++ b/examples/api/test/material/navigation_bar/navigation_bar.1_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/navigation_bar/navigation_bar.1.dart' as example; +import 'package:flutter_api_samples/material/navigation_bar/navigation_bar.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -11,7 +12,9 @@ void main() { WidgetTester tester, ) async { await tester.pumpWidget(const example.NavigationBarApp()); - NavigationBar navigationBarWidget = tester.firstWidget(find.byType(NavigationBar)); + NavigationBar navigationBarWidget = tester.firstWidget( + find.byType(NavigationBar), + ); expect(find.text('Label behavior: alwaysShow'), findsOneWidget); @@ -20,7 +23,10 @@ void main() { await tester.pumpAndSettle(); expect(find.text('Label behavior: alwaysShow'), findsOneWidget); - expect(navigationBarWidget.labelBehavior, NavigationDestinationLabelBehavior.alwaysShow); + expect( + navigationBarWidget.labelBehavior, + NavigationDestinationLabelBehavior.alwaysShow, + ); /// Test onlyShowSelected label behavior button. await tester.tap(find.widgetWithText(ElevatedButton, 'onlyShowSelected')); @@ -28,7 +34,10 @@ void main() { expect(find.text('Label behavior: onlyShowSelected'), findsOneWidget); navigationBarWidget = tester.firstWidget(find.byType(NavigationBar)); - expect(navigationBarWidget.labelBehavior, NavigationDestinationLabelBehavior.onlyShowSelected); + expect( + navigationBarWidget.labelBehavior, + NavigationDestinationLabelBehavior.onlyShowSelected, + ); /// Test alwaysHide label behavior button. await tester.tap(find.widgetWithText(ElevatedButton, 'alwaysHide')); @@ -36,13 +45,20 @@ void main() { expect(find.text('Label behavior: alwaysHide'), findsOneWidget); navigationBarWidget = tester.firstWidget(find.byType(NavigationBar)); - expect(navigationBarWidget.labelBehavior, NavigationDestinationLabelBehavior.alwaysHide); + expect( + navigationBarWidget.labelBehavior, + NavigationDestinationLabelBehavior.alwaysHide, + ); }); - testWidgets('Overflow buttons are aligned in the center', (WidgetTester tester) async { + testWidgets('Overflow buttons are aligned in the center', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.NavigationBarApp()); - final OverflowBar overflowBar = tester.widget(find.byType(OverflowBar)); + final OverflowBar overflowBar = tester.widget( + find.byType(OverflowBar), + ); expect(overflowBar.overflowAlignment, OverflowBarAlignment.center); expect(overflowBar.overflowSpacing, 10.0); }); diff --git a/examples/api/test/material/navigation_bar/navigation_bar.2_test.dart b/examples/api/test/material/navigation_bar/navigation_bar.2_test.dart index 5c4d4964782..aa2cf31a8fe 100644 --- a/examples/api/test/material/navigation_bar/navigation_bar.2_test.dart +++ b/examples/api/test/material/navigation_bar/navigation_bar.2_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/navigation_bar/navigation_bar.2.dart' as example; +import 'package:flutter_api_samples/material/navigation_bar/navigation_bar.2.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('RootPage: only selected destination is on stage', (WidgetTester tester) async { + testWidgets('RootPage: only selected destination is on stage', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const MaterialApp(home: example.Home())); const String tealTitle = 'Teal RootPage - /'; diff --git a/examples/api/test/material/navigation_drawer/navigation_drawer.0_test.dart b/examples/api/test/material/navigation_drawer/navigation_drawer.0_test.dart index 1ec3b4db26e..e2f4db9fbc7 100644 --- a/examples/api/test/material/navigation_drawer/navigation_drawer.0_test.dart +++ b/examples/api/test/material/navigation_drawer/navigation_drawer.0_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/navigation_drawer/navigation_drawer.0.dart' as example; +import 'package:flutter_api_samples/material/navigation_drawer/navigation_drawer.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Navigation bar updates destination on tap', (WidgetTester tester) async { + testWidgets('Navigation bar updates destination on tap', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.NavigationDrawerApp()); await tester.tap(find.text('Open Drawer')); @@ -27,12 +30,16 @@ void main() { expect(find.text('Page Index = 0'), findsOneWidget); /// Switch to second tab - await tester.tap(find.ancestor(of: find.text('Profile'), matching: find.byType(InkWell))); + await tester.tap( + find.ancestor(of: find.text('Profile'), matching: find.byType(InkWell)), + ); await tester.pumpAndSettle(); expect(find.text('Page Index = 1'), findsOneWidget); /// Switch to fourth tab - await tester.tap(find.ancestor(of: find.text('Settings'), matching: find.byType(InkWell))); + await tester.tap( + find.ancestor(of: find.text('Settings'), matching: find.byType(InkWell)), + ); await tester.pumpAndSettle(); expect(find.text('Page Index = 2'), findsOneWidget); }); diff --git a/examples/api/test/material/navigation_rail/navigation_rail.0_test.dart b/examples/api/test/material/navigation_rail/navigation_rail.0_test.dart index 8da63b28c1a..bbb7ed63c92 100644 --- a/examples/api/test/material/navigation_rail/navigation_rail.0_test.dart +++ b/examples/api/test/material/navigation_rail/navigation_rail.0_test.dart @@ -3,13 +3,18 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/navigation_rail/navigation_rail.0.dart' as example; +import 'package:flutter_api_samples/material/navigation_rail/navigation_rail.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('NavigationRail updates destination on tap', (WidgetTester tester) async { + testWidgets('NavigationRail updates destination on tap', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.NavigationRailExampleApp()); - final NavigationRail navigationRailWidget = tester.firstWidget(find.byType(NavigationRail)); + final NavigationRail navigationRailWidget = tester.firstWidget( + find.byType(NavigationRail), + ); /// NavigationRailDestinations must be rendered expect(find.text('First'), findsOneWidget); @@ -47,7 +52,9 @@ void main() { expect(find.text('Label type: none'), findsOneWidget); }); - testWidgets('Navigation rail updates group alignment', (WidgetTester tester) async { + testWidgets('Navigation rail updates group alignment', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.NavigationRailExampleApp()); // initial group alignment set top top. @@ -64,7 +71,9 @@ void main() { expect(find.text('Group alignment: 1.0'), findsOneWidget); }); - testWidgets('NavigationRail shows leading/trailing widgets', (WidgetTester tester) async { + testWidgets('NavigationRail shows leading/trailing widgets', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.NavigationRailExampleApp()); // Initially leading/trailing widgets are hidden. @@ -89,13 +98,19 @@ void main() { // Test badge without label. final Badge notificationBadge = tester.firstWidget( - find.ancestor(of: find.byIcon(Icons.bookmark_border), matching: find.byType(Badge)), + find.ancestor( + of: find.byIcon(Icons.bookmark_border), + matching: find.byType(Badge), + ), ); expect(notificationBadge.label, null); // Test badge with label. final Badge messagesBadge = tester.firstWidget( - find.ancestor(of: find.byIcon(Icons.star_border), matching: find.byType(Badge)), + find.ancestor( + of: find.byIcon(Icons.star_border), + matching: find.byType(Badge), + ), ); expect(messagesBadge.label, isNotNull); }); diff --git a/examples/api/test/material/navigation_rail/navigation_rail.extended_animation.0_test.dart b/examples/api/test/material/navigation_rail/navigation_rail.extended_animation.0_test.dart index cd9fae446c3..3b5c63ba162 100644 --- a/examples/api/test/material/navigation_rail/navigation_rail.extended_animation.0_test.dart +++ b/examples/api/test/material/navigation_rail/navigation_rail.extended_animation.0_test.dart @@ -8,57 +8,58 @@ import 'package:flutter_api_samples/material/navigation_rail/navigation_rail.ext import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Navigation rail animates itself between the normal and extended state', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.ExtendedAnimationExampleApp()); + testWidgets( + 'Navigation rail animates itself between the normal and extended state', + (WidgetTester tester) async { + await tester.pumpWidget(const example.ExtendedAnimationExampleApp()); - expect(find.text('Tap on FloatingActionButton to expand'), findsOne); - expect(find.widgetWithIcon(FloatingActionButton, Icons.add), findsOne); - expect(find.byIcon(Icons.favorite), findsOne); - expect(find.text('First'), findsOne); - expect(find.byIcon(Icons.bookmark_border), findsOne); - expect(find.text('Second'), findsOne); - expect(find.byIcon(Icons.star_border), findsOne); - expect(find.text('First'), findsOne); + expect(find.text('Tap on FloatingActionButton to expand'), findsOne); + expect(find.widgetWithIcon(FloatingActionButton, Icons.add), findsOne); + expect(find.byIcon(Icons.favorite), findsOne); + expect(find.text('First'), findsOne); + expect(find.byIcon(Icons.bookmark_border), findsOne); + expect(find.text('Second'), findsOne); + expect(find.byIcon(Icons.star_border), findsOne); + expect(find.text('First'), findsOne); - // The navigation rail should be in the normal state. - expect( - tester.getCenter(find.byType(FloatingActionButton)), - offsetMoreOrLessEquals(const Offset(40, 36), epsilon: 0.1), - ); - expect(find.widgetWithText(FloatingActionButton, 'CREATE'), findsNothing); + // The navigation rail should be in the normal state. + expect( + tester.getCenter(find.byType(FloatingActionButton)), + offsetMoreOrLessEquals(const Offset(40, 36), epsilon: 0.1), + ); + expect(find.widgetWithText(FloatingActionButton, 'CREATE'), findsNothing); - // Expand the navigation rail. - await tester.tap(find.byType(FloatingActionButton)); - await tester.pump(); - await tester.pump(kThemeAnimationDuration * 0.5); - expect( - tester.getCenter(find.byType(FloatingActionButton)), - offsetMoreOrLessEquals(const Offset(128.1, 36), epsilon: 0.1), - ); + // Expand the navigation rail. + await tester.tap(find.byType(FloatingActionButton)); + await tester.pump(); + await tester.pump(kThemeAnimationDuration * 0.5); + expect( + tester.getCenter(find.byType(FloatingActionButton)), + offsetMoreOrLessEquals(const Offset(128.1, 36), epsilon: 0.1), + ); - await tester.pump(kThemeAnimationDuration * 0.5); - expect( - tester.getCenter(find.byType(FloatingActionButton)), - offsetMoreOrLessEquals(const Offset(132, 36), epsilon: 0.1), - ); - expect(find.widgetWithText(FloatingActionButton, 'CREATE'), findsOne); + await tester.pump(kThemeAnimationDuration * 0.5); + expect( + tester.getCenter(find.byType(FloatingActionButton)), + offsetMoreOrLessEquals(const Offset(132, 36), epsilon: 0.1), + ); + expect(find.widgetWithText(FloatingActionButton, 'CREATE'), findsOne); - // Collapse the navigation rail. - await tester.tap(find.byType(FloatingActionButton)); - await tester.pump(); - await tester.pump(kThemeAnimationDuration * 0.5); - expect( - tester.getCenter(find.byType(FloatingActionButton)), - offsetMoreOrLessEquals(const Offset(128.1, 36), epsilon: 0.1), - ); + // Collapse the navigation rail. + await tester.tap(find.byType(FloatingActionButton)); + await tester.pump(); + await tester.pump(kThemeAnimationDuration * 0.5); + expect( + tester.getCenter(find.byType(FloatingActionButton)), + offsetMoreOrLessEquals(const Offset(128.1, 36), epsilon: 0.1), + ); - await tester.pump(kThemeAnimationDuration * 0.5); - expect( - tester.getCenter(find.byType(FloatingActionButton)), - offsetMoreOrLessEquals(const Offset(40, 36), epsilon: 0.1), - ); - expect(find.widgetWithText(FloatingActionButton, 'CREATE'), findsNothing); - }); + await tester.pump(kThemeAnimationDuration * 0.5); + expect( + tester.getCenter(find.byType(FloatingActionButton)), + offsetMoreOrLessEquals(const Offset(40, 36), epsilon: 0.1), + ); + expect(find.widgetWithText(FloatingActionButton, 'CREATE'), findsNothing); + }, + ); } diff --git a/examples/api/test/material/outlined_button/outlined_button.0_test.dart b/examples/api/test/material/outlined_button/outlined_button.0_test.dart index d233da0b54c..8a57ea089b7 100644 --- a/examples/api/test/material/outlined_button/outlined_button.0_test.dart +++ b/examples/api/test/material/outlined_button/outlined_button.0_test.dart @@ -3,17 +3,26 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/outlined_button/outlined_button.0.dart' as example; +import 'package:flutter_api_samples/material/outlined_button/outlined_button.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('OutlinedButton Smoke Test', (WidgetTester tester) async { await tester.pumpWidget(const example.OutlinedButtonExampleApp()); - expect(find.widgetWithText(AppBar, 'OutlinedButton Sample'), findsOneWidget); - final Finder outlinedButton = find.widgetWithText(OutlinedButton, 'Click Me'); + expect( + find.widgetWithText(AppBar, 'OutlinedButton Sample'), + findsOneWidget, + ); + final Finder outlinedButton = find.widgetWithText( + OutlinedButton, + 'Click Me', + ); expect(outlinedButton, findsOneWidget); - final OutlinedButton outlinedButtonWidget = tester.widget(outlinedButton); + final OutlinedButton outlinedButtonWidget = tester.widget( + outlinedButton, + ); expect(outlinedButtonWidget.onPressed.runtimeType, VoidCallback); }); } diff --git a/examples/api/test/material/page_transitions_theme/page_transitions_theme.0_test.dart b/examples/api/test/material/page_transitions_theme/page_transitions_theme.0_test.dart index 54023d37688..522336d8d17 100644 --- a/examples/api/test/material/page_transitions_theme/page_transitions_theme.0_test.dart +++ b/examples/api/test/material/page_transitions_theme/page_transitions_theme.0_test.dart @@ -8,24 +8,37 @@ import 'package:flutter_api_samples/material/page_transitions_theme/page_transit import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('MaterialApp defines a custom PageTransitionsTheme', (WidgetTester tester) async { + testWidgets('MaterialApp defines a custom PageTransitionsTheme', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.PageTransitionsThemeApp()); final Finder homePage = find.byType(example.HomePage); expect(homePage, findsOneWidget); - final PageTransitionsTheme theme = Theme.of(tester.element(homePage)).pageTransitionsTheme; + final PageTransitionsTheme theme = Theme.of( + tester.element(homePage), + ).pageTransitionsTheme; expect(theme.builders, isNotNull); // Check defined page transitions builder for each platform. for (final TargetPlatform platform in TargetPlatform.values) { switch (platform) { case TargetPlatform.iOS: - expect(theme.builders[platform], isA()); + expect( + theme.builders[platform], + isA(), + ); case TargetPlatform.linux: - expect(theme.builders[platform], isA()); + expect( + theme.builders[platform], + isA(), + ); case TargetPlatform.macOS: - expect(theme.builders[platform], isA()); + expect( + theme.builders[platform], + isA(), + ); case TargetPlatform.android: case TargetPlatform.fuchsia: case TargetPlatform.windows: diff --git a/examples/api/test/material/page_transitions_theme/page_transitions_theme.1_test.dart b/examples/api/test/material/page_transitions_theme/page_transitions_theme.1_test.dart index 10630f770e3..68098c29f1a 100644 --- a/examples/api/test/material/page_transitions_theme/page_transitions_theme.1_test.dart +++ b/examples/api/test/material/page_transitions_theme/page_transitions_theme.1_test.dart @@ -8,13 +8,17 @@ import 'package:flutter_api_samples/material/page_transitions_theme/page_transit import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('MaterialApp defines a custom PageTransitionsTheme', (WidgetTester tester) async { + testWidgets('MaterialApp defines a custom PageTransitionsTheme', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.PageTransitionsThemeApp()); final Finder homePage = find.byType(example.HomePage); expect(homePage, findsOneWidget); - final PageTransitionsTheme theme = Theme.of(tester.element(homePage)).pageTransitionsTheme; + final PageTransitionsTheme theme = Theme.of( + tester.element(homePage), + ).pageTransitionsTheme; expect(theme.builders, isNotNull); // Check defined page transitions builder for each platform. diff --git a/examples/api/test/material/platform_menu_bar/platform_menu_bar.0_test.dart b/examples/api/test/material/platform_menu_bar/platform_menu_bar.0_test.dart index 90aff88f137..476b6f5718b 100644 --- a/examples/api/test/material/platform_menu_bar/platform_menu_bar.0_test.dart +++ b/examples/api/test/material/platform_menu_bar/platform_menu_bar.0_test.dart @@ -4,7 +4,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_api_samples/material/platform_menu_bar/platform_menu_bar.0.dart' as example; +import 'package:flutter_api_samples/material/platform_menu_bar/platform_menu_bar.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -31,7 +32,9 @@ void main() { await tester.pumpWidget(const example.ExampleApp()); expect( - find.text('This space intentionally left blank.\nShow a message here using the menu.'), + find.text( + 'This space intentionally left blank.\nShow a message here using the menu.', + ), findsOne, ); expect(find.byType(PlatformMenuBar), findsOne); @@ -69,7 +72,8 @@ void main() { }, { 'id': 7, - 'label': "There's a million things I haven't done, but just you wait.", + 'label': + "There's a million things I haven't done, but just you wait.", 'enabled': true, 'shortcutTrigger': 50, 'shortcutModifiers': 1, @@ -77,14 +81,20 @@ void main() { ], }, {'id': 9, 'isDivider': true}, - {'id': 10, 'enabled': true, 'platformProvidedMenu': 1}, + { + 'id': 10, + 'enabled': true, + 'platformProvidedMenu': 1, + }, ], }, ], }), ); }, - variant: const TargetPlatformVariant({TargetPlatform.macOS}), + variant: const TargetPlatformVariant({ + TargetPlatform.macOS, + }), ); } @@ -121,5 +131,6 @@ class _FakeMenuChannel implements MethodChannel { String get name => 'flutter/menu'; @override - void setMethodCallHandler(Future Function(MethodCall call)? handler) => incoming = handler; + void setMethodCallHandler(Future Function(MethodCall call)? handler) => + incoming = handler; } diff --git a/examples/api/test/material/popup_menu/popup_menu.0_test.dart b/examples/api/test/material/popup_menu/popup_menu.0_test.dart index c82cc6a9ba0..293454c827f 100644 --- a/examples/api/test/material/popup_menu/popup_menu.0_test.dart +++ b/examples/api/test/material/popup_menu/popup_menu.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/popup_menu/popup_menu.0.dart' as example; +import 'package:flutter_api_samples/material/popup_menu/popup_menu.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/popup_menu/popup_menu.1_test.dart b/examples/api/test/material/popup_menu/popup_menu.1_test.dart index 4726d80bee2..ce7bd9d6678 100644 --- a/examples/api/test/material/popup_menu/popup_menu.1_test.dart +++ b/examples/api/test/material/popup_menu/popup_menu.1_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/popup_menu/popup_menu.1.dart' as example; +import 'package:flutter_api_samples/material/popup_menu/popup_menu.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/popup_menu/popup_menu.2_test.dart b/examples/api/test/material/popup_menu/popup_menu.2_test.dart index 01887df0b0b..7a04e55356e 100644 --- a/examples/api/test/material/popup_menu/popup_menu.2_test.dart +++ b/examples/api/test/material/popup_menu/popup_menu.2_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/popup_menu/popup_menu.2.dart' as example; +import 'package:flutter_api_samples/material/popup_menu/popup_menu.2.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/progress_indicator/circular_progress_indicator.0_test.dart b/examples/api/test/material/progress_indicator/circular_progress_indicator.0_test.dart index 850a8cfd6f3..48bbd674d70 100644 --- a/examples/api/test/material/progress_indicator/circular_progress_indicator.0_test.dart +++ b/examples/api/test/material/progress_indicator/circular_progress_indicator.0_test.dart @@ -15,7 +15,9 @@ void main() { await tester.pump(const Duration(milliseconds: 2500)); final Finder indicatorFinder = find.byType(CircularProgressIndicator).first; - final CircularProgressIndicator progressIndicator = tester.widget(indicatorFinder); + final CircularProgressIndicator progressIndicator = tester.widget( + indicatorFinder, + ); expect(progressIndicator.value, equals(0.5)); }); @@ -26,20 +28,28 @@ void main() { await tester.pump(const Duration(milliseconds: 2500)); final Finder indicatorFinder = find.byType(CircularProgressIndicator).last; - final CircularProgressIndicator progressIndicator = tester.widget(indicatorFinder); + final CircularProgressIndicator progressIndicator = tester.widget( + indicatorFinder, + ); expect(progressIndicator.value, null); }); - testWidgets('Progress indicators year2023 flag can be toggled', (WidgetTester tester) async { + testWidgets('Progress indicators year2023 flag can be toggled', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ProgressIndicatorExampleApp()); - CircularProgressIndicator determinateIndicator = tester.widget( - find.byType(CircularProgressIndicator).first, - ); + CircularProgressIndicator determinateIndicator = tester + .widget( + find.byType(CircularProgressIndicator).first, + ); + // ignore: deprecated_member_use expect(determinateIndicator.year2023, true); - CircularProgressIndicator indeterminateIndicator = tester.widget( - find.byType(CircularProgressIndicator).last, - ); + CircularProgressIndicator indeterminateIndicator = tester + .widget( + find.byType(CircularProgressIndicator).last, + ); + // ignore: deprecated_member_use expect(indeterminateIndicator.year2023, true); await tester.tap(find.byType(SwitchListTile)); @@ -48,10 +58,12 @@ void main() { determinateIndicator = tester.widget( find.byType(CircularProgressIndicator).first, ); + // ignore: deprecated_member_use expect(determinateIndicator.year2023, false); indeterminateIndicator = tester.widget( find.byType(CircularProgressIndicator).last, ); + // ignore: deprecated_member_use expect(indeterminateIndicator.year2023, false); }); } diff --git a/examples/api/test/material/progress_indicator/circular_progress_indicator.1_test.dart b/examples/api/test/material/progress_indicator/circular_progress_indicator.1_test.dart index 539945b373a..aaa3cc84b4d 100644 --- a/examples/api/test/material/progress_indicator/circular_progress_indicator.1_test.dart +++ b/examples/api/test/material/progress_indicator/circular_progress_indicator.1_test.dart @@ -11,7 +11,10 @@ void main() { testWidgets('Finds CircularProgressIndicator', (WidgetTester tester) async { await tester.pumpWidget(const example.ProgressIndicatorExampleApp()); - expect(find.bySemanticsLabel('Circular progress indicator').first, findsOneWidget); + expect( + find.bySemanticsLabel('Circular progress indicator').first, + findsOneWidget, + ); // Test if CircularProgressIndicator is animating. expect(tester.hasRunningAnimations, isTrue); diff --git a/examples/api/test/material/progress_indicator/circular_progress_indicator.2_test.dart b/examples/api/test/material/progress_indicator/circular_progress_indicator.2_test.dart index 2f694ee4455..8d2f993e30d 100644 --- a/examples/api/test/material/progress_indicator/circular_progress_indicator.2_test.dart +++ b/examples/api/test/material/progress_indicator/circular_progress_indicator.2_test.dart @@ -31,13 +31,22 @@ void main() { expect(find.text('Theme controller? No'), findsOne); }); - testWidgets('Theme controller can coordinate progress', (WidgetTester tester) async { - final AnimationController controller = AnimationController(vsync: tester, value: 0.5); + testWidgets('Theme controller can coordinate progress', ( + WidgetTester tester, + ) async { + final AnimationController controller = AnimationController( + vsync: tester, + value: 0.5, + ); addTearDown(controller.dispose); await tester.pumpWidget( Theme( - data: ThemeData(progressIndicatorTheme: ProgressIndicatorThemeData(controller: controller)), + data: ThemeData( + progressIndicatorTheme: ProgressIndicatorThemeData( + controller: controller, + ), + ), child: const example.ManyProgressIndicators(indicatorNum: 4), ), ); diff --git a/examples/api/test/material/progress_indicator/linear_progress_indicator.0_test.dart b/examples/api/test/material/progress_indicator/linear_progress_indicator.0_test.dart index ecbde410678..6cee15e8ff2 100644 --- a/examples/api/test/material/progress_indicator/linear_progress_indicator.0_test.dart +++ b/examples/api/test/material/progress_indicator/linear_progress_indicator.0_test.dart @@ -15,7 +15,9 @@ void main() { await tester.pump(const Duration(milliseconds: 2500)); final Finder indicatorFinder = find.byType(LinearProgressIndicator).first; - final LinearProgressIndicator progressIndicator = tester.widget(indicatorFinder); + final LinearProgressIndicator progressIndicator = tester.widget( + indicatorFinder, + ); expect(progressIndicator.value, equals(0.5)); }); @@ -26,20 +28,28 @@ void main() { await tester.pump(const Duration(milliseconds: 2500)); final Finder indicatorFinder = find.byType(LinearProgressIndicator).last; - final LinearProgressIndicator progressIndicator = tester.widget(indicatorFinder); + final LinearProgressIndicator progressIndicator = tester.widget( + indicatorFinder, + ); expect(progressIndicator.value, null); }); - testWidgets('Progress indicators year2023 flag can be toggled', (WidgetTester tester) async { + testWidgets('Progress indicators year2023 flag can be toggled', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ProgressIndicatorExampleApp()); - LinearProgressIndicator determinateIndicator = tester.widget( - find.byType(LinearProgressIndicator).first, - ); + LinearProgressIndicator determinateIndicator = tester + .widget( + find.byType(LinearProgressIndicator).first, + ); + // ignore: deprecated_member_use expect(determinateIndicator.year2023, true); - LinearProgressIndicator indeterminateIndicator = tester.widget( - find.byType(LinearProgressIndicator).last, - ); + LinearProgressIndicator indeterminateIndicator = tester + .widget( + find.byType(LinearProgressIndicator).last, + ); + // ignore: deprecated_member_use expect(indeterminateIndicator.year2023, true); await tester.tap(find.byType(SwitchListTile)); @@ -48,10 +58,12 @@ void main() { determinateIndicator = tester.widget( find.byType(LinearProgressIndicator).first, ); + // ignore: deprecated_member_use expect(determinateIndicator.year2023, false); indeterminateIndicator = tester.widget( find.byType(LinearProgressIndicator).last, ); + // ignore: deprecated_member_use expect(indeterminateIndicator.year2023, false); }); } diff --git a/examples/api/test/material/progress_indicator/linear_progress_indicator.1_test.dart b/examples/api/test/material/progress_indicator/linear_progress_indicator.1_test.dart index 475df402717..bfb943e30e5 100644 --- a/examples/api/test/material/progress_indicator/linear_progress_indicator.1_test.dart +++ b/examples/api/test/material/progress_indicator/linear_progress_indicator.1_test.dart @@ -8,10 +8,15 @@ import 'package:flutter_api_samples/material/progress_indicator/linear_progress_ import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Can control LinearProgressIndicator value', (WidgetTester tester) async { + testWidgets('Can control LinearProgressIndicator value', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ProgressIndicatorExampleApp()); - expect(find.bySemanticsLabel('Linear progress indicator').first, findsOneWidget); + expect( + find.bySemanticsLabel('Linear progress indicator').first, + findsOneWidget, + ); // Test if LinearProgressIndicator is animating. expect(tester.hasRunningAnimations, isTrue); diff --git a/examples/api/test/material/radio/radio.0_test.dart b/examples/api/test/material/radio/radio.0_test.dart index 33996d27802..3967eaa9bb7 100644 --- a/examples/api/test/material/radio/radio.0_test.dart +++ b/examples/api/test/material/radio/radio.0_test.dart @@ -16,28 +16,42 @@ void main() { final Finder listTile2 = find.widgetWithText(ListTile, 'Thomas Jefferson'); expect(listTile2, findsOneWidget); - final Finder radioButton1 = find.byType(Radio).first; - final Finder radioButton2 = find.byType(Radio).last; - final Finder radioGroup = find.byType(RadioGroup).last; + final Finder radioButton1 = find + .byType(Radio) + .first; + final Finder radioButton2 = find + .byType(Radio) + .last; + final Finder radioGroup = find + .byType(RadioGroup) + .last; await tester.tap(radioButton1); await tester.pumpAndSettle(); expect( - tester.widget>(radioGroup).groupValue, + tester + .widget>(radioGroup) + .groupValue, tester.widget>(radioButton1).value, ); expect( - tester.widget>(radioGroup).groupValue, + tester + .widget>(radioGroup) + .groupValue, isNot(tester.widget>(radioButton2).value), ); await tester.tap(radioButton2); await tester.pumpAndSettle(); expect( - tester.widget>(radioGroup).groupValue, + tester + .widget>(radioGroup) + .groupValue, isNot(tester.widget>(radioButton1).value), ); expect( - tester.widget>(radioGroup).groupValue, + tester + .widget>(radioGroup) + .groupValue, tester.widget>(radioButton2).value, ); }); diff --git a/examples/api/test/material/radio/radio.1_test.dart b/examples/api/test/material/radio/radio.1_test.dart index 3589040c756..0b818f91912 100644 --- a/examples/api/test/material/radio/radio.1_test.dart +++ b/examples/api/test/material/radio/radio.1_test.dart @@ -16,20 +16,29 @@ void main() { expect(find.widgetWithText(ListTile, 'Side'), findsOne); expect(find.widgetWithText(ListTile, 'Inner radius'), findsOne); - final Radio radioFillColor = tester.widget>( - find.byType(Radio).first, - ); + final Radio radioFillColor = tester + .widget>( + find.byType(Radio).first, + ); expect( - radioFillColor.fillColor!.resolve(const {WidgetState.selected}), + radioFillColor.fillColor!.resolve(const { + WidgetState.selected, + }), Colors.deepPurple, ); - expect(radioFillColor.fillColor!.resolve(const {}), Colors.deepPurple.shade200); - - final Radio radioBackgroundColor = tester.widget>( - find.byType(Radio).at(1), - ); expect( - radioBackgroundColor.backgroundColor!.resolve(const {WidgetState.selected}), + radioFillColor.fillColor!.resolve(const {}), + Colors.deepPurple.shade200, + ); + + final Radio radioBackgroundColor = tester + .widget>( + find.byType(Radio).at(1), + ); + expect( + radioBackgroundColor.backgroundColor!.resolve(const { + WidgetState.selected, + }), Colors.greenAccent.withValues(alpha: 0.5), ); expect( @@ -37,21 +46,38 @@ void main() { Colors.grey.shade300.withValues(alpha: 0.3), ); - final Radio radioSide = tester.widget>( - find.byType(Radio).at(2), - ); + final Radio radioSide = tester + .widget>( + find.byType(Radio).at(2), + ); expect( - (radioSide.side! as WidgetStateBorderSide).resolve(const {WidgetState.selected}), - const BorderSide(color: Colors.red, width: 4, strokeAlign: BorderSide.strokeAlignCenter), + (radioSide.side! as WidgetStateBorderSide).resolve(const { + WidgetState.selected, + }), + const BorderSide( + color: Colors.red, + width: 4, + strokeAlign: BorderSide.strokeAlignCenter, + ), ); expect( (radioSide.side! as WidgetStateBorderSide).resolve(const {}), - const BorderSide(color: Colors.grey, width: 1.5, strokeAlign: BorderSide.strokeAlignCenter), + const BorderSide( + color: Colors.grey, + width: 1.5, + strokeAlign: BorderSide.strokeAlignCenter, + ), ); - final Radio radioInnerRadius = tester.widget>( - find.byType(Radio).last, + final Radio radioInnerRadius = tester + .widget>( + find.byType(Radio).last, + ); + expect( + radioInnerRadius.innerRadius!.resolve(const { + WidgetState.selected, + }), + 6, ); - expect(radioInnerRadius.innerRadius!.resolve(const {WidgetState.selected}), 6); }); } diff --git a/examples/api/test/material/radio/radio.toggleable.0_test.dart b/examples/api/test/material/radio/radio.toggleable.0_test.dart index b010edd2826..c7792211dd4 100644 --- a/examples/api/test/material/radio/radio.toggleable.0_test.dart +++ b/examples/api/test/material/radio/radio.toggleable.0_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/radio/radio.toggleable.0.dart' as example; +import 'package:flutter_api_samples/material/radio/radio.toggleable.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('StreamBuilder listens to internal stream', (WidgetTester tester) async { + testWidgets('StreamBuilder listens to internal stream', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ToggleableExampleApp()); expect(find.byType(Radio), findsExactly(5)); @@ -22,7 +25,8 @@ void main() { await tester.pump(); expect( find.byWidgetPredicate( - (Widget widget) => widget is RadioGroup && widget.groupValue == i, + (Widget widget) => + widget is RadioGroup && widget.groupValue == i, ), findsOne, ); diff --git a/examples/api/test/material/radio_list_tile/custom_labeled_radio.0_test.dart b/examples/api/test/material/radio_list_tile/custom_labeled_radio.0_test.dart index af5a7a47e0b..9f348a0de01 100644 --- a/examples/api/test/material/radio_list_tile/custom_labeled_radio.0_test.dart +++ b/examples/api/test/material/radio_list_tile/custom_labeled_radio.0_test.dart @@ -8,14 +8,18 @@ import 'package:flutter_api_samples/material/radio_list_tile/custom_labeled_radi import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('LinkedLabelRadio contains RichText and Radio', (WidgetTester tester) async { + testWidgets('LinkedLabelRadio contains RichText and Radio', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.LabeledRadioApp()); // Label text is in a RichText widget with the correct text. final RichText richText = tester.widget(find.byType(RichText).first); expect(richText.text.toPlainText(), 'First tappable label text'); - RadioGroup group = tester.widget>(find.byType(RadioGroup)); + RadioGroup group = tester.widget>( + find.byType(RadioGroup), + ); // Second radio is checked. expect(group.groupValue, isFalse); diff --git a/examples/api/test/material/radio_list_tile/custom_labeled_radio.1_test.dart b/examples/api/test/material/radio_list_tile/custom_labeled_radio.1_test.dart index a12e6bf987a..82d150ca21f 100644 --- a/examples/api/test/material/radio_list_tile/custom_labeled_radio.1_test.dart +++ b/examples/api/test/material/radio_list_tile/custom_labeled_radio.1_test.dart @@ -8,10 +8,14 @@ import 'package:flutter_api_samples/material/radio_list_tile/custom_labeled_radi import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Tapping LabeledRadio toggles the radio', (WidgetTester tester) async { + testWidgets('Tapping LabeledRadio toggles the radio', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.LabeledRadioApp()); - RadioGroup group = tester.widget>(find.byType(RadioGroup)); + RadioGroup group = tester.widget>( + find.byType(RadioGroup), + ); // Second radio is checked. expect(group.groupValue, isFalse); diff --git a/examples/api/test/material/radio_list_tile/radio_list_tile.0_test.dart b/examples/api/test/material/radio_list_tile/radio_list_tile.0_test.dart index 962797c4840..6c5416895d9 100644 --- a/examples/api/test/material/radio_list_tile/radio_list_tile.0_test.dart +++ b/examples/api/test/material/radio_list_tile/radio_list_tile.0_test.dart @@ -3,15 +3,21 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/radio_list_tile/radio_list_tile.0.dart' as example; +import 'package:flutter_api_samples/material/radio_list_tile/radio_list_tile.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Can update RadioListTile group value', (WidgetTester tester) async { + testWidgets('Can update RadioListTile group value', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.RadioListTileApp()); // Find the number of RadioListTiles. - expect(find.byType(RadioListTile), findsNWidgets(2)); + expect( + find.byType(RadioListTile), + findsNWidgets(2), + ); // The initial group value is lafayette. RadioGroup group = tester diff --git a/examples/api/test/material/radio_list_tile/radio_list_tile.1_test.dart b/examples/api/test/material/radio_list_tile/radio_list_tile.1_test.dart index fb51907f5c1..8dbe84ef419 100644 --- a/examples/api/test/material/radio_list_tile/radio_list_tile.1_test.dart +++ b/examples/api/test/material/radio_list_tile/radio_list_tile.1_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/radio_list_tile/radio_list_tile.1.dart' as example; +import 'package:flutter_api_samples/material/radio_list_tile/radio_list_tile.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -12,20 +13,32 @@ void main() { expect(find.byType(RadioListTile), findsNWidgets(3)); - Offset tileTopLeft = tester.getTopLeft(find.byType(RadioListTile).at(0)); - Offset radioTopLeft = tester.getTopLeft(find.byType(Radio).at(0)); + Offset tileTopLeft = tester.getTopLeft( + find.byType(RadioListTile).at(0), + ); + Offset radioTopLeft = tester.getTopLeft( + find.byType(Radio).at(0), + ); // The radio is centered vertically with the text. expect(radioTopLeft - tileTopLeft, const Offset(16.0, 16.0)); - tileTopLeft = tester.getTopLeft(find.byType(RadioListTile).at(1)); - radioTopLeft = tester.getTopLeft(find.byType(Radio).at(1)); + tileTopLeft = tester.getTopLeft( + find.byType(RadioListTile).at(1), + ); + radioTopLeft = tester.getTopLeft( + find.byType(Radio).at(1), + ); // The radio is centered vertically with the text. expect(radioTopLeft - tileTopLeft, const Offset(16.0, 30.0)); - tileTopLeft = tester.getTopLeft(find.byType(RadioListTile).at(2)); - radioTopLeft = tester.getTopLeft(find.byType(Radio).at(2)); + tileTopLeft = tester.getTopLeft( + find.byType(RadioListTile).at(2), + ); + radioTopLeft = tester.getTopLeft( + find.byType(Radio).at(2), + ); // The radio is aligned to the top vertically with the text. expect(radioTopLeft - tileTopLeft, const Offset(16.0, 8.0)); @@ -37,9 +50,10 @@ void main() { expect(find.byType(RadioListTile), findsNWidgets(3)); // Initially the first radio is checked. - RadioGroup group = tester.widget>( - find.byType(RadioGroup), - ); + RadioGroup group = tester + .widget>( + find.byType(RadioGroup), + ); expect(group.groupValue, example.Groceries.pickles); // Tap the second radio. diff --git a/examples/api/test/material/radio_list_tile/radio_list_tile.toggleable.0_test.dart b/examples/api/test/material/radio_list_tile/radio_list_tile.toggleable.0_test.dart index e375170d3fc..ac5b7989055 100644 --- a/examples/api/test/material/radio_list_tile/radio_list_tile.toggleable.0_test.dart +++ b/examples/api/test/material/radio_list_tile/radio_list_tile.toggleable.0_test.dart @@ -12,7 +12,9 @@ void main() { await tester.pumpWidget(const example.RadioListTileApp()); // Initially the third radio button is not selected. - RadioGroup group = tester.widget>(find.byType(RadioGroup)); + RadioGroup group = tester.widget>( + find.byType(RadioGroup), + ); expect(group.groupValue, null); // Tap the third radio button. diff --git a/examples/api/test/material/range_slider/range_slider.0_test.dart b/examples/api/test/material/range_slider/range_slider.0_test.dart index 384d34fbf88..a9395db4c0e 100644 --- a/examples/api/test/material/range_slider/range_slider.0_test.dart +++ b/examples/api/test/material/range_slider/range_slider.0_test.dart @@ -4,7 +4,8 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/range_slider/range_slider.0.dart' as example; +import 'package:flutter_api_samples/material/range_slider/range_slider.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -16,7 +17,8 @@ void main() { expect(find.widgetWithText(AppBar, 'RangeSlider Sample'), findsOne); expect( find.byWidgetPredicate( - (Widget widget) => widget is RangeSlider && widget.values == const RangeValues(40, 80), + (Widget widget) => + widget is RangeSlider && widget.values == const RangeValues(40, 80), ), findsOne, ); @@ -28,7 +30,9 @@ void main() { final double endX = rangeSliderRect.centerRight.dx; // Drag the start to 0. - final TestGesture drag = await tester.startGesture(Offset(startX + (endX - startX) * 0.4, y)); + final TestGesture drag = await tester.startGesture( + Offset(startX + (endX - startX) * 0.4, y), + ); await tester.pump(kPressTimeout); await drag.moveTo(rangeSliderRect.centerLeft); await drag.up(); @@ -36,7 +40,8 @@ void main() { expect( find.byWidgetPredicate( - (Widget widget) => widget is RangeSlider && widget.values == const RangeValues(0, 80), + (Widget widget) => + widget is RangeSlider && widget.values == const RangeValues(0, 80), ), findsOne, ); @@ -50,7 +55,8 @@ void main() { expect( find.byWidgetPredicate( - (Widget widget) => widget is RangeSlider && widget.values == const RangeValues(20, 80), + (Widget widget) => + widget is RangeSlider && widget.values == const RangeValues(20, 80), ), findsOne, ); @@ -64,7 +70,8 @@ void main() { expect( find.byWidgetPredicate( - (Widget widget) => widget is RangeSlider && widget.values == const RangeValues(20, 60), + (Widget widget) => + widget is RangeSlider && widget.values == const RangeValues(20, 60), ), findsOne, ); @@ -78,7 +85,9 @@ void main() { expect( find.byWidgetPredicate( - (Widget widget) => widget is RangeSlider && widget.values == const RangeValues(20, 100), + (Widget widget) => + widget is RangeSlider && + widget.values == const RangeValues(20, 100), ), findsOne, ); diff --git a/examples/api/test/material/refresh_indicator/refresh_indicator.0_test.dart b/examples/api/test/material/refresh_indicator/refresh_indicator.0_test.dart index f85c291674b..0b70d91ebb7 100644 --- a/examples/api/test/material/refresh_indicator/refresh_indicator.0_test.dart +++ b/examples/api/test/material/refresh_indicator/refresh_indicator.0_test.dart @@ -3,18 +3,24 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/refresh_indicator/refresh_indicator.0.dart' as example; +import 'package:flutter_api_samples/material/refresh_indicator/refresh_indicator.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Trigger RefreshIndicator - Pull from top', (WidgetTester tester) async { + testWidgets('Trigger RefreshIndicator - Pull from top', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.RefreshIndicatorExampleApp()); await tester.fling(find.text('Item 1'), const Offset(0.0, 300.0), 1000.0); await tester.pump(); await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1)); - expect(tester.getCenter(find.byType(RefreshProgressIndicator)).dy, lessThan(300.0)); + expect( + tester.getCenter(find.byType(RefreshProgressIndicator)).dy, + lessThan(300.0), + ); await tester.pumpAndSettle(); // Advance pending time }); @@ -25,7 +31,10 @@ void main() { await tester.pump(); await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1)); - expect(tester.getCenter(find.byType(RefreshProgressIndicator)).dy, lessThan(300.0)); + expect( + tester.getCenter(find.byType(RefreshProgressIndicator)).dy, + lessThan(300.0), + ); await tester.pumpAndSettle(); // Advance pending time }); } diff --git a/examples/api/test/material/refresh_indicator/refresh_indicator.1_test.dart b/examples/api/test/material/refresh_indicator/refresh_indicator.1_test.dart index 322995a06d8..16a9979e366 100644 --- a/examples/api/test/material/refresh_indicator/refresh_indicator.1_test.dart +++ b/examples/api/test/material/refresh_indicator/refresh_indicator.1_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/refresh_indicator/refresh_indicator.1.dart' as example; +import 'package:flutter_api_samples/material/refresh_indicator/refresh_indicator.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -13,13 +14,21 @@ void main() { await tester.pumpWidget(const example.RefreshIndicatorExampleApp()); // Pull from the upper scroll view. - await tester.fling(find.text('Pull down here').first, const Offset(0.0, 300.0), 1000.0); + await tester.fling( + find.text('Pull down here').first, + const Offset(0.0, 300.0), + 1000.0, + ); await tester.pump(); expect(find.byType(RefreshProgressIndicator), findsNothing); await tester.pumpAndSettle(); // Advance pending time // Pull from the nested scroll view. - await tester.fling(find.text('Pull down here').at(3), const Offset(0.0, 300.0), 1000.0); + await tester.fling( + find.text('Pull down here').at(3), + const Offset(0.0, 300.0), + 1000.0, + ); await tester.pump(); expect(find.byType(RefreshProgressIndicator), findsOneWidget); await tester.pumpAndSettle(); // Advance pending time diff --git a/examples/api/test/material/refresh_indicator/refresh_indicator.2_test.dart b/examples/api/test/material/refresh_indicator/refresh_indicator.2_test.dart index 7b3c6960587..3e647ef5e21 100644 --- a/examples/api/test/material/refresh_indicator/refresh_indicator.2_test.dart +++ b/examples/api/test/material/refresh_indicator/refresh_indicator.2_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/refresh_indicator/refresh_indicator.2.dart' as example; +import 'package:flutter_api_samples/material/refresh_indicator/refresh_indicator.2.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -13,13 +14,20 @@ void main() { await tester.pumpWidget(const example.RefreshIndicatorExampleApp()); // Pull the first item. - await tester.fling(find.text('Pull down here').first, const Offset(0.0, 300.0), 1000.0); + await tester.fling( + find.text('Pull down here').first, + const Offset(0.0, 300.0), + 1000.0, + ); await tester.pump(); await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1)); expect(find.byType(RefreshProgressIndicator), findsNothing); - expect(find.bySemanticsLabel('Circular progress indicator'), findsOneWidget); + expect( + find.bySemanticsLabel('Circular progress indicator'), + findsOneWidget, + ); await tester.pumpAndSettle(); // Advance pending time. }, diff --git a/examples/api/test/material/reorderable_list/reorderable_list_view.0_test.dart b/examples/api/test/material/reorderable_list/reorderable_list_view.0_test.dart index dbf48c3a3d9..d6a0c8c9fc4 100644 --- a/examples/api/test/material/reorderable_list/reorderable_list_view.0_test.dart +++ b/examples/api/test/material/reorderable_list/reorderable_list_view.0_test.dart @@ -14,14 +14,18 @@ void main() { bool item1IsBeforeItem2() { final Iterable texts = tester.widgetList(find.byType(Text)); - final List labels = texts.map((final Text text) => text.data).toList(); + final List labels = texts + .map((final Text text) => text.data) + .toList(); return labels.indexOf('Item 1') < labels.indexOf('Item 2'); } expect(item1IsBeforeItem2(), true); // Drag 'Item 1' after 'Item 4'. - final TestGesture drag = await tester.startGesture(tester.getCenter(find.text('Item 1'))); + final TestGesture drag = await tester.startGesture( + tester.getCenter(find.text('Item 1')), + ); await tester.pump(kLongPressTimeout + kPressTimeout); await tester.pumpAndSettle(); await drag.moveTo(tester.getCenter(find.text('Item 4'))); diff --git a/examples/api/test/material/reorderable_list/reorderable_list_view.1_test.dart b/examples/api/test/material/reorderable_list/reorderable_list_view.1_test.dart index a52ab0273ff..e48ea01b21a 100644 --- a/examples/api/test/material/reorderable_list/reorderable_list_view.1_test.dart +++ b/examples/api/test/material/reorderable_list/reorderable_list_view.1_test.dart @@ -15,7 +15,9 @@ void main() { final ThemeData theme = Theme.of(tester.element(find.byType(MaterialApp))); // Dragged item is wrapped in a Material widget with correct color. - final TestGesture drag = await tester.startGesture(tester.getCenter(find.text('Item 1'))); + final TestGesture drag = await tester.startGesture( + tester.getCenter(find.text('Item 1')), + ); await tester.pump(kLongPressTimeout + kPressTimeout); await tester.pumpAndSettle(); final Material material = tester.widget( diff --git a/examples/api/test/material/reorderable_list/reorderable_list_view.2_test.dart b/examples/api/test/material/reorderable_list/reorderable_list_view.2_test.dart index 28e30101546..5ded1e9ab0a 100644 --- a/examples/api/test/material/reorderable_list/reorderable_list_view.2_test.dart +++ b/examples/api/test/material/reorderable_list/reorderable_list_view.2_test.dart @@ -22,7 +22,9 @@ void main() { expect(findCardOne().elevation, null); // Dragged card is elevated. - final TestGesture drag = await tester.startGesture(tester.getCenter(find.text('Card 1'))); + final TestGesture drag = await tester.startGesture( + tester.getCenter(find.text('Card 1')), + ); await tester.pump(kLongPressTimeout + kPressTimeout); await tester.pumpAndSettle(); expect(findCardOne().elevation, 6); diff --git a/examples/api/test/material/reorderable_list/reorderable_list_view.build_default_drag_handles.0_test.dart b/examples/api/test/material/reorderable_list/reorderable_list_view.build_default_drag_handles.0_test.dart index c58066bce08..a78479e4704 100644 --- a/examples/api/test/material/reorderable_list/reorderable_list_view.build_default_drag_handles.0_test.dart +++ b/examples/api/test/material/reorderable_list/reorderable_list_view.build_default_drag_handles.0_test.dart @@ -8,7 +8,11 @@ import 'package:flutter_api_samples/material/reorderable_list/reorderable_list_v import 'package:flutter_test/flutter_test.dart'; void main() { - Future longPressDrag(WidgetTester tester, Offset start, Offset end) async { + Future longPressDrag( + WidgetTester tester, + Offset start, + Offset end, + ) async { final TestGesture drag = await tester.startGesture(start); await tester.pump(kLongPressTimeout + kPressTimeout); await drag.moveTo(end); diff --git a/examples/api/test/material/reorderable_list/reorderable_list_view.reorderable_list_view_builder.0_test.dart b/examples/api/test/material/reorderable_list/reorderable_list_view.reorderable_list_view_builder.0_test.dart index e00d86ee015..eb7b9e6cf27 100644 --- a/examples/api/test/material/reorderable_list/reorderable_list_view.reorderable_list_view_builder.0_test.dart +++ b/examples/api/test/material/reorderable_list/reorderable_list_view.reorderable_list_view_builder.0_test.dart @@ -8,7 +8,11 @@ import 'package:flutter_api_samples/material/reorderable_list/reorderable_list_v import 'package:flutter_test/flutter_test.dart'; void main() { - Future longPressDrag(WidgetTester tester, Offset start, Offset end) async { + Future longPressDrag( + WidgetTester tester, + Offset start, + Offset end, + ) async { final TestGesture drag = await tester.startGesture(start); await tester.pump(kLongPressTimeout + kPressTimeout); await drag.moveTo(end); diff --git a/examples/api/test/material/scaffold/scaffold.0_test.dart b/examples/api/test/material/scaffold/scaffold.0_test.dart index c77ba50db9d..ebaec42a328 100644 --- a/examples/api/test/material/scaffold/scaffold.0_test.dart +++ b/examples/api/test/material/scaffold/scaffold.0_test.dart @@ -3,23 +3,25 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/scaffold/scaffold.0.dart' as example; +import 'package:flutter_api_samples/material/scaffold/scaffold.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('The count should be incremented when the floating action button is tapped', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.ScaffoldExampleApp()); + testWidgets( + 'The count should be incremented when the floating action button is tapped', + (WidgetTester tester) async { + await tester.pumpWidget(const example.ScaffoldExampleApp()); - expect(find.widgetWithText(AppBar, 'Sample Code'), findsOne); - expect(find.widgetWithIcon(FloatingActionButton, Icons.add), findsOne); - expect(find.text('You have pressed the button 0 times.'), findsOne); + expect(find.widgetWithText(AppBar, 'Sample Code'), findsOne); + expect(find.widgetWithIcon(FloatingActionButton, Icons.add), findsOne); + expect(find.text('You have pressed the button 0 times.'), findsOne); - for (int i = 1; i <= 5; i++) { - await tester.tap(find.byType(FloatingActionButton)); - await tester.pump(); - expect(find.text('You have pressed the button $i times.'), findsOne); - } - }); + for (int i = 1; i <= 5; i++) { + await tester.tap(find.byType(FloatingActionButton)); + await tester.pump(); + expect(find.text('You have pressed the button $i times.'), findsOne); + } + }, + ); } diff --git a/examples/api/test/material/scaffold/scaffold.1_test.dart b/examples/api/test/material/scaffold/scaffold.1_test.dart index 9693f24abde..dbe33d0b909 100644 --- a/examples/api/test/material/scaffold/scaffold.1_test.dart +++ b/examples/api/test/material/scaffold/scaffold.1_test.dart @@ -3,26 +3,30 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/scaffold/scaffold.1.dart' as example; +import 'package:flutter_api_samples/material/scaffold/scaffold.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('The count should be incremented when the floating action button is tapped', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.ScaffoldExampleApp()); + testWidgets( + 'The count should be incremented when the floating action button is tapped', + (WidgetTester tester) async { + await tester.pumpWidget(const example.ScaffoldExampleApp()); - expect(find.widgetWithText(AppBar, 'Sample Code'), findsOne); - expect(find.widgetWithIcon(FloatingActionButton, Icons.add), findsOne); - expect(find.text('You have pressed the button 0 times.'), findsOne); + expect(find.widgetWithText(AppBar, 'Sample Code'), findsOne); + expect(find.widgetWithIcon(FloatingActionButton, Icons.add), findsOne); + expect(find.text('You have pressed the button 0 times.'), findsOne); - for (int i = 1; i <= 5; i++) { - await tester.tap(find.byType(FloatingActionButton)); - await tester.pump(); - expect(find.text('You have pressed the button $i times.'), findsOne); - } + for (int i = 1; i <= 5; i++) { + await tester.tap(find.byType(FloatingActionButton)); + await tester.pump(); + expect(find.text('You have pressed the button $i times.'), findsOne); + } - final Scaffold scaffold = tester.firstWidget(find.byType(Scaffold)); - expect(scaffold.backgroundColor, Colors.blueGrey.shade200); - }); + final Scaffold scaffold = tester.firstWidget( + find.byType(Scaffold), + ); + expect(scaffold.backgroundColor, Colors.blueGrey.shade200); + }, + ); } diff --git a/examples/api/test/material/scaffold/scaffold.2_test.dart b/examples/api/test/material/scaffold/scaffold.2_test.dart index d4603a8eafe..4f07d72ef9a 100644 --- a/examples/api/test/material/scaffold/scaffold.2_test.dart +++ b/examples/api/test/material/scaffold/scaffold.2_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/scaffold/scaffold.2.dart' as example; +import 'package:flutter_api_samples/material/scaffold/scaffold.2.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/scaffold/scaffold.drawer.0_test.dart b/examples/api/test/material/scaffold/scaffold.drawer.0_test.dart index 33296dbcb44..ccc57417a07 100644 --- a/examples/api/test/material/scaffold/scaffold.drawer.0_test.dart +++ b/examples/api/test/material/scaffold/scaffold.drawer.0_test.dart @@ -3,53 +3,55 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/scaffold/scaffold.drawer.0.dart' as example; +import 'package:flutter_api_samples/material/scaffold/scaffold.drawer.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('The page should contain a drawer than can be opened and closed', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.DrawerExampleApp()); + testWidgets( + 'The page should contain a drawer than can be opened and closed', + (WidgetTester tester) async { + await tester.pumpWidget(const example.DrawerExampleApp()); - expect(find.byType(Drawer), findsNothing); + expect(find.byType(Drawer), findsNothing); - // Open the drawer by tapping the button at the center of the screen. - await tester.tap(find.widgetWithText(ElevatedButton, 'Open Drawer')); - await tester.pumpAndSettle(); + // Open the drawer by tapping the button at the center of the screen. + await tester.tap(find.widgetWithText(ElevatedButton, 'Open Drawer')); + await tester.pumpAndSettle(); - expect(find.byType(Drawer), findsOne); - expect( - tester.getCenter(find.byType(Drawer)).dx, - lessThan(400), - reason: 'The drawer should be on the left side of the screen', - ); - expect(find.text('This is the Drawer'), findsOne); + expect(find.byType(Drawer), findsOne); + expect( + tester.getCenter(find.byType(Drawer)).dx, + lessThan(400), + reason: 'The drawer should be on the left side of the screen', + ); + expect(find.text('This is the Drawer'), findsOne); - // Close the drawer by tapping the button inside the drawer. - await tester.tap(find.widgetWithText(ElevatedButton, 'Close Drawer')); - await tester.pumpAndSettle(); + // Close the drawer by tapping the button inside the drawer. + await tester.tap(find.widgetWithText(ElevatedButton, 'Close Drawer')); + await tester.pumpAndSettle(); - expect(find.byType(Drawer), findsNothing); + expect(find.byType(Drawer), findsNothing); - // Open the drawer by tapping the drawer button in the app bar. - expect( - tester.getCenter(find.byType(DrawerButton)).dx, - lessThan(400), - reason: 'The drawer button should be on the left side of the app bar', - ); - await tester.tap(find.byType(DrawerButton)); - await tester.pumpAndSettle(); + // Open the drawer by tapping the drawer button in the app bar. + expect( + tester.getCenter(find.byType(DrawerButton)).dx, + lessThan(400), + reason: 'The drawer button should be on the left side of the app bar', + ); + await tester.tap(find.byType(DrawerButton)); + await tester.pumpAndSettle(); - expect(find.byType(Drawer), findsOne); - expect(find.text('This is the Drawer'), findsOne); + expect(find.byType(Drawer), findsOne); + expect(find.text('This is the Drawer'), findsOne); - // Close the drawer by tapping outside the drawer. - final Rect drawerRect = tester.getRect(find.byType(Drawer)); - final Offset outsideDrawer = drawerRect.centerRight + const Offset(50, 0); - await tester.tapAt(outsideDrawer); - await tester.pumpAndSettle(); + // Close the drawer by tapping outside the drawer. + final Rect drawerRect = tester.getRect(find.byType(Drawer)); + final Offset outsideDrawer = drawerRect.centerRight + const Offset(50, 0); + await tester.tapAt(outsideDrawer); + await tester.pumpAndSettle(); - expect(find.byType(Drawer), findsNothing); - }); + expect(find.byType(Drawer), findsNothing); + }, + ); } diff --git a/examples/api/test/material/scaffold/scaffold.end_drawer.0_test.dart b/examples/api/test/material/scaffold/scaffold.end_drawer.0_test.dart index 369aee2bcf2..092d9175314 100644 --- a/examples/api/test/material/scaffold/scaffold.end_drawer.0_test.dart +++ b/examples/api/test/material/scaffold/scaffold.end_drawer.0_test.dart @@ -3,53 +3,55 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/scaffold/scaffold.end_drawer.0.dart' as example; +import 'package:flutter_api_samples/material/scaffold/scaffold.end_drawer.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('The page should contain an end drawer than can be opened and closed', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.EndDrawerExampleApp()); + testWidgets( + 'The page should contain an end drawer than can be opened and closed', + (WidgetTester tester) async { + await tester.pumpWidget(const example.EndDrawerExampleApp()); - expect(find.byType(Drawer), findsNothing); + expect(find.byType(Drawer), findsNothing); - // Open the drawer by tapping the button at the center of the screen. - await tester.tap(find.widgetWithText(ElevatedButton, 'Open End Drawer')); - await tester.pumpAndSettle(); + // Open the drawer by tapping the button at the center of the screen. + await tester.tap(find.widgetWithText(ElevatedButton, 'Open End Drawer')); + await tester.pumpAndSettle(); - expect(find.byType(Drawer), findsOne); - expect( - tester.getCenter(find.byType(Drawer)).dx, - greaterThan(400), - reason: 'The drawer should be on the right side of the screen', - ); - expect(find.text('This is the Drawer'), findsOne); + expect(find.byType(Drawer), findsOne); + expect( + tester.getCenter(find.byType(Drawer)).dx, + greaterThan(400), + reason: 'The drawer should be on the right side of the screen', + ); + expect(find.text('This is the Drawer'), findsOne); - // Close the drawer by tapping the button inside the drawer. - await tester.tap(find.widgetWithText(ElevatedButton, 'Close Drawer')); - await tester.pumpAndSettle(); + // Close the drawer by tapping the button inside the drawer. + await tester.tap(find.widgetWithText(ElevatedButton, 'Close Drawer')); + await tester.pumpAndSettle(); - expect(find.byType(Drawer), findsNothing); + expect(find.byType(Drawer), findsNothing); - // Open the drawer by tapping the drawer button in the app bar. - expect( - tester.getCenter(find.byType(EndDrawerButton)).dx, - greaterThan(400), - reason: 'The drawer button should be on the right side of the app bar', - ); - await tester.tap(find.byType(EndDrawerButton)); - await tester.pumpAndSettle(); + // Open the drawer by tapping the drawer button in the app bar. + expect( + tester.getCenter(find.byType(EndDrawerButton)).dx, + greaterThan(400), + reason: 'The drawer button should be on the right side of the app bar', + ); + await tester.tap(find.byType(EndDrawerButton)); + await tester.pumpAndSettle(); - expect(find.byType(Drawer), findsOne); - expect(find.text('This is the Drawer'), findsOne); + expect(find.byType(Drawer), findsOne); + expect(find.text('This is the Drawer'), findsOne); - // Close the drawer by tapping outside the drawer. - final Rect drawerRect = tester.getRect(find.byType(Drawer)); - final Offset outsideDrawer = drawerRect.centerLeft - const Offset(50, 0); - await tester.tapAt(outsideDrawer); - await tester.pumpAndSettle(); + // Close the drawer by tapping outside the drawer. + final Rect drawerRect = tester.getRect(find.byType(Drawer)); + final Offset outsideDrawer = drawerRect.centerLeft - const Offset(50, 0); + await tester.tapAt(outsideDrawer); + await tester.pumpAndSettle(); - expect(find.byType(Drawer), findsNothing); - }); + expect(find.byType(Drawer), findsNothing); + }, + ); } diff --git a/examples/api/test/material/scaffold/scaffold.floating_action_button_animator.0_test.dart b/examples/api/test/material/scaffold/scaffold.floating_action_button_animator.0_test.dart index 55dcfe698ee..035fff1a287 100644 --- a/examples/api/test/material/scaffold/scaffold.floating_action_button_animator.0_test.dart +++ b/examples/api/test/material/scaffold/scaffold.floating_action_button_animator.0_test.dart @@ -8,8 +8,12 @@ import 'package:flutter_api_samples/material/scaffold/scaffold.floating_action_b import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('FloatingActionButton animation can be customized', (WidgetTester tester) async { - await tester.pumpWidget(const example.ScaffoldFloatingActionButtonAnimatorApp()); + testWidgets('FloatingActionButton animation can be customized', ( + WidgetTester tester, + ) async { + await tester.pumpWidget( + const example.ScaffoldFloatingActionButtonAnimatorApp(), + ); expect(find.byType(FloatingActionButton), findsNothing); @@ -17,26 +21,48 @@ void main() { // Tap the toggle button to show the FAB. await tester.tap(find.text('Toggle FAB')); await tester.pump(); - await tester.pump(const Duration(milliseconds: 100)); // Advance animation by 100ms. + await tester.pump( + const Duration(milliseconds: 100), + ); // Advance animation by 100ms. // FAB is partially animated in. - expect(tester.getTopLeft(find.byType(FloatingActionButton)).dx, closeTo(743.8, 0.1)); + expect( + tester.getTopLeft(find.byType(FloatingActionButton)).dx, + closeTo(743.8, 0.1), + ); - await tester.pump(const Duration(milliseconds: 100)); // Advance animation by 100ms. + await tester.pump( + const Duration(milliseconds: 100), + ); // Advance animation by 100ms. // FAB is fully animated in. - expect(tester.getTopLeft(find.byType(FloatingActionButton)).dx, equals(728.0)); + expect( + tester.getTopLeft(find.byType(FloatingActionButton)).dx, + equals(728.0), + ); // Tap the toggle button to hide the FAB. await tester.tap(find.text('Toggle FAB')); await tester.pump(); - await tester.pump(const Duration(milliseconds: 100)); // Advance animation by 100ms. + await tester.pump( + const Duration(milliseconds: 100), + ); // Advance animation by 100ms. // FAB is partially animated out. - expect(tester.getTopLeft(find.byType(FloatingActionButton)).dx, closeTo(747.1, 0.1)); + expect( + tester.getTopLeft(find.byType(FloatingActionButton)).dx, + closeTo(747.1, 0.1), + ); - await tester.pump(const Duration(milliseconds: 100)); // Advance animation by 100ms. + await tester.pump( + const Duration(milliseconds: 100), + ); // Advance animation by 100ms. // FAB is fully animated out. - expect(tester.getTopLeft(find.byType(FloatingActionButton)).dx, equals(756.0)); + expect( + tester.getTopLeft(find.byType(FloatingActionButton)).dx, + equals(756.0), + ); - await tester.pump(const Duration(milliseconds: 50)); // Advance animation by 50ms. + await tester.pump( + const Duration(milliseconds: 50), + ); // Advance animation by 50ms. // FAB is hidden. expect(find.byType(FloatingActionButton), findsNothing); @@ -48,7 +74,10 @@ void main() { await tester.tap(find.text('Toggle FAB')); await tester.pump(); // FAB is immediately shown. - expect(tester.getTopLeft(find.byType(FloatingActionButton)).dx, equals(728.0)); + expect( + tester.getTopLeft(find.byType(FloatingActionButton)).dx, + equals(728.0), + ); // Tap the toggle button to hide the FAB. await tester.tap(find.text('Toggle FAB')); diff --git a/examples/api/test/material/scaffold/scaffold.of.0_test.dart b/examples/api/test/material/scaffold/scaffold.of.0_test.dart index f4d5bf6d006..b06f7bbd6a1 100644 --- a/examples/api/test/material/scaffold/scaffold.of.0_test.dart +++ b/examples/api/test/material/scaffold/scaffold.of.0_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/scaffold/scaffold.of.0.dart' as example; +import 'package:flutter_api_samples/material/scaffold/scaffold.of.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Verify correct labels are displayed', (WidgetTester tester) async { + testWidgets('Verify correct labels are displayed', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.OfExampleApp()); expect(find.text('Scaffold.of Example'), findsOneWidget); @@ -18,14 +21,20 @@ void main() { await tester.pumpWidget(const example.OfExampleApp()); expect(find.text('BottomSheet'), findsNothing); - expect(find.widgetWithText(ElevatedButton, 'Close BottomSheet'), findsNothing); + expect( + find.widgetWithText(ElevatedButton, 'Close BottomSheet'), + findsNothing, + ); // Tap the button to show the bottom sheet. await tester.tap(find.widgetWithText(ElevatedButton, 'SHOW BOTTOM SHEET')); await tester.pumpAndSettle(); expect(find.text('BottomSheet'), findsOneWidget); - expect(find.widgetWithText(ElevatedButton, 'Close BottomSheet'), findsOneWidget); + expect( + find.widgetWithText(ElevatedButton, 'Close BottomSheet'), + findsOneWidget, + ); }); testWidgets('Bottom sheet can be closed', (WidgetTester tester) async { diff --git a/examples/api/test/material/scaffold/scaffold.of.1_test.dart b/examples/api/test/material/scaffold/scaffold.of.1_test.dart index 20a2e7f6c1d..ea1b535ec20 100644 --- a/examples/api/test/material/scaffold/scaffold.of.1_test.dart +++ b/examples/api/test/material/scaffold/scaffold.of.1_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/scaffold/scaffold.of.1.dart' as example; +import 'package:flutter_api_samples/material/scaffold/scaffold.of.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Verify correct labels are displayed', (WidgetTester tester) async { + testWidgets('Verify correct labels are displayed', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.OfExampleApp()); expect(find.text('Scaffold.of Example'), findsOneWidget); @@ -18,14 +21,20 @@ void main() { await tester.pumpWidget(const example.OfExampleApp()); expect(find.text('BottomSheet'), findsNothing); - expect(find.widgetWithText(ElevatedButton, 'Close BottomSheet'), findsNothing); + expect( + find.widgetWithText(ElevatedButton, 'Close BottomSheet'), + findsNothing, + ); // Tap the button to show the bottom sheet. await tester.tap(find.widgetWithText(ElevatedButton, 'SHOW BOTTOM SHEET')); await tester.pumpAndSettle(); expect(find.text('BottomSheet'), findsOneWidget); - expect(find.widgetWithText(ElevatedButton, 'Close BottomSheet'), findsOneWidget); + expect( + find.widgetWithText(ElevatedButton, 'Close BottomSheet'), + findsOneWidget, + ); }); testWidgets('Bottom sheet can be closed', (WidgetTester tester) async { diff --git a/examples/api/test/material/scaffold/scaffold_messenger.0_test.dart b/examples/api/test/material/scaffold/scaffold_messenger.0_test.dart index 0a3cc7ddfaf..04b849b4e1c 100644 --- a/examples/api/test/material/scaffold/scaffold_messenger.0_test.dart +++ b/examples/api/test/material/scaffold/scaffold_messenger.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/scaffold/scaffold_messenger.0.dart' as example; +import 'package:flutter_api_samples/material/scaffold/scaffold_messenger.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -17,6 +18,9 @@ void main() { await tester.tap(find.widgetWithText(OutlinedButton, 'Show SnackBar')); await tester.pumpAndSettle(); - expect(find.widgetWithText(SnackBar, 'A SnackBar has been shown.'), findsOne); + expect( + find.widgetWithText(SnackBar, 'A SnackBar has been shown.'), + findsOne, + ); }); } diff --git a/examples/api/test/material/scaffold/scaffold_messenger.of.0_test.dart b/examples/api/test/material/scaffold/scaffold_messenger.of.0_test.dart index 8cf3879edf5..e55d104ab97 100644 --- a/examples/api/test/material/scaffold/scaffold_messenger.of.0_test.dart +++ b/examples/api/test/material/scaffold/scaffold_messenger.of.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/scaffold/scaffold_messenger.of.0.dart' as example; +import 'package:flutter_api_samples/material/scaffold/scaffold_messenger.of.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -12,7 +13,10 @@ void main() { ) async { await tester.pumpWidget(const example.OfExampleApp()); - expect(find.widgetWithText(AppBar, 'ScaffoldMessenger.of Sample'), findsOne); + expect( + find.widgetWithText(AppBar, 'ScaffoldMessenger.of Sample'), + findsOne, + ); await tester.tap(find.widgetWithText(ElevatedButton, 'SHOW A SNACKBAR')); await tester.pumpAndSettle(); diff --git a/examples/api/test/material/scaffold/scaffold_messenger.of.1_test.dart b/examples/api/test/material/scaffold/scaffold_messenger.of.1_test.dart index 9cbb086bedd..c5f9dd86806 100644 --- a/examples/api/test/material/scaffold/scaffold_messenger.of.1_test.dart +++ b/examples/api/test/material/scaffold/scaffold_messenger.of.1_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/scaffold/scaffold_messenger.of.1.dart' as example; +import 'package:flutter_api_samples/material/scaffold/scaffold_messenger.of.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('A snack bar is displayed after 10 taps', (WidgetTester tester) async { + testWidgets('A snack bar is displayed after 10 taps', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.OfExampleApp()); expect(find.widgetWithText(AppBar, 'ScaffoldMessenger Demo'), findsOne); diff --git a/examples/api/test/material/scaffold/scaffold_messenger_state.show_material_banner.0_test.dart b/examples/api/test/material/scaffold/scaffold_messenger_state.show_material_banner.0_test.dart index 572c2c6a81d..df0d07965fd 100644 --- a/examples/api/test/material/scaffold/scaffold_messenger_state.show_material_banner.0_test.dart +++ b/examples/api/test/material/scaffold/scaffold_messenger_state.show_material_banner.0_test.dart @@ -8,14 +8,24 @@ import 'package:flutter_api_samples/material/scaffold/scaffold_messenger_state.s import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Pressing the button should show a material banner', (WidgetTester tester) async { + testWidgets('Pressing the button should show a material banner', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ShowMaterialBannerExampleApp()); - expect(find.widgetWithText(AppBar, 'ScaffoldMessengerState Sample'), findsOne); - await tester.tap(find.widgetWithText(OutlinedButton, 'Show MaterialBanner')); + expect( + find.widgetWithText(AppBar, 'ScaffoldMessengerState Sample'), + findsOne, + ); + await tester.tap( + find.widgetWithText(OutlinedButton, 'Show MaterialBanner'), + ); await tester.pumpAndSettle(); - expect(find.widgetWithText(MaterialBanner, 'This is a MaterialBanner'), findsOne); + expect( + find.widgetWithText(MaterialBanner, 'This is a MaterialBanner'), + findsOne, + ); expect( find.descendant( of: find.byType(MaterialBanner), diff --git a/examples/api/test/material/scaffold/scaffold_messenger_state.show_snack_bar.0_test.dart b/examples/api/test/material/scaffold/scaffold_messenger_state.show_snack_bar.0_test.dart index 5b277a523f5..dbb9bc558a8 100644 --- a/examples/api/test/material/scaffold/scaffold_messenger_state.show_snack_bar.0_test.dart +++ b/examples/api/test/material/scaffold/scaffold_messenger_state.show_snack_bar.0_test.dart @@ -8,13 +8,21 @@ import 'package:flutter_api_samples/material/scaffold/scaffold_messenger_state.s import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Pressing the button should display a snack bar', (WidgetTester tester) async { + testWidgets('Pressing the button should display a snack bar', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ShowSnackBarExampleApp()); - expect(find.widgetWithText(AppBar, 'ScaffoldMessengerState Sample'), findsOne); + expect( + find.widgetWithText(AppBar, 'ScaffoldMessengerState Sample'), + findsOne, + ); await tester.tap(find.widgetWithText(OutlinedButton, 'Show SnackBar')); await tester.pumpAndSettle(); - expect(find.widgetWithText(SnackBar, 'A SnackBar has been shown.'), findsOne); + expect( + find.widgetWithText(SnackBar, 'A SnackBar has been shown.'), + findsOne, + ); }); } diff --git a/examples/api/test/material/scaffold/scaffold_messenger_state.show_snack_bar.2_test.dart b/examples/api/test/material/scaffold/scaffold_messenger_state.show_snack_bar.2_test.dart index 83dcc7ecbae..10aca70d0b0 100644 --- a/examples/api/test/material/scaffold/scaffold_messenger_state.show_snack_bar.2_test.dart +++ b/examples/api/test/material/scaffold/scaffold_messenger_state.show_snack_bar.2_test.dart @@ -8,65 +8,99 @@ import 'package:flutter_api_samples/material/scaffold/scaffold_messenger_state.s import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('ScaffoldMessenger showSnackBar animation can be customized using AnimationStyle', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.SnackBarApp()); + testWidgets( + 'ScaffoldMessenger showSnackBar animation can be customized using AnimationStyle', + (WidgetTester tester) async { + await tester.pumpWidget(const example.SnackBarApp()); - // Tap the button to show the SnackBar with default animation style. - await tester.tap(find.byType(ElevatedButton)); - await tester.pump(); - await tester.pump(const Duration(milliseconds: 125)); // Advance the animation by 125ms. + // Tap the button to show the SnackBar with default animation style. + await tester.tap(find.byType(ElevatedButton)); + await tester.pump(); + await tester.pump( + const Duration(milliseconds: 125), + ); // Advance the animation by 125ms. - expect(tester.getTopLeft(find.text('I am a snack bar.')).dy, closeTo(576.7, 0.1)); + expect( + tester.getTopLeft(find.text('I am a snack bar.')).dy, + closeTo(576.7, 0.1), + ); - await tester.pump(const Duration(milliseconds: 125)); // Advance the animation by 125ms. + await tester.pump( + const Duration(milliseconds: 125), + ); // Advance the animation by 125ms. - expect(tester.getTopLeft(find.text('I am a snack bar.')).dy, closeTo(566, 0.1)); + expect( + tester.getTopLeft(find.text('I am a snack bar.')).dy, + closeTo(566, 0.1), + ); - // Tap the close button to dismiss the SnackBar. - await tester.tap(find.byType(IconButton)); - await tester.pump(); - await tester.pump(const Duration(milliseconds: 250)); // Advance the animation by 250ms. + // Tap the close button to dismiss the SnackBar. + await tester.tap(find.byType(IconButton)); + await tester.pump(); + await tester.pump( + const Duration(milliseconds: 250), + ); // Advance the animation by 250ms. - expect(tester.getTopLeft(find.text('I am a snack bar.')).dy, closeTo(614, 0.1)); + expect( + tester.getTopLeft(find.text('I am a snack bar.')).dy, + closeTo(614, 0.1), + ); - // Select custom animation style. - await tester.tap(find.text('Custom')); - await tester.pumpAndSettle(); + // Select custom animation style. + await tester.tap(find.text('Custom')); + await tester.pumpAndSettle(); - // Tap the button to show the SnackBar with custom animation style. - await tester.tap(find.byType(ElevatedButton)); - await tester.pump(); - await tester.pump(const Duration(milliseconds: 1500)); // Advance the animation by 125ms. + // Tap the button to show the SnackBar with custom animation style. + await tester.tap(find.byType(ElevatedButton)); + await tester.pump(); + await tester.pump( + const Duration(milliseconds: 1500), + ); // Advance the animation by 125ms. - expect(tester.getTopLeft(find.text('I am a snack bar.')).dy, closeTo(576.7, 0.1)); + expect( + tester.getTopLeft(find.text('I am a snack bar.')).dy, + closeTo(576.7, 0.1), + ); - await tester.pump(const Duration(milliseconds: 1500)); // Advance the animation by 125ms. + await tester.pump( + const Duration(milliseconds: 1500), + ); // Advance the animation by 125ms. - expect(tester.getTopLeft(find.text('I am a snack bar.')).dy, closeTo(566, 0.1)); + expect( + tester.getTopLeft(find.text('I am a snack bar.')).dy, + closeTo(566, 0.1), + ); - // Tap the close button to dismiss the SnackBar. - await tester.tap(find.byType(IconButton)); - await tester.pump(); - await tester.pump(const Duration(seconds: 1)); // Advance the animation by 1sec. + // Tap the close button to dismiss the SnackBar. + await tester.tap(find.byType(IconButton)); + await tester.pump(); + await tester.pump( + const Duration(seconds: 1), + ); // Advance the animation by 1sec. - expect(tester.getTopLeft(find.text('I am a snack bar.')).dy, closeTo(614, 0.1)); + expect( + tester.getTopLeft(find.text('I am a snack bar.')).dy, + closeTo(614, 0.1), + ); - // Select no animation style. - await tester.tap(find.text('None')); - await tester.pumpAndSettle(); + // Select no animation style. + await tester.tap(find.text('None')); + await tester.pumpAndSettle(); - // Tap the button to show the SnackBar with no animation style. - await tester.tap(find.byType(ElevatedButton)); - await tester.pump(); + // Tap the button to show the SnackBar with no animation style. + await tester.tap(find.byType(ElevatedButton)); + await tester.pump(); - expect(tester.getTopLeft(find.text('I am a snack bar.')).dy, closeTo(566, 0.1)); + expect( + tester.getTopLeft(find.text('I am a snack bar.')).dy, + closeTo(566, 0.1), + ); - // Tap the close button to dismiss the SnackBar. - await tester.tap(find.byType(IconButton)); - await tester.pump(); + // Tap the close button to dismiss the SnackBar. + await tester.tap(find.byType(IconButton)); + await tester.pump(); - expect(find.text('I am a snack bar.'), findsNothing); - }); + expect(find.text('I am a snack bar.'), findsNothing); + }, + ); } diff --git a/examples/api/test/material/scaffold/scaffold_state.show_bottom_sheet.0_test.dart b/examples/api/test/material/scaffold/scaffold_state.show_bottom_sheet.0_test.dart index bf17062b181..838db0053ba 100644 --- a/examples/api/test/material/scaffold/scaffold_state.show_bottom_sheet.0_test.dart +++ b/examples/api/test/material/scaffold/scaffold_state.show_bottom_sheet.0_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/material/scaffold/scaffold_state.show_bottom import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('The button should show a bottom sheet when pressed', (WidgetTester tester) async { + testWidgets('The button should show a bottom sheet when pressed', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ShowBottomSheetExampleApp()); expect(find.widgetWithText(AppBar, 'ScaffoldState Sample'), findsOne); diff --git a/examples/api/test/material/scaffold/scaffold_state.show_bottom_sheet.1_test.dart b/examples/api/test/material/scaffold/scaffold_state.show_bottom_sheet.1_test.dart index b4edbc0f520..8d9d6beeaff 100644 --- a/examples/api/test/material/scaffold/scaffold_state.show_bottom_sheet.1_test.dart +++ b/examples/api/test/material/scaffold/scaffold_state.show_bottom_sheet.1_test.dart @@ -8,60 +8,67 @@ import 'package:flutter_api_samples/material/scaffold/scaffold_state.show_bottom import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Scaffold showBottomSheet animation can be customized using AnimationStyle', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.ShowBottomSheetExampleApp()); + testWidgets( + 'Scaffold showBottomSheet animation can be customized using AnimationStyle', + (WidgetTester tester) async { + await tester.pumpWidget(const example.ShowBottomSheetExampleApp()); - // Show the bottom sheet with default animation style. - await tester.tap(find.widgetWithText(ElevatedButton, 'showBottomSheet')); - await tester.pump(); - // Advance the animation by 1/2 of the default forward duration. - await tester.pump(const Duration(milliseconds: 125)); + // Show the bottom sheet with default animation style. + await tester.tap(find.widgetWithText(ElevatedButton, 'showBottomSheet')); + await tester.pump(); + // Advance the animation by 1/2 of the default forward duration. + await tester.pump(const Duration(milliseconds: 125)); - // The bottom sheet is partially visible. - expect(tester.getTopLeft(find.byType(BottomSheet)).dy, closeTo(444.8, 0.1)); + // The bottom sheet is partially visible. + expect( + tester.getTopLeft(find.byType(BottomSheet)).dy, + closeTo(444.8, 0.1), + ); - // Advance the animation by 1/2 of the default forward duration. - await tester.pump(const Duration(milliseconds: 125)); + // Advance the animation by 1/2 of the default forward duration. + await tester.pump(const Duration(milliseconds: 125)); - // The bottom sheet is fully visible. - expect(tester.getTopLeft(find.byType(BottomSheet)).dy, equals(400.0)); + // The bottom sheet is fully visible. + expect(tester.getTopLeft(find.byType(BottomSheet)).dy, equals(400.0)); - // Dismiss the bottom sheet. - await tester.tap(find.widgetWithText(ElevatedButton, 'Close')); - await tester.pumpAndSettle(); + // Dismiss the bottom sheet. + await tester.tap(find.widgetWithText(ElevatedButton, 'Close')); + await tester.pumpAndSettle(); - // Select custom animation style. - await tester.tap(find.text('Custom')); - await tester.pumpAndSettle(); + // Select custom animation style. + await tester.tap(find.text('Custom')); + await tester.pumpAndSettle(); - // Show the bottom sheet with custom animation style. - await tester.tap(find.widgetWithText(ElevatedButton, 'showBottomSheet')); - await tester.pump(); - // Advance the animation by 1/2 of the custom forward duration. - await tester.pump(const Duration(milliseconds: 1500)); + // Show the bottom sheet with custom animation style. + await tester.tap(find.widgetWithText(ElevatedButton, 'showBottomSheet')); + await tester.pump(); + // Advance the animation by 1/2 of the custom forward duration. + await tester.pump(const Duration(milliseconds: 1500)); - // The bottom sheet is partially visible. - expect(tester.getTopLeft(find.byType(BottomSheet)).dy, closeTo(444.8, 0.1)); + // The bottom sheet is partially visible. + expect( + tester.getTopLeft(find.byType(BottomSheet)).dy, + closeTo(444.8, 0.1), + ); - // Advance the animation by 1/2 of the custom forward duration. - await tester.pump(const Duration(milliseconds: 1500)); + // Advance the animation by 1/2 of the custom forward duration. + await tester.pump(const Duration(milliseconds: 1500)); - // The bottom sheet is fully visible. - expect(tester.getTopLeft(find.byType(BottomSheet)).dy, equals(400.0)); + // The bottom sheet is fully visible. + expect(tester.getTopLeft(find.byType(BottomSheet)).dy, equals(400.0)); - // Dismiss the bottom sheet. - await tester.tap(find.widgetWithText(ElevatedButton, 'Close')); - await tester.pumpAndSettle(); + // Dismiss the bottom sheet. + await tester.tap(find.widgetWithText(ElevatedButton, 'Close')); + await tester.pumpAndSettle(); - // Select no animation style. - await tester.tap(find.text('None')); - await tester.pumpAndSettle(); + // Select no animation style. + await tester.tap(find.text('None')); + await tester.pumpAndSettle(); - // Show the bottom sheet with no animation style. - await tester.tap(find.widgetWithText(ElevatedButton, 'showBottomSheet')); - await tester.pump(); - expect(tester.getTopLeft(find.byType(BottomSheet)).dy, equals(400.0)); - }); + // Show the bottom sheet with no animation style. + await tester.tap(find.widgetWithText(ElevatedButton, 'showBottomSheet')); + await tester.pump(); + expect(tester.getTopLeft(find.byType(BottomSheet)).dy, equals(400.0)); + }, + ); } diff --git a/examples/api/test/material/scrollbar/scrollbar.0_test.dart b/examples/api/test/material/scrollbar/scrollbar.0_test.dart index 9a3a489dfec..cd1aaf2128a 100644 --- a/examples/api/test/material/scrollbar/scrollbar.0_test.dart +++ b/examples/api/test/material/scrollbar/scrollbar.0_test.dart @@ -3,29 +3,42 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/scrollbar/scrollbar.0.dart' as example; +import 'package:flutter_api_samples/material/scrollbar/scrollbar.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Scrollbar.0 works well on all platforms', (WidgetTester tester) async { - await tester.pumpWidget(const example.ScrollbarExampleApp()); + testWidgets( + 'Scrollbar.0 works well on all platforms', + (WidgetTester tester) async { + await tester.pumpWidget(const example.ScrollbarExampleApp()); - final Finder buttonFinder = find.byType(Scrollbar); - await tester.drag(buttonFinder.last, const Offset(0, 100.0)); + final Finder buttonFinder = find.byType(Scrollbar); + await tester.drag(buttonFinder.last, const Offset(0, 100.0)); - expect(tester.takeException(), isNull); - }, variant: TargetPlatformVariant.all()); + expect(tester.takeException(), isNull); + }, + variant: TargetPlatformVariant.all(), + ); - testWidgets('The scrollbar should be painted when the user scrolls', (WidgetTester tester) async { + testWidgets('The scrollbar should be painted when the user scrolls', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ScrollbarExampleApp()); await tester.pump(); - await tester.pump(const Duration(milliseconds: 10)); // Wait for the thumb to start appearing. + await tester.pump( + const Duration(milliseconds: 10), + ); // Wait for the thumb to start appearing. expect(find.text('item 0'), findsOne); expect(find.text('item 9'), findsNothing); expect(find.byType(Scrollbar), isNot(paints..rect())); - await tester.fling(find.byType(Scrollbar).last, const Offset(0, -300), 10.0); + await tester.fling( + find.byType(Scrollbar).last, + const Offset(0, -300), + 10.0, + ); expect(find.text('item 0'), findsNothing); expect(find.text('item 9'), findsOne); diff --git a/examples/api/test/material/scrollbar/scrollbar.1_test.dart b/examples/api/test/material/scrollbar/scrollbar.1_test.dart index 3cfb61b800f..f01e4ab610c 100644 --- a/examples/api/test/material/scrollbar/scrollbar.1_test.dart +++ b/examples/api/test/material/scrollbar/scrollbar.1_test.dart @@ -3,14 +3,19 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/scrollbar/scrollbar.1.dart' as example; +import 'package:flutter_api_samples/material/scrollbar/scrollbar.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('The scrollbar thumb should be visible at all time', (WidgetTester tester) async { + testWidgets('The scrollbar thumb should be visible at all time', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ScrollbarExampleApp()); await tester.pump(); - await tester.pump(const Duration(milliseconds: 10)); // Wait for the thumb to start appearing. + await tester.pump( + const Duration(milliseconds: 10), + ); // Wait for the thumb to start appearing. expect(find.widgetWithText(AppBar, 'Scrollbar Sample'), findsOne); @@ -18,7 +23,11 @@ void main() { expect(find.text('item 9'), findsNothing); expect(find.byType(Scrollbar), paints..rect()); - await tester.fling(find.byType(Scrollbar).last, const Offset(0, -300), 10.0); + await tester.fling( + find.byType(Scrollbar).last, + const Offset(0, -300), + 10.0, + ); expect(find.text('item 0'), findsNothing); expect(find.text('item 9'), findsOne); diff --git a/examples/api/test/material/search_anchor/search_anchor.0_test.dart b/examples/api/test/material/search_anchor/search_anchor.0_test.dart index d840db3a1ff..67d7871b4e5 100644 --- a/examples/api/test/material/search_anchor/search_anchor.0_test.dart +++ b/examples/api/test/material/search_anchor/search_anchor.0_test.dart @@ -3,74 +3,79 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/search_anchor/search_anchor.0.dart' as example; +import 'package:flutter_api_samples/material/search_anchor/search_anchor.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Search a color in the search bar and choosing an option changes the color scheme', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.SearchBarApp()); + testWidgets( + 'Search a color in the search bar and choosing an option changes the color scheme', + (WidgetTester tester) async { + await tester.pumpWidget(const example.SearchBarApp()); - expect(find.widgetWithText(AppBar, 'Search Bar Sample'), findsOne); + expect(find.widgetWithText(AppBar, 'Search Bar Sample'), findsOne); - expect( - find.byWidgetPredicate( - (Widget widget) => widget is Card && widget.color == const Color(0xff6750a4), - ), - findsOne, - ); + expect( + find.byWidgetPredicate( + (Widget widget) => + widget is Card && widget.color == const Color(0xff6750a4), + ), + findsOne, + ); - await tester.tap(find.byIcon(Icons.search)); - await tester.pumpAndSettle(); + await tester.tap(find.byIcon(Icons.search)); + await tester.pumpAndSettle(); - expect(find.text('No search history.'), findsOne); - await tester.enterText(find.byType(SearchBar).last, 're'); - await tester.pump(); + expect(find.text('No search history.'), findsOne); + await tester.enterText(find.byType(SearchBar).last, 're'); + await tester.pump(); - expect(find.widgetWithText(ListTile, 'red'), findsOne); - expect(find.widgetWithText(ListTile, 'green'), findsOne); - expect(find.widgetWithText(ListTile, 'grey'), findsOne); + expect(find.widgetWithText(ListTile, 'red'), findsOne); + expect(find.widgetWithText(ListTile, 'green'), findsOne); + expect(find.widgetWithText(ListTile, 'grey'), findsOne); - await tester.tap(find.widgetWithText(ListTile, 'red')); - await tester.pumpAndSettle(); + await tester.tap(find.widgetWithText(ListTile, 'red')); + await tester.pumpAndSettle(); - expect( - find.byWidgetPredicate( - (Widget widget) => widget is Card && widget.color == const Color(0xff904a42), - ), - findsOne, - ); + expect( + find.byWidgetPredicate( + (Widget widget) => + widget is Card && widget.color == const Color(0xff904a42), + ), + findsOne, + ); - await tester.tap(find.byIcon(Icons.search)); - await tester.pumpAndSettle(); + await tester.tap(find.byIcon(Icons.search)); + await tester.pumpAndSettle(); - await tester.tap(find.byIcon(Icons.close)); - await tester.pump(); + await tester.tap(find.byIcon(Icons.close)); + await tester.pump(); - expect( - find.widgetWithText(ListTile, 'red'), - findsOne, - reason: 'The search history should be displayed', - ); - expect(find.widgetWithIcon(ListTile, Icons.history), findsOne); + expect( + find.widgetWithText(ListTile, 'red'), + findsOne, + reason: 'The search history should be displayed', + ); + expect(find.widgetWithIcon(ListTile, Icons.history), findsOne); - await tester.enterText(find.byType(SearchBar).last, 'b'); - await tester.pump(); + await tester.enterText(find.byType(SearchBar).last, 'b'); + await tester.pump(); - expect(find.widgetWithText(ListTile, 'blue'), findsOne); - expect(find.widgetWithText(ListTile, 'beige'), findsOne); - expect(find.widgetWithText(ListTile, 'brown'), findsOne); - expect(find.widgetWithText(ListTile, 'black'), findsOne); + expect(find.widgetWithText(ListTile, 'blue'), findsOne); + expect(find.widgetWithText(ListTile, 'beige'), findsOne); + expect(find.widgetWithText(ListTile, 'brown'), findsOne); + expect(find.widgetWithText(ListTile, 'black'), findsOne); - await tester.tap(find.widgetWithText(ListTile, 'blue')); - await tester.pumpAndSettle(); + await tester.tap(find.widgetWithText(ListTile, 'blue')); + await tester.pumpAndSettle(); - expect( - find.byWidgetPredicate( - (Widget widget) => widget is Card && widget.color == const Color(0xff36618e), - ), - findsOne, - ); - }); + expect( + find.byWidgetPredicate( + (Widget widget) => + widget is Card && widget.color == const Color(0xff36618e), + ), + findsOne, + ); + }, + ); } diff --git a/examples/api/test/material/search_anchor/search_anchor.1_test.dart b/examples/api/test/material/search_anchor/search_anchor.1_test.dart index fc4742b43ee..fc35136d98f 100644 --- a/examples/api/test/material/search_anchor/search_anchor.1_test.dart +++ b/examples/api/test/material/search_anchor/search_anchor.1_test.dart @@ -5,11 +5,14 @@ import 'dart:ui' as ui; import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/search_anchor/search_anchor.1.dart' as example; +import 'package:flutter_api_samples/material/search_anchor/search_anchor.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('The SearchAnchor should be floating', (WidgetTester tester) async { + testWidgets('The SearchAnchor should be floating', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.PinnedSearchBarApp()); await tester.tap(find.byIcon(Icons.search)); @@ -23,18 +26,26 @@ void main() { await tester.pumpAndSettle(); expect(find.byType(SearchBar), findsOne); - final double searchBarHeight = tester.getSize(find.byType(SearchBar)).height; + final double searchBarHeight = tester + .getSize(find.byType(SearchBar)) + .height; final TestPointer testPointer = TestPointer(1, ui.PointerDeviceKind.mouse); testPointer.hover(tester.getCenter(find.byType(CustomScrollView))); - await tester.sendEventToBinding(testPointer.scroll(Offset(0.0, 2 * searchBarHeight))); + await tester.sendEventToBinding( + testPointer.scroll(Offset(0.0, 2 * searchBarHeight)), + ); await tester.pump(); expect(find.byType(SearchBar), findsNothing); - await tester.sendEventToBinding(testPointer.scroll(Offset(0.0, -0.5 * searchBarHeight))); + await tester.sendEventToBinding( + testPointer.scroll(Offset(0.0, -0.5 * searchBarHeight)), + ); await tester.pump(); expect(find.byType(SearchBar), findsOne); - await tester.sendEventToBinding(testPointer.scroll(Offset(0.0, 0.5 * searchBarHeight))); + await tester.sendEventToBinding( + testPointer.scroll(Offset(0.0, 0.5 * searchBarHeight)), + ); await tester.pump(); expect(find.byType(SearchBar), findsNothing); }); diff --git a/examples/api/test/material/search_anchor/search_anchor.2_test.dart b/examples/api/test/material/search_anchor/search_anchor.2_test.dart index dbd1390f466..277255b1ac8 100644 --- a/examples/api/test/material/search_anchor/search_anchor.2_test.dart +++ b/examples/api/test/material/search_anchor/search_anchor.2_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/search_anchor/search_anchor.2.dart' as example; +import 'package:flutter_api_samples/material/search_anchor/search_anchor.2.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Suggestion of the search bar can be selected', (WidgetTester tester) async { + testWidgets('Suggestion of the search bar can be selected', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.SearchBarApp()); expect(find.widgetWithText(AppBar, 'Search Anchor Sample'), findsOne); diff --git a/examples/api/test/material/search_anchor/search_anchor.3_test.dart b/examples/api/test/material/search_anchor/search_anchor.3_test.dart index 9a96de8b864..43cd811a5df 100644 --- a/examples/api/test/material/search_anchor/search_anchor.3_test.dart +++ b/examples/api/test/material/search_anchor/search_anchor.3_test.dart @@ -3,34 +3,36 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/search_anchor/search_anchor.3.dart' as example; +import 'package:flutter_api_samples/material/search_anchor/search_anchor.3.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('can search and find options after waiting for fake network delay', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.SearchAnchorAsyncExampleApp()); + testWidgets( + 'can search and find options after waiting for fake network delay', + (WidgetTester tester) async { + await tester.pumpWidget(const example.SearchAnchorAsyncExampleApp()); - await tester.tap(find.byIcon(Icons.search)); - await tester.pumpAndSettle(); + await tester.tap(find.byIcon(Icons.search)); + await tester.pumpAndSettle(); - expect(find.widgetWithText(ListTile, 'aardvark'), findsNothing); - expect(find.widgetWithText(ListTile, 'bobcat'), findsNothing); - expect(find.widgetWithText(ListTile, 'chameleon'), findsNothing); + expect(find.widgetWithText(ListTile, 'aardvark'), findsNothing); + expect(find.widgetWithText(ListTile, 'bobcat'), findsNothing); + expect(find.widgetWithText(ListTile, 'chameleon'), findsNothing); - await tester.enterText(find.byType(SearchBar), 'a'); - await tester.pump(example.fakeAPIDuration); + await tester.enterText(find.byType(SearchBar), 'a'); + await tester.pump(example.fakeAPIDuration); - expect(find.widgetWithText(ListTile, 'aardvark'), findsOneWidget); - expect(find.widgetWithText(ListTile, 'bobcat'), findsOneWidget); - expect(find.widgetWithText(ListTile, 'chameleon'), findsOneWidget); + expect(find.widgetWithText(ListTile, 'aardvark'), findsOneWidget); + expect(find.widgetWithText(ListTile, 'bobcat'), findsOneWidget); + expect(find.widgetWithText(ListTile, 'chameleon'), findsOneWidget); - await tester.enterText(find.byType(SearchBar), 'aa'); - await tester.pump(example.fakeAPIDuration); + await tester.enterText(find.byType(SearchBar), 'aa'); + await tester.pump(example.fakeAPIDuration); - expect(find.widgetWithText(ListTile, 'aardvark'), findsOneWidget); - expect(find.widgetWithText(ListTile, 'bobcat'), findsNothing); - expect(find.widgetWithText(ListTile, 'chameleon'), findsNothing); - }); + expect(find.widgetWithText(ListTile, 'aardvark'), findsOneWidget); + expect(find.widgetWithText(ListTile, 'bobcat'), findsNothing); + expect(find.widgetWithText(ListTile, 'chameleon'), findsNothing); + }, + ); } diff --git a/examples/api/test/material/search_anchor/search_anchor.4_test.dart b/examples/api/test/material/search_anchor/search_anchor.4_test.dart index ecacb358b1c..fa0d7696527 100644 --- a/examples/api/test/material/search_anchor/search_anchor.4_test.dart +++ b/examples/api/test/material/search_anchor/search_anchor.4_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/search_anchor/search_anchor.4.dart' as example; +import 'package:flutter_api_samples/material/search_anchor/search_anchor.4.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -42,35 +43,45 @@ void main() { }, ); - testWidgets('debounce is reset each time a character is entered', (WidgetTester tester) async { + testWidgets('debounce is reset each time a character is entered', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.SearchAnchorAsyncExampleApp()); await tester.tap(find.byIcon(Icons.search)); await tester.pumpAndSettle(); await tester.enterText(find.byType(SearchBar), 'c'); - await tester.pump(example.debounceDuration - const Duration(milliseconds: 100)); + await tester.pump( + example.debounceDuration - const Duration(milliseconds: 100), + ); expect(find.widgetWithText(ListTile, 'aardvark'), findsNothing); expect(find.widgetWithText(ListTile, 'bobcat'), findsNothing); expect(find.widgetWithText(ListTile, 'chameleon'), findsNothing); await tester.enterText(find.byType(SearchBar), 'ch'); - await tester.pump(example.debounceDuration - const Duration(milliseconds: 100)); + await tester.pump( + example.debounceDuration - const Duration(milliseconds: 100), + ); expect(find.widgetWithText(ListTile, 'aardvark'), findsNothing); expect(find.widgetWithText(ListTile, 'bobcat'), findsNothing); expect(find.widgetWithText(ListTile, 'chameleon'), findsNothing); await tester.enterText(find.byType(SearchBar), 'cha'); - await tester.pump(example.debounceDuration - const Duration(milliseconds: 100)); + await tester.pump( + example.debounceDuration - const Duration(milliseconds: 100), + ); expect(find.widgetWithText(ListTile, 'aardvark'), findsNothing); expect(find.widgetWithText(ListTile, 'bobcat'), findsNothing); expect(find.widgetWithText(ListTile, 'chameleon'), findsNothing); await tester.enterText(find.byType(SearchBar), 'cham'); - await tester.pump(example.debounceDuration - const Duration(milliseconds: 100)); + await tester.pump( + example.debounceDuration - const Duration(milliseconds: 100), + ); // Despite the total elapsed time being greater than debounceDuration + // fakeAPIDuration, the search has not yet completed, because the debounce diff --git a/examples/api/test/material/search_anchor/search_bar.0_test.dart b/examples/api/test/material/search_anchor/search_bar.0_test.dart index 2ad92b86e15..a7d785423d5 100644 --- a/examples/api/test/material/search_anchor/search_bar.0_test.dart +++ b/examples/api/test/material/search_anchor/search_bar.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/search_anchor/search_bar.0.dart' as example; +import 'package:flutter_api_samples/material/search_anchor/search_bar.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -15,13 +16,19 @@ void main() { expect(find.byIcon(Icons.search), findsOneWidget); expect(searchBar.trailing, isNotEmpty); expect(searchBar.trailing?.length, equals(1)); - final Finder trailingButtonFinder = find.widgetWithIcon(IconButton, Icons.wb_sunny_outlined); + final Finder trailingButtonFinder = find.widgetWithIcon( + IconButton, + Icons.wb_sunny_outlined, + ); expect(trailingButtonFinder, findsOneWidget); await tester.tap(trailingButtonFinder); await tester.pumpAndSettle(); - expect(find.widgetWithIcon(IconButton, Icons.brightness_2_outlined), findsOneWidget); + expect( + find.widgetWithIcon(IconButton, Icons.brightness_2_outlined), + findsOneWidget, + ); await tester.tap(searchBarFinder); await tester.pumpAndSettle(); diff --git a/examples/api/test/material/segmented_button/segmented_button.0_test.dart b/examples/api/test/material/segmented_button/segmented_button.0_test.dart index 9292ee9d4fc..330a74633b8 100644 --- a/examples/api/test/material/segmented_button/segmented_button.0_test.dart +++ b/examples/api/test/material/segmented_button/segmented_button.0_test.dart @@ -4,11 +4,14 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/segmented_button/segmented_button.0.dart' as example; +import 'package:flutter_api_samples/material/segmented_button/segmented_button.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Segmented button can be used with a single selection', (WidgetTester tester) async { + testWidgets('Segmented button can be used with a single selection', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.SegmentedButtonApp()); void expectOneCalendarButton(example.Calendar period) { @@ -70,7 +73,8 @@ void main() { expect( find.byWidgetPredicate( (Widget widget) => - widget is SegmentedButton && setEquals(widget.selected, sizes), + widget is SegmentedButton && + setEquals(widget.selected, sizes), ), findsOne, ); @@ -83,7 +87,10 @@ void main() { expect(find.text('L'), findsOne); expect(find.text('XL'), findsOne); - expectSizeButtons(const {example.Sizes.large, example.Sizes.extraLarge}); + expectSizeButtons(const { + example.Sizes.large, + example.Sizes.extraLarge, + }); // Select everything. await tester.tap(find.text('XS')); diff --git a/examples/api/test/material/segmented_button/segmented_button.1_test.dart b/examples/api/test/material/segmented_button/segmented_button.1_test.dart index 7723fbb04fc..f5b456c1702 100644 --- a/examples/api/test/material/segmented_button/segmented_button.1_test.dart +++ b/examples/api/test/material/segmented_button/segmented_button.1_test.dart @@ -3,32 +3,36 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/segmented_button/segmented_button.1.dart' as example; +import 'package:flutter_api_samples/material/segmented_button/segmented_button.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Can use SegmentedButton.styleFrom to customize SegmentedButton', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.SegmentedButtonApp()); + testWidgets( + 'Can use SegmentedButton.styleFrom to customize SegmentedButton', + (WidgetTester tester) async { + await tester.pumpWidget(const example.SegmentedButtonApp()); - final Color unselectedBackgroundColor = Colors.grey[200]!; - const Color unselectedForegroundColor = Colors.red; - const Color selectedBackgroundColor = Colors.green; - const Color selectedForegroundColor = Colors.white; + final Color unselectedBackgroundColor = Colors.grey[200]!; + const Color unselectedForegroundColor = Colors.red; + const Color selectedBackgroundColor = Colors.green; + const Color selectedForegroundColor = Colors.white; - Material getMaterial(String text) { - return tester.widget( - find.ancestor(of: find.text(text), matching: find.byType(Material)).first, - ); - } + Material getMaterial(String text) { + return tester.widget( + find + .ancestor(of: find.text(text), matching: find.byType(Material)) + .first, + ); + } - // Verify the unselected button style. - expect(getMaterial('Day').textStyle?.color, unselectedForegroundColor); - expect(getMaterial('Day').color, unselectedBackgroundColor); + // Verify the unselected button style. + expect(getMaterial('Day').textStyle?.color, unselectedForegroundColor); + expect(getMaterial('Day').color, unselectedBackgroundColor); - // Verify the selected button style. - expect(getMaterial('Week').textStyle?.color, selectedForegroundColor); - expect(getMaterial('Week').color, selectedBackgroundColor); - }); + // Verify the selected button style. + expect(getMaterial('Week').textStyle?.color, selectedForegroundColor); + expect(getMaterial('Week').color, selectedBackgroundColor); + }, + ); } diff --git a/examples/api/test/material/selectable_region/selectable_region.0_test.dart b/examples/api/test/material/selectable_region/selectable_region.0_test.dart index 1b496c173f2..1ab4aff344f 100644 --- a/examples/api/test/material/selectable_region/selectable_region.0_test.dart +++ b/examples/api/test/material/selectable_region/selectable_region.0_test.dart @@ -5,11 +5,15 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_api_samples/material/selectable_region/selectable_region.0.dart' as example; +import 'package:flutter_api_samples/material/selectable_region/selectable_region.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - Future sendKeyCombination(WidgetTester tester, LogicalKeyboardKey key) async { + Future sendKeyCombination( + WidgetTester tester, + LogicalKeyboardKey key, + ) async { final LogicalKeyboardKey modifier = switch (defaultTargetPlatform) { TargetPlatform.iOS || TargetPlatform.macOS => LogicalKeyboardKey.meta, _ => LogicalKeyboardKey.control, @@ -21,21 +25,23 @@ void main() { await tester.pump(); } - testWidgets('The icon can be selected with the text', (WidgetTester tester) async { + testWidgets('The icon can be selected with the text', ( + WidgetTester tester, + ) async { String? clipboard; - tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(SystemChannels.platform, ( - MethodCall methodCall, - ) async { - if (methodCall.method == 'Clipboard.setData') { - clipboard = (methodCall.arguments as Map)['text'] as String; - } - return null; - }); + tester.binding.defaultBinaryMessenger.setMockMethodCallHandler( + SystemChannels.platform, + (MethodCall methodCall) async { + if (methodCall.method == 'Clipboard.setData') { + clipboard = + (methodCall.arguments as Map)['text'] as String; + } + return null; + }, + ); addTearDown(() { - TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler( - SystemChannels.platform, - null, - ); + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger + .setMockMethodCallHandler(SystemChannels.platform, null); }); await tester.pumpWidget(const example.SelectableRegionExampleApp()); diff --git a/examples/api/test/material/selection_area/selection_area.0_test.dart b/examples/api/test/material/selection_area/selection_area.0_test.dart index 8e70417dc41..85812e990d7 100644 --- a/examples/api/test/material/selection_area/selection_area.0_test.dart +++ b/examples/api/test/material/selection_area/selection_area.0_test.dart @@ -3,15 +3,21 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/selection_area/selection_area.0.dart' as example; +import 'package:flutter_api_samples/material/selection_area/selection_area.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Texts are descendant of the SelectionArea', (WidgetTester tester) async { + testWidgets('Texts are descendant of the SelectionArea', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.SelectionAreaExampleApp()); expect( - find.descendant(of: find.byType(SelectionArea), matching: find.byType(Text)), + find.descendant( + of: find.byType(SelectionArea), + matching: find.byType(Text), + ), findsExactly(4), ); @@ -24,7 +30,10 @@ void main() { for (final String text in selectableTexts) { expect( - find.descendant(of: find.byType(SelectionArea), matching: find.text(text)), + find.descendant( + of: find.byType(SelectionArea), + matching: find.text(text), + ), findsExactly(1), ); } diff --git a/examples/api/test/material/selection_area/selection_area.1_test.dart b/examples/api/test/material/selection_area/selection_area.1_test.dart index d4fc0a7493f..677133fc242 100644 --- a/examples/api/test/material/selection_area/selection_area.1_test.dart +++ b/examples/api/test/material/selection_area/selection_area.1_test.dart @@ -3,19 +3,26 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/selection_area/selection_area.1.dart' as example; +import 'package:flutter_api_samples/material/selection_area/selection_area.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('SelectionArea SelectionListener Example Smoke Test', (WidgetTester tester) async { - await tester.pumpWidget(const example.SelectionAreaSelectionListenerExampleApp()); + testWidgets('SelectionArea SelectionListener Example Smoke Test', ( + WidgetTester tester, + ) async { + await tester.pumpWidget( + const example.SelectionAreaSelectionListenerExampleApp(), + ); expect(find.byType(Column), findsNWidgets(2)); expect(find.textContaining('Selection StartOffset:'), findsOneWidget); expect(find.textContaining('Selection EndOffset:'), findsOneWidget); expect(find.textContaining('Selection Status:'), findsOneWidget); expect(find.textContaining('Selectable Region Status:'), findsOneWidget); expect( - find.textContaining('This is some text under a SelectionArea that can be selected.'), + find.textContaining( + 'This is some text under a SelectionArea that can be selected.', + ), findsOneWidget, ); }); diff --git a/examples/api/test/material/selection_area/selection_area.2_test.dart b/examples/api/test/material/selection_area/selection_area.2_test.dart index fa77e53d866..91ed4ac4b91 100644 --- a/examples/api/test/material/selection_area/selection_area.2_test.dart +++ b/examples/api/test/material/selection_area/selection_area.2_test.dart @@ -5,164 +5,288 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; -import 'package:flutter_api_samples/material/selection_area/selection_area.2.dart' as example; +import 'package:flutter_api_samples/material/selection_area/selection_area.2.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('SelectionArea Color Text Red Example Smoke Test', (WidgetTester tester) async { - await tester.pumpWidget(const example.SelectionAreaColorTextRedExampleApp()); - expect(find.widgetWithIcon(FloatingActionButton, Icons.undo), findsOneWidget); + testWidgets('SelectionArea Color Text Red Example Smoke Test', ( + WidgetTester tester, + ) async { + await tester.pumpWidget( + const example.SelectionAreaColorTextRedExampleApp(), + ); + expect( + find.widgetWithIcon(FloatingActionButton, Icons.undo), + findsOneWidget, + ); expect(find.byType(Column), findsNWidgets(2)); - expect(find.textContaining('This is some bulleted list:\n'), findsOneWidget); + expect( + find.textContaining('This is some bulleted list:\n'), + findsOneWidget, + ); for (int i = 1; i <= 7; i += 1) { expect(find.widgetWithText(Text, '• Bullet $i'), findsOneWidget); } - expect(find.textContaining('This is some text in a text widget.'), findsOneWidget); - expect(find.textContaining(' This is some more text in the same text widget.'), findsOneWidget); - expect(find.textContaining('This is some text in another text widget.'), findsOneWidget); + expect( + find.textContaining('This is some text in a text widget.'), + findsOneWidget, + ); + expect( + find.textContaining(' This is some more text in the same text widget.'), + findsOneWidget, + ); + expect( + find.textContaining('This is some text in another text widget.'), + findsOneWidget, + ); }); - testWidgets('SelectionArea Color Text Red Example - colors selected range red', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.SelectionAreaColorTextRedExampleApp()); - await tester.pumpAndSettle(); - final Finder paragraph1Finder = find.descendant( - of: find.textContaining('This is some bulleted list').first, - matching: find.byType(RichText).first, - ); - final Finder paragraph3Finder = find.descendant( - of: find.textContaining('This is some text in another text widget.'), - matching: find.byType(RichText), - ); - final RenderParagraph paragraph1 = tester.renderObject(paragraph1Finder); - final List bullets = tester - .renderObjectList( - find.descendant(of: find.textContaining('• Bullet'), matching: find.byType(RichText)), - ) - .toList(); - expect(bullets.length, 7); - final RenderParagraph paragraph2 = tester.renderObject( - find.descendant( - of: find.textContaining('This is some text in a text widget.'), + testWidgets( + 'SelectionArea Color Text Red Example - colors selected range red', + (WidgetTester tester) async { + await tester.pumpWidget( + const example.SelectionAreaColorTextRedExampleApp(), + ); + await tester.pumpAndSettle(); + final Finder paragraph1Finder = find.descendant( + of: find.textContaining('This is some bulleted list').first, + matching: find.byType(RichText).first, + ); + final Finder paragraph3Finder = find.descendant( + of: find.textContaining('This is some text in another text widget.'), matching: find.byType(RichText), - ), - ); - final RenderParagraph paragraph3 = tester.renderObject(paragraph3Finder); - // Drag to select from paragraph 1 position 4 to paragraph 3 position 25. - final TestGesture gesture = await tester.startGesture( - tester.getRect(paragraph1Finder).topLeft + const Offset(50.0, 10.0), - kind: PointerDeviceKind.mouse, - ); - addTearDown(gesture.removePointer); - await tester.pump(); - await gesture.moveTo(tester.getRect(paragraph3Finder).centerLeft + const Offset(360.0, 0.0)); - await tester.pump(); - await gesture.up(); - await tester.pumpAndSettle(); + ); + final RenderParagraph paragraph1 = tester.renderObject( + paragraph1Finder, + ); + final List bullets = tester + .renderObjectList( + find.descendant( + of: find.textContaining('• Bullet'), + matching: find.byType(RichText), + ), + ) + .toList(); + expect(bullets.length, 7); + final RenderParagraph paragraph2 = tester.renderObject( + find.descendant( + of: find.textContaining('This is some text in a text widget.'), + matching: find.byType(RichText), + ), + ); + final RenderParagraph paragraph3 = tester.renderObject( + paragraph3Finder, + ); + // Drag to select from paragraph 1 position 4 to paragraph 3 position 25. + final TestGesture gesture = await tester.startGesture( + tester.getRect(paragraph1Finder).topLeft + const Offset(50.0, 10.0), + kind: PointerDeviceKind.mouse, + ); + addTearDown(gesture.removePointer); + await tester.pump(); + await gesture.moveTo( + tester.getRect(paragraph3Finder).centerLeft + const Offset(360.0, 0.0), + ); + await tester.pump(); + await gesture.up(); + await tester.pumpAndSettle(); - // Verify selection. - // Bulleted list title. - expect(paragraph1.selections.length, 1); - expect(paragraph1.selections[0], const TextSelection(baseOffset: 4, extentOffset: 27)); - // Bulleted list. - for (final RenderParagraph paragraphBullet in bullets) { - expect(paragraphBullet.selections.length, 1); - expect(paragraphBullet.selections[0], const TextSelection(baseOffset: 0, extentOffset: 10)); - } - // Second text widget. - expect(paragraph2.selections.length, 1); - expect(paragraph2.selections[0], const TextSelection(baseOffset: 0, extentOffset: 83)); - // Third text widget. - expect(paragraph3.selections.length, 1); - expect(paragraph3.selections[0], const TextSelection(baseOffset: 0, extentOffset: 25)); - - // Color selection red. - expect(find.textContaining('Color Text Red'), findsOneWidget); - await tester.tap(find.textContaining('Color Text Red')); - await tester.pumpAndSettle(); - - // Verify selection is red. - final TextSpan paragraph1ResultingSpan = paragraph1.text as TextSpan; - final TextSpan paragraph2ResultingSpan = paragraph2.text as TextSpan; - final TextSpan paragraph3ResultingSpan = paragraph3.text as TextSpan; - // Title of bulleted list is partially red. - expect(paragraph1ResultingSpan.children, isNotNull); - expect(paragraph1ResultingSpan.children!.length, 1); - expect((paragraph1ResultingSpan.children![0] as TextSpan).children, isNotNull); - expect((paragraph1ResultingSpan.children![0] as TextSpan).children!.length, 3); - expect((paragraph1ResultingSpan.children![0] as TextSpan).children![0].style, isNull); - expect((paragraph1ResultingSpan.children![0] as TextSpan).children![1], isA()); - expect( - ((paragraph1ResultingSpan.children![0] as TextSpan).children![1] as TextSpan).text, - isNotNull, - ); - expect( - ((paragraph1ResultingSpan.children![0] as TextSpan).children![1] as TextSpan).text, - ' is some bulleted list:\n', - ); - expect((paragraph1ResultingSpan.children![0] as TextSpan).children![1].style, isNotNull); - expect((paragraph1ResultingSpan.children![0] as TextSpan).children![1].style!.color, isNotNull); - expect( - (paragraph1ResultingSpan.children![0] as TextSpan).children![1].style!.color, - Colors.red, - ); - expect((paragraph1ResultingSpan.children![0] as TextSpan).children![2], isA()); - // Bullets are red. - for (final RenderParagraph paragraphBullet in bullets) { - final TextSpan resultingBulletSpan = paragraphBullet.text as TextSpan; - expect(resultingBulletSpan.children, isNotNull); - expect(resultingBulletSpan.children!.length, 1); - expect(resultingBulletSpan.children![0], isA()); - expect((resultingBulletSpan.children![0] as TextSpan).children, isNotNull); - expect((resultingBulletSpan.children![0] as TextSpan).children!.length, 1); - expect((resultingBulletSpan.children![0] as TextSpan).children![0], isA()); + // Verify selection. + // Bulleted list title. + expect(paragraph1.selections.length, 1); expect( - ((resultingBulletSpan.children![0] as TextSpan).children![0] as TextSpan).style, + paragraph1.selections[0], + const TextSelection(baseOffset: 4, extentOffset: 27), + ); + // Bulleted list. + for (final RenderParagraph paragraphBullet in bullets) { + expect(paragraphBullet.selections.length, 1); + expect( + paragraphBullet.selections[0], + const TextSelection(baseOffset: 0, extentOffset: 10), + ); + } + // Second text widget. + expect(paragraph2.selections.length, 1); + expect( + paragraph2.selections[0], + const TextSelection(baseOffset: 0, extentOffset: 83), + ); + // Third text widget. + expect(paragraph3.selections.length, 1); + expect( + paragraph3.selections[0], + const TextSelection(baseOffset: 0, extentOffset: 25), + ); + + // Color selection red. + expect(find.textContaining('Color Text Red'), findsOneWidget); + await tester.tap(find.textContaining('Color Text Red')); + await tester.pumpAndSettle(); + + // Verify selection is red. + final TextSpan paragraph1ResultingSpan = paragraph1.text as TextSpan; + final TextSpan paragraph2ResultingSpan = paragraph2.text as TextSpan; + final TextSpan paragraph3ResultingSpan = paragraph3.text as TextSpan; + // Title of bulleted list is partially red. + expect(paragraph1ResultingSpan.children, isNotNull); + expect(paragraph1ResultingSpan.children!.length, 1); + expect( + (paragraph1ResultingSpan.children![0] as TextSpan).children, isNotNull, ); expect( - ((resultingBulletSpan.children![0] as TextSpan).children![0] as TextSpan).style!.color, + (paragraph1ResultingSpan.children![0] as TextSpan).children!.length, + 3, + ); + expect( + (paragraph1ResultingSpan.children![0] as TextSpan).children![0].style, + isNull, + ); + expect( + (paragraph1ResultingSpan.children![0] as TextSpan).children![1], + isA(), + ); + expect( + ((paragraph1ResultingSpan.children![0] as TextSpan).children![1] + as TextSpan) + .text, isNotNull, ); expect( - ((resultingBulletSpan.children![0] as TextSpan).children![0] as TextSpan).style!.color, + ((paragraph1ResultingSpan.children![0] as TextSpan).children![1] + as TextSpan) + .text, + ' is some bulleted list:\n', + ); + expect( + (paragraph1ResultingSpan.children![0] as TextSpan).children![1].style, + isNotNull, + ); + expect( + (paragraph1ResultingSpan.children![0] as TextSpan) + .children![1] + .style! + .color, + isNotNull, + ); + expect( + (paragraph1ResultingSpan.children![0] as TextSpan) + .children![1] + .style! + .color, Colors.red, ); - } - // Second text widget is red. - expect(paragraph2ResultingSpan.children, isNotNull); - expect(paragraph2ResultingSpan.children!.length, 1); - expect(paragraph2ResultingSpan.children![0], isA()); - expect((paragraph2ResultingSpan.children![0] as TextSpan).children, isNotNull); - for (final InlineSpan span in (paragraph2ResultingSpan.children![0] as TextSpan).children!) { - if (span is TextSpan) { - expect(span.style, isNotNull); - expect(span.style!.color, isNotNull); - expect(span.style!.color, Colors.red); + expect( + (paragraph1ResultingSpan.children![0] as TextSpan).children![2], + isA(), + ); + // Bullets are red. + for (final RenderParagraph paragraphBullet in bullets) { + final TextSpan resultingBulletSpan = paragraphBullet.text as TextSpan; + expect(resultingBulletSpan.children, isNotNull); + expect(resultingBulletSpan.children!.length, 1); + expect(resultingBulletSpan.children![0], isA()); + expect( + (resultingBulletSpan.children![0] as TextSpan).children, + isNotNull, + ); + expect( + (resultingBulletSpan.children![0] as TextSpan).children!.length, + 1, + ); + expect( + (resultingBulletSpan.children![0] as TextSpan).children![0], + isA(), + ); + expect( + ((resultingBulletSpan.children![0] as TextSpan).children![0] + as TextSpan) + .style, + isNotNull, + ); + expect( + ((resultingBulletSpan.children![0] as TextSpan).children![0] + as TextSpan) + .style! + .color, + isNotNull, + ); + expect( + ((resultingBulletSpan.children![0] as TextSpan).children![0] + as TextSpan) + .style! + .color, + Colors.red, + ); } - } - // Part of third text widget is red. - expect(paragraph3ResultingSpan.children, isNotNull); - expect(paragraph3ResultingSpan.children!.length, 1); - expect(paragraph3ResultingSpan.children![0], isA()); - expect((paragraph3ResultingSpan.children![0] as TextSpan).children, isNotNull); - expect((paragraph3ResultingSpan.children![0] as TextSpan).children!.length, 2); - expect((paragraph3ResultingSpan.children![0] as TextSpan).children![0], isA()); - expect( - ((paragraph3ResultingSpan.children![0] as TextSpan).children![0] as TextSpan).text, - isNotNull, - ); - expect( - ((paragraph3ResultingSpan.children![0] as TextSpan).children![0] as TextSpan).text, - 'This is some text in ano', - ); - expect((paragraph3ResultingSpan.children![0] as TextSpan).children![0].style, isNotNull); - expect((paragraph3ResultingSpan.children![0] as TextSpan).children![0].style!.color, isNotNull); - expect( - (paragraph3ResultingSpan.children![0] as TextSpan).children![0].style!.color, - Colors.red, - ); - expect((paragraph3ResultingSpan.children![0] as TextSpan).children![1].style, isNull); - }); + // Second text widget is red. + expect(paragraph2ResultingSpan.children, isNotNull); + expect(paragraph2ResultingSpan.children!.length, 1); + expect(paragraph2ResultingSpan.children![0], isA()); + expect( + (paragraph2ResultingSpan.children![0] as TextSpan).children, + isNotNull, + ); + for (final InlineSpan span + in (paragraph2ResultingSpan.children![0] as TextSpan).children!) { + if (span is TextSpan) { + expect(span.style, isNotNull); + expect(span.style!.color, isNotNull); + expect(span.style!.color, Colors.red); + } + } + // Part of third text widget is red. + expect(paragraph3ResultingSpan.children, isNotNull); + expect(paragraph3ResultingSpan.children!.length, 1); + expect(paragraph3ResultingSpan.children![0], isA()); + expect( + (paragraph3ResultingSpan.children![0] as TextSpan).children, + isNotNull, + ); + expect( + (paragraph3ResultingSpan.children![0] as TextSpan).children!.length, + 2, + ); + expect( + (paragraph3ResultingSpan.children![0] as TextSpan).children![0], + isA(), + ); + expect( + ((paragraph3ResultingSpan.children![0] as TextSpan).children![0] + as TextSpan) + .text, + isNotNull, + ); + expect( + ((paragraph3ResultingSpan.children![0] as TextSpan).children![0] + as TextSpan) + .text, + 'This is some text in ano', + ); + expect( + (paragraph3ResultingSpan.children![0] as TextSpan).children![0].style, + isNotNull, + ); + expect( + (paragraph3ResultingSpan.children![0] as TextSpan) + .children![0] + .style! + .color, + isNotNull, + ); + expect( + (paragraph3ResultingSpan.children![0] as TextSpan) + .children![0] + .style! + .color, + Colors.red, + ); + expect( + (paragraph3ResultingSpan.children![0] as TextSpan).children![1].style, + isNull, + ); + }, + ); } diff --git a/examples/api/test/material/selection_container/selection_container.0_test.dart b/examples/api/test/material/selection_container/selection_container.0_test.dart index c261ae2968a..23a5531f614 100644 --- a/examples/api/test/material/selection_container/selection_container.0_test.dart +++ b/examples/api/test/material/selection_container/selection_container.0_test.dart @@ -15,16 +15,28 @@ void main() { (WidgetTester tester) async { await tester.pumpWidget(const example.SelectionContainerExampleApp()); - expect(find.widgetWithText(AppBar, 'SelectionContainer Sample'), findsOne); + expect( + find.widgetWithText(AppBar, 'SelectionContainer Sample'), + findsOne, + ); final RenderParagraph paragraph1 = tester.renderObject( - find.descendant(of: find.text('Row 1'), matching: find.byType(RichText)), + find.descendant( + of: find.text('Row 1'), + matching: find.byType(RichText), + ), ); final RenderParagraph paragraph2 = tester.renderObject( - find.descendant(of: find.text('Row 2'), matching: find.byType(RichText)), + find.descendant( + of: find.text('Row 2'), + matching: find.byType(RichText), + ), ); final RenderParagraph paragraph3 = tester.renderObject( - find.descendant(of: find.text('Row 3'), matching: find.byType(RichText)), + find.descendant( + of: find.text('Row 3'), + matching: find.byType(RichText), + ), ); final Rect paragraph1Rect = tester.getRect(find.text('Row 1')); final TestGesture gesture = await tester.startGesture( @@ -36,9 +48,18 @@ void main() { await gesture.moveTo(paragraph1Rect.center); await tester.pump(); - expect(paragraph1.selections.first, const TextSelection(baseOffset: 0, extentOffset: 5)); - expect(paragraph2.selections.first, const TextSelection(baseOffset: 0, extentOffset: 5)); - expect(paragraph3.selections.first, const TextSelection(baseOffset: 0, extentOffset: 5)); + expect( + paragraph1.selections.first, + const TextSelection(baseOffset: 0, extentOffset: 5), + ); + expect( + paragraph2.selections.first, + const TextSelection(baseOffset: 0, extentOffset: 5), + ); + expect( + paragraph3.selections.first, + const TextSelection(baseOffset: 0, extentOffset: 5), + ); await gesture.up(); }, diff --git a/examples/api/test/material/selection_container/selection_container_disabled.0_test.dart b/examples/api/test/material/selection_container/selection_container_disabled.0_test.dart index 7985bd13ff4..673b32cb942 100644 --- a/examples/api/test/material/selection_container/selection_container_disabled.0_test.dart +++ b/examples/api/test/material/selection_container/selection_container_disabled.0_test.dart @@ -13,14 +13,24 @@ void main() { testWidgets('A SelectionContainer.disabled should disable selections', ( WidgetTester tester, ) async { - await tester.pumpWidget(const example.SelectionContainerDisabledExampleApp()); + await tester.pumpWidget( + const example.SelectionContainerDisabledExampleApp(), + ); - expect(find.widgetWithText(AppBar, 'SelectionContainer.disabled Sample'), findsOne); + expect( + find.widgetWithText(AppBar, 'SelectionContainer.disabled Sample'), + findsOne, + ); final RenderParagraph paragraph1 = tester.renderObject( - find.descendant(of: find.text('Selectable text').first, matching: find.byType(RichText)), + find.descendant( + of: find.text('Selectable text').first, + matching: find.byType(RichText), + ), + ); + final Rect paragraph1Rect = tester.getRect( + find.text('Selectable text').first, ); - final Rect paragraph1Rect = tester.getRect(find.text('Selectable text').first); final TestGesture gesture = await tester.startGesture( paragraph1Rect.centerLeft, kind: PointerDeviceKind.mouse, @@ -30,26 +40,48 @@ void main() { await gesture.moveTo(paragraph1Rect.center); await tester.pump(); - expect(paragraph1.selections.first, const TextSelection(baseOffset: 0, extentOffset: 7)); + expect( + paragraph1.selections.first, + const TextSelection(baseOffset: 0, extentOffset: 7), + ); final RenderParagraph paragraph2 = tester.renderObject( - find.descendant(of: find.text('Non-selectable text'), matching: find.byType(RichText)), + find.descendant( + of: find.text('Non-selectable text'), + matching: find.byType(RichText), + ), + ); + final Rect paragraph2Rect = tester.getRect( + find.text('Non-selectable text'), ); - final Rect paragraph2Rect = tester.getRect(find.text('Non-selectable text')); await gesture.moveTo(paragraph2Rect.center); // Should select the rest of paragraph 1. - expect(paragraph1.selections.first, const TextSelection(baseOffset: 0, extentOffset: 15)); + expect( + paragraph1.selections.first, + const TextSelection(baseOffset: 0, extentOffset: 15), + ); // paragraph2 is in a disabled container. expect(paragraph2.selections, isEmpty); final RenderParagraph paragraph3 = tester.renderObject( - find.descendant(of: find.text('Selectable text').last, matching: find.byType(RichText)), + find.descendant( + of: find.text('Selectable text').last, + matching: find.byType(RichText), + ), + ); + final Rect paragraph3Rect = tester.getRect( + find.text('Selectable text').last, ); - final Rect paragraph3Rect = tester.getRect(find.text('Selectable text').last); await gesture.moveTo(paragraph3Rect.center); - expect(paragraph1.selections.first, const TextSelection(baseOffset: 0, extentOffset: 15)); + expect( + paragraph1.selections.first, + const TextSelection(baseOffset: 0, extentOffset: 15), + ); expect(paragraph2.selections, isEmpty); - expect(paragraph3.selections.first, const TextSelection(baseOffset: 0, extentOffset: 7)); + expect( + paragraph3.selections.first, + const TextSelection(baseOffset: 0, extentOffset: 7), + ); await gesture.up(); }); diff --git a/examples/api/test/material/slider/slider.0_test.dart b/examples/api/test/material/slider/slider.0_test.dart index b05036a5946..1aeb1c641b5 100644 --- a/examples/api/test/material/slider/slider.0_test.dart +++ b/examples/api/test/material/slider/slider.0_test.dart @@ -33,20 +33,26 @@ void main() { expect(slider.value, equals(0)); }); - testWidgets('Sliders year2023 flag can be toggled', (WidgetTester tester) async { + testWidgets('Sliders year2023 flag can be toggled', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.SliderExampleApp()); Slider slider = tester.widget(find.byType(Slider).first); + // ignore: deprecated_member_use expect(slider.year2023, true); Slider discreteSlider = tester.widget(find.byType(Slider).last); + // ignore: deprecated_member_use expect(discreteSlider.year2023, true); await tester.tap(find.byType(SwitchListTile)); await tester.pumpAndSettle(); slider = tester.widget(find.byType(Slider).first); + // ignore: deprecated_member_use expect(slider.year2023, false); discreteSlider = tester.widget(find.byType(Slider).last); + // ignore: deprecated_member_use expect(discreteSlider.year2023, false); }); } diff --git a/examples/api/test/material/snack_bar/snack_bar.0_test.dart b/examples/api/test/material/snack_bar/snack_bar.0_test.dart index 479d4bd140d..6aa815d8d6c 100644 --- a/examples/api/test/material/snack_bar/snack_bar.0_test.dart +++ b/examples/api/test/material/snack_bar/snack_bar.0_test.dart @@ -3,15 +3,21 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/snack_bar/snack_bar.0.dart' as example; +import 'package:flutter_api_samples/material/snack_bar/snack_bar.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Clicking on Button shows a SnackBar', (WidgetTester tester) async { + testWidgets('Clicking on Button shows a SnackBar', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.SnackBarExampleApp()); expect(find.widgetWithText(AppBar, 'SnackBar Sample'), findsOneWidget); - expect(find.widgetWithText(ElevatedButton, 'Show Snackbar'), findsOneWidget); + expect( + find.widgetWithText(ElevatedButton, 'Show Snackbar'), + findsOneWidget, + ); await tester.tap(find.widgetWithText(ElevatedButton, 'Show Snackbar')); await tester.pump(); expect(find.text('Awesome Snackbar!'), findsOneWidget); diff --git a/examples/api/test/material/snack_bar/snack_bar.1_test.dart b/examples/api/test/material/snack_bar/snack_bar.1_test.dart index a1ff3c93090..31487053712 100644 --- a/examples/api/test/material/snack_bar/snack_bar.1_test.dart +++ b/examples/api/test/material/snack_bar/snack_bar.1_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/snack_bar/snack_bar.1.dart' as example; +import 'package:flutter_api_samples/material/snack_bar/snack_bar.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -20,7 +21,10 @@ void main() { expect(find.widgetWithText(SnackBarAction, 'Action'), findsOneWidget); final SnackBar bar = tester.widget( - find.ancestor(of: find.text('Awesome SnackBar!'), matching: find.byType(SnackBar)), + find.ancestor( + of: find.text('Awesome SnackBar!'), + matching: find.byType(SnackBar), + ), ); expect(bar.behavior, SnackBarBehavior.floating); }); @@ -45,22 +49,23 @@ void main() { ); }); - testWidgets('Snackbar should not disappear after timeout, unless tapping the action button', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.SnackBarExampleApp()); - expect(find.byType(SnackBar), findsNothing); + testWidgets( + 'Snackbar should not disappear after timeout, unless tapping the action button', + (WidgetTester tester) async { + await tester.pumpWidget(const example.SnackBarExampleApp()); + expect(find.byType(SnackBar), findsNothing); - await tester.tap(find.byType(ElevatedButton)); - await tester.pumpAndSettle(); - expect(find.byType(SnackBar), findsOneWidget); + await tester.tap(find.byType(ElevatedButton)); + await tester.pumpAndSettle(); + expect(find.byType(SnackBar), findsOneWidget); - await tester.pump(const Duration(milliseconds: 1500)); - await tester.pumpAndSettle(); - expect(find.byType(SnackBar), findsOneWidget); + await tester.pump(const Duration(milliseconds: 1500)); + await tester.pumpAndSettle(); + expect(find.byType(SnackBar), findsOneWidget); - await tester.tap(find.widgetWithText(SnackBarAction, 'Action')); - await tester.pumpAndSettle(); - expect(find.byType(SnackBar), findsNothing); - }); + await tester.tap(find.widgetWithText(SnackBarAction, 'Action')); + await tester.pumpAndSettle(); + expect(find.byType(SnackBar), findsNothing); + }, + ); } diff --git a/examples/api/test/material/snack_bar/snack_bar.2_test.dart b/examples/api/test/material/snack_bar/snack_bar.2_test.dart index b9fabd427b6..443bc035ef1 100644 --- a/examples/api/test/material/snack_bar/snack_bar.2_test.dart +++ b/examples/api/test/material/snack_bar/snack_bar.2_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/snack_bar/snack_bar.2.dart' as example; +import 'package:flutter_api_samples/material/snack_bar/snack_bar.2.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -12,22 +13,39 @@ void main() { expect(find.byType(SnackBar), findsNothing); expect(find.widgetWithText(AppBar, 'SnackBar Sample'), findsOneWidget); - expect(find.widgetWithText(FloatingActionButton, 'Show Snackbar'), findsOneWidget); + expect( + find.widgetWithText(FloatingActionButton, 'Show Snackbar'), + findsOneWidget, + ); expect(find.text('Behavior'), findsOneWidget); expect(find.text('Fixed'), findsOneWidget); expect(find.text('Floating'), findsOneWidget); expect(find.text('Content'), findsOneWidget); - expect(find.widgetWithText(SwitchListTile, 'Include close Icon'), findsOneWidget); - expect(find.widgetWithText(SwitchListTile, 'Multi Line Text'), findsOneWidget); - expect(find.widgetWithText(SwitchListTile, 'Include Action'), findsOneWidget); - expect(find.widgetWithText(SwitchListTile, 'Long Action Label'), findsOneWidget); + expect( + find.widgetWithText(SwitchListTile, 'Include close Icon'), + findsOneWidget, + ); + expect( + find.widgetWithText(SwitchListTile, 'Multi Line Text'), + findsOneWidget, + ); + expect( + find.widgetWithText(SwitchListTile, 'Include Action'), + findsOneWidget, + ); + expect( + find.widgetWithText(SwitchListTile, 'Long Action Label'), + findsOneWidget, + ); await tester.scrollUntilVisible(find.byType(Slider), 30); expect(find.text('Action new-line overflow threshold'), findsOneWidget); expect(find.byType(Slider), findsOneWidget); }); - testWidgets('Applies default configuration to snackbar', (WidgetTester tester) async { + testWidgets('Applies default configuration to snackbar', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.SnackBarExampleApp()); expect(find.byType(SnackBar), findsNothing); @@ -44,14 +62,19 @@ void main() { expect(find.text('Single Line Snack Bar'), findsOneWidget); expect(find.text('Action'), findsOneWidget); expect(find.byIcon(Icons.close), findsOneWidget); - expect(tester.widget(find.byType(SnackBar)).behavior, SnackBarBehavior.floating); + expect( + tester.widget(find.byType(SnackBar)).behavior, + SnackBarBehavior.floating, + ); await tester.tap(find.byIcon(Icons.close)); await tester.pumpAndSettle(); expect(find.byType(SnackBar), findsNothing); }); - testWidgets('Can configure fixed snack bar with long text', (WidgetTester tester) async { + testWidgets('Can configure fixed snack bar with long text', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.SnackBarExampleApp()); await tester.tap(find.text('Fixed')); @@ -64,14 +87,19 @@ void main() { expect(find.textContaining('spans across multiple lines'), findsOneWidget); expect(find.text('Long Action Text'), findsOneWidget); expect(find.byIcon(Icons.close), findsOneWidget); - expect(tester.widget(find.byType(SnackBar)).behavior, SnackBarBehavior.fixed); + expect( + tester.widget(find.byType(SnackBar)).behavior, + SnackBarBehavior.fixed, + ); await tester.tap(find.byIcon(Icons.close)); await tester.pumpAndSettle(); expect(find.byType(SnackBar), findsNothing); }); - testWidgets('Can configure to remove action and close icon', (WidgetTester tester) async { + testWidgets('Can configure to remove action and close icon', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.SnackBarExampleApp()); await tester.tap(find.text('Include close Icon')); @@ -84,7 +112,9 @@ void main() { expect(find.byIcon(Icons.close), findsNothing); }); - testWidgets('Higher overflow threshold leads to smaller snack bars', (WidgetTester tester) async { + testWidgets('Higher overflow threshold leads to smaller snack bars', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.SnackBarExampleApp()); await tester.tap(find.text('Fixed')); @@ -93,7 +123,9 @@ void main() { // Establish max size with low threshold (causes overflow) await tester.scrollUntilVisible(find.byType(Slider), 30); - TestGesture gesture = await tester.startGesture(tester.getCenter(find.byType(Slider))); + TestGesture gesture = await tester.startGesture( + tester.getCenter(find.byType(Slider)), + ); await gesture.moveTo(tester.getBottomLeft(find.byType(Slider))); await gesture.up(); await tester.tapAt(tester.getBottomLeft(find.byType(Slider))); @@ -112,7 +144,10 @@ void main() { await tester.tap(find.text('Show Snackbar')); await tester.pumpAndSettle(); - expect(tester.getSize(find.byType(SnackBar)).height, lessThan(highSnackBar)); + expect( + tester.getSize(find.byType(SnackBar)).height, + lessThan(highSnackBar), + ); }); testWidgets('Disable unusable elements', (WidgetTester tester) async { diff --git a/examples/api/test/material/stepper/step_style.0_test.dart b/examples/api/test/material/stepper/step_style.0_test.dart index c13927d516b..b5f3a2931e9 100644 --- a/examples/api/test/material/stepper/step_style.0_test.dart +++ b/examples/api/test/material/stepper/step_style.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/stepper/step_style.0.dart' as example; +import 'package:flutter_api_samples/material/stepper/step_style.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/stepper/stepper.controls_builder.0_test.dart b/examples/api/test/material/stepper/stepper.controls_builder.0_test.dart index c739f4b0340..2ca1070f15f 100644 --- a/examples/api/test/material/stepper/stepper.controls_builder.0_test.dart +++ b/examples/api/test/material/stepper/stepper.controls_builder.0_test.dart @@ -3,19 +3,21 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/stepper/stepper.controls_builder.0.dart' as example; +import 'package:flutter_api_samples/material/stepper/stepper.controls_builder.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Stepper control builder can be overridden to display custom buttons', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.ControlsBuilderExampleApp()); + testWidgets( + 'Stepper control builder can be overridden to display custom buttons', + (WidgetTester tester) async { + await tester.pumpWidget(const example.ControlsBuilderExampleApp()); - expect(find.widgetWithText(AppBar, 'Stepper Sample'), findsOne); - expect(find.text('A').hitTestable(), findsOne); - expect(find.text('B').hitTestable(), findsOne); - expect(find.widgetWithText(TextButton, 'NEXT').hitTestable(), findsOne); - expect(find.widgetWithText(TextButton, 'CANCEL').hitTestable(), findsOne); - }); + expect(find.widgetWithText(AppBar, 'Stepper Sample'), findsOne); + expect(find.text('A').hitTestable(), findsOne); + expect(find.text('B').hitTestable(), findsOne); + expect(find.widgetWithText(TextButton, 'NEXT').hitTestable(), findsOne); + expect(find.widgetWithText(TextButton, 'CANCEL').hitTestable(), findsOne); + }, + ); } diff --git a/examples/api/test/material/switch/switch.2_test.dart b/examples/api/test/material/switch/switch.2_test.dart index bc71d73382e..2adf5246f60 100644 --- a/examples/api/test/material/switch/switch.2_test.dart +++ b/examples/api/test/material/switch/switch.2_test.dart @@ -7,7 +7,9 @@ import 'package:flutter_api_samples/material/switch/switch.2.dart' as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Switch thumb icon supports material states', (WidgetTester tester) async { + testWidgets('Switch thumb icon supports material states', ( + WidgetTester tester, + ) async { const Set selected = {WidgetState.selected}; const Set unselected = {}; diff --git a/examples/api/test/material/switch/switch.4_test.dart b/examples/api/test/material/switch/switch.4_test.dart index d1d06248a48..4eca5066291 100644 --- a/examples/api/test/material/switch/switch.4_test.dart +++ b/examples/api/test/material/switch/switch.4_test.dart @@ -36,21 +36,29 @@ void main() { ..rrect(color: Colors.white), // Thumb color ); - await tester.tap(find.widgetWithText(OutlinedButton, 'Show cupertino style')); + await tester.tap( + find.widgetWithText(OutlinedButton, 'Show cupertino style'), + ); await tester.pumpAndSettle(); expect( adaptiveSwitch, paints - ..rrect(color: const Color(0xff795548)) // Customized track color only for cupertino. + ..rrect( + color: const Color(0xff795548), + ) // Customized track color only for cupertino. ..rrect() ..rrect() ..rrect() ..rrect() - ..rrect(color: const Color(0xffffeb3b)), // Customized thumb color only for cupertino. + ..rrect( + color: const Color(0xffffeb3b), + ), // Customized thumb color only for cupertino. ); - await tester.tap(find.widgetWithText(OutlinedButton, 'Remove customization')); + await tester.tap( + find.widgetWithText(OutlinedButton, 'Remove customization'), + ); await tester.pumpAndSettle(); expect( diff --git a/examples/api/test/material/switch_list_tile/custom_labeled_switch.0_test.dart b/examples/api/test/material/switch_list_tile/custom_labeled_switch.0_test.dart index d81b78aefaa..0fbffa8413f 100644 --- a/examples/api/test/material/switch_list_tile/custom_labeled_switch.0_test.dart +++ b/examples/api/test/material/switch_list_tile/custom_labeled_switch.0_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/material/switch_list_tile/custom_labeled_swi import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('LinkedLabelSwitch contains RichText and Switch', (WidgetTester tester) async { + testWidgets('LinkedLabelSwitch contains RichText and Switch', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.LabeledSwitchApp()); // Label text is in a RichText widget with the correct text. diff --git a/examples/api/test/material/switch_list_tile/custom_labeled_switch.1_test.dart b/examples/api/test/material/switch_list_tile/custom_labeled_switch.1_test.dart index f9de640febe..e76589a35a0 100644 --- a/examples/api/test/material/switch_list_tile/custom_labeled_switch.1_test.dart +++ b/examples/api/test/material/switch_list_tile/custom_labeled_switch.1_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/material/switch_list_tile/custom_labeled_swi import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Tapping LabeledSwitch toggles the switch', (WidgetTester tester) async { + testWidgets('Tapping LabeledSwitch toggles the switch', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.LabeledSwitchApp()); // Switch is initially off. diff --git a/examples/api/test/material/switch_list_tile/switch_list_tile.0_test.dart b/examples/api/test/material/switch_list_tile/switch_list_tile.0_test.dart index c0675b31553..7995041d188 100644 --- a/examples/api/test/material/switch_list_tile/switch_list_tile.0_test.dart +++ b/examples/api/test/material/switch_list_tile/switch_list_tile.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/switch_list_tile/switch_list_tile.0.dart' as example; +import 'package:flutter_api_samples/material/switch_list_tile/switch_list_tile.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/switch_list_tile/switch_list_tile.1_test.dart b/examples/api/test/material/switch_list_tile/switch_list_tile.1_test.dart index 88a7fbc8169..a483583a1e3 100644 --- a/examples/api/test/material/switch_list_tile/switch_list_tile.1_test.dart +++ b/examples/api/test/material/switch_list_tile/switch_list_tile.1_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/switch_list_tile/switch_list_tile.1.dart' as example; +import 'package:flutter_api_samples/material/switch_list_tile/switch_list_tile.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/tab_controller/tab_controller.1_test.dart b/examples/api/test/material/tab_controller/tab_controller.1_test.dart index 4d8f5b2764b..36851465e70 100644 --- a/examples/api/test/material/tab_controller/tab_controller.1_test.dart +++ b/examples/api/test/material/tab_controller/tab_controller.1_test.dart @@ -4,17 +4,23 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/tab_controller/tab_controller.1.dart' as example; +import 'package:flutter_api_samples/material/tab_controller/tab_controller.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Verify first tab is selected by default', (WidgetTester tester) async { + testWidgets('Verify first tab is selected by default', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.TabControllerExampleApp()); final Tab firstTab = example.TabControllerExampleApp.tabs.first; expect( - find.descendant(of: find.byType(TabBarView), matching: find.text('${firstTab.text} Tab')), + find.descendant( + of: find.byType(TabBarView), + matching: find.text('${firstTab.text} Tab'), + ), findsOneWidget, ); }); @@ -39,11 +45,19 @@ void main() { for (final Tab tab in tabsTraversalOrder) { // Tap on the TabBar's tab to select it. - await tester.tap(find.descendant(of: find.byType(TabBar), matching: find.text(tab.text!))); + await tester.tap( + find.descendant( + of: find.byType(TabBar), + matching: find.text(tab.text!), + ), + ); await tester.pumpAndSettle(); expect( - find.descendant(of: find.byType(TabBarView), matching: find.text('${tab.text} Tab')), + find.descendant( + of: find.byType(TabBarView), + matching: find.text('${tab.text} Tab'), + ), findsOneWidget, ); @@ -56,26 +70,30 @@ void main() { debugPrint = originalDebugPrint; }); - testWidgets('DefaultTabControllerListener throws when no DefaultTabController above', ( - WidgetTester tester, - ) async { - await tester.pumpWidget( - example.DefaultTabControllerListener(onTabChanged: (_) {}, child: const SizedBox.shrink()), - ); + testWidgets( + 'DefaultTabControllerListener throws when no DefaultTabController above', + (WidgetTester tester) async { + await tester.pumpWidget( + example.DefaultTabControllerListener( + onTabChanged: (_) {}, + child: const SizedBox.shrink(), + ), + ); - final dynamic exception = tester.takeException(); - expect(exception, isFlutterError); + final dynamic exception = tester.takeException(); + expect(exception, isFlutterError); - final FlutterError error = exception as FlutterError; - expect( - error.toStringDeep(), - equalsIgnoringHashCodes( - 'FlutterError\n' - ' No DefaultTabController for DefaultTabControllerListener.\n' - ' When creating a DefaultTabControllerListener, you must ensure\n' - ' that there is a DefaultTabController above the\n' - ' DefaultTabControllerListener.\n', - ), - ); - }); + final FlutterError error = exception as FlutterError; + expect( + error.toStringDeep(), + equalsIgnoringHashCodes( + 'FlutterError\n' + ' No DefaultTabController for DefaultTabControllerListener.\n' + ' When creating a DefaultTabControllerListener, you must ensure\n' + ' that there is a DefaultTabController above the\n' + ' DefaultTabControllerListener.\n', + ), + ); + }, + ); } diff --git a/examples/api/test/material/tabs/tab_bar.2_test.dart b/examples/api/test/material/tabs/tab_bar.2_test.dart index 2e315c24a9f..d0878fc14c3 100644 --- a/examples/api/test/material/tabs/tab_bar.2_test.dart +++ b/examples/api/test/material/tabs/tab_bar.2_test.dart @@ -16,10 +16,14 @@ void main() { await tester.pumpWidget(const example.TabBarApp()); - final TabBar primaryTabBar = tester.widget(find.byType(TabBar).last); + final TabBar primaryTabBar = tester.widget( + find.byType(TabBar).last, + ); expect(primaryTabBar.tabs.length, 3); - final TabBar secondaryTabBar = tester.widget(find.byType(TabBar).first); + final TabBar secondaryTabBar = tester.widget( + find.byType(TabBar).first, + ); expect(secondaryTabBar.tabs.length, 2); String tabBarViewText = '$primaryTabLabel2: $secondaryTabLabel1 tab'; diff --git a/examples/api/test/material/tabs/tab_bar.indicator_animation.0_test.dart b/examples/api/test/material/tabs/tab_bar.indicator_animation.0_test.dart index ed2860953e4..f805c70eeb2 100644 --- a/examples/api/test/material/tabs/tab_bar.indicator_animation.0_test.dart +++ b/examples/api/test/material/tabs/tab_bar.indicator_animation.0_test.dart @@ -3,95 +3,99 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/tabs/tab_bar.indicator_animation.0.dart' as example; +import 'package:flutter_api_samples/material/tabs/tab_bar.indicator_animation.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('TabBar.indicatorAnimation can customize tab indicator animation', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.IndicatorAnimationExampleApp()); + testWidgets( + 'TabBar.indicatorAnimation can customize tab indicator animation', + (WidgetTester tester) async { + await tester.pumpWidget(const example.IndicatorAnimationExampleApp()); - final RenderBox tabBarBox = tester.firstRenderObject(find.byType(TabBar)); + final RenderBox tabBarBox = tester.firstRenderObject( + find.byType(TabBar), + ); - late RRect indicatorRRect; + late RRect indicatorRRect; - expect( - tabBarBox, - paints..something((Symbol method, List arguments) { - if (method != #drawRRect) { - return false; - } - indicatorRRect = arguments[0] as RRect; - return true; - }), - ); - expect(indicatorRRect.left, equals(16.0)); - expect(indicatorRRect.top, equals(45.0)); - expect(indicatorRRect.right, closeTo(142.9, 0.1)); - expect(indicatorRRect.bottom, equals(48.0)); + expect( + tabBarBox, + paints..something((Symbol method, List arguments) { + if (method != #drawRRect) { + return false; + } + indicatorRRect = arguments[0] as RRect; + return true; + }), + ); + expect(indicatorRRect.left, equals(16.0)); + expect(indicatorRRect.top, equals(45.0)); + expect(indicatorRRect.right, closeTo(142.9, 0.1)); + expect(indicatorRRect.bottom, equals(48.0)); - // Tap the long tab. - await tester.tap(find.text('Very Very Very Long Tab').first); - await tester.pump(); - await tester.pump(const Duration(milliseconds: 100)); + // Tap the long tab. + await tester.tap(find.text('Very Very Very Long Tab').first); + await tester.pump(); + await tester.pump(const Duration(milliseconds: 100)); - expect( - tabBarBox, - paints..something((Symbol method, List arguments) { - if (method != #drawRRect) { - return false; - } - indicatorRRect = arguments[0] as RRect; - return true; - }), - ); - expect(indicatorRRect.left, closeTo(107.5, 0.1)); - expect(indicatorRRect.top, equals(45.0)); - expect(indicatorRRect.right, closeTo(348.2, 0.1)); - expect(indicatorRRect.bottom, equals(48.0)); + expect( + tabBarBox, + paints..something((Symbol method, List arguments) { + if (method != #drawRRect) { + return false; + } + indicatorRRect = arguments[0] as RRect; + return true; + }), + ); + expect(indicatorRRect.left, closeTo(107.5, 0.1)); + expect(indicatorRRect.top, equals(45.0)); + expect(indicatorRRect.right, closeTo(348.2, 0.1)); + expect(indicatorRRect.bottom, equals(48.0)); - // Tap to go to the first tab. - await tester.tap(find.text('Short Tab').first); - await tester.pumpAndSettle(); + // Tap to go to the first tab. + await tester.tap(find.text('Short Tab').first); + await tester.pumpAndSettle(); - expect( - tabBarBox, - paints..something((Symbol method, List arguments) { - if (method != #drawRRect) { - return false; - } - indicatorRRect = arguments[0] as RRect; - return true; - }), - ); - expect(indicatorRRect.left, equals(16.0)); - expect(indicatorRRect.top, equals(45.0)); - expect(indicatorRRect.right, closeTo(142.9, 0.1)); - expect(indicatorRRect.bottom, equals(48.0)); + expect( + tabBarBox, + paints..something((Symbol method, List arguments) { + if (method != #drawRRect) { + return false; + } + indicatorRRect = arguments[0] as RRect; + return true; + }), + ); + expect(indicatorRRect.left, equals(16.0)); + expect(indicatorRRect.top, equals(45.0)); + expect(indicatorRRect.right, closeTo(142.9, 0.1)); + expect(indicatorRRect.bottom, equals(48.0)); - // Select the elastic animation. - await tester.tap(find.text('Elastic')); - await tester.pumpAndSettle(); + // Select the elastic animation. + await tester.tap(find.text('Elastic')); + await tester.pumpAndSettle(); - // Tap the long tab. - await tester.tap(find.text('Very Very Very Long Tab').first); - await tester.pump(); - await tester.pump(const Duration(milliseconds: 100)); + // Tap the long tab. + await tester.tap(find.text('Very Very Very Long Tab').first); + await tester.pump(); + await tester.pump(const Duration(milliseconds: 100)); - expect( - tabBarBox, - paints..something((Symbol method, List arguments) { - if (method != #drawRRect) { - return false; - } - indicatorRRect = arguments[0] as RRect; - return true; - }), - ); - expect(indicatorRRect.left, closeTo(76.7, 0.1)); - expect(indicatorRRect.top, equals(45.0)); - expect(indicatorRRect.right, closeTo(423.1, 0.1)); - expect(indicatorRRect.bottom, equals(48.0)); - }); + expect( + tabBarBox, + paints..something((Symbol method, List arguments) { + if (method != #drawRRect) { + return false; + } + indicatorRRect = arguments[0] as RRect; + return true; + }), + ); + expect(indicatorRRect.left, closeTo(76.7, 0.1)); + expect(indicatorRRect.top, equals(45.0)); + expect(indicatorRRect.right, closeTo(423.1, 0.1)); + expect(indicatorRRect.bottom, equals(48.0)); + }, + ); } diff --git a/examples/api/test/material/tabs/tab_bar.onFocusChange_test.dart b/examples/api/test/material/tabs/tab_bar.onFocusChange_test.dart index 3e8d7f99cb7..6308844a44a 100644 --- a/examples/api/test/material/tabs/tab_bar.onFocusChange_test.dart +++ b/examples/api/test/material/tabs/tab_bar.onFocusChange_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/tabs/tab_bar.onFocusChange.dart' as example; +import 'package:flutter_api_samples/material/tabs/tab_bar.onFocusChange.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/tabs/tab_bar.onHover_test.dart b/examples/api/test/material/tabs/tab_bar.onHover_test.dart index 5acab61dc0c..c959d06e8be 100644 --- a/examples/api/test/material/tabs/tab_bar.onHover_test.dart +++ b/examples/api/test/material/tabs/tab_bar.onHover_test.dart @@ -4,7 +4,8 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/tabs/tab_bar.onHover.dart' as example; +import 'package:flutter_api_samples/material/tabs/tab_bar.onHover.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -14,9 +15,18 @@ void main() { final TabBar tabBar = tester.widget(find.byType(TabBar)); expect(tabBar.tabs.length, 3); - expect(tester.widget(find.byIcon(Icons.cloud_outlined)).color, Colors.purple); - expect(tester.widget(find.byIcon(Icons.beach_access_sharp)).color, Colors.purple); - expect(tester.widget(find.byIcon(Icons.brightness_5_sharp)).color, Colors.purple); + expect( + tester.widget(find.byIcon(Icons.cloud_outlined)).color, + Colors.purple, + ); + expect( + tester.widget(find.byIcon(Icons.beach_access_sharp)).color, + Colors.purple, + ); + expect( + tester.widget(find.byIcon(Icons.brightness_5_sharp)).color, + Colors.purple, + ); // Hover over the first tab. final TestGesture gesture = await tester.createGesture( @@ -27,32 +37,72 @@ void main() { await gesture.moveTo(tester.getCenter(find.byIcon(Icons.cloud_outlined))); await tester.pump(); await tester.pump(); - expect(tester.widget(find.byIcon(Icons.cloud_outlined)).color, Colors.pink); - expect(tester.widget(find.byIcon(Icons.beach_access_sharp)).color, Colors.purple); - expect(tester.widget(find.byIcon(Icons.brightness_5_sharp)).color, Colors.purple); + expect( + tester.widget(find.byIcon(Icons.cloud_outlined)).color, + Colors.pink, + ); + expect( + tester.widget(find.byIcon(Icons.beach_access_sharp)).color, + Colors.purple, + ); + expect( + tester.widget(find.byIcon(Icons.brightness_5_sharp)).color, + Colors.purple, + ); // Hover over the second tab - await gesture.moveTo(tester.getCenter(find.byIcon(Icons.beach_access_sharp))); + await gesture.moveTo( + tester.getCenter(find.byIcon(Icons.beach_access_sharp)), + ); await tester.pump(); await tester.pump(); - expect(tester.widget(find.byIcon(Icons.cloud_outlined)).color, Colors.purple); - expect(tester.widget(find.byIcon(Icons.beach_access_sharp)).color, Colors.pink); - expect(tester.widget(find.byIcon(Icons.brightness_5_sharp)).color, Colors.purple); + expect( + tester.widget(find.byIcon(Icons.cloud_outlined)).color, + Colors.purple, + ); + expect( + tester.widget(find.byIcon(Icons.beach_access_sharp)).color, + Colors.pink, + ); + expect( + tester.widget(find.byIcon(Icons.brightness_5_sharp)).color, + Colors.purple, + ); // And the third - await gesture.moveTo(tester.getCenter(find.byIcon(Icons.brightness_5_sharp))); + await gesture.moveTo( + tester.getCenter(find.byIcon(Icons.brightness_5_sharp)), + ); await tester.pump(); await tester.pump(); - expect(tester.widget(find.byIcon(Icons.cloud_outlined)).color, Colors.purple); - expect(tester.widget(find.byIcon(Icons.beach_access_sharp)).color, Colors.purple); - expect(tester.widget(find.byIcon(Icons.brightness_5_sharp)).color, Colors.pink); + expect( + tester.widget(find.byIcon(Icons.cloud_outlined)).color, + Colors.purple, + ); + expect( + tester.widget(find.byIcon(Icons.beach_access_sharp)).color, + Colors.purple, + ); + expect( + tester.widget(find.byIcon(Icons.brightness_5_sharp)).color, + Colors.pink, + ); // Remove hover await gesture.removePointer(); await tester.pump(); await tester.pump(); - expect(tester.widget(find.byIcon(Icons.cloud_outlined)).color, Colors.purple); - expect(tester.widget(find.byIcon(Icons.beach_access_sharp)).color, Colors.purple); - expect(tester.widget(find.byIcon(Icons.brightness_5_sharp)).color, Colors.purple); + expect( + tester.widget(find.byIcon(Icons.cloud_outlined)).color, + Colors.purple, + ); + expect( + tester.widget(find.byIcon(Icons.beach_access_sharp)).color, + Colors.purple, + ); + expect( + tester.widget(find.byIcon(Icons.brightness_5_sharp)).color, + Colors.purple, + ); }); } diff --git a/examples/api/test/material/text_button/text_button.0_test.dart b/examples/api/test/material/text_button/text_button.0_test.dart index 02392112936..76e154e6547 100644 --- a/examples/api/test/material/text_button/text_button.0_test.dart +++ b/examples/api/test/material/text_button/text_button.0_test.dart @@ -5,7 +5,8 @@ import 'dart:io'; import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/text_button/text_button.0.dart' as example; +import 'package:flutter_api_samples/material/text_button/text_button.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -58,7 +59,10 @@ void main() { String smileyButtonImageUrl() { final AnimatedContainer container = tester.widget( - find.descendant(of: smileyButton, matching: find.byType(AnimatedContainer)), + find.descendant( + of: smileyButton, + matching: find.byType(AnimatedContainer), + ), ); final BoxDecoration decoration = container.decoration! as BoxDecoration; final NetworkImage image = decoration.image!.image as NetworkImage; @@ -70,7 +74,10 @@ void main() { // image changes while the action is running. expect(smileyButtonImageUrl().endsWith('text_button_nhu_end.png'), isTrue); await tester.pump(const Duration(seconds: 1)); - expect(smileyButtonImageUrl().endsWith('text_button_nhu_default.png'), isTrue); + expect( + smileyButtonImageUrl().endsWith('text_button_nhu_default.png'), + isTrue, + ); // Pressing the smiley button while the one second action is // underway starts a new one section action. The button's image @@ -82,7 +89,10 @@ void main() { await tester.pump(const Duration(milliseconds: 500)); expect(smileyButtonImageUrl().endsWith('text_button_nhu_end.png'), isTrue); await tester.pump(const Duration(milliseconds: 500)); - expect(smileyButtonImageUrl().endsWith('text_button_nhu_default.png'), isTrue); + expect( + smileyButtonImageUrl().endsWith('text_button_nhu_default.png'), + isTrue, + ); await tester.tap(find.byType(Switch).at(0)); // Dark Mode Switch await tester.pumpAndSettle(); diff --git a/examples/api/test/material/text_button/text_button.1_test.dart b/examples/api/test/material/text_button/text_button.1_test.dart index 6282dc82892..b08d9a73ffe 100644 --- a/examples/api/test/material/text_button/text_button.1_test.dart +++ b/examples/api/test/material/text_button/text_button.1_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/text_button/text_button.1.dart' as example; +import 'package:flutter_api_samples/material/text_button/text_button.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -17,11 +18,15 @@ void main() { final Finder button = find.byType(example.SelectableButton); - example.SelectableButton buttonWidget() => tester.widget(button); + example.SelectableButton buttonWidget() => + tester.widget(button); Material buttonMaterial() { return tester.widget( - find.descendant(of: find.byType(example.SelectableButton), matching: find.byType(Material)), + find.descendant( + of: find.byType(example.SelectableButton), + matching: find.byType(Material), + ), ); } @@ -30,7 +35,10 @@ void main() { buttonMaterial().textStyle!.color, const ColorScheme.light().primary, ); // default button foreground color - expect(buttonMaterial().color, Colors.transparent); // default button background color + expect( + buttonMaterial().color, + Colors.transparent, + ); // default button background color await tester.tap(button); // Toggles the button's selected property. await tester.pumpAndSettle(); @@ -41,7 +49,10 @@ void main() { await tester.tap(button); // Toggles the button's selected property. await tester.pumpAndSettle(); expect(buttonWidget().selected, false); - expect(buttonMaterial().textStyle!.color, const ColorScheme.light().primary); + expect( + buttonMaterial().textStyle!.color, + const ColorScheme.light().primary, + ); expect(buttonMaterial().color, Colors.transparent); }); } diff --git a/examples/api/test/material/text_field/text_field.0_test.dart b/examples/api/test/material/text_field/text_field.0_test.dart index ebaa998e5c6..5a8c2d766a9 100644 --- a/examples/api/test/material/text_field/text_field.0_test.dart +++ b/examples/api/test/material/text_field/text_field.0_test.dart @@ -3,16 +3,21 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/text_field/text_field.0.dart' as example; +import 'package:flutter_api_samples/material/text_field/text_field.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('TextField is obscured and has "Password" as labelText', (WidgetTester tester) async { + testWidgets('TextField is obscured and has "Password" as labelText', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.TextFieldExampleApp()); expect(find.byType(TextField), findsOneWidget); - final TextField textField = tester.widget(find.byType(TextField)); + final TextField textField = tester.widget( + find.byType(TextField), + ); expect(textField.obscureText, isTrue); expect(textField.decoration!.labelText, 'Password'); }); diff --git a/examples/api/test/material/text_field/text_field.1_test.dart b/examples/api/test/material/text_field/text_field.1_test.dart index 46a7741e109..867576a5f02 100644 --- a/examples/api/test/material/text_field/text_field.1_test.dart +++ b/examples/api/test/material/text_field/text_field.1_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/text_field/text_field.1.dart' as example; +import 'package:flutter_api_samples/material/text_field/text_field.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Dialog shows submitted TextField value', (WidgetTester tester) async { + testWidgets('Dialog shows submitted TextField value', ( + WidgetTester tester, + ) async { // This example is also used to illustrate special character counting. const String sampleText = 'Some sample text 👨‍👩‍👦'; await tester.pumpWidget(const example.TextFieldExampleApp()); @@ -17,7 +20,9 @@ void main() { expect(find.text('Thanks!'), findsNothing); expect(find.widgetWithText(TextButton, 'OK'), findsNothing); expect( - find.text('You typed "$sampleText", which has the length ${sampleText.length}.'), + find.text( + 'You typed "$sampleText", which has the length ${sampleText.length}.', + ), findsNothing, ); @@ -28,7 +33,9 @@ void main() { expect(find.text('Thanks!'), findsOneWidget); expect(find.widgetWithText(TextButton, 'OK'), findsOneWidget); expect( - find.text('You typed "$sampleText", which has length ${sampleText.characters.length}.'), + find.text( + 'You typed "$sampleText", which has length ${sampleText.characters.length}.', + ), findsOneWidget, ); }); diff --git a/examples/api/test/material/text_field/text_field.2_test.dart b/examples/api/test/material/text_field/text_field.2_test.dart index 4b8b287f409..18d2cf88dd4 100644 --- a/examples/api/test/material/text_field/text_field.2_test.dart +++ b/examples/api/test/material/text_field/text_field.2_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/text_field/text_field.2.dart' as example; +import 'package:flutter_api_samples/material/text_field/text_field.2.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/material/text_field/text_field.3_test.dart b/examples/api/test/material/text_field/text_field.3_test.dart index 1ac8b7a43b9..9a262ea8c01 100644 --- a/examples/api/test/material/text_field/text_field.3_test.dart +++ b/examples/api/test/material/text_field/text_field.3_test.dart @@ -4,7 +4,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_api_samples/material/text_field/text_field.3.dart' as example; +import 'package:flutter_api_samples/material/text_field/text_field.3.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -28,32 +29,48 @@ void main() { ); }); - testWidgets('adds new line when Shift+Enter is pressed', (WidgetTester tester) async { + testWidgets('adds new line when Shift+Enter is pressed', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.TextFieldExampleApp()); final Finder textFieldFinder = find.byType(TextField); await tester.enterText(textFieldFinder, 'Hello'); - expect(find.descendant(of: textFieldFinder, matching: find.text('Hello')), findsOneWidget); + expect( + find.descendant(of: textFieldFinder, matching: find.text('Hello')), + findsOneWidget, + ); await pressShiftEnter(tester); - expect(find.descendant(of: textFieldFinder, matching: find.text('Hello\n')), findsOneWidget); + expect( + find.descendant(of: textFieldFinder, matching: find.text('Hello\n')), + findsOneWidget, + ); }); - testWidgets('displays entered text when TextField is submitted', (WidgetTester tester) async { + testWidgets('displays entered text when TextField is submitted', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.TextFieldExampleApp()); final Finder textFieldFinder = find.byType(TextField); await tester.enterText(textFieldFinder, 'Hello'); - expect(find.descendant(of: textFieldFinder, matching: find.text('Hello')), findsOneWidget); + expect( + find.descendant(of: textFieldFinder, matching: find.text('Hello')), + findsOneWidget, + ); await pressShiftEnter(tester); await tester.testTextInput.receiveAction(TextInputAction.done); await tester.pump(); - expect(find.descendant(of: textFieldFinder, matching: find.text('')), findsOneWidget); + expect( + find.descendant(of: textFieldFinder, matching: find.text('')), + findsOneWidget, + ); expect(find.text('Submitted text:\n\nHello\n'), findsOneWidget); }); }); diff --git a/examples/api/test/material/text_form_field/text_form_field.1_test.dart b/examples/api/test/material/text_form_field/text_form_field.1_test.dart index a069e57bfab..4e35b93aa61 100644 --- a/examples/api/test/material/text_form_field/text_form_field.1_test.dart +++ b/examples/api/test/material/text_form_field/text_form_field.1_test.dart @@ -4,11 +4,14 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_api_samples/material/text_form_field/text_form_field.1.dart' as example; +import 'package:flutter_api_samples/material/text_form_field/text_form_field.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Pressing space should focus the next field', (WidgetTester tester) async { + testWidgets('Pressing space should focus the next field', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.TextFormFieldExampleApp()); final Finder textFormField = find.byType(TextFormField); @@ -20,7 +23,10 @@ void main() { List getFocuses() { return editableText .evaluate() - .map((Element finderResult) => (finderResult.widget as EditableText).focusNode.hasFocus) + .map( + (Element finderResult) => + (finderResult.widget as EditableText).focusNode.hasFocus, + ) .toList(); } diff --git a/examples/api/test/material/text_form_field/text_form_field.2_test.dart b/examples/api/test/material/text_form_field/text_form_field.2_test.dart index 3a6dc649981..03b2835b369 100644 --- a/examples/api/test/material/text_form_field/text_form_field.2_test.dart +++ b/examples/api/test/material/text_form_field/text_form_field.2_test.dart @@ -3,45 +3,58 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/text_form_field/text_form_field.2.dart' as example; +import 'package:flutter_api_samples/material/text_form_field/text_form_field.2.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { group('TextFormFieldExample2 Widget Tests', () { - testWidgets('Input validation handles empty, incorrect, and short usernames', ( + testWidgets( + 'Input validation handles empty, incorrect, and short usernames', + (WidgetTester tester) async { + await tester.pumpWidget(const example.TextFormFieldExampleApp()); + final Finder textFormField = find.byType(TextFormField); + final Finder saveButton = find.byType(TextButton); + + await tester.enterText(textFormField, ''); + await tester.pump(); + await tester.tap(saveButton); + await tester.pump(); + expect(find.text('This field is required'), findsOneWidget); + + await tester.enterText(textFormField, 'jo hn'); + await tester.tap(saveButton); + await tester.pump(); + expect( + find.text('Username must not contain any spaces'), + findsOneWidget, + ); + + await tester.enterText(textFormField, 'jo'); + await tester.tap(saveButton); + await tester.pump(); + expect( + find.text('Username should be at least 3 characters long'), + findsOneWidget, + ); + + await tester.enterText(textFormField, '1jo'); + await tester.tap(saveButton); + await tester.pump(); + expect( + find.text('Username must not start with a number'), + findsOneWidget, + ); + }, + ); + + testWidgets('Async validation feedback is handled correctly', ( WidgetTester tester, ) async { await tester.pumpWidget(const example.TextFormFieldExampleApp()); final Finder textFormField = find.byType(TextFormField); final Finder saveButton = find.byType(TextButton); - await tester.enterText(textFormField, ''); - await tester.pump(); - await tester.tap(saveButton); - await tester.pump(); - expect(find.text('This field is required'), findsOneWidget); - - await tester.enterText(textFormField, 'jo hn'); - await tester.tap(saveButton); - await tester.pump(); - expect(find.text('Username must not contain any spaces'), findsOneWidget); - - await tester.enterText(textFormField, 'jo'); - await tester.tap(saveButton); - await tester.pump(); - expect(find.text('Username should be at least 3 characters long'), findsOneWidget); - - await tester.enterText(textFormField, '1jo'); - await tester.tap(saveButton); - await tester.pump(); - expect(find.text('Username must not start with a number'), findsOneWidget); - }); - - testWidgets('Async validation feedback is handled correctly', (WidgetTester tester) async { - await tester.pumpWidget(const example.TextFormFieldExampleApp()); - final Finder textFormField = find.byType(TextFormField); - final Finder saveButton = find.byType(TextButton); - // Simulate entering a username already taken. await tester.enterText(textFormField, 'jack'); await tester.pump(); @@ -68,7 +81,9 @@ void main() { expect(find.text('Username jack is already taken'), findsOneWidget); }); - testWidgets('Loading spinner displays correctly when saving', (WidgetTester tester) async { + testWidgets('Loading spinner displays correctly when saving', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.TextFormFieldExampleApp()); final Finder textFormField = find.byType(TextFormField); final Finder saveButton = find.byType(TextButton); diff --git a/examples/api/test/material/theme/theme_extension.1_test.dart b/examples/api/test/material/theme/theme_extension.1_test.dart index 0b73e7f467a..56bef394192 100644 --- a/examples/api/test/material/theme/theme_extension.1_test.dart +++ b/examples/api/test/material/theme/theme_extension.1_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/theme/theme_extension.1.dart' as example; +import 'package:flutter_api_samples/material/theme/theme_extension.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -37,12 +38,17 @@ void main() { expect(colors.danger, equals(const Color(0xFFEF9A9A))); }); - testWidgets('Home uses MyColors extension correctly', (WidgetTester tester) async { + testWidgets('Home uses MyColors extension correctly', ( + WidgetTester tester, + ) async { await tester.pumpWidget( MaterialApp( theme: ThemeData( extensions: const >[ - example.MyColors(brandColor: Color(0xFF0000FF), danger: Color(0xFFFF0000)), + example.MyColors( + brandColor: Color(0xFF0000FF), + danger: Color(0xFFFF0000), + ), ], ), home: example.Home(isLightTheme: true, toggleTheme: () {}), @@ -81,6 +87,9 @@ void main() { expect(theme.brightness, equals(Brightness.dark)); expect(home.isLightTheme, isFalse); - expect(iconButton.icon, isA().having((Icon i) => i.icon, 'icon', equals(Icons.wb_sunny))); + expect( + iconButton.icon, + isA().having((Icon i) => i.icon, 'icon', equals(Icons.wb_sunny)), + ); }); } diff --git a/examples/api/test/material/theme_data/theme_data.0_test.dart b/examples/api/test/material/theme_data/theme_data.0_test.dart index 3eb5053e63b..dba8e4abb2f 100644 --- a/examples/api/test/material/theme_data/theme_data.0_test.dart +++ b/examples/api/test/material/theme_data/theme_data.0_test.dart @@ -3,22 +3,31 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/theme_data/theme_data.0.dart' as example; +import 'package:flutter_api_samples/material/theme_data/theme_data.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('ThemeData basics', (WidgetTester tester) async { await tester.pumpWidget(const example.ThemeDataExampleApp()); - final ColorScheme colorScheme = ColorScheme.fromSeed(seedColor: Colors.indigo); + final ColorScheme colorScheme = ColorScheme.fromSeed( + seedColor: Colors.indigo, + ); final Material fabMaterial = tester.widget( - find.descendant(of: find.byType(FloatingActionButton), matching: find.byType(Material)), + find.descendant( + of: find.byType(FloatingActionButton), + matching: find.byType(Material), + ), ); expect(fabMaterial.color, colorScheme.tertiary); final RichText iconRichText = tester.widget( - find.descendant(of: find.byIcon(Icons.add), matching: find.byType(RichText)), + find.descendant( + of: find.byIcon(Icons.add), + matching: find.byType(RichText), + ), ); expect(iconRichText.text.style!.color, colorScheme.onTertiary); diff --git a/examples/api/test/material/time_picker/show_time_picker.0_test.dart b/examples/api/test/material/time_picker/show_time_picker.0_test.dart index 7928de40373..1cea70ec6f7 100644 --- a/examples/api/test/material/time_picker/show_time_picker.0_test.dart +++ b/examples/api/test/material/time_picker/show_time_picker.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/time_picker/show_time_picker.0.dart' as example; +import 'package:flutter_api_samples/material/time_picker/show_time_picker.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -11,13 +12,17 @@ void main() { const String openPicker = 'Open time picker'; final List options = [ '$TimePickerEntryMode', - ...TimePickerEntryMode.values.map((TimePickerEntryMode value) => value.name), + ...TimePickerEntryMode.values.map( + (TimePickerEntryMode value) => value.name, + ), '$ThemeMode', ...ThemeMode.values.map((ThemeMode value) => value.name), '$TextDirection', ...TextDirection.values.map((TextDirection value) => value.name), '$MaterialTapTargetSize', - ...MaterialTapTargetSize.values.map((MaterialTapTargetSize value) => value.name), + ...MaterialTapTargetSize.values.map( + (MaterialTapTargetSize value) => value.name, + ), '$Orientation', ...Orientation.values.map((Orientation value) => value.name), 'Time Mode', diff --git a/examples/api/test/material/toggle_buttons/toggle_buttons.0_test.dart b/examples/api/test/material/toggle_buttons/toggle_buttons.0_test.dart index 73d4a0fd0b6..1b6af952160 100644 --- a/examples/api/test/material/toggle_buttons/toggle_buttons.0_test.dart +++ b/examples/api/test/material/toggle_buttons/toggle_buttons.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/toggle_buttons/toggle_buttons.0.dart' as example; +import 'package:flutter_api_samples/material/toggle_buttons/toggle_buttons.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -23,8 +24,14 @@ void main() { /// First button is selected. expect(firstButton.style!.backgroundColor!.resolve(enabled), selectedColor); - expect(secondButton.style!.backgroundColor!.resolve(enabled), unselectedColor); - expect(thirdButton.style!.backgroundColor!.resolve(enabled), unselectedColor); + expect( + secondButton.style!.backgroundColor!.resolve(enabled), + unselectedColor, + ); + expect( + thirdButton.style!.backgroundColor!.resolve(enabled), + unselectedColor, + ); /// Tap on second button. await tester.tap(find.widgetWithText(TextButton, 'Banana')); @@ -35,9 +42,18 @@ void main() { thirdButton = findButton('Orange'); /// Only second button is selected. - expect(firstButton.style!.backgroundColor!.resolve(enabled), unselectedColor); - expect(secondButton.style!.backgroundColor!.resolve(enabled), selectedColor); - expect(thirdButton.style!.backgroundColor!.resolve(enabled), unselectedColor); + expect( + firstButton.style!.backgroundColor!.resolve(enabled), + unselectedColor, + ); + expect( + secondButton.style!.backgroundColor!.resolve(enabled), + selectedColor, + ); + expect( + thirdButton.style!.backgroundColor!.resolve(enabled), + unselectedColor, + ); }); testWidgets('Multi-select ToggleButtons', (WidgetTester tester) async { @@ -55,9 +71,18 @@ void main() { const Color unselectedColor = Color(0x00fef7ff); /// Second button is selected. - expect(firstButton.style!.backgroundColor!.resolve(enabled), unselectedColor); - expect(secondButton.style!.backgroundColor!.resolve(enabled), selectedColor); - expect(thirdButton.style!.backgroundColor!.resolve(enabled), unselectedColor); + expect( + firstButton.style!.backgroundColor!.resolve(enabled), + unselectedColor, + ); + expect( + secondButton.style!.backgroundColor!.resolve(enabled), + selectedColor, + ); + expect( + thirdButton.style!.backgroundColor!.resolve(enabled), + unselectedColor, + ); /// Tap on other two buttons. await tester.tap(find.widgetWithText(TextButton, 'Tomatoes')); @@ -70,13 +95,18 @@ void main() { /// All buttons are selected. expect(firstButton.style!.backgroundColor!.resolve(enabled), selectedColor); - expect(secondButton.style!.backgroundColor!.resolve(enabled), selectedColor); + expect( + secondButton.style!.backgroundColor!.resolve(enabled), + selectedColor, + ); expect(thirdButton.style!.backgroundColor!.resolve(enabled), selectedColor); }); testWidgets('Icon-only ToggleButtons', (WidgetTester tester) async { TextButton findButton(IconData iconData) { - return tester.widget(find.widgetWithIcon(TextButton, iconData)); + return tester.widget( + find.widgetWithIcon(TextButton, iconData), + ); } await tester.pumpWidget(const example.ToggleButtonsExampleApp()); @@ -89,8 +119,14 @@ void main() { const Color unselectedColor = Color(0x00fef7ff); /// Third button is selected. - expect(firstButton.style!.backgroundColor!.resolve(enabled), unselectedColor); - expect(secondButton.style!.backgroundColor!.resolve(enabled), unselectedColor); + expect( + firstButton.style!.backgroundColor!.resolve(enabled), + unselectedColor, + ); + expect( + secondButton.style!.backgroundColor!.resolve(enabled), + unselectedColor, + ); expect(thirdButton.style!.backgroundColor!.resolve(enabled), selectedColor); /// Tap on the first button. @@ -103,8 +139,14 @@ void main() { /// First button os selected. expect(firstButton.style!.backgroundColor!.resolve(enabled), selectedColor); - expect(secondButton.style!.backgroundColor!.resolve(enabled), unselectedColor); - expect(thirdButton.style!.backgroundColor!.resolve(enabled), unselectedColor); + expect( + secondButton.style!.backgroundColor!.resolve(enabled), + unselectedColor, + ); + expect( + thirdButton.style!.backgroundColor!.resolve(enabled), + unselectedColor, + ); }); } diff --git a/examples/api/test/material/toggle_buttons/toggle_buttons.1_test.dart b/examples/api/test/material/toggle_buttons/toggle_buttons.1_test.dart index 7562bebc545..856c9732379 100644 --- a/examples/api/test/material/toggle_buttons/toggle_buttons.1_test.dart +++ b/examples/api/test/material/toggle_buttons/toggle_buttons.1_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/material/toggle_buttons/toggle_buttons.1.dart' as example; +import 'package:flutter_api_samples/material/toggle_buttons/toggle_buttons.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('ToggleButtons allows multiple or no selection', (WidgetTester tester) async { + testWidgets('ToggleButtons allows multiple or no selection', ( + WidgetTester tester, + ) async { final ThemeData theme = ThemeData(); Finder findButton(String text) { return find.descendant( @@ -24,11 +27,11 @@ void main() { // Initially, only M is selected. expect( toggleMButton.style!.backgroundColor!.resolve(enabled), - theme.colorScheme.primary.withOpacity(0.12), + isSameColorAs(theme.colorScheme.primary.withValues(alpha: 0.1216)), ); expect( toggleXLButton.style!.backgroundColor!.resolve(enabled), - theme.colorScheme.surface.withOpacity(0.0), + theme.colorScheme.surface.withValues(alpha: 0.0), ); // Tap on XL. @@ -41,11 +44,11 @@ void main() { expect( toggleMButton.style!.backgroundColor!.resolve(enabled), - theme.colorScheme.primary.withOpacity(0.12), + isSameColorAs(theme.colorScheme.primary.withValues(alpha: 0.1216)), ); expect( toggleXLButton.style!.backgroundColor!.resolve(enabled), - theme.colorScheme.primary.withOpacity(0.12), + isSameColorAs(theme.colorScheme.primary.withValues(alpha: 0.1216)), ); // Tap M to deselect it. @@ -62,15 +65,17 @@ void main() { expect( toggleMButton.style!.backgroundColor!.resolve(enabled), - theme.colorScheme.surface.withOpacity(0.0), + theme.colorScheme.surface.withValues(alpha: 0.0), ); expect( toggleXLButton.style!.backgroundColor!.resolve(enabled), - theme.colorScheme.surface.withOpacity(0.0), + theme.colorScheme.surface.withValues(alpha: 0.0), ); }); - testWidgets('SegmentedButton allows multiple or no selection', (WidgetTester tester) async { + testWidgets('SegmentedButton allows multiple or no selection', ( + WidgetTester tester, + ) async { final ThemeData theme = ThemeData(); Finder findButton(String text) { return find.descendant( diff --git a/examples/api/test/material/tooltip/tooltip.0_test.dart b/examples/api/test/material/tooltip/tooltip.0_test.dart index e69a8337d1a..6defab48370 100644 --- a/examples/api/test/material/tooltip/tooltip.0_test.dart +++ b/examples/api/test/material/tooltip/tooltip.0_test.dart @@ -8,12 +8,16 @@ import 'package:flutter_api_samples/material/tooltip/tooltip.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Tooltip is visible when hovering over text', (WidgetTester tester) async { + testWidgets('Tooltip is visible when hovering over text', ( + WidgetTester tester, + ) async { const String tooltipText = 'I am a Tooltip'; await tester.pumpWidget(const example.TooltipExampleApp()); - TestGesture? gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); + TestGesture? gesture = await tester.createGesture( + kind: PointerDeviceKind.mouse, + ); addTearDown(() async { if (gesture != null) { return gesture.removePointer(); diff --git a/examples/api/test/material/tooltip/tooltip.1_test.dart b/examples/api/test/material/tooltip/tooltip.1_test.dart index 0c74bb9438b..f943f9aa3be 100644 --- a/examples/api/test/material/tooltip/tooltip.1_test.dart +++ b/examples/api/test/material/tooltip/tooltip.1_test.dart @@ -13,7 +13,9 @@ void main() { await tester.pumpWidget(const example.TooltipExampleApp()); - final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); + final TestGesture gesture = await tester.createGesture( + kind: PointerDeviceKind.mouse, + ); addTearDown(() async { return gesture.removePointer(); }); diff --git a/examples/api/test/material/tooltip/tooltip.2_test.dart b/examples/api/test/material/tooltip/tooltip.2_test.dart index 1f2809565d4..f830e04d2f6 100644 --- a/examples/api/test/material/tooltip/tooltip.2_test.dart +++ b/examples/api/test/material/tooltip/tooltip.2_test.dart @@ -8,12 +8,17 @@ import 'package:flutter_api_samples/material/tooltip/tooltip.2.dart' as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Tooltip is visible when hovering over text', (WidgetTester tester) async { - const String tooltipText = 'I am a rich tooltip. I am another span of this rich tooltip'; + testWidgets('Tooltip is visible when hovering over text', ( + WidgetTester tester, + ) async { + const String tooltipText = + 'I am a rich tooltip. I am another span of this rich tooltip'; await tester.pumpWidget(const example.TooltipExampleApp()); - TestGesture? gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); + TestGesture? gesture = await tester.createGesture( + kind: PointerDeviceKind.mouse, + ); addTearDown(() async { if (gesture != null) { return gesture.removePointer(); diff --git a/examples/api/test/material/tooltip/tooltip.3_test.dart b/examples/api/test/material/tooltip/tooltip.3_test.dart index 888a190ea92..add697a7c54 100644 --- a/examples/api/test/material/tooltip/tooltip.3_test.dart +++ b/examples/api/test/material/tooltip/tooltip.3_test.dart @@ -7,7 +7,9 @@ import 'package:flutter_api_samples/material/tooltip/tooltip.3.dart' as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Tooltip is visible when tapping button', (WidgetTester tester) async { + testWidgets('Tooltip is visible when tapping button', ( + WidgetTester tester, + ) async { const String tooltipText = 'I am a Tooltip'; await tester.pumpWidget(const example.TooltipExampleApp()); diff --git a/examples/api/test/material/widget_state_input_border/widget_state_input_border.0_test.dart b/examples/api/test/material/widget_state_input_border/widget_state_input_border.0_test.dart index 5af94cf2987..dda6209c584 100644 --- a/examples/api/test/material/widget_state_input_border/widget_state_input_border.0_test.dart +++ b/examples/api/test/material/widget_state_input_border/widget_state_input_border.0_test.dart @@ -9,18 +9,27 @@ import 'package:flutter_api_samples/material/widget_state_input_border/widget_st import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('InputBorder appearance matches configuration', (WidgetTester tester) async { - const WidgetStateInputBorder inputBorder = WidgetStateInputBorder.resolveWith( - example.WidgetStateInputBorderExample.veryCoolBorder, - ); + testWidgets('InputBorder appearance matches configuration', ( + WidgetTester tester, + ) async { + const WidgetStateInputBorder inputBorder = + WidgetStateInputBorder.resolveWith( + example.WidgetStateInputBorderExample.veryCoolBorder, + ); void expectBorderToMatch(Set states) { final RenderBox renderBox = tester.renderObject( - find.descendant(of: find.byType(TextField), matching: find.byType(CustomPaint)), + find.descendant( + of: find.byType(TextField), + matching: find.byType(CustomPaint), + ), ); final BorderSide side = inputBorder.resolve(states).borderSide; - expect(renderBox, paints..line(color: side.color, strokeWidth: side.width)); + expect( + renderBox, + paints..line(color: side.color, strokeWidth: side.width), + ); } await tester.pumpWidget(const example.WidgetStateInputBorderExampleApp()); @@ -34,9 +43,16 @@ void main() { await tester.pumpAndSettle(); expectBorderToMatch(const {WidgetState.focused}); - final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); - await gesture.addPointer(location: tester.getCenter(find.byType(TextField))); + final TestGesture gesture = await tester.createGesture( + kind: PointerDeviceKind.mouse, + ); + await gesture.addPointer( + location: tester.getCenter(find.byType(TextField)), + ); await tester.pumpAndSettle(); - expectBorderToMatch(const {WidgetState.focused, WidgetState.hovered}); + expectBorderToMatch(const { + WidgetState.focused, + WidgetState.hovered, + }); }); } diff --git a/examples/api/test/painting/axis_direction/axis_direction.0_test.dart b/examples/api/test/painting/axis_direction/axis_direction.0_test.dart index 3546c6ef9d9..176d84329d6 100644 --- a/examples/api/test/painting/axis_direction/axis_direction.0_test.dart +++ b/examples/api/test/painting/axis_direction/axis_direction.0_test.dart @@ -4,11 +4,14 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; -import 'package:flutter_api_samples/painting/axis_direction/axis_direction.0.dart' as example; +import 'package:flutter_api_samples/painting/axis_direction/axis_direction.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Example app has radio buttons to toggle AxisDirection', (WidgetTester tester) async { + testWidgets('Example app has radio buttons to toggle AxisDirection', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ExampleApp()); expect(find.byType(Radio), findsNWidgets(4)); @@ -21,7 +24,8 @@ void main() { await tester.tap( find.byWidgetPredicate((Widget widget) { - return widget is Radio && widget.value == AxisDirection.up; + return widget is Radio && + widget.value == AxisDirection.up; }), ); await tester.pumpAndSettle(); diff --git a/examples/api/test/painting/borders/border_side.stroke_align.0_test.dart b/examples/api/test/painting/borders/border_side.stroke_align.0_test.dart index f0dec77f901..9aa36fb8d69 100644 --- a/examples/api/test/painting/borders/border_side.stroke_align.0_test.dart +++ b/examples/api/test/painting/borders/border_side.stroke_align.0_test.dart @@ -3,12 +3,15 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/painting/borders/border_side.stroke_align.0.dart' as example; +import 'package:flutter_api_samples/painting/borders/border_side.stroke_align.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('Finds the expected BorderedBox', (WidgetTester tester) async { - await tester.pumpWidget(const MaterialApp(home: example.StrokeAlignExample())); + await tester.pumpWidget( + const MaterialApp(home: example.StrokeAlignExample()), + ); expect(find.byType(example.StrokeAlignExample), findsOneWidget); expect(find.byType(example.BorderedBox), findsNWidgets(10)); diff --git a/examples/api/test/painting/gradient/linear_gradient.0_test.dart b/examples/api/test/painting/gradient/linear_gradient.0_test.dart index 3b5803e6a29..4e5308b4548 100644 --- a/examples/api/test/painting/gradient/linear_gradient.0_test.dart +++ b/examples/api/test/painting/gradient/linear_gradient.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/painting/gradient/linear_gradient.0.dart' as example; +import 'package:flutter_api_samples/painting/gradient/linear_gradient.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/painting/linear_border/linear_border.0_test.dart b/examples/api/test/painting/linear_border/linear_border.0_test.dart index 34da46ae098..c6e2212d975 100644 --- a/examples/api/test/painting/linear_border/linear_border.0_test.dart +++ b/examples/api/test/painting/linear_border/linear_border.0_test.dart @@ -4,7 +4,8 @@ import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/painting/linear_border/linear_border.0.dart' as example; +import 'package:flutter_api_samples/painting/linear_border/linear_border.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/painting/rounded_superellipse_border/rounded_superellipse_border.0_test.dart b/examples/api/test/painting/rounded_superellipse_border/rounded_superellipse_border.0_test.dart index 620efd2a867..c0bede588a4 100644 --- a/examples/api/test/painting/rounded_superellipse_border/rounded_superellipse_border.0_test.dart +++ b/examples/api/test/painting/rounded_superellipse_border/rounded_superellipse_border.0_test.dart @@ -11,7 +11,10 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('Smoke Test', (WidgetTester tester) async { await tester.pumpWidget(const example.RoundedSuperellipseBorderExample()); - expect(find.byType(example.RoundedSuperellipseBorderExample), findsOneWidget); + expect( + find.byType(example.RoundedSuperellipseBorderExample), + findsOneWidget, + ); final RenderObject borderBox = tester.renderObject( find.byKey(example.RoundedSuperellipseBorderExample.kBorderBoxKey), @@ -29,7 +32,9 @@ void main() { ); expect(radiusSlider, findsOne); final Finder thicknessSlider = find.descendant( - of: find.byKey(example.RoundedSuperellipseBorderExample.kThicknessSliderKey), + of: find.byKey( + example.RoundedSuperellipseBorderExample.kThicknessSliderKey, + ), matching: find.byType(CupertinoSlider), ); expect(thicknessSlider, findsOne); diff --git a/examples/api/test/painting/star_border/star_border.0_test.dart b/examples/api/test/painting/star_border/star_border.0_test.dart index 965bf8bd013..1aec570ca9a 100644 --- a/examples/api/test/painting/star_border/star_border.0_test.dart +++ b/examples/api/test/painting/star_border/star_border.0_test.dart @@ -4,13 +4,15 @@ import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/painting/star_border/star_border.0.dart' as example; +import 'package:flutter_api_samples/painting/star_border/star_border.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { Finder getStartBorderFinder(StarBorder shape) { return find.byWidgetPredicate( - (Widget widget) => widget is example.ExampleBorder && widget.border == shape, + (Widget widget) => + widget is example.ExampleBorder && widget.border == shape, ); } @@ -34,7 +36,9 @@ void main() { expect(find.widgetWithText(ElevatedButton, 'Reset'), findsOne); }); - testWidgets('StartBorder uses the values from the sliders', (WidgetTester tester) async { + testWidgets('StartBorder uses the values from the sliders', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.StarBorderApp()); expect(find.text('0.00'), findsExactly(4)); @@ -108,13 +112,18 @@ Container( ); }); - testWidgets('StartBorder.polygon uses the values from the sliders', (WidgetTester tester) async { + testWidgets('StartBorder.polygon uses the values from the sliders', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.StarBorderApp()); expect(find.text('0.00'), findsExactly(4)); expect(find.text('5.0'), findsOne); expect(find.text('0.40'), findsOne); - expect(getStartBorderFinder(const StarBorder(side: BorderSide())), findsOne); + expect( + getStartBorderFinder(const StarBorder(side: BorderSide())), + findsOne, + ); expect( find.text(''' Container( @@ -173,7 +182,9 @@ Container( ); }); - testWidgets('The "Nearest" button rounds the number of points', (WidgetTester tester) async { + testWidgets('The "Nearest" button rounds the number of points', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.StarBorderApp()); expect(find.text('5.0'), findsOne); @@ -190,30 +201,31 @@ Container( expect(find.text('12.0'), findsOne); }); - testWidgets('The "Reset" button resets the parameters to the default values', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.StarBorderApp()); + testWidgets( + 'The "Reset" button resets the parameters to the default values', + (WidgetTester tester) async { + await tester.pumpWidget(const example.StarBorderApp()); - expect(find.text('0.00'), findsExactly(4)); - expect(find.text('5.0'), findsOne); - expect(find.text('0.40'), findsOne); + expect(find.text('0.00'), findsExactly(4)); + expect(find.text('5.0'), findsOne); + expect(find.text('0.40'), findsOne); - // Put all the sliders to the middle. - for (int i = 0; i < 6; i++) { - await tester.tap(find.byType(Slider).at(i)); + // Put all the sliders to the middle. + for (int i = 0; i < 6; i++) { + await tester.tap(find.byType(Slider).at(i)); + await tester.pump(); + } + + expect(find.text('0.50'), findsExactly(4)); + expect(find.text('11.5'), findsOne); + expect(find.text('180.00'), findsOne); + + await tester.tap(find.widgetWithText(ElevatedButton, 'Reset')); await tester.pump(); - } - expect(find.text('0.50'), findsExactly(4)); - expect(find.text('11.5'), findsOne); - expect(find.text('180.00'), findsOne); - - await tester.tap(find.widgetWithText(ElevatedButton, 'Reset')); - await tester.pump(); - - expect(find.text('0.00'), findsExactly(4)); - expect(find.text('5.0'), findsOne); - expect(find.text('0.40'), findsOne); - }); + expect(find.text('0.00'), findsExactly(4)); + expect(find.text('5.0'), findsOne); + expect(find.text('0.40'), findsOne); + }, + ); } diff --git a/examples/api/test/rendering/box/parent_data.0_test.dart b/examples/api/test/rendering/box/parent_data.0_test.dart index 91c4a1beb42..696e7760ddb 100644 --- a/examples/api/test/rendering/box/parent_data.0_test.dart +++ b/examples/api/test/rendering/box/parent_data.0_test.dart @@ -9,9 +9,15 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('parent data example', (WidgetTester tester) async { await tester.pumpWidget(const SampleApp()); - expect(tester.getTopLeft(find.byType(Headline).at(2)), const Offset(30.0, 728.0)); + expect( + tester.getTopLeft(find.byType(Headline).at(2)), + const Offset(30.0, 728.0), + ); await tester.tap(find.byIcon(Icons.density_small)); await tester.pump(); - expect(tester.getTopLeft(find.byType(Headline).at(2)), const Offset(30.0, 682.0)); + expect( + tester.getTopLeft(find.byType(Headline).at(2)), + const Offset(30.0, 682.0), + ); }); } diff --git a/examples/api/test/rendering/growth_direction/growth_direction.0_test.dart b/examples/api/test/rendering/growth_direction/growth_direction.0_test.dart index 5b538a374b0..2a722ac1560 100644 --- a/examples/api/test/rendering/growth_direction/growth_direction.0_test.dart +++ b/examples/api/test/rendering/growth_direction/growth_direction.0_test.dart @@ -4,11 +4,14 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; -import 'package:flutter_api_samples/rendering/growth_direction/growth_direction.0.dart' as example; +import 'package:flutter_api_samples/rendering/growth_direction/growth_direction.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Example app has GrowthDirections represented', (WidgetTester tester) async { + testWidgets('Example app has GrowthDirections represented', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ExampleApp()); final RenderViewport viewport = tester.renderObject(find.byType(Viewport)); @@ -24,7 +27,8 @@ void main() { await tester.tap( find.byWidgetPredicate((Widget widget) { - return widget is Radio && widget.value == AxisDirection.up; + return widget is Radio && + widget.value == AxisDirection.up; }), ); await tester.pumpAndSettle(); diff --git a/examples/api/test/rendering/scroll_direction/scroll_direction.0_test.dart b/examples/api/test/rendering/scroll_direction/scroll_direction.0_test.dart index 68ffdf02b47..90892fde02c 100644 --- a/examples/api/test/rendering/scroll_direction/scroll_direction.0_test.dart +++ b/examples/api/test/rendering/scroll_direction/scroll_direction.0_test.dart @@ -4,11 +4,14 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; -import 'package:flutter_api_samples/rendering/scroll_direction/scroll_direction.0.dart' as example; +import 'package:flutter_api_samples/rendering/scroll_direction/scroll_direction.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Example app has ScrollDirection represented', (WidgetTester tester) async { + testWidgets('Example app has ScrollDirection represented', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ExampleApp()); expect(find.byType(Radio), findsNWidgets(4)); @@ -22,7 +25,8 @@ void main() { await tester.tap( find.byWidgetPredicate((Widget widget) { - return widget is Radio && widget.value == AxisDirection.up; + return widget is Radio && + widget.value == AxisDirection.up; }), ); await tester.pumpAndSettle(); diff --git a/examples/api/test/rendering/sliver_grid/sliver_grid_delegate_with_fixed_cross_axis_count.0_test.dart b/examples/api/test/rendering/sliver_grid/sliver_grid_delegate_with_fixed_cross_axis_count.0_test.dart index 68068c91789..8f1a56896fb 100644 --- a/examples/api/test/rendering/sliver_grid/sliver_grid_delegate_with_fixed_cross_axis_count.0_test.dart +++ b/examples/api/test/rendering/sliver_grid/sliver_grid_delegate_with_fixed_cross_axis_count.0_test.dart @@ -11,7 +11,9 @@ void main() { testWidgets('Each tiles should have a width of 200.0 and a height of 100.0', ( WidgetTester tester, ) async { - await tester.pumpWidget(const example.SliverGridDelegateWithFixedCrossAxisCountExampleApp()); + await tester.pumpWidget( + const example.SliverGridDelegateWithFixedCrossAxisCountExampleApp(), + ); for (int i = 0; i < 20; i++) { expect(find.text('$i'), findsOne); diff --git a/examples/api/test/rendering/sliver_grid/sliver_grid_delegate_with_fixed_cross_axis_count.1_test.dart b/examples/api/test/rendering/sliver_grid/sliver_grid_delegate_with_fixed_cross_axis_count.1_test.dart index adc3a13f704..57e55fcacfd 100644 --- a/examples/api/test/rendering/sliver_grid/sliver_grid_delegate_with_fixed_cross_axis_count.1_test.dart +++ b/examples/api/test/rendering/sliver_grid/sliver_grid_delegate_with_fixed_cross_axis_count.1_test.dart @@ -11,7 +11,9 @@ void main() { testWidgets('Each tiles should have a width of 200.0 and a height of 150.0', ( WidgetTester tester, ) async { - await tester.pumpWidget(const example.SliverGridDelegateWithFixedCrossAxisCountExampleApp()); + await tester.pumpWidget( + const example.SliverGridDelegateWithFixedCrossAxisCountExampleApp(), + ); for (int i = 0; i < 4; i++) { expect(find.text('$i'), findsOne); diff --git a/examples/api/test/sample_templates/cupertino.0_test.dart b/examples/api/test/sample_templates/cupertino.0_test.dart index 3830f41b710..34dbe8ae371 100644 --- a/examples/api/test/sample_templates/cupertino.0_test.dart +++ b/examples/api/test/sample_templates/cupertino.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter_api_samples/sample_templates/cupertino.0.dart' as example; +import 'package:flutter_api_samples/sample_templates/cupertino.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; // This is an example of a test for API example code. diff --git a/examples/api/test/sample_templates/material.0_test.dart b/examples/api/test/sample_templates/material.0_test.dart index ab1c16c6370..b06d1451abb 100644 --- a/examples/api/test/sample_templates/material.0_test.dart +++ b/examples/api/test/sample_templates/material.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/sample_templates/material.0.dart' as example; +import 'package:flutter_api_samples/sample_templates/material.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; // This is an example of a test for API example code. diff --git a/examples/api/test/services/binding/handle_request_app_exit.0_test.dart b/examples/api/test/services/binding/handle_request_app_exit.0_test.dart index 08d48332860..e077f3ea46d 100644 --- a/examples/api/test/services/binding/handle_request_app_exit.0_test.dart +++ b/examples/api/test/services/binding/handle_request_app_exit.0_test.dart @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:flutter_api_samples/services/binding/handle_request_app_exit.0.dart' as example; +import 'package:flutter_api_samples/services/binding/handle_request_app_exit.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/services/keyboard_key/logical_keyboard_key.0_test.dart b/examples/api/test/services/keyboard_key/logical_keyboard_key.0_test.dart index 9ad4735687e..1a62eed7c62 100644 --- a/examples/api/test/services/keyboard_key/logical_keyboard_key.0_test.dart +++ b/examples/api/test/services/keyboard_key/logical_keyboard_key.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/services.dart'; -import 'package:flutter_api_samples/services/keyboard_key/logical_keyboard_key.0.dart' as example; +import 'package:flutter_api_samples/services/keyboard_key/logical_keyboard_key.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/services/keyboard_key/physical_keyboard_key.0_test.dart b/examples/api/test/services/keyboard_key/physical_keyboard_key.0_test.dart index a9f93629388..49822cf3cc7 100644 --- a/examples/api/test/services/keyboard_key/physical_keyboard_key.0_test.dart +++ b/examples/api/test/services/keyboard_key/physical_keyboard_key.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/services.dart'; -import 'package:flutter_api_samples/services/keyboard_key/physical_keyboard_key.0.dart' as example; +import 'package:flutter_api_samples/services/keyboard_key/physical_keyboard_key.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -13,12 +14,21 @@ void main() { await tester.tap(find.text('Click to focus')); await tester.pumpAndSettle(); expect(find.text('Press a key'), findsOneWidget); - await tester.sendKeyEvent(LogicalKeyboardKey.keyQ, physicalKey: PhysicalKeyboardKey.keyA); + await tester.sendKeyEvent( + LogicalKeyboardKey.keyQ, + physicalKey: PhysicalKeyboardKey.keyA, + ); await tester.pumpAndSettle(); expect(find.text('Pressed the key next to CAPS LOCK!'), findsOneWidget); - await tester.sendKeyEvent(LogicalKeyboardKey.keyB, physicalKey: PhysicalKeyboardKey.keyB); + await tester.sendKeyEvent( + LogicalKeyboardKey.keyB, + physicalKey: PhysicalKeyboardKey.keyB, + ); await tester.pumpAndSettle(); - expect(find.text('Not the key next to CAPS LOCK: Pressed Key B'), findsOneWidget); + expect( + find.text('Not the key next to CAPS LOCK: Pressed Key B'), + findsOneWidget, + ); }); } diff --git a/examples/api/test/services/mouse_cursor/mouse_cursor.0_test.dart b/examples/api/test/services/mouse_cursor/mouse_cursor.0_test.dart index 07590a50db4..7ac06090908 100644 --- a/examples/api/test/services/mouse_cursor/mouse_cursor.0_test.dart +++ b/examples/api/test/services/mouse_cursor/mouse_cursor.0_test.dart @@ -3,14 +3,18 @@ // found in the LICENSE file. import 'package:flutter/widgets.dart'; -import 'package:flutter_api_samples/services/mouse_cursor/mouse_cursor.0.dart' as example; +import 'package:flutter_api_samples/services/mouse_cursor/mouse_cursor.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('Uses Text Cursor', (WidgetTester tester) async { await tester.pumpWidget(const example.MouseCursorExampleApp()); - expect(find.byType(MouseRegion), findsNWidgets(2)); // There's one in the MaterialApp + expect( + find.byType(MouseRegion), + findsNWidgets(2), + ); // There's one in the MaterialApp final Finder mouseRegionFinder = find.ancestor( of: find.byType(Container), matching: find.byType(MouseRegion), diff --git a/examples/api/test/services/system_chrome/system_chrome.set_system_u_i_overlay_style.0_test.dart b/examples/api/test/services/system_chrome/system_chrome.set_system_u_i_overlay_style.0_test.dart index d142fdc0da7..0c5985b03dc 100644 --- a/examples/api/test/services/system_chrome/system_chrome.set_system_u_i_overlay_style.0_test.dart +++ b/examples/api/test/services/system_chrome/system_chrome.set_system_u_i_overlay_style.0_test.dart @@ -20,12 +20,18 @@ void main() { await tester.pump(); final SystemUiOverlayStyle? secondStyle = SystemChrome.latestStyle; expect(secondStyle?.statusBarColor, isNot(firstStyle?.statusBarColor)); - expect(secondStyle?.systemNavigationBarColor, isNot(firstStyle?.systemNavigationBarColor)); + expect( + secondStyle?.systemNavigationBarColor, + isNot(firstStyle?.systemNavigationBarColor), + ); await tester.tap(find.byType(ElevatedButton)); await tester.pump(); final SystemUiOverlayStyle? thirdStyle = SystemChrome.latestStyle; expect(thirdStyle?.statusBarColor, isNot(secondStyle?.statusBarColor)); - expect(thirdStyle?.systemNavigationBarColor, isNot(secondStyle?.systemNavigationBarColor)); + expect( + thirdStyle?.systemNavigationBarColor, + isNot(secondStyle?.systemNavigationBarColor), + ); }); } diff --git a/examples/api/test/services/system_chrome/system_chrome.set_system_u_i_overlay_style.1_test.dart b/examples/api/test/services/system_chrome/system_chrome.set_system_u_i_overlay_style.1_test.dart index fd5c9fa5d36..7f66f214e36 100644 --- a/examples/api/test/services/system_chrome/system_chrome.set_system_u_i_overlay_style.1_test.dart +++ b/examples/api/test/services/system_chrome/system_chrome.set_system_u_i_overlay_style.1_test.dart @@ -9,7 +9,9 @@ import 'package:flutter_api_samples/services/system_chrome/system_chrome.set_sys import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('AnnotatedRegion can change system overlays style.', (WidgetTester tester) async { + testWidgets('AnnotatedRegion can change system overlays style.', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.SystemOverlayStyleApp()); final SystemUiOverlayStyle? firstStyle = SystemChrome.latestStyle; @@ -18,12 +20,18 @@ void main() { await tester.pump(); final SystemUiOverlayStyle? secondStyle = SystemChrome.latestStyle; expect(secondStyle?.statusBarColor, isNot(firstStyle?.statusBarColor)); - expect(secondStyle?.systemNavigationBarColor, isNot(firstStyle?.systemNavigationBarColor)); + expect( + secondStyle?.systemNavigationBarColor, + isNot(firstStyle?.systemNavigationBarColor), + ); await tester.tap(find.byType(ElevatedButton)); await tester.pump(); final SystemUiOverlayStyle? thirdStyle = SystemChrome.latestStyle; expect(thirdStyle?.statusBarColor, isNot(secondStyle?.statusBarColor)); - expect(thirdStyle?.systemNavigationBarColor, isNot(secondStyle?.systemNavigationBarColor)); + expect( + thirdStyle?.systemNavigationBarColor, + isNot(secondStyle?.systemNavigationBarColor), + ); }); } diff --git a/examples/api/test/services/text_input/text_input_control.0_test.dart b/examples/api/test/services/text_input/text_input_control.0_test.dart index 9a05fec9952..1d5a06888d5 100644 --- a/examples/api/test/services/text_input/text_input_control.0_test.dart +++ b/examples/api/test/services/text_input/text_input_control.0_test.dart @@ -4,7 +4,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_api_samples/services/text_input/text_input_control.0.dart' as example; +import 'package:flutter_api_samples/services/text_input/text_input_control.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/ui/text/font_feature.0_test.dart b/examples/api/test/ui/text/font_feature.0_test.dart index 5ad76b14dcc..170fb53edf8 100644 --- a/examples/api/test/ui/text/font_feature.0_test.dart +++ b/examples/api/test/ui/text/font_feature.0_test.dart @@ -11,8 +11,14 @@ void main() { await tester.pumpWidget(const MaterialApp(home: example.ExampleWidget())); expect(find.byType(Text), findsNWidgets(9)); - expect((tester.widget(find.byType(Text).at(0)) as Text).style!.fontSize, equals(18.0)); - expect((tester.widget(find.byType(Text).at(1)) as Text).style!.fontFamily, equals('Cardo')); + expect( + (tester.widget(find.byType(Text).at(0)) as Text).style!.fontSize, + equals(18.0), + ); + expect( + (tester.widget(find.byType(Text).at(1)) as Text).style!.fontFamily, + equals('Cardo'), + ); expect( (tester.widget(find.byType(Text).at(3)) as Text).style!.fontFeatures, equals(const [FontFeature.oldstyleFigures()]), diff --git a/examples/api/test/ui/text/font_feature.font_feature_alternative.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_alternative.0_test.dart index fb9ad7d32cf..5ddd004cbe3 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_alternative.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_alternative.0_test.dart @@ -12,7 +12,10 @@ void main() { await tester.pumpWidget(const MaterialApp(home: example.ExampleWidget())); expect(find.byType(Text), findsOneWidget); - expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Raleway')); + expect( + (tester.widget(find.byType(Text).first) as Text).style!.fontFamily, + equals('Raleway'), + ); expect( (tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, equals(const [FontFeature.alternative(1)]), diff --git a/examples/api/test/ui/text/font_feature.font_feature_case_sensitive_forms.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_case_sensitive_forms.0_test.dart index 4e228825a52..c66132ffce6 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_case_sensitive_forms.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_case_sensitive_forms.0_test.dart @@ -12,7 +12,10 @@ void main() { await tester.pumpWidget(const MaterialApp(home: example.ExampleWidget())); expect(find.byType(Text), findsOneWidget); - expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Piazzolla')); + expect( + (tester.widget(find.byType(Text).first) as Text).style!.fontFamily, + equals('Piazzolla'), + ); expect( (tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, equals(const [FontFeature.caseSensitiveForms()]), diff --git a/examples/api/test/ui/text/font_feature.font_feature_denominator.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_denominator.0_test.dart index 8e41d7314fd..d2717d6f29e 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_denominator.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_denominator.0_test.dart @@ -12,7 +12,10 @@ void main() { await tester.pumpWidget(const MaterialApp(home: example.ExampleWidget())); expect(find.byType(Text), findsOneWidget); - expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Piazzolla')); + expect( + (tester.widget(find.byType(Text).first) as Text).style!.fontFamily, + equals('Piazzolla'), + ); expect( (tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, equals(const [FontFeature.denominator()]), diff --git a/examples/api/test/ui/text/font_feature.font_feature_fractions.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_fractions.0_test.dart index 3b545cf51ef..9a684ce24a7 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_fractions.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_fractions.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/ui/text/font_feature.font_feature_fractions.0.dart' as example; +import 'package:flutter_api_samples/ui/text/font_feature.font_feature_fractions.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/ui/text/font_feature.font_feature_historical_ligatures.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_historical_ligatures.0_test.dart index 7daeb8b6641..3564f8db201 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_historical_ligatures.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_historical_ligatures.0_test.dart @@ -18,7 +18,10 @@ void main() { ); expect( (tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, - equals(const [FontFeature.historicalForms(), FontFeature.historicalLigatures()]), + equals(const [ + FontFeature.historicalForms(), + FontFeature.historicalLigatures(), + ]), ); }); } diff --git a/examples/api/test/ui/text/font_feature.font_feature_locale_aware.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_locale_aware.0_test.dart index b65823af144..80f87bd44a4 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_locale_aware.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_locale_aware.0_test.dart @@ -12,7 +12,10 @@ void main() { await tester.pumpWidget(const MaterialApp(home: example.ExampleWidget())); expect(find.byType(Text), findsOneWidget); - expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Noto Sans')); + expect( + (tester.widget(find.byType(Text).first) as Text).style!.fontFamily, + equals('Noto Sans'), + ); expect( (tester.widget(find.byType(Text).first) as Text).locale, equals(const Locale('zh', 'CN')), diff --git a/examples/api/test/ui/text/font_feature.font_feature_notational_forms.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_notational_forms.0_test.dart index a7e299e87e2..09bd7b855a9 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_notational_forms.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_notational_forms.0_test.dart @@ -12,7 +12,10 @@ void main() { await tester.pumpWidget(const MaterialApp(home: example.ExampleWidget())); expect(find.byType(Text), findsOneWidget); - expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Gothic A1')); + expect( + (tester.widget(find.byType(Text).first) as Text).style!.fontFamily, + equals('Gothic A1'), + ); expect( (tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, equals(const [FontFeature.notationalForms(3)]), diff --git a/examples/api/test/ui/text/font_feature.font_feature_numerators.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_numerators.0_test.dart index b05bd9f21d8..d6b0c7e4015 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_numerators.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_numerators.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/ui/text/font_feature.font_feature_numerators.0.dart' as example; +import 'package:flutter_api_samples/ui/text/font_feature.font_feature_numerators.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -11,7 +12,10 @@ void main() { await tester.pumpWidget(const MaterialApp(home: example.ExampleWidget())); expect(find.byType(Text), findsOneWidget); - expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Piazzolla')); + expect( + (tester.widget(find.byType(Text).first) as Text).style!.fontFamily, + equals('Piazzolla'), + ); expect( (tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, equals(const [FontFeature.numerators()]), diff --git a/examples/api/test/ui/text/font_feature.font_feature_oldstyle_figures.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_oldstyle_figures.0_test.dart index e9e6603e464..9381ad87d56 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_oldstyle_figures.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_oldstyle_figures.0_test.dart @@ -12,7 +12,10 @@ void main() { await tester.pumpWidget(const MaterialApp(home: example.ExampleWidget())); expect(find.byType(Text), findsOneWidget); - expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Piazzolla')); + expect( + (tester.widget(find.byType(Text).first) as Text).style!.fontFamily, + equals('Piazzolla'), + ); expect( (tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, equals(const [FontFeature.oldstyleFigures()]), diff --git a/examples/api/test/ui/text/font_feature.font_feature_ordinal_forms.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_ordinal_forms.0_test.dart index 68ea893cb93..64fb2926420 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_ordinal_forms.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_ordinal_forms.0_test.dart @@ -12,7 +12,10 @@ void main() { await tester.pumpWidget(const MaterialApp(home: example.ExampleWidget())); expect(find.byType(Text), findsOneWidget); - expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Piazzolla')); + expect( + (tester.widget(find.byType(Text).first) as Text).style!.fontFamily, + equals('Piazzolla'), + ); expect( (tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, equals(const [FontFeature.ordinalForms()]), diff --git a/examples/api/test/ui/text/font_feature.font_feature_proportional_figures.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_proportional_figures.0_test.dart index d7faef9339a..5637a59743f 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_proportional_figures.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_proportional_figures.0_test.dart @@ -12,7 +12,10 @@ void main() { await tester.pumpWidget(const MaterialApp(home: example.ExampleWidget())); expect(find.byType(Text), findsOneWidget); - expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Kufam')); + expect( + (tester.widget(find.byType(Text).first) as Text).style!.fontFamily, + equals('Kufam'), + ); expect( (tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, equals(const [FontFeature.proportionalFigures()]), diff --git a/examples/api/test/ui/text/font_feature.font_feature_scientific_inferiors.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_scientific_inferiors.0_test.dart index 34cdc9e8f4f..8d22b103d99 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_scientific_inferiors.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_scientific_inferiors.0_test.dart @@ -12,7 +12,10 @@ void main() { await tester.pumpWidget(const MaterialApp(home: example.ExampleWidget())); expect(find.byType(Text), findsOneWidget); - expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Piazzolla')); + expect( + (tester.widget(find.byType(Text).first) as Text).style!.fontFamily, + equals('Piazzolla'), + ); expect( (tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, equals(const [FontFeature.scientificInferiors()]), diff --git a/examples/api/test/ui/text/font_feature.font_feature_stylistic_set.1_test.dart b/examples/api/test/ui/text/font_feature.font_feature_stylistic_set.1_test.dart index 3e35b4104a9..c76b2d4013c 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_stylistic_set.1_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_stylistic_set.1_test.dart @@ -12,10 +12,16 @@ void main() { await tester.pumpWidget(const MaterialApp(home: example.ExampleWidget())); expect(find.byType(Text), findsOneWidget); - expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Piazzolla')); + expect( + (tester.widget(find.byType(Text).first) as Text).style!.fontFamily, + equals('Piazzolla'), + ); expect( (tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, - equals([FontFeature.stylisticSet(1), FontFeature.stylisticSet(2)]), + equals([ + FontFeature.stylisticSet(1), + FontFeature.stylisticSet(2), + ]), ); }); } diff --git a/examples/api/test/ui/text/font_feature.font_feature_subscripts.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_subscripts.0_test.dart index a2e9439412f..cb030ba922a 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_subscripts.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_subscripts.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/ui/text/font_feature.font_feature_subscripts.0.dart' as example; +import 'package:flutter_api_samples/ui/text/font_feature.font_feature_subscripts.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -11,7 +12,10 @@ void main() { await tester.pumpWidget(const MaterialApp(home: example.ExampleWidget())); expect(find.byType(Text), findsOneWidget); - expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Piazzolla')); + expect( + (tester.widget(find.byType(Text).first) as Text).style!.fontFamily, + equals('Piazzolla'), + ); expect( (tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, equals(const [FontFeature.subscripts()]), diff --git a/examples/api/test/ui/text/font_feature.font_feature_swash.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_swash.0_test.dart index 3ac51fed6e4..55c0c5b6420 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_swash.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_swash.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/ui/text/font_feature.font_feature_swash.0.dart' as example; +import 'package:flutter_api_samples/ui/text/font_feature.font_feature_swash.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/ui/text/font_feature.font_feature_tabular_figures.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_tabular_figures.0_test.dart index 96dcc270fcb..b8c703016e0 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_tabular_figures.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_tabular_figures.0_test.dart @@ -12,7 +12,10 @@ void main() { await tester.pumpWidget(const MaterialApp(home: example.ExampleWidget())); expect(find.byType(Text), findsOneWidget); - expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Piazzolla')); + expect( + (tester.widget(find.byType(Text).first) as Text).style!.fontFamily, + equals('Piazzolla'), + ); expect( (tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, equals(const [FontFeature.tabularFigures()]), diff --git a/examples/api/test/widgets/actions/action.action_overridable.0_test.dart b/examples/api/test/widgets/actions/action.action_overridable.0_test.dart index 9633e566bfa..0c7885df90a 100644 --- a/examples/api/test/widgets/actions/action.action_overridable.0_test.dart +++ b/examples/api/test/widgets/actions/action.action_overridable.0_test.dart @@ -4,7 +4,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_api_samples/widgets/actions/action.action_overridable.0.dart' as example; +import 'package:flutter_api_samples/widgets/actions/action.action_overridable.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -18,7 +19,9 @@ void main() { ); await tester.pumpWidget( const MaterialApp( - home: Scaffold(body: Center(child: example.VerificationCodeGenerator())), + home: Scaffold( + body: Center(child: example.VerificationCodeGenerator()), + ), ), ); diff --git a/examples/api/test/widgets/actions/action_listener.0_test.dart b/examples/api/test/widgets/actions/action_listener.0_test.dart index 50e7a5d17cf..31f6e23f415 100644 --- a/examples/api/test/widgets/actions/action_listener.0_test.dart +++ b/examples/api/test/widgets/actions/action_listener.0_test.dart @@ -4,7 +4,8 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/actions/action_listener.0.dart' as example; +import 'package:flutter_api_samples/widgets/actions/action_listener.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -27,7 +28,10 @@ void main() { await tester.pump(); expect(find.widgetWithText(OutlinedButton, 'Disable'), findsOne); - expect(find.widgetWithText(ElevatedButton, 'Call Action Listener'), findsOne); + expect( + find.widgetWithText(ElevatedButton, 'Call Action Listener'), + findsOne, + ); expect(log, const ['Action Listener was added']); await tester.tap(find.text('Call Action Listener')); @@ -39,7 +43,10 @@ void main() { await tester.pump(); expect(find.widgetWithText(OutlinedButton, 'Enable'), findsOne); - expect(log, const ['Action Listener was added', 'Action Listener was removed']); + expect(log, const [ + 'Action Listener was added', + 'Action Listener was removed', + ]); } finally { debugPrint = originalDebugPrint; } diff --git a/examples/api/test/widgets/actions/actions.0_test.dart b/examples/api/test/widgets/actions/actions.0_test.dart index c7ff9701877..2129fd99412 100644 --- a/examples/api/test/widgets/actions/actions.0_test.dart +++ b/examples/api/test/widgets/actions/actions.0_test.dart @@ -12,7 +12,9 @@ void main() { final ButtonStyleButton button = tester.widget( find.descendant( of: find.byType(example.SaveButton), - matching: find.byWidgetPredicate((Widget widget) => widget is TextButton), + matching: find.byWidgetPredicate( + (Widget widget) => widget is TextButton, + ), ), ); @@ -71,7 +73,9 @@ void main() { expect(saveButtonColor, equals(Colors.red)); }); - testWidgets('SaveButton tap resets dirty status and adds log', (WidgetTester tester) async { + testWidgets('SaveButton tap resets dirty status and adds log', ( + WidgetTester tester, + ) async { final List log = []; final DebugPrintCallback originalDebugPrint = debugPrint; @@ -85,7 +89,10 @@ void main() { Color? saveButtonColor = getSaveButtonColor(tester); expect(saveButtonColor, equals(Colors.green)); expect( - find.descendant(of: find.byType(example.SaveButton), matching: find.text('0')), + find.descendant( + of: find.byType(example.SaveButton), + matching: find.text('0'), + ), findsOneWidget, ); @@ -98,7 +105,10 @@ void main() { saveButtonColor = getSaveButtonColor(tester); expect(saveButtonColor, equals(Colors.red)); expect( - find.descendant(of: find.byType(example.SaveButton), matching: find.text('0')), + find.descendant( + of: find.byType(example.SaveButton), + matching: find.text('0'), + ), findsOneWidget, ); @@ -114,7 +124,10 @@ void main() { saveButtonColor = getSaveButtonColor(tester); expect(saveButtonColor, equals(Colors.green)); expect( - find.descendant(of: find.byType(example.SaveButton), matching: find.text('-1')), + find.descendant( + of: find.byType(example.SaveButton), + matching: find.text('-1'), + ), findsOneWidget, ); diff --git a/examples/api/test/widgets/actions/focusable_action_detector.0_test.dart b/examples/api/test/widgets/actions/focusable_action_detector.0_test.dart index 855643526bc..ab14f760154 100644 --- a/examples/api/test/widgets/actions/focusable_action_detector.0_test.dart +++ b/examples/api/test/widgets/actions/focusable_action_detector.0_test.dart @@ -4,7 +4,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_api_samples/widgets/actions/focusable_action_detector.0.dart' as example; +import 'package:flutter_api_samples/widgets/actions/focusable_action_detector.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -12,10 +13,15 @@ void main() { (Widget widget) => widget is Container && widget.color == Colors.red, ); - testWidgets('Taps on the "And me" button toggle the red box', (WidgetTester tester) async { + testWidgets('Taps on the "And me" button toggle the red box', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.FocusableActionDetectorExampleApp()); - expect(find.widgetWithText(AppBar, 'FocusableActionDetector Example'), findsOne); + expect( + find.widgetWithText(AppBar, 'FocusableActionDetector Example'), + findsOne, + ); expect(redContainerFinder, findsNothing); @@ -35,11 +41,16 @@ void main() { ) async { await tester.pumpWidget(const example.FocusableActionDetectorExampleApp()); - expect(find.widgetWithText(AppBar, 'FocusableActionDetector Example'), findsOne); + expect( + find.widgetWithText(AppBar, 'FocusableActionDetector Example'), + findsOne, + ); expect(redContainerFinder, findsNothing); - await tester.sendKeyEvent(LogicalKeyboardKey.tab); // Focuses the "Press Me" button. + await tester.sendKeyEvent( + LogicalKeyboardKey.tab, + ); // Focuses the "Press Me" button. await tester.pump(); expect(redContainerFinder, findsNothing); @@ -49,7 +60,9 @@ void main() { expect(redContainerFinder, findsNothing); - await tester.sendKeyEvent(LogicalKeyboardKey.tab); // Focuses the "And Me" button. + await tester.sendKeyEvent( + LogicalKeyboardKey.tab, + ); // Focuses the "And Me" button. await tester.pump(); expect(redContainerFinder, findsNothing); diff --git a/examples/api/test/widgets/animated_grid/animated_grid.0_test.dart b/examples/api/test/widgets/animated_grid/animated_grid.0_test.dart index 45fdacdb54e..32e4cf13b37 100644 --- a/examples/api/test/widgets/animated_grid/animated_grid.0_test.dart +++ b/examples/api/test/widgets/animated_grid/animated_grid.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/animated_grid/animated_grid.0.dart' as example; +import 'package:flutter_api_samples/widgets/animated_grid/animated_grid.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/widgets/animated_grid/sliver_animated_grid.0_test.dart b/examples/api/test/widgets/animated_grid/sliver_animated_grid.0_test.dart index 49859053d84..17e693b6c30 100644 --- a/examples/api/test/widgets/animated_grid/sliver_animated_grid.0_test.dart +++ b/examples/api/test/widgets/animated_grid/sliver_animated_grid.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/animated_grid/sliver_animated_grid.0.dart' as example; +import 'package:flutter_api_samples/widgets/animated_grid/sliver_animated_grid.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/widgets/animated_list/animated_list.0_test.dart b/examples/api/test/widgets/animated_list/animated_list.0_test.dart index 0fc681b4a19..96da2f0f113 100644 --- a/examples/api/test/widgets/animated_list/animated_list.0_test.dart +++ b/examples/api/test/widgets/animated_list/animated_list.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/animated_list/animated_list.0.dart' as example; +import 'package:flutter_api_samples/widgets/animated_list/animated_list.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/widgets/animated_list/animated_list_separated.0_test.dart b/examples/api/test/widgets/animated_list/animated_list_separated.0_test.dart index 3c706d6dd65..1100c6dc83e 100644 --- a/examples/api/test/widgets/animated_list/animated_list_separated.0_test.dart +++ b/examples/api/test/widgets/animated_list/animated_list_separated.0_test.dart @@ -8,49 +8,50 @@ import 'package:flutter_api_samples/widgets/animated_list/animated_list_separate import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Items can be selected, added, and removed from AnimatedList.separated', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.AnimatedListSeparatedSample()); + testWidgets( + 'Items can be selected, added, and removed from AnimatedList.separated', + (WidgetTester tester) async { + await tester.pumpWidget(const example.AnimatedListSeparatedSample()); - expect(find.text('Item 0'), findsOneWidget); - expect(find.text('Separator 0'), findsOneWidget); - expect(find.text('Item 1'), findsOneWidget); - expect(find.text('Separator 1'), findsOneWidget); - expect(find.text('Item 2'), findsOneWidget); + expect(find.text('Item 0'), findsOneWidget); + expect(find.text('Separator 0'), findsOneWidget); + expect(find.text('Item 1'), findsOneWidget); + expect(find.text('Separator 1'), findsOneWidget); + expect(find.text('Item 2'), findsOneWidget); - // Add an item at the end of the list - await tester.tap(find.byIcon(Icons.add_circle)); - await tester.pumpAndSettle(); - expect(find.text('Separator 2'), findsOneWidget); - expect(find.text('Item 3'), findsOneWidget); + // Add an item at the end of the list + await tester.tap(find.byIcon(Icons.add_circle)); + await tester.pumpAndSettle(); + expect(find.text('Separator 2'), findsOneWidget); + expect(find.text('Item 3'), findsOneWidget); - // Select Item 1. - await tester.tap(find.text('Item 1')); - await tester.pumpAndSettle(); + // Select Item 1. + await tester.tap(find.text('Item 1')); + await tester.pumpAndSettle(); - // Add item at the top of the list - await tester.tap(find.byIcon(Icons.add_circle)); - await tester.pumpAndSettle(); - expect(find.text('Item 4'), findsOneWidget); - // Contrary to the behavior for insertion at other places, - // the Separator for the last item of the list will be added - // before that item instead of after it. - expect(find.text('Separator 4'), findsOneWidget); + // Add item at the top of the list + await tester.tap(find.byIcon(Icons.add_circle)); + await tester.pumpAndSettle(); + expect(find.text('Item 4'), findsOneWidget); + // Contrary to the behavior for insertion at other places, + // the Separator for the last item of the list will be added + // before that item instead of after it. + expect(find.text('Separator 4'), findsOneWidget); - // Remove selected item. - await tester.tap(find.byIcon(Icons.remove_circle)); + // Remove selected item. + await tester.tap(find.byIcon(Icons.remove_circle)); - // Item animation is not completed. - await tester.pump(); - expect(find.text('Item 1'), findsOneWidget); - expect(find.text('Separator 1'), findsNothing); - expect(find.text('Removing separator'), findsOneWidget); + // Item animation is not completed. + await tester.pump(); + expect(find.text('Item 1'), findsOneWidget); + expect(find.text('Separator 1'), findsNothing); + expect(find.text('Removing separator'), findsOneWidget); - // When the animation completes, Item 1 disappears. - await tester.pumpAndSettle(); - expect(find.text('Item 1'), findsNothing); - expect(find.text('Separator 1'), findsNothing); - expect(find.text('Removing separator'), findsNothing); - }); + // When the animation completes, Item 1 disappears. + await tester.pumpAndSettle(); + expect(find.text('Item 1'), findsNothing); + expect(find.text('Separator 1'), findsNothing); + expect(find.text('Removing separator'), findsNothing); + }, + ); } diff --git a/examples/api/test/widgets/animated_list/sliver_animated_list.0_test.dart b/examples/api/test/widgets/animated_list/sliver_animated_list.0_test.dart index d5db96811ea..31a78915514 100644 --- a/examples/api/test/widgets/animated_list/sliver_animated_list.0_test.dart +++ b/examples/api/test/widgets/animated_list/sliver_animated_list.0_test.dart @@ -3,42 +3,44 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/animated_list/sliver_animated_list.0.dart' as example; +import 'package:flutter_api_samples/widgets/animated_list/sliver_animated_list.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Items can be selected, added, and removed from SliverAnimatedList', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.SliverAnimatedListSample()); + testWidgets( + 'Items can be selected, added, and removed from SliverAnimatedList', + (WidgetTester tester) async { + await tester.pumpWidget(const example.SliverAnimatedListSample()); - expect(find.text('Item 0'), findsOneWidget); - expect(find.text('Item 1'), findsOneWidget); - expect(find.text('Item 2'), findsOneWidget); + expect(find.text('Item 0'), findsOneWidget); + expect(find.text('Item 1'), findsOneWidget); + expect(find.text('Item 2'), findsOneWidget); - // Add an item at the end of the list - await tester.tap(find.byIcon(Icons.add_circle)); - await tester.pumpAndSettle(); - expect(find.text('Item 3'), findsOneWidget); + // Add an item at the end of the list + await tester.tap(find.byIcon(Icons.add_circle)); + await tester.pumpAndSettle(); + expect(find.text('Item 3'), findsOneWidget); - // Select Item 1. - await tester.tap(find.text('Item 1')); - await tester.pumpAndSettle(); + // Select Item 1. + await tester.tap(find.text('Item 1')); + await tester.pumpAndSettle(); - // Add item at the top of the list - await tester.tap(find.byIcon(Icons.add_circle)); - await tester.pumpAndSettle(); - expect(find.text('Item 4'), findsOneWidget); + // Add item at the top of the list + await tester.tap(find.byIcon(Icons.add_circle)); + await tester.pumpAndSettle(); + expect(find.text('Item 4'), findsOneWidget); - // Remove selected item. - await tester.tap(find.byIcon(Icons.remove_circle)); + // Remove selected item. + await tester.tap(find.byIcon(Icons.remove_circle)); - // Item animation is not completed. - await tester.pump(); - expect(find.text('Item 1'), findsOneWidget); + // Item animation is not completed. + await tester.pump(); + expect(find.text('Item 1'), findsOneWidget); - // When the animation completes, Item 1 disappears. - await tester.pumpAndSettle(); - expect(find.text('Item 1'), findsNothing); - }); + // When the animation completes, Item 1 disappears. + await tester.pumpAndSettle(); + expect(find.text('Item 1'), findsNothing); + }, + ); } diff --git a/examples/api/test/widgets/animated_size/animated_size.0_test.dart b/examples/api/test/widgets/animated_size/animated_size.0_test.dart index 21c49a49a69..bcfd3204431 100644 --- a/examples/api/test/widgets/animated_size/animated_size.0_test.dart +++ b/examples/api/test/widgets/animated_size/animated_size.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/animated_size/animated_size.0.dart' as example; +import 'package:flutter_api_samples/widgets/animated_size/animated_size.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/widgets/animated_switcher/animated_switcher.0_test.dart b/examples/api/test/widgets/animated_switcher/animated_switcher.0_test.dart index 88cf8ef3cbe..146ff7271cc 100644 --- a/examples/api/test/widgets/animated_switcher/animated_switcher.0_test.dart +++ b/examples/api/test/widgets/animated_switcher/animated_switcher.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/animated_switcher/animated_switcher.0.dart' as example; +import 'package:flutter_api_samples/widgets/animated_switcher/animated_switcher.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -17,7 +18,10 @@ void main() { while (counter < 10) { // Tap on the button to increment the counter. await tester.tap( - find.ancestor(of: find.text('Increment'), matching: find.byType(ElevatedButton)), + find.ancestor( + of: find.text('Increment'), + matching: find.byType(ElevatedButton), + ), ); await tester.pumpAndSettle(); @@ -51,7 +55,10 @@ void main() { // Tap on the button to increment the counter. await tester.tap( - find.ancestor(of: find.text('Increment'), matching: find.byType(ElevatedButton)), + find.ancestor( + of: find.text('Increment'), + matching: find.byType(ElevatedButton), + ), ); await tester.pump(); diff --git a/examples/api/test/widgets/app/widgets_app.widgets_app.0_test.dart b/examples/api/test/widgets/app/widgets_app.widgets_app.0_test.dart index ff078feeb3c..7a1316a47ce 100644 --- a/examples/api/test/widgets/app/widgets_app.widgets_app.0_test.dart +++ b/examples/api/test/widgets/app/widgets_app.widgets_app.0_test.dart @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:flutter_api_samples/widgets/app/widgets_app.widgets_app.0.dart' as example; +import 'package:flutter_api_samples/widgets/app/widgets_app.widgets_app.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/widgets/async/future_builder.0_test.dart b/examples/api/test/widgets/async/future_builder.0_test.dart index 2a1e4b0e820..5e47906cd8b 100644 --- a/examples/api/test/widgets/async/future_builder.0_test.dart +++ b/examples/api/test/widgets/async/future_builder.0_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/async/future_builder.0.dart' as example; +import 'package:flutter_api_samples/widgets/async/future_builder.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('StreamBuilder listens to internal stream', (WidgetTester tester) async { + testWidgets('StreamBuilder listens to internal stream', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.FutureBuilderExampleApp()); expect(find.byType(CircularProgressIndicator), findsOne); diff --git a/examples/api/test/widgets/async/stream_builder.0_test.dart b/examples/api/test/widgets/async/stream_builder.0_test.dart index 481d5d0f2d8..7c9fa1463ec 100644 --- a/examples/api/test/widgets/async/stream_builder.0_test.dart +++ b/examples/api/test/widgets/async/stream_builder.0_test.dart @@ -5,11 +5,14 @@ import 'dart:async'; import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/async/stream_builder.0.dart' as example; +import 'package:flutter_api_samples/widgets/async/stream_builder.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('StreamBuilder listens to internal stream', (WidgetTester tester) async { + testWidgets('StreamBuilder listens to internal stream', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.StreamBuilderExampleApp()); expect(find.byType(CircularProgressIndicator), findsOneWidget); @@ -26,7 +29,9 @@ void main() { expect(find.text(r'$1 (closed)'), findsOneWidget); }); - testWidgets('BidsStatus correctly displays error state', (WidgetTester tester) async { + testWidgets('BidsStatus correctly displays error state', ( + WidgetTester tester, + ) async { final StreamController controller = StreamController(); addTearDown(controller.close); @@ -34,7 +39,9 @@ void main() { controller.addError('Unexpected error!', StackTrace.empty); }; - await tester.pumpWidget(MaterialApp(home: example.BidsStatus(bids: controller.stream))); + await tester.pumpWidget( + MaterialApp(home: example.BidsStatus(bids: controller.stream)), + ); await tester.pump(); expect(find.byIcon(Icons.error_outline), findsOneWidget); @@ -42,24 +49,34 @@ void main() { expect(find.text('Stack trace: ${StackTrace.empty}'), findsOneWidget); }); - testWidgets('BidsStatus correctly displays none state', (WidgetTester tester) async { - await tester.pumpWidget(const MaterialApp(home: example.BidsStatus(bids: null))); + testWidgets('BidsStatus correctly displays none state', ( + WidgetTester tester, + ) async { + await tester.pumpWidget( + const MaterialApp(home: example.BidsStatus(bids: null)), + ); expect(find.byIcon(Icons.info), findsOneWidget); expect(find.text('Select a lot'), findsOneWidget); }); - testWidgets('BidsStatus correctly displays waiting state', (WidgetTester tester) async { + testWidgets('BidsStatus correctly displays waiting state', ( + WidgetTester tester, + ) async { final StreamController controller = StreamController(); addTearDown(controller.close); - await tester.pumpWidget(MaterialApp(home: example.BidsStatus(bids: controller.stream))); + await tester.pumpWidget( + MaterialApp(home: example.BidsStatus(bids: controller.stream)), + ); expect(find.byType(CircularProgressIndicator), findsOneWidget); expect(find.text('Awaiting bids...'), findsOneWidget); }); - testWidgets('BidsStatus correctly displays active state', (WidgetTester tester) async { + testWidgets('BidsStatus correctly displays active state', ( + WidgetTester tester, + ) async { final StreamController controller = StreamController(); addTearDown(controller.close); @@ -67,18 +84,24 @@ void main() { controller.add(1); }; - await tester.pumpWidget(MaterialApp(home: example.BidsStatus(bids: controller.stream))); + await tester.pumpWidget( + MaterialApp(home: example.BidsStatus(bids: controller.stream)), + ); await tester.pump(); expect(find.byIcon(Icons.check_circle_outline), findsOneWidget); expect(find.text(r'$1'), findsOneWidget); }); - testWidgets('BidsStatus correctly displays done state', (WidgetTester tester) async { + testWidgets('BidsStatus correctly displays done state', ( + WidgetTester tester, + ) async { final StreamController controller = StreamController(); controller.close(); - await tester.pumpWidget(MaterialApp(home: example.BidsStatus(bids: controller.stream))); + await tester.pumpWidget( + MaterialApp(home: example.BidsStatus(bids: controller.stream)), + ); await tester.pump(); expect(find.byIcon(Icons.info), findsOneWidget); diff --git a/examples/api/test/widgets/autocomplete/raw_autocomplete.0_test.dart b/examples/api/test/widgets/autocomplete/raw_autocomplete.0_test.dart index ce54106efc4..dc7fd4630da 100644 --- a/examples/api/test/widgets/autocomplete/raw_autocomplete.0_test.dart +++ b/examples/api/test/widgets/autocomplete/raw_autocomplete.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/autocomplete/raw_autocomplete.0.dart' as example; +import 'package:flutter_api_samples/widgets/autocomplete/raw_autocomplete.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -17,7 +18,9 @@ void main() { expect(find.text('chameleon'), findsNothing); }); - testWidgets('Options are shown correctly and selectable', (WidgetTester tester) async { + testWidgets('Options are shown correctly and selectable', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.AutocompleteExampleApp()); await tester.tap(find.byType(TextFormField)); await tester.pump(); @@ -40,7 +43,10 @@ void main() { expect(find.byType(ListTile), findsNothing); expect( - find.descendant(of: find.byType(TextFormField), matching: find.text('bobcat')), + find.descendant( + of: find.byType(TextFormField), + matching: find.text('bobcat'), + ), findsOneWidget, ); }); diff --git a/examples/api/test/widgets/autocomplete/raw_autocomplete.1_test.dart b/examples/api/test/widgets/autocomplete/raw_autocomplete.1_test.dart index 284eb8bbb3b..61d0e142ec8 100644 --- a/examples/api/test/widgets/autocomplete/raw_autocomplete.1_test.dart +++ b/examples/api/test/widgets/autocomplete/raw_autocomplete.1_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/autocomplete/raw_autocomplete.1.dart' as example; +import 'package:flutter_api_samples/widgets/autocomplete/raw_autocomplete.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -17,7 +18,9 @@ void main() { expect(find.text('Charlie'), findsNothing); }); - testWidgets('Options are shown correctly and selectable', (WidgetTester tester) async { + testWidgets('Options are shown correctly and selectable', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.AutocompleteExampleApp()); await tester.tap(find.byType(TextFormField)); await tester.pump(); @@ -40,7 +43,10 @@ void main() { expect(find.byType(ListTile), findsNothing); expect( - find.descendant(of: find.byType(TextFormField), matching: find.text('Bob')), + find.descendant( + of: find.byType(TextFormField), + matching: find.text('Bob'), + ), findsOneWidget, ); }); @@ -69,7 +75,10 @@ void main() { expect(find.byType(ListTile), findsNothing); expect( - find.descendant(of: find.byType(TextFormField), matching: find.text('Charlie')), + find.descendant( + of: find.byType(TextFormField), + matching: find.text('Charlie'), + ), findsOneWidget, ); }); diff --git a/examples/api/test/widgets/autocomplete/raw_autocomplete.2_test.dart b/examples/api/test/widgets/autocomplete/raw_autocomplete.2_test.dart index 5dcd8f40e5a..01fb450448c 100644 --- a/examples/api/test/widgets/autocomplete/raw_autocomplete.2_test.dart +++ b/examples/api/test/widgets/autocomplete/raw_autocomplete.2_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/autocomplete/raw_autocomplete.2.dart' as example; +import 'package:flutter_api_samples/widgets/autocomplete/raw_autocomplete.2.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -14,7 +15,10 @@ void main() { expect(find.text('RawAutocomplete Form'), findsOneWidget); expect(find.byType(TextFormField), findsNWidgets(2)); expect(find.byIcon(Icons.arrow_downward), findsOneWidget); - expect(find.text('This is a regular DropdownButtonFormField'), findsOneWidget); + expect( + find.text('This is a regular DropdownButtonFormField'), + findsOneWidget, + ); expect(find.text('This is a regular TextFormField'), findsOneWidget); expect(find.text('This is a RawAutocomplete!'), findsOneWidget); expect(find.text('Submit'), findsOneWidget); diff --git a/examples/api/test/widgets/autocomplete/raw_autocomplete.focus_node.0_test.dart b/examples/api/test/widgets/autocomplete/raw_autocomplete.focus_node.0_test.dart index f8358de3b55..4785bbbcdef 100644 --- a/examples/api/test/widgets/autocomplete/raw_autocomplete.focus_node.0_test.dart +++ b/examples/api/test/widgets/autocomplete/raw_autocomplete.focus_node.0_test.dart @@ -14,7 +14,10 @@ void main() { expect(find.byType(AppBar), findsOneWidget); expect(find.byType(TextFormField), findsOneWidget); expect( - find.descendant(of: find.byType(AppBar), matching: find.byType(TextFormField)), + find.descendant( + of: find.byType(AppBar), + matching: find.byType(TextFormField), + ), findsOneWidget, ); @@ -23,12 +26,17 @@ void main() { expect(find.text('bobcat'), findsNothing); expect(find.text('chameleon'), findsNothing); expect( - find.ancestor(matching: find.byType(AppBar), of: find.byType(RawAutocomplete)), + find.ancestor( + matching: find.byType(AppBar), + of: find.byType(RawAutocomplete), + ), findsNothing, ); }); - testWidgets('Options are shown correctly and selectable', (WidgetTester tester) async { + testWidgets('Options are shown correctly and selectable', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.AutocompleteExampleApp()); await tester.tap(find.byType(TextFormField)); await tester.pump(); @@ -51,7 +59,10 @@ void main() { expect(find.byType(ListTile), findsNothing); expect( - find.descendant(of: find.byType(TextFormField), matching: find.text('bobcat')), + find.descendant( + of: find.byType(TextFormField), + matching: find.text('bobcat'), + ), findsOneWidget, ); }); diff --git a/examples/api/test/widgets/autofill/autofill_group.0_test.dart b/examples/api/test/widgets/autofill/autofill_group.0_test.dart index eb6c532a330..e2cc61cbfe6 100644 --- a/examples/api/test/widgets/autofill/autofill_group.0_test.dart +++ b/examples/api/test/widgets/autofill/autofill_group.0_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/autofill/autofill_group.0.dart' as example; +import 'package:flutter_api_samples/widgets/autofill/autofill_group.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('AutofillGroupExample renders and updates correctly', (WidgetTester tester) async { + testWidgets('AutofillGroupExample renders and updates correctly', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.AutofillGroupExampleApp()); expect(find.text('Shipping address'), findsOneWidget); @@ -33,24 +36,54 @@ void main() { findsNWidgets(7), // 5 initial + 2 billing address fields ); - final TextField shippingAddress1 = tester.widget(find.byType(TextField).at(0)); - expect(shippingAddress1.autofillHints, contains(AutofillHints.streetAddressLine1)); + final TextField shippingAddress1 = tester.widget( + find.byType(TextField).at(0), + ); + expect( + shippingAddress1.autofillHints, + contains(AutofillHints.streetAddressLine1), + ); - final TextField shippingAddress2 = tester.widget(find.byType(TextField).at(1)); - expect(shippingAddress2.autofillHints, contains(AutofillHints.streetAddressLine2)); + final TextField shippingAddress2 = tester.widget( + find.byType(TextField).at(1), + ); + expect( + shippingAddress2.autofillHints, + contains(AutofillHints.streetAddressLine2), + ); - final TextField billingAddress1 = tester.widget(find.byType(TextField).at(2)); - expect(billingAddress1.autofillHints, contains(AutofillHints.streetAddressLine1)); + final TextField billingAddress1 = tester.widget( + find.byType(TextField).at(2), + ); + expect( + billingAddress1.autofillHints, + contains(AutofillHints.streetAddressLine1), + ); - final TextField billingAddress2 = tester.widget(find.byType(TextField).at(3)); - expect(billingAddress2.autofillHints, contains(AutofillHints.streetAddressLine2)); + final TextField billingAddress2 = tester.widget( + find.byType(TextField).at(3), + ); + expect( + billingAddress2.autofillHints, + contains(AutofillHints.streetAddressLine2), + ); // Credit card information fields. - final TextField creditCardNumber = tester.widget(find.byType(TextField).at(4)); - expect(creditCardNumber.autofillHints, contains(AutofillHints.creditCardNumber)); + final TextField creditCardNumber = tester.widget( + find.byType(TextField).at(4), + ); + expect( + creditCardNumber.autofillHints, + contains(AutofillHints.creditCardNumber), + ); - final TextField creditCardSecurityCode = tester.widget(find.byType(TextField).at(5)); - expect(creditCardSecurityCode.autofillHints, contains(AutofillHints.creditCardSecurityCode)); + final TextField creditCardSecurityCode = tester.widget( + find.byType(TextField).at(5), + ); + expect( + creditCardSecurityCode.autofillHints, + contains(AutofillHints.creditCardSecurityCode), + ); // Contact phone number field. final TextField phoneNumber = tester.widget(find.byType(TextField).at(6)); diff --git a/examples/api/test/widgets/basic/absorb_pointer.0_test.dart b/examples/api/test/widgets/basic/absorb_pointer.0_test.dart index ebf9aa57b9b..0323ae2666e 100644 --- a/examples/api/test/widgets/basic/absorb_pointer.0_test.dart +++ b/examples/api/test/widgets/basic/absorb_pointer.0_test.dart @@ -6,11 +6,14 @@ import 'package:flutter/foundation.dart' show kIsWeb; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; -import 'package:flutter_api_samples/widgets/basic/absorb_pointer.0.dart' as example; +import 'package:flutter_api_samples/widgets/basic/absorb_pointer.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('AbsorbPointer prevents hit testing on its child', (WidgetTester tester) async { + testWidgets('AbsorbPointer prevents hit testing on its child', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.AbsorbPointerApp()); // Get the center of the stack. diff --git a/examples/api/test/widgets/basic/aspect_ratio.0_test.dart b/examples/api/test/widgets/basic/aspect_ratio.0_test.dart index 0185137b29e..8d7ed26581f 100644 --- a/examples/api/test/widgets/basic/aspect_ratio.0_test.dart +++ b/examples/api/test/widgets/basic/aspect_ratio.0_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/basic/aspect_ratio.0.dart' as example; +import 'package:flutter_api_samples/widgets/basic/aspect_ratio.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('AspectRatio applies 16 / 9 aspect ratio on its child', (WidgetTester tester) async { + testWidgets('AspectRatio applies 16 / 9 aspect ratio on its child', ( + WidgetTester tester, + ) async { const double height = 100.0; await tester.pumpWidget(const example.AspectRatioApp()); diff --git a/examples/api/test/widgets/basic/aspect_ratio.1_test.dart b/examples/api/test/widgets/basic/aspect_ratio.1_test.dart index b37449f67be..7329c459970 100644 --- a/examples/api/test/widgets/basic/aspect_ratio.1_test.dart +++ b/examples/api/test/widgets/basic/aspect_ratio.1_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/basic/aspect_ratio.1.dart' as example; +import 'package:flutter_api_samples/widgets/basic/aspect_ratio.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('AspectRatio applies 2.0 aspect ratio on its child', (WidgetTester tester) async { + testWidgets('AspectRatio applies 2.0 aspect ratio on its child', ( + WidgetTester tester, + ) async { const Size containerSize = Size(100, 100); await tester.pumpWidget(const example.AspectRatioApp()); @@ -16,6 +19,9 @@ void main() { expect(parentContainer, containerSize); final Size childContainer = tester.getSize(find.byType(Container).last); - expect(childContainer, Size(containerSize.height, containerSize.height / 2.0)); + expect( + childContainer, + Size(containerSize.height, containerSize.height / 2.0), + ); }); } diff --git a/examples/api/test/widgets/basic/aspect_ratio.2_test.dart b/examples/api/test/widgets/basic/aspect_ratio.2_test.dart index 8ec065472bb..1c75ac6e099 100644 --- a/examples/api/test/widgets/basic/aspect_ratio.2_test.dart +++ b/examples/api/test/widgets/basic/aspect_ratio.2_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/basic/aspect_ratio.2.dart' as example; +import 'package:flutter_api_samples/widgets/basic/aspect_ratio.2.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('AspectRatio applies 0.5 aspect ratio on its child', (WidgetTester tester) async { + testWidgets('AspectRatio applies 0.5 aspect ratio on its child', ( + WidgetTester tester, + ) async { const Size containerSize = Size(100, 100); await tester.pumpWidget(const example.AspectRatioApp()); @@ -16,6 +19,9 @@ void main() { expect(parentContainer, containerSize); final Size childContainer = tester.getSize(find.byType(Container).last); - expect(childContainer, Size(containerSize.height * 0.5, containerSize.height)); + expect( + childContainer, + Size(containerSize.height * 0.5, containerSize.height), + ); }); } diff --git a/examples/api/test/widgets/basic/clip_rrect.0_test.dart b/examples/api/test/widgets/basic/clip_rrect.0_test.dart index 4ce58ec2a6d..384ea3c1396 100644 --- a/examples/api/test/widgets/basic/clip_rrect.0_test.dart +++ b/examples/api/test/widgets/basic/clip_rrect.0_test.dart @@ -7,7 +7,9 @@ import 'package:flutter_api_samples/widgets/basic/clip_rrect.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('ClipRRect adds rounded corners to containers', (WidgetTester tester) async { + testWidgets('ClipRRect adds rounded corners to containers', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ClipRRectApp()); final Finder clipRRectFinder = find.byType(ClipRRect); diff --git a/examples/api/test/widgets/basic/custom_multi_child_layout.0_test.dart b/examples/api/test/widgets/basic/custom_multi_child_layout.0_test.dart index a3f57099e25..44c70f5266a 100644 --- a/examples/api/test/widgets/basic/custom_multi_child_layout.0_test.dart +++ b/examples/api/test/widgets/basic/custom_multi_child_layout.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/basic/custom_multi_child_layout.0.dart' as example; +import 'package:flutter_api_samples/widgets/basic/custom_multi_child_layout.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -15,7 +16,9 @@ void main() { testWidgets('containers are the same size', (WidgetTester tester) async { await tester.pumpWidget( - const MaterialApp(home: Scaffold(body: example.CustomMultiChildLayoutExample())), + const MaterialApp( + home: Scaffold(body: example.CustomMultiChildLayoutExample()), + ), ); final Finder containerFinder = find.byType(Container); const Size expectedSize = Size(100, 100); @@ -27,7 +30,9 @@ void main() { testWidgets('containers are offset', (WidgetTester tester) async { await tester.pumpWidget( - const MaterialApp(home: Scaffold(body: example.CustomMultiChildLayoutExample())), + const MaterialApp( + home: Scaffold(body: example.CustomMultiChildLayoutExample()), + ), ); final Finder containerFinder = find.byType(Container); Rect previousRect = tester.getRect(containerFinder.first); diff --git a/examples/api/test/widgets/basic/flow.0_test.dart b/examples/api/test/widgets/basic/flow.0_test.dart index 31bdfd9fcab..45e36e255af 100644 --- a/examples/api/test/widgets/basic/flow.0_test.dart +++ b/examples/api/test/widgets/basic/flow.0_test.dart @@ -7,7 +7,9 @@ import 'package:flutter_api_samples/widgets/basic/flow.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Clicking on the menu icon opens the Flow menu', (WidgetTester tester) async { + testWidgets('Clicking on the menu icon opens the Flow menu', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.FlowApp()); // The menu icon is in the top left corner of the screen. diff --git a/examples/api/test/widgets/basic/fractionally_sized_box.0_test.dart b/examples/api/test/widgets/basic/fractionally_sized_box.0_test.dart index 8517d73f8ed..5f5f90de2c6 100644 --- a/examples/api/test/widgets/basic/fractionally_sized_box.0_test.dart +++ b/examples/api/test/widgets/basic/fractionally_sized_box.0_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/basic/fractionally_sized_box.0.dart' as example; +import 'package:flutter_api_samples/widgets/basic/fractionally_sized_box.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('FractionallySizedBox sizes DecoratedBox', (WidgetTester tester) async { + testWidgets('FractionallySizedBox sizes DecoratedBox', ( + WidgetTester tester, + ) async { const double appBarHeight = 56.0; const double widthFactor = 0.5; const double heightFactor = 0.5; diff --git a/examples/api/test/widgets/basic/ignore_pointer.0_test.dart b/examples/api/test/widgets/basic/ignore_pointer.0_test.dart index 436d80c0e3e..5761163db1a 100644 --- a/examples/api/test/widgets/basic/ignore_pointer.0_test.dart +++ b/examples/api/test/widgets/basic/ignore_pointer.0_test.dart @@ -5,11 +5,14 @@ import 'package:flutter/foundation.dart' show kIsWeb; import 'package:flutter/gestures.dart'; import 'package:flutter/rendering.dart'; -import 'package:flutter_api_samples/widgets/basic/ignore_pointer.0.dart' as example; +import 'package:flutter_api_samples/widgets/basic/ignore_pointer.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('IgnorePointer ignores pointer on the ElevatedButton', (WidgetTester tester) async { + testWidgets('IgnorePointer ignores pointer on the ElevatedButton', ( + WidgetTester tester, + ) async { const String clickButtonText = 'Click me!'; await tester.pumpWidget(const example.IgnorePointerApp()); @@ -21,7 +24,9 @@ void main() { kind: PointerDeviceKind.mouse, pointer: 1, ); - await gesture.addPointer(location: tester.getCenter(find.text(clickButtonText))); + await gesture.addPointer( + location: tester.getCenter(find.text(clickButtonText)), + ); // On hovering the ElevatedButton, the cursor should be SystemMouseCursors.click. expect( RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), diff --git a/examples/api/test/widgets/basic/indexed_stack.0_test.dart b/examples/api/test/widgets/basic/indexed_stack.0_test.dart index 6aa76dd484d..8622840593f 100644 --- a/examples/api/test/widgets/basic/indexed_stack.0_test.dart +++ b/examples/api/test/widgets/basic/indexed_stack.0_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/basic/indexed_stack.0.dart' as example; +import 'package:flutter_api_samples/widgets/basic/indexed_stack.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('has correct forward rendering mechanism', (WidgetTester tester) async { + testWidgets('has correct forward rendering mechanism', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.IndexedStackApp()); final Finder gesture2 = find.byKey(const Key('gesture2')); @@ -39,7 +42,9 @@ void main() { expect(containerFinder1.renderObject!.debugNeedsPaint, false); expect(containerFinder2.renderObject!.debugNeedsPaint, false); }); - testWidgets('has correct backward rendering mechanism', (WidgetTester tester) async { + testWidgets('has correct backward rendering mechanism', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.IndexedStackApp()); final Finder gesture1 = find.byKey(const Key('gesture1')); @@ -68,21 +73,32 @@ void main() { expect(containerFinder1.renderObject!.debugNeedsPaint, false); expect(containerFinder2.renderObject!.debugNeedsPaint, false); }); - testWidgets('has correct element addition handling', (WidgetTester tester) async { + testWidgets('has correct element addition handling', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.IndexedStackApp()); expect(find.byType(example.PersonTracker), findsOneWidget); - expect(find.byType(example.PersonTracker, skipOffstage: false), findsNWidgets(3)); + expect( + find.byType(example.PersonTracker, skipOffstage: false), + findsNWidgets(3), + ); final Finder textField = find.byType(TextField); await tester.enterText(textField, 'hello'); await tester.testTextInput.receiveAction(TextInputAction.done); await tester.pump(); - expect(find.byType(example.PersonTracker, skipOffstage: false), findsNWidgets(4)); + expect( + find.byType(example.PersonTracker, skipOffstage: false), + findsNWidgets(4), + ); await tester.enterText(textField, 'hello1'); await tester.testTextInput.receiveAction(TextInputAction.done); await tester.pump(); - expect(find.byType(example.PersonTracker, skipOffstage: false), findsNWidgets(5)); + expect( + find.byType(example.PersonTracker, skipOffstage: false), + findsNWidgets(5), + ); }); testWidgets('has state preservation', (WidgetTester tester) async { await tester.pumpWidget(const example.IndexedStackApp()); @@ -92,7 +108,10 @@ void main() { final Finder containerFinder = find.byKey(const Key('Dash')); final Finder incrementFinder = find.byKey(const Key('incrementDash')); Finder counterFinder(int score) { - return find.descendant(of: containerFinder, matching: find.text('Score: $score')); + return find.descendant( + of: containerFinder, + matching: find.text('Score: $score'), + ); } expect(counterFinder(0), findsOneWidget); diff --git a/examples/api/test/widgets/basic/listener.0_test.dart b/examples/api/test/widgets/basic/listener.0_test.dart index f27ebc56b05..f52155ddaaa 100644 --- a/examples/api/test/widgets/basic/listener.0_test.dart +++ b/examples/api/test/widgets/basic/listener.0_test.dart @@ -8,13 +8,17 @@ import 'package:flutter_api_samples/widgets/basic/listener.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Listener detects press & release, and cursor location', (WidgetTester tester) async { + testWidgets('Listener detects press & release, and cursor location', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const MaterialApp(home: example.ListenerExample())); expect(find.text('0 presses\n0 releases'), findsOneWidget); expect(find.text('The cursor is here: (0.00, 0.00)'), findsOneWidget); - final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); + final TestGesture gesture = await tester.createGesture( + kind: PointerDeviceKind.mouse, + ); await gesture.addPointer(); await gesture.down( tester.getCenter( diff --git a/examples/api/test/widgets/basic/mouse_region.0_test.dart b/examples/api/test/widgets/basic/mouse_region.0_test.dart index 4c2db4daa3d..ef14b5d6dd0 100644 --- a/examples/api/test/widgets/basic/mouse_region.0_test.dart +++ b/examples/api/test/widgets/basic/mouse_region.0_test.dart @@ -4,7 +4,8 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/basic/mouse_region.0.dart' as example; +import 'package:flutter_api_samples/widgets/basic/mouse_region.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -16,7 +17,9 @@ void main() { expect(find.text('0 Entries\n0 Exits'), findsOneWidget); expect(find.text('The cursor is here: (0.00, 0.00)'), findsOneWidget); - final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); + final TestGesture gesture = await tester.createGesture( + kind: PointerDeviceKind.mouse, + ); await gesture.addPointer(); await gesture.moveTo( tester.getCenter( diff --git a/examples/api/test/widgets/basic/mouse_region.on_exit.0_test.dart b/examples/api/test/widgets/basic/mouse_region.on_exit.0_test.dart index 4bd8ac74724..b37ffa38e31 100644 --- a/examples/api/test/widgets/basic/mouse_region.on_exit.0_test.dart +++ b/examples/api/test/widgets/basic/mouse_region.on_exit.0_test.dart @@ -4,7 +4,8 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/basic/mouse_region.on_exit.0.dart' as example; +import 'package:flutter_api_samples/widgets/basic/mouse_region.on_exit.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -14,7 +15,9 @@ void main() { Container container = tester.widget(find.byType(Container)); expect(container.decoration, const BoxDecoration(color: Colors.blue)); - final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); + final TestGesture gesture = await tester.createGesture( + kind: PointerDeviceKind.mouse, + ); await gesture.addPointer(); await gesture.moveTo(tester.getCenter(find.byType(Container))); await tester.pump(); diff --git a/examples/api/test/widgets/basic/mouse_region.on_exit.1_test.dart b/examples/api/test/widgets/basic/mouse_region.on_exit.1_test.dart index 07bb23d1a71..65440dadd5c 100644 --- a/examples/api/test/widgets/basic/mouse_region.on_exit.1_test.dart +++ b/examples/api/test/widgets/basic/mouse_region.on_exit.1_test.dart @@ -4,16 +4,21 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/basic/mouse_region.on_exit.1.dart' as example; +import 'package:flutter_api_samples/widgets/basic/mouse_region.on_exit.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('MouseRegion update mouse hover with a delay', (WidgetTester tester) async { + testWidgets('MouseRegion update mouse hover with a delay', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.MouseRegionApp()); expect(find.text('Not hovering'), findsOneWidget); - final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); + final TestGesture gesture = await tester.createGesture( + kind: PointerDeviceKind.mouse, + ); await gesture.addPointer(); await gesture.moveTo(tester.getCenter(find.byType(Container))); await tester.pump(); diff --git a/examples/api/test/widgets/basic/offstage.0_test.dart b/examples/api/test/widgets/basic/offstage.0_test.dart index e43c4603ad9..1e0df497cad 100644 --- a/examples/api/test/widgets/basic/offstage.0_test.dart +++ b/examples/api/test/widgets/basic/offstage.0_test.dart @@ -6,7 +6,9 @@ import 'package:flutter_api_samples/widgets/basic/offstage.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Can off/on stage Flutter logo widget', (WidgetTester tester) async { + testWidgets('Can off/on stage Flutter logo widget', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.OffstageApp()); // The Flutter logo is off stage and not visible. @@ -16,7 +18,10 @@ void main() { await tester.tap(find.text('Get Flutter Logo size')); await tester.pumpAndSettle(); - expect(find.text('Flutter Logo size is Size(150.0, 150.0)'), findsOneWidget); + expect( + find.text('Flutter Logo size is Size(150.0, 150.0)'), + findsOneWidget, + ); // Tap to toggle the offstage value. await tester.tap(find.text('Toggle Offstage Value')); diff --git a/examples/api/test/widgets/basic/overflowbox.0_test.dart b/examples/api/test/widgets/basic/overflowbox.0_test.dart index 51ad7935e1e..ac56aa2657d 100644 --- a/examples/api/test/widgets/basic/overflowbox.0_test.dart +++ b/examples/api/test/widgets/basic/overflowbox.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/basic/overflowbox.0.dart' as example; +import 'package:flutter_api_samples/widgets/basic/overflowbox.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -25,7 +26,10 @@ void main() { expect(overflowBox.maxHeight, maxSize.height); // The child widget overflows the parent container. - expect(tester.getSize(find.byType(FlutterLogo)), greaterThan(containerSize)); + expect( + tester.getSize(find.byType(FlutterLogo)), + greaterThan(containerSize), + ); expect(tester.getSize(find.byType(FlutterLogo)), maxSize); }); } diff --git a/examples/api/test/widgets/basic/physical_shape.0_test.dart b/examples/api/test/widgets/basic/physical_shape.0_test.dart index 80ab92dafdf..30490243a9f 100644 --- a/examples/api/test/widgets/basic/physical_shape.0_test.dart +++ b/examples/api/test/widgets/basic/physical_shape.0_test.dart @@ -3,15 +3,21 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/basic/physical_shape.0.dart' as example; +import 'package:flutter_api_samples/widgets/basic/physical_shape.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('PhysicalShape is an ancestor of the text widget', (WidgetTester tester) async { + testWidgets('PhysicalShape is an ancestor of the text widget', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.PhysicalShapeApp()); final PhysicalShape physicalShape = tester.widget( - find.ancestor(of: find.text('Hello, World!'), matching: find.byType(PhysicalShape)), + find.ancestor( + of: find.text('Hello, World!'), + matching: find.byType(PhysicalShape), + ), ); expect(physicalShape.clipper, isNotNull); expect(physicalShape.color, Colors.orange); diff --git a/examples/api/test/widgets/binding/widget_binding_observer.0_test.dart b/examples/api/test/widgets/binding/widget_binding_observer.0_test.dart index 3f5f3aa7a22..08e2e71bde5 100644 --- a/examples/api/test/widgets/binding/widget_binding_observer.0_test.dart +++ b/examples/api/test/widgets/binding/widget_binding_observer.0_test.dart @@ -4,13 +4,16 @@ import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; -import 'package:flutter_api_samples/widgets/binding/widget_binding_observer.0.dart' as example; +import 'package:flutter_api_samples/widgets/binding/widget_binding_observer.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('App tracks lifecycle states', (WidgetTester tester) async { Future setAppLifeCycleState(AppLifecycleState state) async { - final ByteData? message = const StringCodec().encodeMessage(state.toString()); + final ByteData? message = const StringCodec().encodeMessage( + state.toString(), + ); await tester.binding.defaultBinaryMessenger.handlePlatformMessage( 'flutter/lifecycle', message, @@ -20,7 +23,10 @@ void main() { await tester.pumpWidget(const example.WidgetBindingObserverExampleApp()); - expect(find.text('There are no AppLifecycleStates to show.'), findsOneWidget); + expect( + find.text('There are no AppLifecycleStates to show.'), + findsOneWidget, + ); await setAppLifeCycleState(AppLifecycleState.resumed); await tester.pumpAndSettle(); diff --git a/examples/api/test/widgets/color_filter/color_filtered.0_test.dart b/examples/api/test/widgets/color_filter/color_filtered.0_test.dart index e485b9431f0..dff954dccdd 100644 --- a/examples/api/test/widgets/color_filter/color_filtered.0_test.dart +++ b/examples/api/test/widgets/color_filter/color_filtered.0_test.dart @@ -6,7 +6,8 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; -import 'package:flutter_api_samples/widgets/color_filter/color_filtered.0.dart' as example; +import 'package:flutter_api_samples/widgets/color_filter/color_filtered.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -16,7 +17,9 @@ void main() { HttpOverrides.global = null; }); - testWidgets('Color filters are applied to the images', (WidgetTester tester) async { + testWidgets('Color filters are applied to the images', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ColorFilteredExampleApp()); await tester.pumpAndSettle(); @@ -24,8 +27,11 @@ void main() { // Verify that two images are displayed. expect(find.byType(Image), findsNWidgets(2)); - RenderObject renderObject = tester.firstRenderObject(find.byType(ColorFiltered).first); - ColorFilterLayer colorFilterLayer = renderObject.debugLayer! as ColorFilterLayer; + RenderObject renderObject = tester.firstRenderObject( + find.byType(ColorFiltered).first, + ); + ColorFilterLayer colorFilterLayer = + renderObject.debugLayer! as ColorFilterLayer; // Verify that red colored filter with modulate blend mode is applied to the first image. expect( diff --git a/examples/api/test/widgets/dismissible/dismissible.0_test.dart b/examples/api/test/widgets/dismissible/dismissible.0_test.dart index 9aec90aab78..74dd78e1ff8 100644 --- a/examples/api/test/widgets/dismissible/dismissible.0_test.dart +++ b/examples/api/test/widgets/dismissible/dismissible.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/dismissible/dismissible.0.dart' as example; +import 'package:flutter_api_samples/widgets/dismissible/dismissible.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -24,7 +25,9 @@ void main() { await tester.drag(finder, offset); } - testWidgets('ListTiles can be dismissed from right to left', (WidgetTester tester) async { + testWidgets('ListTiles can be dismissed from right to left', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.DismissibleExampleApp()); for (final int index in [0, 33, 66, 99]) { @@ -46,7 +49,9 @@ void main() { } }); - testWidgets('ListTiles can be dismissed from left to right', (WidgetTester tester) async { + testWidgets('ListTiles can be dismissed from left to right', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.DismissibleExampleApp()); for (final int index in [0, 33, 66, 99]) { diff --git a/examples/api/test/widgets/drag_target/draggable.0_test.dart b/examples/api/test/widgets/drag_target/draggable.0_test.dart index d61e24789f8..54679a03ccf 100644 --- a/examples/api/test/widgets/drag_target/draggable.0_test.dart +++ b/examples/api/test/widgets/drag_target/draggable.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/drag_target/draggable.0.dart' as example; +import 'package:flutter_api_samples/widgets/drag_target/draggable.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -22,12 +23,18 @@ void main() { expect(find.text('Draggable Sample'), findsOneWidget); expect( - findContainerWith(color: Colors.lightGreenAccent, child: find.text('Draggable')), + findContainerWith( + color: Colors.lightGreenAccent, + child: find.text('Draggable'), + ), findsOneWidget, ); expect( - findContainerWith(color: Colors.cyan, child: find.text('Value is updated to: 0')), + findContainerWith( + color: Colors.cyan, + child: find.text('Value is updated to: 0'), + ), findsOneWidget, ); }); @@ -54,7 +61,9 @@ void main() { expect(draggingContainer, findsNothing); expect(feedbackContainer, findsNothing); - final TestGesture gesture = await tester.startGesture(tester.getCenter(idleContainer)); + final TestGesture gesture = await tester.startGesture( + tester.getCenter(idleContainer), + ); await tester.pump(); expect(idleContainer, findsNothing); @@ -87,7 +96,9 @@ void main() { int counter = 0; for (int i = 0; i < 5; i++) { - final TestGesture gesture = await tester.startGesture(tester.getCenter(draggable)); + final TestGesture gesture = await tester.startGesture( + tester.getCenter(draggable), + ); await gesture.moveTo(tester.getCenter(target)); await gesture.up(); await tester.pump(); @@ -95,7 +106,10 @@ void main() { counter += 10; expect( - findContainerWith(color: Colors.cyan, child: find.text('Value is updated to: $counter')), + findContainerWith( + color: Colors.cyan, + child: find.text('Value is updated to: $counter'), + ), findsOneWidget, ); } diff --git a/examples/api/test/widgets/draggable_scrollable_sheet/draggable_scrollable_sheet.0_test.dart b/examples/api/test/widgets/draggable_scrollable_sheet/draggable_scrollable_sheet.0_test.dart index 3a0eabf0e86..17861ed949c 100644 --- a/examples/api/test/widgets/draggable_scrollable_sheet/draggable_scrollable_sheet.0_test.dart +++ b/examples/api/test/widgets/draggable_scrollable_sheet/draggable_scrollable_sheet.0_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/widgets/draggable_scrollable_sheet/draggable import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Test DraggableScrollableSheet initial state', (WidgetTester tester) async { + testWidgets('Test DraggableScrollableSheet initial state', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.DraggableScrollableSheetExampleApp()); final Finder sheetFinder = find.byType(DraggableScrollableSheet); @@ -24,7 +26,9 @@ void main() { testWidgets( 'Test DraggableScrollableSheet drag behavior on mobile platforms', (WidgetTester tester) async { - await tester.pumpWidget(const example.DraggableScrollableSheetExampleApp()); + await tester.pumpWidget( + const example.DraggableScrollableSheetExampleApp(), + ); // Verify that ListView is visible final Finder listViewFinder = find.byType(ListView); @@ -39,7 +43,10 @@ void main() { // Verify that the ListView is expanded final Size listViewCurrentSize = tester.getSize(listViewFinder); - expect(listViewCurrentSize.height, greaterThan(listViewInitialSize.height)); + expect( + listViewCurrentSize.height, + greaterThan(listViewInitialSize.height), + ); }, variant: TargetPlatformVariant.mobile(), ); @@ -47,7 +54,9 @@ void main() { testWidgets( 'Test DraggableScrollableSheet drag behavior on desktop platforms', (WidgetTester tester) async { - await tester.pumpWidget(const example.DraggableScrollableSheetExampleApp()); + await tester.pumpWidget( + const example.DraggableScrollableSheetExampleApp(), + ); // Verify that Grabber is visible final Finder grabberFinder = find.byType(example.Grabber); diff --git a/examples/api/test/widgets/editable_text/editable_text.on_changed.0_test.dart b/examples/api/test/widgets/editable_text/editable_text.on_changed.0_test.dart index 42587d1af2b..a01b589dfe2 100644 --- a/examples/api/test/widgets/editable_text/editable_text.on_changed.0_test.dart +++ b/examples/api/test/widgets/editable_text/editable_text.on_changed.0_test.dart @@ -8,14 +8,21 @@ import 'package:flutter_api_samples/widgets/editable_text/editable_text.on_chang import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Verify correct labels are displayed', (WidgetTester tester) async { + testWidgets('Verify correct labels are displayed', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.OnChangedExampleApp()); - expect(find.text('What number comes next in the sequence?'), findsOneWidget); + expect( + find.text('What number comes next in the sequence?'), + findsOneWidget, + ); expect(find.text('1, 1, 2, 3, 5, 8...?'), findsOneWidget); }); - testWidgets('Does not show dialog when answer is not correct', (WidgetTester tester) async { + testWidgets('Does not show dialog when answer is not correct', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.OnChangedExampleApp()); await tester.enterText(find.byType(TextField), '33'); @@ -24,7 +31,9 @@ void main() { expect(find.byType(AlertDialog), findsNothing); }); - testWidgets('Shows dialog when answer is correct', (WidgetTester tester) async { + testWidgets('Shows dialog when answer is correct', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.OnChangedExampleApp()); await tester.enterText(find.byType(TextField), '13'); @@ -44,7 +53,9 @@ void main() { expect(find.byType(AlertDialog), findsOneWidget); - await tester.tap(find.ancestor(of: find.text('OK'), matching: find.byType(TextButton))); + await tester.tap( + find.ancestor(of: find.text('OK'), matching: find.byType(TextButton)), + ); await tester.pumpAndSettle(); expect(find.byType(AlertDialog), findsNothing); diff --git a/examples/api/test/widgets/editable_text/editable_text.on_content_inserted.0_test.dart b/examples/api/test/widgets/editable_text/editable_text.on_content_inserted.0_test.dart index db987d54d9d..c07461af847 100644 --- a/examples/api/test/widgets/editable_text/editable_text.on_content_inserted.0_test.dart +++ b/examples/api/test/widgets/editable_text/editable_text.on_content_inserted.0_test.dart @@ -11,7 +11,9 @@ import 'package:flutter_api_samples/widgets/editable_text/editable_text.on_conte import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Image.memory displays inserted content', (WidgetTester tester) async { + testWidgets('Image.memory displays inserted content', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.KeyboardInsertedContentApp()); expect(find.text('Keyboard Inserted Content Sample'), findsOneWidget); @@ -20,7 +22,8 @@ void main() { await tester.enterText(find.byType(EditableText), 'test'); await tester.idle(); - const String uri = 'content://com.google.android.inputmethod.latin.fileprovider/test.png'; + const String uri = + 'content://com.google.android.inputmethod.latin.fileprovider/test.png'; const List kBlueSquarePng = [ 0x89, 0x50, @@ -152,14 +155,18 @@ void main() { 0x60, 0x82, ]; - final ByteData? messageBytes = const JSONMessageCodec().encodeMessage({ - 'args': [ - -1, - 'TextInputAction.commitContent', - jsonDecode('{"mimeType": "image/png", "data": $kBlueSquarePng, "uri": "$uri"}'), - ], - 'method': 'TextInputClient.performAction', - }); + final ByteData? messageBytes = const JSONMessageCodec().encodeMessage( + { + 'args': [ + -1, + 'TextInputAction.commitContent', + jsonDecode( + '{"mimeType": "image/png", "data": $kBlueSquarePng, "uri": "$uri"}', + ), + ], + 'method': 'TextInputClient.performAction', + }, + ); try { await tester.binding.defaultBinaryMessenger.handlePlatformMessage( diff --git a/examples/api/test/widgets/editable_text/text_editing_controller.0_test.dart b/examples/api/test/widgets/editable_text/text_editing_controller.0_test.dart index 3eee9e6519b..5e12772a535 100644 --- a/examples/api/test/widgets/editable_text/text_editing_controller.0_test.dart +++ b/examples/api/test/widgets/editable_text/text_editing_controller.0_test.dart @@ -23,7 +23,9 @@ void main() { expect(controller.text, input.toLowerCase()); }); - testWidgets('Keeps the caret at the end of the input', (WidgetTester tester) async { + testWidgets('Keeps the caret at the end of the input', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.TextEditingControllerExampleApp()); const String input = 'flutter'; @@ -37,12 +39,17 @@ void main() { final TextEditingController controller = textField.controller!; // Verify that the caret positioned at the end of the input. - expect(controller.selection, const TextSelection.collapsed(offset: input.length)); + expect( + controller.selection, + const TextSelection.collapsed(offset: input.length), + ); final RenderBox box = tester.renderObject(find.byType(TextFormField)); // Calculate the center-left point of the field. - final Offset centerLeftPoint = box.localToGlobal(Offset(0, box.size.height / 2)); + final Offset centerLeftPoint = box.localToGlobal( + Offset(0, box.size.height / 2), + ); // Tap on the center-left point of the field to try to change the caret // position. @@ -50,6 +57,9 @@ void main() { await tester.pump(); // Verify that the caret position remains unchanged. - expect(controller.selection, const TextSelection.collapsed(offset: input.length)); + expect( + controller.selection, + const TextSelection.collapsed(offset: input.length), + ); }); } diff --git a/examples/api/test/widgets/editable_text/text_editing_controller.1_test.dart b/examples/api/test/widgets/editable_text/text_editing_controller.1_test.dart index e45791b0f37..300d2e05047 100644 --- a/examples/api/test/widgets/editable_text/text_editing_controller.1_test.dart +++ b/examples/api/test/widgets/editable_text/text_editing_controller.1_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/widgets/editable_text/text_editing_controlle import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Initial selection is collapsed at offset 0', (WidgetTester tester) async { + testWidgets('Initial selection is collapsed at offset 0', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.TextEditingControllerExampleApp()); final EditableText editableText = tester.widget(find.byType(EditableText)); diff --git a/examples/api/test/widgets/focus_manager/focus_node.0_test.dart b/examples/api/test/widgets/focus_manager/focus_node.0_test.dart index 47c0b9d7ce6..44bf7b87779 100644 --- a/examples/api/test/widgets/focus_manager/focus_node.0_test.dart +++ b/examples/api/test/widgets/focus_manager/focus_node.0_test.dart @@ -4,7 +4,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_api_samples/widgets/focus_manager/focus_node.0.dart' as example; +import 'package:flutter_api_samples/widgets/focus_manager/focus_node.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -15,7 +16,10 @@ void main() { final Element button = tester.element(find.byType(example.ColorfulButton)); - expect(tester.binding.focusManager.primaryFocus?.context, isNot(equals(button))); + expect( + tester.binding.focusManager.primaryFocus?.context, + isNot(equals(button)), + ); // Tapping on ColorfulButton to focus on FocusNode. await tester.tap(find.byType(example.ColorfulButton)); @@ -27,7 +31,10 @@ void main() { await tester.tap(find.byType(example.ColorfulButton)); await tester.pump(); - expect(tester.binding.focusManager.primaryFocus?.context, isNot(equals(button))); + expect( + tester.binding.focusManager.primaryFocus?.context, + isNot(equals(button)), + ); }); testWidgets('FocusNode updates the text label when focused or unfocused', ( @@ -53,41 +60,42 @@ void main() { expect(find.text("I'm in color! Press R,G,B!"), findsNothing); }); - testWidgets('FocusNode updates color of the Container according to the key events when focused', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.FocusNodeExampleApp()); + testWidgets( + 'FocusNode updates color of the Container according to the key events when focused', + (WidgetTester tester) async { + await tester.pumpWidget(const example.FocusNodeExampleApp()); - // Tapping on ColorfulButton to focus on FocusNode. - await tester.tap(find.byType(example.ColorfulButton)); - await tester.pump(); + // Tapping on ColorfulButton to focus on FocusNode. + await tester.tap(find.byType(example.ColorfulButton)); + await tester.pump(); - final Finder containerFinder = find.descendant( - of: find.byType(example.ColorfulButton), - matching: find.byType(Container), - ); + final Finder containerFinder = find.descendant( + of: find.byType(example.ColorfulButton), + matching: find.byType(Container), + ); - Container container = tester.widget(containerFinder); - expect(container.color, equals(Colors.white)); + Container container = tester.widget(containerFinder); + expect(container.color, equals(Colors.white)); - await tester.sendKeyEvent(LogicalKeyboardKey.keyR); - await tester.pump(); + await tester.sendKeyEvent(LogicalKeyboardKey.keyR); + await tester.pump(); - container = tester.widget(containerFinder); - expect(container.color, equals(Colors.red)); + container = tester.widget(containerFinder); + expect(container.color, equals(Colors.red)); - await tester.sendKeyEvent(LogicalKeyboardKey.keyG); - await tester.pump(); + await tester.sendKeyEvent(LogicalKeyboardKey.keyG); + await tester.pump(); - container = tester.widget(containerFinder); - expect(container.color, equals(Colors.green)); + container = tester.widget(containerFinder); + expect(container.color, equals(Colors.green)); - await tester.sendKeyEvent(LogicalKeyboardKey.keyB); - await tester.pump(); + await tester.sendKeyEvent(LogicalKeyboardKey.keyB); + await tester.pump(); - container = tester.widget(containerFinder); - expect(container.color, equals(Colors.blue)); - }); + container = tester.widget(containerFinder); + expect(container.color, equals(Colors.blue)); + }, + ); testWidgets('FocusNode does not listen to the key events when unfocused', ( WidgetTester tester, diff --git a/examples/api/test/widgets/focus_manager/focus_node.unfocus.0_test.dart b/examples/api/test/widgets/focus_manager/focus_node.unfocus.0_test.dart index 171290fc944..9d62f3c2e17 100644 --- a/examples/api/test/widgets/focus_manager/focus_node.unfocus.0_test.dart +++ b/examples/api/test/widgets/focus_manager/focus_node.unfocus.0_test.dart @@ -4,35 +4,39 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_api_samples/widgets/focus_manager/focus_node.unfocus.0.dart' as example; +import 'package:flutter_api_samples/widgets/focus_manager/focus_node.unfocus.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Unfocusing with UnfocusDisposition.scope gives the focus to the parent scope', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.UnfocusExampleApp()); + testWidgets( + 'Unfocusing with UnfocusDisposition.scope gives the focus to the parent scope', + (WidgetTester tester) async { + await tester.pumpWidget(const example.UnfocusExampleApp()); - // Focuses the first text field. - await tester.tap(find.byType(TextField).first); - await tester.pump(); + // Focuses the first text field. + await tester.tap(find.byType(TextField).first); + await tester.pump(); + + // Changes the focus to the unfocus button. + for (int i = 0; i < 6; i++) { + await tester.sendKeyEvent(LogicalKeyboardKey.tab); + await tester.pump(); + } + + await tester.sendKeyEvent(LogicalKeyboardKey.enter); + await tester.pump(); - // Changes the focus to the unfocus button. - for (int i = 0; i < 6; i++) { await tester.sendKeyEvent(LogicalKeyboardKey.tab); await tester.pump(); - } - await tester.sendKeyEvent(LogicalKeyboardKey.enter); - await tester.pump(); - - await tester.sendKeyEvent(LogicalKeyboardKey.tab); - await tester.pump(); - - // After pressing tab once, the focus is on the first text field. - final EditableText firstEditableText = tester.firstWidget(find.byType(EditableText)); - expect(firstEditableText.focusNode.hasFocus, true); - }); + // After pressing tab once, the focus is on the first text field. + final EditableText firstEditableText = tester.firstWidget( + find.byType(EditableText), + ); + expect(firstEditableText.focusNode.hasFocus, true); + }, + ); testWidgets( 'Unfocusing with UnfocusDisposition.previouslyFocusedChild gives the focus the previously focused child', @@ -65,7 +69,9 @@ void main() { await tester.pump(); } - final EditableText firstEditableText = tester.firstWidget(find.byType(EditableText)); + final EditableText firstEditableText = tester.firstWidget( + find.byType(EditableText), + ); expect(firstEditableText.focusNode.hasFocus, true); }, ); diff --git a/examples/api/test/widgets/focus_scope/focus.0_test.dart b/examples/api/test/widgets/focus_scope/focus.0_test.dart index 05c91cb64f9..5b372fb3d66 100644 --- a/examples/api/test/widgets/focus_scope/focus.0_test.dart +++ b/examples/api/test/widgets/focus_scope/focus.0_test.dart @@ -4,7 +4,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_api_samples/widgets/focus_scope/focus.0.dart' as example; +import 'package:flutter_api_samples/widgets/focus_scope/focus.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -17,7 +18,9 @@ void main() { expect(find.text('Focus Sample'), findsOneWidget); expect(find.byType(Container), findsOneWidget); - final Container container = tester.widget(find.byType(Container)); + final Container container = tester.widget( + find.byType(Container), + ); expect(container.color, Colors.white); }); @@ -31,7 +34,9 @@ void main() { expect(find.text("I'm in color! Press R,G,B!"), findsOneWidget); expect(find.byType(Container), findsOneWidget); - final Container container = tester.widget(find.byType(Container)); + final Container container = tester.widget( + find.byType(Container), + ); expect(container.color, Colors.white); await tester.tap(find.text("I'm in color! Press R,G,B!")); @@ -40,31 +45,51 @@ void main() { expect(find.text("I'm in color! Press R,G,B!"), findsNothing); }); - testWidgets('changes color according to key presses', (WidgetTester tester) async { + testWidgets('changes color according to key presses', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.FocusExampleApp()); expect(find.byType(Container), findsOneWidget); - expect(tester.widget(find.byType(Container)).color, Colors.white); + expect( + tester.widget(find.byType(Container)).color, + Colors.white, + ); await tester.sendKeyEvent(LogicalKeyboardKey.keyR); await tester.pumpAndSettle(); - expect(tester.widget(find.byType(Container)).color, Colors.white); + expect( + tester.widget(find.byType(Container)).color, + Colors.white, + ); await tester.sendKeyEvent(LogicalKeyboardKey.keyG); await tester.pumpAndSettle(); - expect(tester.widget(find.byType(Container)).color, Colors.white); + expect( + tester.widget(find.byType(Container)).color, + Colors.white, + ); await tester.sendKeyEvent(LogicalKeyboardKey.keyB); await tester.pumpAndSettle(); - expect(tester.widget(find.byType(Container)).color, Colors.white); + expect( + tester.widget(find.byType(Container)).color, + Colors.white, + ); expect(find.text('Press to focus'), findsOneWidget); await tester.tap(find.text('Press to focus')); await tester.pumpAndSettle(); expect(find.byType(Container), findsOneWidget); - expect(tester.widget(find.byType(Container)).color, Colors.white); + expect( + tester.widget(find.byType(Container)).color, + Colors.white, + ); await tester.sendKeyEvent(LogicalKeyboardKey.keyR); await tester.pumpAndSettle(); expect(tester.widget(find.byType(Container)).color, Colors.red); await tester.sendKeyEvent(LogicalKeyboardKey.keyG); await tester.pumpAndSettle(); - expect(tester.widget(find.byType(Container)).color, Colors.green); + expect( + tester.widget(find.byType(Container)).color, + Colors.green, + ); await tester.sendKeyEvent(LogicalKeyboardKey.keyB); await tester.pumpAndSettle(); expect(tester.widget(find.byType(Container)).color, Colors.blue); @@ -72,6 +97,9 @@ void main() { expect(find.text("I'm in color! Press R,G,B!"), findsOneWidget); await tester.tap(find.text("I'm in color! Press R,G,B!")); await tester.pumpAndSettle(); - expect(tester.widget(find.byType(Container)).color, Colors.white); + expect( + tester.widget(find.byType(Container)).color, + Colors.white, + ); }); } diff --git a/examples/api/test/widgets/focus_scope/focus.1_test.dart b/examples/api/test/widgets/focus_scope/focus.1_test.dart index 3d5370a3d88..b538f1cfe47 100644 --- a/examples/api/test/widgets/focus_scope/focus.1_test.dart +++ b/examples/api/test/widgets/focus_scope/focus.1_test.dart @@ -4,7 +4,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_api_samples/widgets/focus_scope/focus.1.dart' as example; +import 'package:flutter_api_samples/widgets/focus_scope/focus.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -12,23 +13,32 @@ void main() { WidgetTester tester, ) async { await tester.pumpWidget( - const MaterialApp(home: Scaffold(body: example.FocusableText('Item 0', autofocus: false))), + const MaterialApp( + home: Scaffold(body: example.FocusableText('Item 0', autofocus: false)), + ), ); // Autofocus needs to check that no other node in the [FocusScope] is // focused and can only request focus for the second frame. await tester.pumpAndSettle(); expect( - find.descendant(of: find.byType(example.FocusableText), matching: find.byType(Focus)), + find.descendant( + of: find.byType(example.FocusableText), + matching: find.byType(Focus), + ), findsOneWidget, ); expect(find.text('Item 0'), findsOneWidget); expect(find.byType(Container), findsOneWidget); - final Container container1 = tester.widget(find.byType(Container)); + final Container container1 = tester.widget( + find.byType(Container), + ); expect(container1.color, Colors.white); await tester.pumpWidget( - const MaterialApp(home: Scaffold(body: example.FocusableText('Item 1', autofocus: true))), + const MaterialApp( + home: Scaffold(body: example.FocusableText('Item 1', autofocus: true)), + ), ); await tester.pumpAndSettle(); @@ -38,17 +48,27 @@ void main() { ); expect( tester - .widget(find.descendant(of: focusableTextFinder2, matching: find.byType(Focus))) + .widget( + find.descendant( + of: focusableTextFinder2, + matching: find.byType(Focus), + ), + ) .autofocus, isTrue, ); final Container container2 = tester.widget( - find.descendant(of: focusableTextFinder2, matching: find.byType(Container)), + find.descendant( + of: focusableTextFinder2, + matching: find.byType(Container), + ), ); expect(container2.color, Colors.red); }); - testWidgets('builds list showcasing focus traversal', (WidgetTester tester) async { + testWidgets('builds list showcasing focus traversal', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.FocusExampleApp()); await tester.pumpAndSettle(); diff --git a/examples/api/test/widgets/focus_scope/focus.2_test.dart b/examples/api/test/widgets/focus_scope/focus.2_test.dart index 07313e796ed..8b94cd90992 100644 --- a/examples/api/test/widgets/focus_scope/focus.2_test.dart +++ b/examples/api/test/widgets/focus_scope/focus.2_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/focus_scope/focus.2.dart' as example; +import 'package:flutter_api_samples/widgets/focus_scope/focus.2.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -27,7 +28,10 @@ void main() { for (int i = 0; i <= 10; i += 1) { expect(find.text('CHILD $i'), findsOneWidget); final ActionChip chip = tester.widget( - find.ancestor(of: find.text('CHILD $i'), matching: find.byType(ActionChip)), + find.ancestor( + of: find.text('CHILD $i'), + matching: find.byType(ActionChip), + ), ); expect(chip.focusNode, isNotNull); expect(chip.focusNode!.hasPrimaryFocus, isTrue); diff --git a/examples/api/test/widgets/focus_scope/focus_scope.0_test.dart b/examples/api/test/widgets/focus_scope/focus_scope.0_test.dart index d9624d89b09..80c3f9c2586 100644 --- a/examples/api/test/widgets/focus_scope/focus_scope.0_test.dart +++ b/examples/api/test/widgets/focus_scope/focus_scope.0_test.dart @@ -4,16 +4,21 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_api_samples/widgets/focus_scope/focus_scope.0.dart' as example; +import 'package:flutter_api_samples/widgets/focus_scope/focus_scope.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { bool hasFocus(WidgetTester tester, IconData icon) => tester - .widget(find.ancestor(of: find.byIcon(icon), matching: find.byType(IconButton))) + .widget( + find.ancestor(of: find.byIcon(icon), matching: find.byType(IconButton)), + ) .focusNode! .hasFocus; - testWidgets('The focus is restricted to the foreground', (WidgetTester tester) async { + testWidgets('The focus is restricted to the foreground', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.FocusScopeExampleApp()); expect(find.text('FOREGROUND'), findsOne); diff --git a/examples/api/test/widgets/focus_traversal/focus_traversal_group.0_test.dart b/examples/api/test/widgets/focus_traversal/focus_traversal_group.0_test.dart index 332ad800b48..89d6b2eb48d 100644 --- a/examples/api/test/widgets/focus_traversal/focus_traversal_group.0_test.dart +++ b/examples/api/test/widgets/focus_traversal/focus_traversal_group.0_test.dart @@ -13,34 +13,35 @@ void main() { return Focus.of(tester.element(find.text(text))).hasPrimaryFocus; } - testWidgets('The focus updates should follow the focus traversal groups policy', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.FocusTraversalGroupExampleApp()); + testWidgets( + 'The focus updates should follow the focus traversal groups policy', + (WidgetTester tester) async { + await tester.pumpWidget(const example.FocusTraversalGroupExampleApp()); - // Set the focus to the first button. - Focus.of(tester.element(find.text('num: 0'))).requestFocus(); - await tester.pump(); - - expect(hasFocus(tester, 'num: 0'), isTrue); - - const List focusOrder = [ - 'num: 1', - 'num: 2', - 'String: A', - 'String: B', - 'String: C', - 'ignored num: 3', - 'ignored num: 2', - 'ignored num: 1', - 'num: 0', - ]; - - for (final String text in focusOrder) { - await tester.sendKeyEvent(LogicalKeyboardKey.tab); + // Set the focus to the first button. + Focus.of(tester.element(find.text('num: 0'))).requestFocus(); await tester.pump(); - expect(hasFocus(tester, text), isTrue); - } - }); + expect(hasFocus(tester, 'num: 0'), isTrue); + + const List focusOrder = [ + 'num: 1', + 'num: 2', + 'String: A', + 'String: B', + 'String: C', + 'ignored num: 3', + 'ignored num: 2', + 'ignored num: 1', + 'num: 0', + ]; + + for (final String text in focusOrder) { + await tester.sendKeyEvent(LogicalKeyboardKey.tab); + await tester.pump(); + + expect(hasFocus(tester, text), isTrue); + } + }, + ); } diff --git a/examples/api/test/widgets/focus_traversal/ordered_traversal_policy.0_test.dart b/examples/api/test/widgets/focus_traversal/ordered_traversal_policy.0_test.dart index 09e961bb5cf..75b95a96413 100644 --- a/examples/api/test/widgets/focus_traversal/ordered_traversal_policy.0_test.dart +++ b/examples/api/test/widgets/focus_traversal/ordered_traversal_policy.0_test.dart @@ -13,20 +13,28 @@ void main() { return Focus.of(tester.element(find.text(text))).hasPrimaryFocus; } - testWidgets('The focus updates should follow the focus traversal groups policy', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.OrderedTraversalPolicyExampleApp()); + testWidgets( + 'The focus updates should follow the focus traversal groups policy', + (WidgetTester tester) async { + await tester.pumpWidget(const example.OrderedTraversalPolicyExampleApp()); - expect(hasFocus(tester, 'One'), isTrue); + expect(hasFocus(tester, 'One'), isTrue); - const List focusOrder = ['Two', 'Three', 'Four', 'Five', 'Six', 'One']; + const List focusOrder = [ + 'Two', + 'Three', + 'Four', + 'Five', + 'Six', + 'One', + ]; - for (final String text in focusOrder) { - await tester.sendKeyEvent(LogicalKeyboardKey.tab); - await tester.pump(); + for (final String text in focusOrder) { + await tester.sendKeyEvent(LogicalKeyboardKey.tab); + await tester.pump(); - expect(hasFocus(tester, text), isTrue); - } - }); + expect(hasFocus(tester, text), isTrue); + } + }, + ); } diff --git a/examples/api/test/widgets/framework/build_owner.0_test.dart b/examples/api/test/widgets/framework/build_owner.0_test.dart index 8a254f03964..09d8f002580 100644 --- a/examples/api/test/widgets/framework/build_owner.0_test.dart +++ b/examples/api/test/widgets/framework/build_owner.0_test.dart @@ -3,17 +3,23 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/framework/build_owner.0.dart' as example; +import 'package:flutter_api_samples/widgets/framework/build_owner.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('BuildOwnerExample displays the measured size', (WidgetTester tester) async { + testWidgets('BuildOwnerExample displays the measured size', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.BuildOwnerExample()); expect(find.text('Size(640.0, 480.0)'), findsOne); }); test('The size of the widget is measured', () { - expect(example.measureWidget(const SizedBox(width: 234, height: 567)), const Size(234, 567)); + expect( + example.measureWidget(const SizedBox(width: 234, height: 567)), + const Size(234, 567), + ); }); } diff --git a/examples/api/test/widgets/framework/error_widget.0_test.dart b/examples/api/test/widgets/framework/error_widget.0_test.dart index 0d4ea298d6b..57bc1885699 100644 --- a/examples/api/test/widgets/framework/error_widget.0_test.dart +++ b/examples/api/test/widgets/framework/error_widget.0_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/framework/error_widget.0.dart' as example; +import 'package:flutter_api_samples/widgets/framework/error_widget.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('ErrorWidget is displayed in debug mode', (WidgetTester tester) async { + testWidgets('ErrorWidget is displayed in debug mode', ( + WidgetTester tester, + ) async { final ErrorWidgetBuilder oldBuilder = ErrorWidget.builder; ErrorWidget.builder = (FlutterErrorDetails details) { return ErrorWidget(details.exception); @@ -30,7 +33,9 @@ void main() { ErrorWidget.builder = oldBuilder; }); - testWidgets('ErrorWidget is displayed in release mode', (WidgetTester tester) async { + testWidgets('ErrorWidget is displayed in release mode', ( + WidgetTester tester, + ) async { final ErrorWidgetBuilder oldBuilder = ErrorWidget.builder; ErrorWidget.builder = (FlutterErrorDetails details) { return example.ReleaseModeErrorWidget(details: details); @@ -44,7 +49,9 @@ void main() { expectLater(tester.takeException(), isInstanceOf()); - final Finder errorTextFinder = find.textContaining('Error!\nException: oh no, an error'); + final Finder errorTextFinder = find.textContaining( + 'Error!\nException: oh no, an error', + ); expect(errorTextFinder, findsOneWidget); final Text errorText = tester.firstWidget(errorTextFinder); expect(errorText.style?.color, Colors.yellow); diff --git a/examples/api/test/widgets/gesture_detector/gesture_detector.0_test.dart b/examples/api/test/widgets/gesture_detector/gesture_detector.0_test.dart index 53e69bcb227..655264d4818 100644 --- a/examples/api/test/widgets/gesture_detector/gesture_detector.0_test.dart +++ b/examples/api/test/widgets/gesture_detector/gesture_detector.0_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/gesture_detector/gesture_detector.0.dart' as example; +import 'package:flutter_api_samples/widgets/gesture_detector/gesture_detector.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('GestureDetector updates icon color and text on tap', (WidgetTester tester) async { + testWidgets('GestureDetector updates icon color and text on tap', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.GestureDetectorExampleApp()); Icon icon = tester.widget(find.byIcon(Icons.lightbulb_outline)); diff --git a/examples/api/test/widgets/gesture_detector/gesture_detector.1_test.dart b/examples/api/test/widgets/gesture_detector/gesture_detector.1_test.dart index d4b0d73f05d..d87659ae14f 100644 --- a/examples/api/test/widgets/gesture_detector/gesture_detector.1_test.dart +++ b/examples/api/test/widgets/gesture_detector/gesture_detector.1_test.dart @@ -3,15 +3,21 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/gesture_detector/gesture_detector.1.dart' as example; +import 'package:flutter_api_samples/widgets/gesture_detector/gesture_detector.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('GestureDetector updates Container color on tap', (WidgetTester tester) async { + testWidgets('GestureDetector updates Container color on tap', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.GestureDetectorExampleApp()); Container container = tester.widget( - find.ancestor(of: find.byType(GestureDetector), matching: find.byType(Container)), + find.ancestor( + of: find.byType(GestureDetector), + matching: find.byType(Container), + ), ); expect(container.color, Colors.white); @@ -20,7 +26,10 @@ void main() { await tester.pump(); container = tester.widget( - find.ancestor(of: find.byType(GestureDetector), matching: find.byType(Container)), + find.ancestor( + of: find.byType(GestureDetector), + matching: find.byType(Container), + ), ); expect(container.color, Colors.yellow); @@ -29,7 +38,10 @@ void main() { await tester.pump(); container = tester.widget( - find.ancestor(of: find.byType(GestureDetector), matching: find.byType(Container)), + find.ancestor( + of: find.byType(GestureDetector), + matching: find.byType(Container), + ), ); expect(container.color, Colors.white); diff --git a/examples/api/test/widgets/gesture_detector/gesture_detector.2_test.dart b/examples/api/test/widgets/gesture_detector/gesture_detector.2_test.dart index b00c77b2936..93a47b5891d 100644 --- a/examples/api/test/widgets/gesture_detector/gesture_detector.2_test.dart +++ b/examples/api/test/widgets/gesture_detector/gesture_detector.2_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/gesture_detector/gesture_detector.2.dart' as example; +import 'package:flutter_api_samples/widgets/gesture_detector/gesture_detector.2.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -17,20 +18,31 @@ void main() { final Finder yellowFinder = containerFinder.last; final Container greenContainer = tester.firstWidget(greenFinder); - final BoxDecoration? greenDecoration = greenContainer.decoration as BoxDecoration?; + final BoxDecoration? greenDecoration = + greenContainer.decoration as BoxDecoration?; expect(greenDecoration?.border, expectGreenHasBorder ? isNot(null) : null); - final Container yellowContainer = tester.firstWidget(yellowFinder); - final BoxDecoration? yellowDecoration = yellowContainer.decoration as BoxDecoration?; - expect(yellowDecoration?.border, expectYellowHasBorder ? isNot(null) : null); + final Container yellowContainer = tester.firstWidget( + yellowFinder, + ); + final BoxDecoration? yellowDecoration = + yellowContainer.decoration as BoxDecoration?; + expect( + yellowDecoration?.border, + expectYellowHasBorder ? isNot(null) : null, + ); } - void expectInnerGestureDetectorBehavior(WidgetTester tester, HitTestBehavior behavior) { + void expectInnerGestureDetectorBehavior( + WidgetTester tester, + HitTestBehavior behavior, + ) { // There is a third GestureDetector added by Scaffold. - final Finder innerGestureDetectorFinder = find.byType(GestureDetector).at(1); - final GestureDetector innerGestureDetector = tester.firstWidget( - innerGestureDetectorFinder, - ); + final Finder innerGestureDetectorFinder = find + .byType(GestureDetector) + .at(1); + final GestureDetector innerGestureDetector = tester + .firstWidget(innerGestureDetectorFinder); expect(innerGestureDetector.behavior, behavior); } @@ -43,7 +55,11 @@ void main() { final Offset greenTopLeftCorner = tester.getTopLeft(greenFinder); await tester.tapAt(greenTopLeftCorner); await tester.pumpAndSettle(); - expectBorders(tester, expectGreenHasBorder: true, expectYellowHasBorder: false); + expectBorders( + tester, + expectGreenHasBorder: true, + expectYellowHasBorder: false, + ); // Tap on the button to toggle inner GestureDetector.behavior final Finder toggleBehaviorFinder = find.byType(ElevatedButton).last; @@ -54,7 +70,11 @@ void main() { // Tap again on the green container, expect nothing changed await tester.tapAt(greenTopLeftCorner); await tester.pump(); - expectBorders(tester, expectGreenHasBorder: true, expectYellowHasBorder: false); + expectBorders( + tester, + expectGreenHasBorder: true, + expectYellowHasBorder: false, + ); // Tap on the reset button final Finder resetFinder = find.byType(ElevatedButton).first; @@ -72,7 +92,11 @@ void main() { final Offset yellowTopLeftCorner = tester.getTopLeft(yellowFinder); await tester.tapAt(yellowTopLeftCorner); await tester.pump(); - expectBorders(tester, expectGreenHasBorder: false, expectYellowHasBorder: true); + expectBorders( + tester, + expectGreenHasBorder: false, + expectYellowHasBorder: true, + ); // Tap on the button to toggle inner GestureDetector.behavior final Finder toggleBehaviorFinder = find.byType(ElevatedButton).last; @@ -83,7 +107,11 @@ void main() { // Tap again on the yellow container, expect nothing changed await tester.tapAt(yellowTopLeftCorner); await tester.pump(); - expectBorders(tester, expectGreenHasBorder: false, expectYellowHasBorder: true); + expectBorders( + tester, + expectGreenHasBorder: false, + expectYellowHasBorder: true, + ); // Tap on the reset button final Finder resetFinder = find.byType(ElevatedButton).first; diff --git a/examples/api/test/widgets/gesture_detector/gesture_detector.3_test.dart b/examples/api/test/widgets/gesture_detector/gesture_detector.3_test.dart index accbbc871a7..6c1eec1b13e 100644 --- a/examples/api/test/widgets/gesture_detector/gesture_detector.3_test.dart +++ b/examples/api/test/widgets/gesture_detector/gesture_detector.3_test.dart @@ -4,19 +4,27 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/gesture_detector/gesture_detector.3.dart' as example; +import 'package:flutter_api_samples/widgets/gesture_detector/gesture_detector.3.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('The red box always moves inside the green box', (WidgetTester tester) async { + testWidgets('The red box always moves inside the green box', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.DragBoundaryExampleApp()); final Finder greenFinder = find.byType(Container).first; final Finder redFinder = find.byType(Container).last; - final TestGesture drag = await tester.startGesture(tester.getCenter(redFinder)); + final TestGesture drag = await tester.startGesture( + tester.getCenter(redFinder), + ); await tester.pump(kLongPressTimeout); await drag.moveBy(const Offset(1000, 1000)); await tester.pumpAndSettle(); - expect(tester.getBottomRight(redFinder), tester.getBottomRight(greenFinder)); + expect( + tester.getBottomRight(redFinder), + tester.getBottomRight(greenFinder), + ); await drag.moveBy(const Offset(-2000, -2000)); await tester.pumpAndSettle(); expect(tester.getTopLeft(redFinder), tester.getTopLeft(greenFinder)); diff --git a/examples/api/test/widgets/hardware_keyboard/key_event_manager.0_test.dart b/examples/api/test/widgets/hardware_keyboard/key_event_manager.0_test.dart index b5ccd089d34..de6606f495c 100644 --- a/examples/api/test/widgets/hardware_keyboard/key_event_manager.0_test.dart +++ b/examples/api/test/widgets/hardware_keyboard/key_event_manager.0_test.dart @@ -4,7 +4,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_api_samples/widgets/hardware_keyboard/key_event_manager.0.dart' as example; +import 'package:flutter_api_samples/widgets/hardware_keyboard/key_event_manager.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/widgets/heroes/hero.0_test.dart b/examples/api/test/widgets/heroes/hero.0_test.dart index 702b1607c2b..992b261bfd5 100644 --- a/examples/api/test/widgets/heroes/hero.0_test.dart +++ b/examples/api/test/widgets/heroes/hero.0_test.dart @@ -9,7 +9,9 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('Has Hero animation', (WidgetTester tester) async { final TransitionDurationObserver observer = TransitionDurationObserver(); - await tester.pumpWidget(example.HeroApp(navigatorObservers: [observer])); + await tester.pumpWidget( + example.HeroApp(navigatorObservers: [observer]), + ); expect(find.text('Hero Sample'), findsOneWidget); await tester.tap(find.byType(Container)); diff --git a/examples/api/test/widgets/heroes/hero.1_test.dart b/examples/api/test/widgets/heroes/hero.1_test.dart index 9d671a1c029..61cdfed3476 100644 --- a/examples/api/test/widgets/heroes/hero.1_test.dart +++ b/examples/api/test/widgets/heroes/hero.1_test.dart @@ -7,9 +7,13 @@ import 'package:flutter_api_samples/widgets/heroes/hero.1.dart' as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Hero flight animation with default rect tween', (WidgetTester tester) async { + testWidgets('Hero flight animation with default rect tween', ( + WidgetTester tester, + ) async { final TransitionDurationObserver observer = TransitionDurationObserver(); - await tester.pumpWidget(example.HeroApp(navigatorObservers: [observer])); + await tester.pumpWidget( + example.HeroApp(navigatorObservers: [observer]), + ); expect(find.text('Hero Sample'), findsOneWidget); await tester.tap(find.byType(ElevatedButton)); @@ -69,9 +73,13 @@ void main() { expect(heroSize, const Size(50.0, 50.0)); }); - testWidgets('Hero flight animation with custom rect tween', (WidgetTester tester) async { + testWidgets('Hero flight animation with custom rect tween', ( + WidgetTester tester, + ) async { final TransitionDurationObserver observer = TransitionDurationObserver(); - await tester.pumpWidget(example.HeroApp(navigatorObservers: [observer])); + await tester.pumpWidget( + example.HeroApp(navigatorObservers: [observer]), + ); expect(find.text('Hero Sample'), findsOneWidget); await tester.tap(find.byType(ElevatedButton)); diff --git a/examples/api/test/widgets/image/image.error_builder.0_test.dart b/examples/api/test/widgets/image/image.error_builder.0_test.dart index 18ddb0832d7..4378c6f82f5 100644 --- a/examples/api/test/widgets/image/image.error_builder.0_test.dart +++ b/examples/api/test/widgets/image/image.error_builder.0_test.dart @@ -5,7 +5,8 @@ import 'dart:io'; import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/image/image.error_builder.0.dart' as example; +import 'package:flutter_api_samples/widgets/image/image.error_builder.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -22,7 +23,10 @@ void main() { final Image image = tester.widget(find.byType(Image)); final NetworkImage imageProvider = image.image as NetworkImage; - expect(imageProvider.url, equals('https://example.does.not.exist/image.jpg')); + expect( + imageProvider.url, + equals('https://example.does.not.exist/image.jpg'), + ); }); testWidgets('errorBuilder returns text', (WidgetTester tester) async { @@ -35,7 +39,11 @@ void main() { expect( errorBuilder(context, const HttpException('oops'), StackTrace.empty), - isA().having((Text text) => text.data, 'data', equals('Image failed to load')), + isA().having( + (Text text) => text.data, + 'data', + equals('Image failed to load'), + ), ); }); } diff --git a/examples/api/test/widgets/image/image.frame_builder.0_test.dart b/examples/api/test/widgets/image/image.frame_builder.0_test.dart index b7fa3d51fd1..c6d79acbcdb 100644 --- a/examples/api/test/widgets/image/image.frame_builder.0_test.dart +++ b/examples/api/test/widgets/image/image.frame_builder.0_test.dart @@ -5,7 +5,8 @@ import 'dart:io'; import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/image/image.frame_builder.0.dart' as example; +import 'package:flutter_api_samples/widgets/image/image.frame_builder.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -15,23 +16,28 @@ void main() { HttpOverrides.global = null; }); - testWidgets('The frame builder returns an AnimatedOpacity when not synchronously loaded', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.FrameBuilderExampleApp()); - await tester.pumpAndSettle(); + testWidgets( + 'The frame builder returns an AnimatedOpacity when not synchronously loaded', + (WidgetTester tester) async { + await tester.pumpWidget(const example.FrameBuilderExampleApp()); + await tester.pumpAndSettle(); - final Image image = tester.widget(find.byType(Image)); - final ImageFrameBuilder frameBuilder = image.frameBuilder!; - final BuildContext context = tester.element(find.byType(Image)); + final Image image = tester.widget(find.byType(Image)); + final ImageFrameBuilder frameBuilder = image.frameBuilder!; + final BuildContext context = tester.element(find.byType(Image)); - const Key key = Key('child'); + const Key key = Key('child'); - expect( - frameBuilder(context, const SizedBox(key: key), null, false), - isA().having((AnimatedOpacity opacity) => opacity.child!.key, 'key', key), - ); - }); + expect( + frameBuilder(context, const SizedBox(key: key), null, false), + isA().having( + (AnimatedOpacity opacity) => opacity.child!.key, + 'key', + key, + ), + ); + }, + ); testWidgets('The frame builder returns the child when synchronously loaded', ( WidgetTester tester, diff --git a/examples/api/test/widgets/image/image.loading_builder.0_test.dart b/examples/api/test/widgets/image/image.loading_builder.0_test.dart index 1841dbe3acf..05cb17f4558 100644 --- a/examples/api/test/widgets/image/image.loading_builder.0_test.dart +++ b/examples/api/test/widgets/image/image.loading_builder.0_test.dart @@ -5,7 +5,8 @@ import 'dart:io'; import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/image/image.loading_builder.0.dart' as example; +import 'package:flutter_api_samples/widgets/image/image.loading_builder.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -15,47 +16,52 @@ void main() { HttpOverrides.global = null; }); - testWidgets('The loading builder returns the child when there is no loading progress', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.LoadingBuilderExampleApp()); - await tester.pumpAndSettle(); + testWidgets( + 'The loading builder returns the child when there is no loading progress', + (WidgetTester tester) async { + await tester.pumpWidget(const example.LoadingBuilderExampleApp()); + await tester.pumpAndSettle(); - final Image image = tester.widget(find.byType(Image)); - final ImageLoadingBuilder loadingBuilder = image.loadingBuilder!; - final BuildContext context = tester.element(find.byType(Image)); + final Image image = tester.widget(find.byType(Image)); + final ImageLoadingBuilder loadingBuilder = image.loadingBuilder!; + final BuildContext context = tester.element(find.byType(Image)); - const SizedBox child = SizedBox(key: Key('child')); + const SizedBox child = SizedBox(key: Key('child')); - await tester.pumpWidget(loadingBuilder(context, child, null)); + await tester.pumpWidget(loadingBuilder(context, child, null)); - expect(find.byWidget(child), findsOne); - expect(find.byType(CircularProgressIndicator), findsNothing); - }); + expect(find.byWidget(child), findsOne); + expect(find.byType(CircularProgressIndicator), findsNothing); + }, + ); - testWidgets('The loading builder returns a circular progress indicator when loading', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.LoadingBuilderExampleApp()); - await tester.pumpAndSettle(); + testWidgets( + 'The loading builder returns a circular progress indicator when loading', + (WidgetTester tester) async { + await tester.pumpWidget(const example.LoadingBuilderExampleApp()); + await tester.pumpAndSettle(); - final Image image = tester.widget(find.byType(Image)); - final ImageLoadingBuilder loadingBuilder = image.loadingBuilder!; - final BuildContext context = tester.element(find.byType(Image)); + final Image image = tester.widget(find.byType(Image)); + final ImageLoadingBuilder loadingBuilder = image.loadingBuilder!; + final BuildContext context = tester.element(find.byType(Image)); - const SizedBox child = SizedBox(key: Key('child')); + const SizedBox child = SizedBox(key: Key('child')); - await tester.pumpWidget( - MaterialApp( - home: loadingBuilder( - context, - child, - const ImageChunkEvent(cumulativeBytesLoaded: 1, expectedTotalBytes: 10), + await tester.pumpWidget( + MaterialApp( + home: loadingBuilder( + context, + child, + const ImageChunkEvent( + cumulativeBytesLoaded: 1, + expectedTotalBytes: 10, + ), + ), ), - ), - ); + ); - expect(find.byWidget(child), findsNothing); - expect(find.byType(CircularProgressIndicator), findsOne); - }); + expect(find.byWidget(child), findsNothing); + expect(find.byType(CircularProgressIndicator), findsOne); + }, + ); } diff --git a/examples/api/test/widgets/implicit_animations/animated_align.0_test.dart b/examples/api/test/widgets/implicit_animations/animated_align.0_test.dart index 923dadb3ae9..58a6c5f80ac 100644 --- a/examples/api/test/widgets/implicit_animations/animated_align.0_test.dart +++ b/examples/api/test/widgets/implicit_animations/animated_align.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/implicit_animations/animated_align.0.dart' as example; +import 'package:flutter_api_samples/widgets/implicit_animations/animated_align.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/widgets/implicit_animations/animated_container.0_test.dart b/examples/api/test/widgets/implicit_animations/animated_container.0_test.dart index 748ff16c2bf..cf9e8294f53 100644 --- a/examples/api/test/widgets/implicit_animations/animated_container.0_test.dart +++ b/examples/api/test/widgets/implicit_animations/animated_container.0_test.dart @@ -12,20 +12,32 @@ void main() { await tester.pumpWidget(const example.AnimatedContainerExampleApp()); Container container = tester.widget( - find.ancestor(of: find.byType(AnimatedContainer), matching: find.byType(Container)), + find.ancestor( + of: find.byType(AnimatedContainer), + matching: find.byType(Container), + ), ); expect((container.decoration! as BoxDecoration).color, equals(Colors.blue)); - expect(container.constraints, equals(const BoxConstraints.tightFor(width: 100, height: 200))); + expect( + container.constraints, + equals(const BoxConstraints.tightFor(width: 100, height: 200)), + ); expect(container.alignment, equals(Alignment.topCenter)); await tester.tap(find.byType(FlutterLogo)); await tester.pump(); container = tester.widget( - find.ancestor(of: find.byType(AnimatedContainer), matching: find.byType(Container)), + find.ancestor( + of: find.byType(AnimatedContainer), + matching: find.byType(Container), + ), ); expect((container.decoration! as BoxDecoration).color, equals(Colors.blue)); - expect(container.constraints, equals(const BoxConstraints.tightFor(width: 100, height: 200))); + expect( + container.constraints, + equals(const BoxConstraints.tightFor(width: 100, height: 200)), + ); expect(container.alignment, equals(Alignment.topCenter)); // Advance animation to the end by the 2-second duration specified in @@ -33,10 +45,16 @@ void main() { await tester.pump(const Duration(seconds: 2)); container = tester.widget( - find.ancestor(of: find.byType(AnimatedContainer), matching: find.byType(Container)), + find.ancestor( + of: find.byType(AnimatedContainer), + matching: find.byType(Container), + ), ); expect((container.decoration! as BoxDecoration).color, equals(Colors.red)); - expect(container.constraints, equals(const BoxConstraints.tightFor(width: 200, height: 100))); + expect( + container.constraints, + equals(const BoxConstraints.tightFor(width: 200, height: 100)), + ); expect(container.alignment, equals(Alignment.center)); }); } diff --git a/examples/api/test/widgets/implicit_animations/animated_fractionally_sized_box.0_test.dart b/examples/api/test/widgets/implicit_animations/animated_fractionally_sized_box.0_test.dart index dee51083f19..93a32317b03 100644 --- a/examples/api/test/widgets/implicit_animations/animated_fractionally_sized_box.0_test.dart +++ b/examples/api/test/widgets/implicit_animations/animated_fractionally_sized_box.0_test.dart @@ -10,8 +10,12 @@ import 'package:flutter_api_samples/widgets/implicit_animations/animated_fractio import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('AnimatedFractionallySizedBox animates on tap', (WidgetTester tester) async { - await tester.pumpWidget(const example.AnimatedFractionallySizedBoxExampleApp()); + testWidgets('AnimatedFractionallySizedBox animates on tap', ( + WidgetTester tester, + ) async { + await tester.pumpWidget( + const example.AnimatedFractionallySizedBoxExampleApp(), + ); final Finder fractionallySizedBoxFinder = find.descendant( of: find.byType(AnimatedFractionallySizedBox), @@ -25,7 +29,9 @@ void main() { const Alignment beginAlignment = Alignment.bottomRight; const Alignment endAlignment = Alignment.topLeft; - FractionallySizedBox fractionallySizedBox = tester.widget(fractionallySizedBoxFinder); + FractionallySizedBox fractionallySizedBox = tester.widget( + fractionallySizedBoxFinder, + ); expect(fractionallySizedBox.widthFactor, beginWidthFactor); expect(fractionallySizedBox.heightFactor, beginHeightFactor); expect(fractionallySizedBox.alignment, beginAlignment); @@ -41,17 +47,31 @@ void main() { expect(fractionallySizedBox.alignment, beginAlignment); // Advance animation to the middle. - await tester.pump(example.AnimatedFractionallySizedBoxExampleApp.duration ~/ 2); + await tester.pump( + example.AnimatedFractionallySizedBoxExampleApp.duration ~/ 2, + ); - final double t = example.AnimatedFractionallySizedBoxExampleApp.curve.transform(0.5); + final double t = example.AnimatedFractionallySizedBoxExampleApp.curve + .transform(0.5); fractionallySizedBox = tester.widget(fractionallySizedBoxFinder); - expect(fractionallySizedBox.widthFactor, lerpDouble(beginWidthFactor, endWidthFactor, t)); - expect(fractionallySizedBox.heightFactor, lerpDouble(beginHeightFactor, endHeightFactor, t)); - expect(fractionallySizedBox.alignment, Alignment.lerp(beginAlignment, endAlignment, t)); + expect( + fractionallySizedBox.widthFactor, + lerpDouble(beginWidthFactor, endWidthFactor, t), + ); + expect( + fractionallySizedBox.heightFactor, + lerpDouble(beginHeightFactor, endHeightFactor, t), + ); + expect( + fractionallySizedBox.alignment, + Alignment.lerp(beginAlignment, endAlignment, t), + ); // Advance animation to the end. - await tester.pump(example.AnimatedFractionallySizedBoxExampleApp.duration ~/ 2); + await tester.pump( + example.AnimatedFractionallySizedBoxExampleApp.duration ~/ 2, + ); fractionallySizedBox = tester.widget(fractionallySizedBoxFinder); expect(fractionallySizedBox.widthFactor, endWidthFactor); @@ -69,15 +89,28 @@ void main() { expect(fractionallySizedBox.alignment, endAlignment); // Advance animation to the middle. - await tester.pump(example.AnimatedFractionallySizedBoxExampleApp.duration ~/ 2); + await tester.pump( + example.AnimatedFractionallySizedBoxExampleApp.duration ~/ 2, + ); fractionallySizedBox = tester.widget(fractionallySizedBoxFinder); - expect(fractionallySizedBox.widthFactor, lerpDouble(endWidthFactor, beginWidthFactor, t)); - expect(fractionallySizedBox.heightFactor, lerpDouble(endHeightFactor, beginHeightFactor, t)); - expect(fractionallySizedBox.alignment, Alignment.lerp(endAlignment, beginAlignment, t)); + expect( + fractionallySizedBox.widthFactor, + lerpDouble(endWidthFactor, beginWidthFactor, t), + ); + expect( + fractionallySizedBox.heightFactor, + lerpDouble(endHeightFactor, beginHeightFactor, t), + ); + expect( + fractionallySizedBox.alignment, + Alignment.lerp(endAlignment, beginAlignment, t), + ); // Advance animation to the end. - await tester.pump(example.AnimatedFractionallySizedBoxExampleApp.duration ~/ 2); + await tester.pump( + example.AnimatedFractionallySizedBoxExampleApp.duration ~/ 2, + ); fractionallySizedBox = tester.widget(fractionallySizedBoxFinder); expect(fractionallySizedBox.widthFactor, beginWidthFactor); diff --git a/examples/api/test/widgets/implicit_animations/animated_padding.0_test.dart b/examples/api/test/widgets/implicit_animations/animated_padding.0_test.dart index e8033d222bf..794629c1953 100644 --- a/examples/api/test/widgets/implicit_animations/animated_padding.0_test.dart +++ b/examples/api/test/widgets/implicit_animations/animated_padding.0_test.dart @@ -3,15 +3,21 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/implicit_animations/animated_padding.0.dart' as example; +import 'package:flutter_api_samples/widgets/implicit_animations/animated_padding.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('AnimatedPadding animates on ElevatedButton tap', (WidgetTester tester) async { + testWidgets('AnimatedPadding animates on ElevatedButton tap', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.AnimatedPaddingExampleApp()); Padding padding = tester.widget( - find.descendant(of: find.byType(AnimatedPadding), matching: find.byType(Padding)), + find.descendant( + of: find.byType(AnimatedPadding), + matching: find.byType(Padding), + ), ); expect(padding.padding, equals(EdgeInsets.zero)); @@ -19,7 +25,10 @@ void main() { await tester.pump(); padding = tester.widget( - find.descendant(of: find.byType(AnimatedPadding), matching: find.byType(Padding)), + find.descendant( + of: find.byType(AnimatedPadding), + matching: find.byType(Padding), + ), ); expect(padding.padding, equals(EdgeInsets.zero)); @@ -28,7 +37,10 @@ void main() { await tester.pump(const Duration(seconds: 2)); padding = tester.widget( - find.descendant(of: find.byType(AnimatedPadding), matching: find.byType(Padding)), + find.descendant( + of: find.byType(AnimatedPadding), + matching: find.byType(Padding), + ), ); expect(padding.padding, equals(const EdgeInsets.all(100.0))); }); diff --git a/examples/api/test/widgets/implicit_animations/animated_positioned.0_test.dart b/examples/api/test/widgets/implicit_animations/animated_positioned.0_test.dart index 479bbe0922e..9c4e3c9f258 100644 --- a/examples/api/test/widgets/implicit_animations/animated_positioned.0_test.dart +++ b/examples/api/test/widgets/implicit_animations/animated_positioned.0_test.dart @@ -10,7 +10,9 @@ import 'package:flutter_api_samples/widgets/implicit_animations/animated_positio import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('AnimatedPositioned animates on tap', (WidgetTester tester) async { + testWidgets('AnimatedPositioned animates on tap', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.AnimatedPositionedExampleApp()); final Finder positionedFinder = find.descendant( diff --git a/examples/api/test/widgets/implicit_animations/animated_slide.0_test.dart b/examples/api/test/widgets/implicit_animations/animated_slide.0_test.dart index d428244485a..536fab53bf3 100644 --- a/examples/api/test/widgets/implicit_animations/animated_slide.0_test.dart +++ b/examples/api/test/widgets/implicit_animations/animated_slide.0_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/implicit_animations/animated_slide.0.dart' as example; +import 'package:flutter_api_samples/widgets/implicit_animations/animated_slide.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Translate FlutterLogo using AnimatedSlide', (WidgetTester tester) async { + testWidgets('Translate FlutterLogo using AnimatedSlide', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.AnimatedSlideApp()); Offset logoOffset = tester.getCenter(find.byType(FlutterLogo)); diff --git a/examples/api/test/widgets/inherited_model/inherited_model.0_test.dart b/examples/api/test/widgets/inherited_model/inherited_model.0_test.dart index 68de66af8a8..d7b3729ec21 100644 --- a/examples/api/test/widgets/inherited_model/inherited_model.0_test.dart +++ b/examples/api/test/widgets/inherited_model/inherited_model.0_test.dart @@ -3,22 +3,29 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/inherited_model/inherited_model.0.dart' as example; +import 'package:flutter_api_samples/widgets/inherited_model/inherited_model.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Rebuild widget using InheritedModel', (WidgetTester tester) async { + testWidgets('Rebuild widget using InheritedModel', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.InheritedModelApp()); BoxDecoration? decoration = - tester.widget(find.byType(AnimatedContainer).first).decoration + tester + .widget(find.byType(AnimatedContainer).first) + .decoration as BoxDecoration?; expect(decoration!.color, Colors.blue); await tester.tap(find.text('Update background')); await tester.pumpAndSettle(); decoration = - tester.widget(find.byType(AnimatedContainer).first).decoration + tester + .widget(find.byType(AnimatedContainer).first) + .decoration as BoxDecoration?; expect(decoration!.color, Colors.red); diff --git a/examples/api/test/widgets/inherited_notifier/inherited_notifier.0_test.dart b/examples/api/test/widgets/inherited_notifier/inherited_notifier.0_test.dart index 50b2f4d1062..02344a0fb9d 100644 --- a/examples/api/test/widgets/inherited_notifier/inherited_notifier.0_test.dart +++ b/examples/api/test/widgets/inherited_notifier/inherited_notifier.0_test.dart @@ -19,7 +19,11 @@ void main() { Matcher transformMatcher(Matrix4 matrix) { return everyElement( - isA().having((Transform widget) => widget.transform, 'transform', matrix), + isA().having( + (Transform widget) => widget.transform, + 'transform', + matrix, + ), ); } diff --git a/examples/api/test/widgets/inherited_theme/inherited_theme.0_test.dart b/examples/api/test/widgets/inherited_theme/inherited_theme.0_test.dart index 8eff3fa3809..077db66385d 100644 --- a/examples/api/test/widgets/inherited_theme/inherited_theme.0_test.dart +++ b/examples/api/test/widgets/inherited_theme/inherited_theme.0_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/inherited_theme/inherited_theme.0.dart' as example; +import 'package:flutter_api_samples/widgets/inherited_theme/inherited_theme.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('StreamBuilder listens to internal stream', (WidgetTester tester) async { + testWidgets('StreamBuilder listens to internal stream', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.InheritedThemeExampleApp()); expect(find.byType(GestureDetector), findsOne); @@ -16,7 +19,10 @@ void main() { final DefaultTextStyle bodyDefaultTextStyle = DefaultTextStyle.of( tester.element(find.text('Tap Here')), ); - expect(bodyDefaultTextStyle.style, const TextStyle(fontSize: 48, color: Colors.blue)); + expect( + bodyDefaultTextStyle.style, + const TextStyle(fontSize: 48, color: Colors.blue), + ); await tester.tap(find.text('Tap Here')); await tester.pumpAndSettle(); @@ -26,6 +32,9 @@ void main() { final DefaultTextStyle routeDefaultTextStyle = DefaultTextStyle.of( tester.element(find.text('Hello World')), ); - expect(routeDefaultTextStyle.style, const TextStyle(fontSize: 48, color: Colors.blue)); + expect( + routeDefaultTextStyle.style, + const TextStyle(fontSize: 48, color: Colors.blue), + ); }); } diff --git a/examples/api/test/widgets/interactive_viewer/interactive_viewer.constrained.0_test.dart b/examples/api/test/widgets/interactive_viewer/interactive_viewer.constrained.0_test.dart index 118c4dc7c05..f43994702d4 100644 --- a/examples/api/test/widgets/interactive_viewer/interactive_viewer.constrained.0_test.dart +++ b/examples/api/test/widgets/interactive_viewer/interactive_viewer.constrained.0_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/widgets/interactive_viewer/interactive_viewe import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('The reset button resets the view with an animation', (WidgetTester tester) async { + testWidgets('The reset button resets the view with an animation', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ConstrainedExampleApp()); expect(find.widgetWithText(AppBar, 'Constrained Sample'), findsOne); diff --git a/examples/api/test/widgets/interactive_viewer/interactive_viewer.transformation_controller.0_test.dart b/examples/api/test/widgets/interactive_viewer/interactive_viewer.transformation_controller.0_test.dart index 6a494c093ae..a951c49e9e2 100644 --- a/examples/api/test/widgets/interactive_viewer/interactive_viewer.transformation_controller.0_test.dart +++ b/examples/api/test/widgets/interactive_viewer/interactive_viewer.transformation_controller.0_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/widgets/interactive_viewer/interactive_viewe import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('The reset button resets the view with an animation', (WidgetTester tester) async { + testWidgets('The reset button resets the view with an animation', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.TransformationControllerExampleApp()); expect(find.widgetWithText(AppBar, 'Controller demo'), findsOne); diff --git a/examples/api/test/widgets/keep_alive/automatic_keep_alive.0_test.dart b/examples/api/test/widgets/keep_alive/automatic_keep_alive.0_test.dart index b7d65adad1a..0f2ecca9650 100644 --- a/examples/api/test/widgets/keep_alive/automatic_keep_alive.0_test.dart +++ b/examples/api/test/widgets/keep_alive/automatic_keep_alive.0_test.dart @@ -7,7 +7,9 @@ import 'package:flutter_api_samples/widgets/keep_alive/automatic_keep_alive.0.da import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('The state is maintained for the even items', (WidgetTester tester) async { + testWidgets('The state is maintained for the even items', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const AutomaticKeepAliveExampleApp()); expect(find.text('Item 0: 0'), findsOne); @@ -30,7 +32,11 @@ void main() { await tester.fling(find.byType(ListView), const Offset(0, 6000), 1000); await tester.pumpAndSettle(); - expect(find.text('Item 0: 1'), findsOne, reason: 'The state of item 0 should be maintained'); + expect( + find.text('Item 0: 1'), + findsOne, + reason: 'The state of item 0 should be maintained', + ); expect( find.text('Item 1: 0'), findsOne, diff --git a/examples/api/test/widgets/keep_alive/automatic_keep_alive_client_mixin.0_test.dart b/examples/api/test/widgets/keep_alive/automatic_keep_alive_client_mixin.0_test.dart index 9aab5086502..47d45322473 100644 --- a/examples/api/test/widgets/keep_alive/automatic_keep_alive_client_mixin.0_test.dart +++ b/examples/api/test/widgets/keep_alive/automatic_keep_alive_client_mixin.0_test.dart @@ -29,38 +29,43 @@ void main() { await tester.fling(find.byType(ListView), const Offset(0, 6000), 1000); await tester.pumpAndSettle(); - expect(find.text('Item 0: 1'), findsOne, reason: 'The state of item 0 should be maintained'); - }); - - testWidgets('The state is not maintained when the item is scrolled out of view', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const AutomaticKeepAliveClientMixinExampleApp()); - - await tester.tap(find.byType(Switch)); - await tester.pumpAndSettle(); - - expect(find.text('Item 0: 0'), findsOne); - - await tester.tap(find.widgetWithIcon(IconButton, Icons.add).first); - await tester.pump(); - - expect(find.text('Item 0: 1'), findsOne); - - // Scrolls all the way down to the bottom of the list. - await tester.fling(find.byType(ListView), const Offset(0, -6000), 1000); - await tester.pumpAndSettle(); - - expect(find.text('Item 99: 0'), findsOne); - - // Scrolls all the way back to the top of the list. - await tester.fling(find.byType(ListView), const Offset(0, 6000), 1000); - await tester.pumpAndSettle(); - expect( - find.text('Item 0: 0'), + find.text('Item 0: 1'), findsOne, - reason: 'The state of item 0 should not be maintained', + reason: 'The state of item 0 should be maintained', ); }); + + testWidgets( + 'The state is not maintained when the item is scrolled out of view', + (WidgetTester tester) async { + await tester.pumpWidget(const AutomaticKeepAliveClientMixinExampleApp()); + + await tester.tap(find.byType(Switch)); + await tester.pumpAndSettle(); + + expect(find.text('Item 0: 0'), findsOne); + + await tester.tap(find.widgetWithIcon(IconButton, Icons.add).first); + await tester.pump(); + + expect(find.text('Item 0: 1'), findsOne); + + // Scrolls all the way down to the bottom of the list. + await tester.fling(find.byType(ListView), const Offset(0, -6000), 1000); + await tester.pumpAndSettle(); + + expect(find.text('Item 99: 0'), findsOne); + + // Scrolls all the way back to the top of the list. + await tester.fling(find.byType(ListView), const Offset(0, 6000), 1000); + await tester.pumpAndSettle(); + + expect( + find.text('Item 0: 0'), + findsOne, + reason: 'The state of item 0 should not be maintained', + ); + }, + ); } diff --git a/examples/api/test/widgets/keep_alive/keep_alive.0_test.dart b/examples/api/test/widgets/keep_alive/keep_alive.0_test.dart index f5fde12e926..a252ec9ddab 100644 --- a/examples/api/test/widgets/keep_alive/keep_alive.0_test.dart +++ b/examples/api/test/widgets/keep_alive/keep_alive.0_test.dart @@ -7,7 +7,9 @@ import 'package:flutter_api_samples/widgets/keep_alive/keep_alive.0.dart'; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('The state is maintained for the even items', (WidgetTester tester) async { + testWidgets('The state is maintained for the even items', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const KeepAliveExampleApp()); expect(find.text('Item 0: 0'), findsOne); @@ -30,7 +32,11 @@ void main() { await tester.fling(find.byType(ListView), const Offset(0, 6000), 1000); await tester.pumpAndSettle(); - expect(find.text('Item 0: 1'), findsOne, reason: 'The state of item 0 should be maintained'); + expect( + find.text('Item 0: 1'), + findsOne, + reason: 'The state of item 0 should be maintained', + ); expect( find.text('Item 1: 0'), findsOne, diff --git a/examples/api/test/widgets/layout_builder/layout_builder.0_test.dart b/examples/api/test/widgets/layout_builder/layout_builder.0_test.dart index 38e737a7447..8f15aa83af7 100644 --- a/examples/api/test/widgets/layout_builder/layout_builder.0_test.dart +++ b/examples/api/test/widgets/layout_builder/layout_builder.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/widgets.dart'; -import 'package:flutter_api_samples/widgets/layout_builder/layout_builder.0.dart' as example; +import 'package:flutter_api_samples/widgets/layout_builder/layout_builder.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/widgets/magnifier/cupertino_magnifier.0_test.dart b/examples/api/test/widgets/magnifier/cupertino_magnifier.0_test.dart index b2c0d439b55..bdeb507360c 100644 --- a/examples/api/test/widgets/magnifier/cupertino_magnifier.0_test.dart +++ b/examples/api/test/widgets/magnifier/cupertino_magnifier.0_test.dart @@ -3,18 +3,23 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter_api_samples/widgets/magnifier/cupertino_magnifier.0.dart' as example; +import 'package:flutter_api_samples/widgets/magnifier/cupertino_magnifier.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('CupertinoMagnifier must be visible', (WidgetTester tester) async { + testWidgets('CupertinoMagnifier must be visible', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.CupertinoMagnifierApp()); final Finder cupertinoMagnifierWidget = find.byType(CupertinoMagnifier); expect(cupertinoMagnifierWidget, findsOneWidget); }); - testWidgets('CupertinoMagnifier is not using the default value', (WidgetTester tester) async { + testWidgets('CupertinoMagnifier is not using the default value', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.CupertinoMagnifierApp()); expect( tester.widget(find.byType(CupertinoMagnifier)), @@ -26,7 +31,9 @@ void main() { ); }); - testWidgets('should update CupertinoMagnifier position on drag', (WidgetTester tester) async { + testWidgets('should update CupertinoMagnifier position on drag', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.CupertinoMagnifierApp()); Matcher isPositionedAt(Offset at) { @@ -40,7 +47,8 @@ void main() { // Make sure magnifier is present. final Finder positionedWidget = find.byType(Positioned); final Widget positionedWidgetInTree = tester.widget(positionedWidget.first); - final Positioned oldConcretePositioned = positionedWidgetInTree as Positioned; + final Positioned oldConcretePositioned = + positionedWidgetInTree as Positioned; final Offset centerOfPositioned = tester.getCenter(positionedWidget.first); // Drag the magnifier and confirm its new position is expected. diff --git a/examples/api/test/widgets/magnifier/cupertino_text_magnifier.0_test.dart b/examples/api/test/widgets/magnifier/cupertino_text_magnifier.0_test.dart index 7d3b2699f7a..57d285ed6f1 100644 --- a/examples/api/test/widgets/magnifier/cupertino_text_magnifier.0_test.dart +++ b/examples/api/test/widgets/magnifier/cupertino_text_magnifier.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter_api_samples/widgets/magnifier/cupertino_text_magnifier.0.dart' as example; +import 'package:flutter_api_samples/widgets/magnifier/cupertino_text_magnifier.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -15,7 +16,9 @@ void main() { final Finder cupertinoTextFieldWidget = find.byType(CupertinoTextField); await tester.longPress(cupertinoTextFieldWidget); - final Finder cupertinoTextMagnifierWidget = find.byType(CupertinoTextMagnifier); + final Finder cupertinoTextMagnifierWidget = find.byType( + CupertinoTextMagnifier, + ); expect(cupertinoTextMagnifierWidget, findsOneWidget); }); } diff --git a/examples/api/test/widgets/magnifier/magnifier.0_test.dart b/examples/api/test/widgets/magnifier/magnifier.0_test.dart index f610426dc5b..8d69c88b4f7 100644 --- a/examples/api/test/widgets/magnifier/magnifier.0_test.dart +++ b/examples/api/test/widgets/magnifier/magnifier.0_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/magnifier/magnifier.0.dart' as example; +import 'package:flutter_api_samples/widgets/magnifier/magnifier.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('should update magnifier position on drag', (WidgetTester tester) async { + testWidgets('should update magnifier position on drag', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.MagnifierExampleApp()); Matcher isPositionedAt(Offset at) { @@ -21,12 +24,15 @@ void main() { // Make sure magnifier is present. final Finder positionedWidget = find.byType(Positioned); final Widget positionedWidgetInTree = tester.widget(positionedWidget); - final Positioned oldConcretePositioned = positionedWidgetInTree as Positioned; + final Positioned oldConcretePositioned = + positionedWidgetInTree as Positioned; expect(positionedWidget, findsOneWidget); // Confirm if magnifier is in the center of the FlutterLogo. final Offset centerOfPositioned = tester.getCenter(positionedWidget); - final Offset centerOfFlutterLogo = tester.getCenter(find.byType(FlutterLogo)); + final Offset centerOfFlutterLogo = tester.getCenter( + find.byType(FlutterLogo), + ); expect(centerOfPositioned, equals(centerOfFlutterLogo)); // Drag the magnifier and confirm its new position is expected. @@ -49,6 +55,9 @@ void main() { await tester.dragFrom(centerOfPositioned, dragDistance); await tester.pump(); - await expectLater(find.byType(RepaintBoundary).last, matchesGoldenFile('magnifier.0_test.png')); + await expectLater( + find.byType(RepaintBoundary).last, + matchesGoldenFile('magnifier.0_test.png'), + ); }); } diff --git a/examples/api/test/widgets/media_query/media_query_data.system_gesture_insets.0_test.dart b/examples/api/test/widgets/media_query/media_query_data.system_gesture_insets.0_test.dart index e00e7643893..9108bcf5622 100644 --- a/examples/api/test/widgets/media_query/media_query_data.system_gesture_insets.0_test.dart +++ b/examples/api/test/widgets/media_query/media_query_data.system_gesture_insets.0_test.dart @@ -11,13 +11,22 @@ void main() { testWidgets('The slider should be padded with the system gesture insets', ( WidgetTester tester, ) async { - tester.view.systemGestureInsets = const FakeViewPadding(left: 60, right: 60); + tester.view.systemGestureInsets = const FakeViewPadding( + left: 60, + right: 60, + ); await tester.pumpWidget(const example.SystemGestureInsetsExampleApp()); - expect(find.widgetWithText(AppBar, 'Pad Slider to avoid systemGestureInsets'), findsOne); + expect( + find.widgetWithText(AppBar, 'Pad Slider to avoid systemGestureInsets'), + findsOne, + ); final Rect rect = tester.getRect(find.byType(Slider)); - expect(rect, rectMoreOrLessEquals(const Rect.fromLTRB(20.0, 56.0, 780.0, 600.0))); + expect( + rect, + rectMoreOrLessEquals(const Rect.fromLTRB(20.0, 56.0, 780.0, 600.0)), + ); }); } diff --git a/examples/api/test/widgets/navigator/navigator.0_test.dart b/examples/api/test/widgets/navigator/navigator.0_test.dart index 6f3ef17f8cf..a251e5d8795 100644 --- a/examples/api/test/widgets/navigator/navigator.0_test.dart +++ b/examples/api/test/widgets/navigator/navigator.0_test.dart @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:flutter_api_samples/widgets/navigator/navigator.0.dart' as example; +import 'package:flutter_api_samples/widgets/navigator/navigator.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -12,22 +13,23 @@ void main() { expect(find.text('Home Page'), findsOne); }); - testWidgets('It should start from the sign up page and follow the flow to reach the home page', ( - WidgetTester tester, - ) async { - tester.platformDispatcher.defaultRouteNameTestValue = '/signup'; - await tester.pumpWidget(const example.NavigatorExampleApp()); + testWidgets( + 'It should start from the sign up page and follow the flow to reach the home page', + (WidgetTester tester) async { + tester.platformDispatcher.defaultRouteNameTestValue = '/signup'; + await tester.pumpWidget(const example.NavigatorExampleApp()); - expect(find.text('Collect Personal Info Page'), findsOne); + expect(find.text('Collect Personal Info Page'), findsOne); - await tester.tap(find.text('Collect Personal Info Page')); - await tester.pumpAndSettle(); + await tester.tap(find.text('Collect Personal Info Page')); + await tester.pumpAndSettle(); - expect(find.text('Choose Credentials Page'), findsOne); + expect(find.text('Choose Credentials Page'), findsOne); - await tester.tap(find.text('Choose Credentials Page')); - await tester.pumpAndSettle(); + await tester.tap(find.text('Choose Credentials Page')); + await tester.pumpAndSettle(); - expect(find.text('Home Page'), findsOne); - }); + expect(find.text('Home Page'), findsOne); + }, + ); } diff --git a/examples/api/test/widgets/navigator/navigator.restorable_push.0_test.dart b/examples/api/test/widgets/navigator/navigator.restorable_push.0_test.dart index 0dd225e5523..c0ff0fdea48 100644 --- a/examples/api/test/widgets/navigator/navigator.restorable_push.0_test.dart +++ b/examples/api/test/widgets/navigator/navigator.restorable_push.0_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/navigator/navigator.restorable_push.0.dart' as example; +import 'package:flutter_api_samples/widgets/navigator/navigator.restorable_push.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('It pushes a restorable route and pops it', (WidgetTester tester) async { + testWidgets('It pushes a restorable route and pops it', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.RestorablePushExampleApp()); expect(find.widgetWithText(AppBar, 'Sample Code'), findsOne); @@ -22,7 +25,9 @@ void main() { expect(find.byType(BackButton), findsNothing); }); - testWidgets('It pushes a restorable route and restores it', (WidgetTester tester) async { + testWidgets('It pushes a restorable route and restores it', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.RestorablePushExampleApp()); expect(find.widgetWithText(AppBar, 'Sample Code'), findsOne); diff --git a/examples/api/test/widgets/navigator/navigator.restorable_push_and_remove_until.0_test.dart b/examples/api/test/widgets/navigator/navigator.restorable_push_and_remove_until.0_test.dart index 0646113c063..8c65a5d24b5 100644 --- a/examples/api/test/widgets/navigator/navigator.restorable_push_and_remove_until.0_test.dart +++ b/examples/api/test/widgets/navigator/navigator.restorable_push_and_remove_until.0_test.dart @@ -8,8 +8,12 @@ import 'package:flutter_api_samples/widgets/navigator/navigator.restorable_push_ import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('It pushes a restorable route and pops it', (WidgetTester tester) async { - await tester.pumpWidget(const example.RestorablePushAndRemoveUntilExampleApp()); + testWidgets('It pushes a restorable route and pops it', ( + WidgetTester tester, + ) async { + await tester.pumpWidget( + const example.RestorablePushAndRemoveUntilExampleApp(), + ); expect(find.widgetWithText(AppBar, 'Sample Code'), findsOne); expect(find.byType(BackButton), findsNothing); @@ -23,8 +27,12 @@ void main() { expect(find.byType(BackButton), findsNothing); }); - testWidgets('It pushes a restorable route and restores it', (WidgetTester tester) async { - await tester.pumpWidget(const example.RestorablePushAndRemoveUntilExampleApp()); + testWidgets('It pushes a restorable route and restores it', ( + WidgetTester tester, + ) async { + await tester.pumpWidget( + const example.RestorablePushAndRemoveUntilExampleApp(), + ); expect(find.widgetWithText(AppBar, 'Sample Code'), findsOne); expect(find.byType(BackButton), findsNothing); diff --git a/examples/api/test/widgets/navigator/navigator.restorable_push_replacement.0_test.dart b/examples/api/test/widgets/navigator/navigator.restorable_push_replacement.0_test.dart index 7b4814479c7..2afda40ea34 100644 --- a/examples/api/test/widgets/navigator/navigator.restorable_push_replacement.0_test.dart +++ b/examples/api/test/widgets/navigator/navigator.restorable_push_replacement.0_test.dart @@ -8,8 +8,12 @@ import 'package:flutter_api_samples/widgets/navigator/navigator.restorable_push_ import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('It pushes a restorable route and restores it', (WidgetTester tester) async { - await tester.pumpWidget(const example.RestorablePushReplacementExampleApp()); + testWidgets('It pushes a restorable route and restores it', ( + WidgetTester tester, + ) async { + await tester.pumpWidget( + const example.RestorablePushReplacementExampleApp(), + ); expect(find.widgetWithText(AppBar, 'Sample Code'), findsOne); expect(find.text('This is the initial route.'), findsOne); diff --git a/examples/api/test/widgets/navigator/navigator_state.restorable_push.0_test.dart b/examples/api/test/widgets/navigator/navigator_state.restorable_push.0_test.dart index 988e33e5b25..15ccc82dc2a 100644 --- a/examples/api/test/widgets/navigator/navigator_state.restorable_push.0_test.dart +++ b/examples/api/test/widgets/navigator/navigator_state.restorable_push.0_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/widgets/navigator/navigator_state.restorable import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('It pushes a restorable route and pops it', (WidgetTester tester) async { + testWidgets('It pushes a restorable route and pops it', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.RestorablePushExampleApp()); expect(find.widgetWithText(AppBar, 'Sample Code'), findsOne); @@ -23,7 +25,9 @@ void main() { expect(find.byType(BackButton), findsNothing); }); - testWidgets('It pushes a restorable route and restores it', (WidgetTester tester) async { + testWidgets('It pushes a restorable route and restores it', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.RestorablePushExampleApp()); expect(find.widgetWithText(AppBar, 'Sample Code'), findsOne); diff --git a/examples/api/test/widgets/navigator/navigator_state.restorable_push_and_remove_until.0_test.dart b/examples/api/test/widgets/navigator/navigator_state.restorable_push_and_remove_until.0_test.dart index 4feec668cdd..01ed8f84f93 100644 --- a/examples/api/test/widgets/navigator/navigator_state.restorable_push_and_remove_until.0_test.dart +++ b/examples/api/test/widgets/navigator/navigator_state.restorable_push_and_remove_until.0_test.dart @@ -8,8 +8,12 @@ import 'package:flutter_api_samples/widgets/navigator/navigator_state.restorable import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('It pushes a restorable route and pops it', (WidgetTester tester) async { - await tester.pumpWidget(const example.RestorablePushAndRemoveUntilExampleApp()); + testWidgets('It pushes a restorable route and pops it', ( + WidgetTester tester, + ) async { + await tester.pumpWidget( + const example.RestorablePushAndRemoveUntilExampleApp(), + ); expect(find.widgetWithText(AppBar, 'Sample Code'), findsOne); expect(find.byType(BackButton), findsNothing); @@ -23,8 +27,12 @@ void main() { expect(find.byType(BackButton), findsNothing); }); - testWidgets('It pushes a restorable route and restores it', (WidgetTester tester) async { - await tester.pumpWidget(const example.RestorablePushAndRemoveUntilExampleApp()); + testWidgets('It pushes a restorable route and restores it', ( + WidgetTester tester, + ) async { + await tester.pumpWidget( + const example.RestorablePushAndRemoveUntilExampleApp(), + ); expect(find.widgetWithText(AppBar, 'Sample Code'), findsOne); expect(find.byType(BackButton), findsNothing); diff --git a/examples/api/test/widgets/navigator/navigator_state.restorable_push_replacement.0_test.dart b/examples/api/test/widgets/navigator/navigator_state.restorable_push_replacement.0_test.dart index c2aeebf6a1b..73cd11c16a2 100644 --- a/examples/api/test/widgets/navigator/navigator_state.restorable_push_replacement.0_test.dart +++ b/examples/api/test/widgets/navigator/navigator_state.restorable_push_replacement.0_test.dart @@ -8,8 +8,12 @@ import 'package:flutter_api_samples/widgets/navigator/navigator_state.restorable import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('It pushes a restorable route and restores it', (WidgetTester tester) async { - await tester.pumpWidget(const example.RestorablePushReplacementExampleApp()); + testWidgets('It pushes a restorable route and restores it', ( + WidgetTester tester, + ) async { + await tester.pumpWidget( + const example.RestorablePushReplacementExampleApp(), + ); expect(find.widgetWithText(AppBar, 'Sample Code'), findsOne); expect(find.text('This is the initial route.'), findsOne); diff --git a/examples/api/test/widgets/navigator/restorable_route_future.0_test.dart b/examples/api/test/widgets/navigator/restorable_route_future.0_test.dart index 8771537366b..dd8118e04f5 100644 --- a/examples/api/test/widgets/navigator/restorable_route_future.0_test.dart +++ b/examples/api/test/widgets/navigator/restorable_route_future.0_test.dart @@ -3,14 +3,20 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/navigator/restorable_route_future.0.dart' as example; +import 'package:flutter_api_samples/widgets/navigator/restorable_route_future.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('It pushes a restorable route and pops it', (WidgetTester tester) async { + testWidgets('It pushes a restorable route and pops it', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.RestorableRouteFutureExampleApp()); - expect(find.widgetWithText(AppBar, 'RestorableRouteFuture Example'), findsOne); + expect( + find.widgetWithText(AppBar, 'RestorableRouteFuture Example'), + findsOne, + ); expect(find.byType(BackButton), findsNothing); expect(find.text('Last count: 0'), findsOne); @@ -29,14 +35,22 @@ void main() { await tester.tap(find.byType(BackButton)); await tester.pumpAndSettle(); - expect(find.widgetWithText(AppBar, 'RestorableRouteFuture Example'), findsOne); + expect( + find.widgetWithText(AppBar, 'RestorableRouteFuture Example'), + findsOne, + ); expect(find.text('Last count: 1'), findsOne); }); - testWidgets('It pushes a restorable route and restores it', (WidgetTester tester) async { + testWidgets('It pushes a restorable route and restores it', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.RestorableRouteFutureExampleApp()); - expect(find.widgetWithText(AppBar, 'RestorableRouteFuture Example'), findsOne); + expect( + find.widgetWithText(AppBar, 'RestorableRouteFuture Example'), + findsOne, + ); expect(find.byType(BackButton), findsNothing); expect(find.text('Last count: 0'), findsOne); @@ -64,7 +78,10 @@ void main() { expect(find.byType(BackButton), findsNothing); - expect(find.widgetWithText(AppBar, 'RestorableRouteFuture Example'), findsOne); + expect( + find.widgetWithText(AppBar, 'RestorableRouteFuture Example'), + findsOne, + ); expect(find.text('Last count: 1'), findsOne); await tester.restoreFrom(data); diff --git a/examples/api/test/widgets/navigator_pop_handler/navigator_pop_handler.0_test.dart b/examples/api/test/widgets/navigator_pop_handler/navigator_pop_handler.0_test.dart index 0c8a9125341..c5a52bb25d8 100644 --- a/examples/api/test/widgets/navigator_pop_handler/navigator_pop_handler.0_test.dart +++ b/examples/api/test/widgets/navigator_pop_handler/navigator_pop_handler.0_test.dart @@ -16,31 +16,34 @@ void main() { bool? lastFrameworkHandlesBack; setUp(() async { lastFrameworkHandlesBack = null; - TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler( - SystemChannels.platform, - (MethodCall methodCall) async { - if (methodCall.method == 'SystemNavigator.setFrameworkHandlesBack') { - expect(methodCall.arguments, isA()); - lastFrameworkHandlesBack = methodCall.arguments as bool; - } - return; - }, - ); - await TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.handlePlatformMessage( - 'flutter/lifecycle', - const StringCodec().encodeMessage(AppLifecycleState.resumed.toString()), - (ByteData? data) {}, - ); + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger + .setMockMethodCallHandler(SystemChannels.platform, ( + MethodCall methodCall, + ) async { + if (methodCall.method == 'SystemNavigator.setFrameworkHandlesBack') { + expect(methodCall.arguments, isA()); + lastFrameworkHandlesBack = methodCall.arguments as bool; + } + return; + }); + await TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger + .handlePlatformMessage( + 'flutter/lifecycle', + const StringCodec().encodeMessage( + AppLifecycleState.resumed.toString(), + ), + (ByteData? data) {}, + ); }); tearDown(() { - TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler( - SystemChannels.platform, - null, - ); + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger + .setMockMethodCallHandler(SystemChannels.platform, null); }); - testWidgets('Can go back with system back gesture', (WidgetTester tester) async { + testWidgets('Can go back with system back gesture', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.NavigatorPopHandlerApp()); expect(find.text('Nested Navigators Example'), findsOneWidget); @@ -91,7 +94,9 @@ void main() { } }); - testWidgets('restoring the app preserves the navigation stack', (WidgetTester tester) async { + testWidgets('restoring the app preserves the navigation stack', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.NavigatorPopHandlerApp()); expect(find.text('Nested Navigators Example'), findsOneWidget); diff --git a/examples/api/test/widgets/navigator_pop_handler/navigator_pop_handler.1_test.dart b/examples/api/test/widgets/navigator_pop_handler/navigator_pop_handler.1_test.dart index 2a5bdb75d8d..bb0fa73410a 100644 --- a/examples/api/test/widgets/navigator_pop_handler/navigator_pop_handler.1_test.dart +++ b/examples/api/test/widgets/navigator_pop_handler/navigator_pop_handler.1_test.dart @@ -16,36 +16,102 @@ void main() { bool? lastFrameworkHandlesBack; setUp(() async { lastFrameworkHandlesBack = null; - TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler( - SystemChannels.platform, - (MethodCall methodCall) async { - if (methodCall.method == 'SystemNavigator.setFrameworkHandlesBack') { - expect(methodCall.arguments, isA()); - lastFrameworkHandlesBack = methodCall.arguments as bool; - } - return; - }, - ); - await TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.handlePlatformMessage( - 'flutter/lifecycle', - const StringCodec().encodeMessage(AppLifecycleState.resumed.toString()), - (ByteData? data) {}, - ); + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger + .setMockMethodCallHandler(SystemChannels.platform, ( + MethodCall methodCall, + ) async { + if (methodCall.method == 'SystemNavigator.setFrameworkHandlesBack') { + expect(methodCall.arguments, isA()); + lastFrameworkHandlesBack = methodCall.arguments as bool; + } + return; + }); + await TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger + .handlePlatformMessage( + 'flutter/lifecycle', + const StringCodec().encodeMessage( + AppLifecycleState.resumed.toString(), + ), + (ByteData? data) {}, + ); }); tearDown(() { - TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler( - SystemChannels.platform, - null, - ); + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger + .setMockMethodCallHandler(SystemChannels.platform, null); }); - testWidgets("System back gesture operates on current tab's nested Navigator", ( + testWidgets( + "System back gesture operates on current tab's nested Navigator", + (WidgetTester tester) async { + await tester.pumpWidget(const example.NavigatorPopHandlerApp()); + + expect( + find.text('Bottom nav - tab Home Tab - route _TabPage.home'), + findsOneWidget, + ); + if (!kIsWeb && defaultTargetPlatform == TargetPlatform.android) { + expect(lastFrameworkHandlesBack, isFalse); + } + + // Go to the next route in this tab. + await tester.tap( + find.text('Go to another route in this nested Navigator'), + ); + await tester.pumpAndSettle(); + expect( + find.text('Bottom nav - tab Home Tab - route _TabPage.one'), + findsOneWidget, + ); + if (!kIsWeb && defaultTargetPlatform == TargetPlatform.android) { + expect(lastFrameworkHandlesBack, isTrue); + } + + // Go to another tab. + await tester.tap(find.text('Go to One')); + await tester.pumpAndSettle(); + expect( + find.text('Bottom nav - tab Tab One - route _TabPage.home'), + findsOneWidget, + ); + if (!kIsWeb && defaultTargetPlatform == TargetPlatform.android) { + expect(lastFrameworkHandlesBack, isFalse); + } + + // Return to the home tab. The navigation state is preserved. + await tester.tap(find.text('Go to Home')); + await tester.pumpAndSettle(); + expect( + find.text('Bottom nav - tab Home Tab - route _TabPage.one'), + findsOneWidget, + ); + if (!kIsWeb && defaultTargetPlatform == TargetPlatform.android) { + expect(lastFrameworkHandlesBack, isTrue); + } + + // A back pops the navigation stack of the current tab's nested Navigator. + await simulateSystemBack(); + await tester.pumpAndSettle(); + expect( + find.text('Bottom nav - tab Home Tab - route _TabPage.home'), + findsOneWidget, + ); + + if (!kIsWeb && defaultTargetPlatform == TargetPlatform.android) { + expect(lastFrameworkHandlesBack, isFalse); + } + }, + ); + + testWidgets('restoring the app preserves the navigation stack', ( WidgetTester tester, ) async { await tester.pumpWidget(const example.NavigatorPopHandlerApp()); - expect(find.text('Bottom nav - tab Home Tab - route _TabPage.home'), findsOneWidget); + expect( + find.text('Bottom nav - tab Home Tab - route _TabPage.home'), + findsOneWidget, + ); if (!kIsWeb && defaultTargetPlatform == TargetPlatform.android) { expect(lastFrameworkHandlesBack, isFalse); } @@ -53,7 +119,10 @@ void main() { // Go to the next route in this tab. await tester.tap(find.text('Go to another route in this nested Navigator')); await tester.pumpAndSettle(); - expect(find.text('Bottom nav - tab Home Tab - route _TabPage.one'), findsOneWidget); + expect( + find.text('Bottom nav - tab Home Tab - route _TabPage.one'), + findsOneWidget, + ); if (!kIsWeb && defaultTargetPlatform == TargetPlatform.android) { expect(lastFrameworkHandlesBack, isTrue); } @@ -61,56 +130,20 @@ void main() { // Go to another tab. await tester.tap(find.text('Go to One')); await tester.pumpAndSettle(); - expect(find.text('Bottom nav - tab Tab One - route _TabPage.home'), findsOneWidget); - if (!kIsWeb && defaultTargetPlatform == TargetPlatform.android) { - expect(lastFrameworkHandlesBack, isFalse); - } - - // Return to the home tab. The navigation state is preserved. - await tester.tap(find.text('Go to Home')); - await tester.pumpAndSettle(); - expect(find.text('Bottom nav - tab Home Tab - route _TabPage.one'), findsOneWidget); - if (!kIsWeb && defaultTargetPlatform == TargetPlatform.android) { - expect(lastFrameworkHandlesBack, isTrue); - } - - // A back pops the navigation stack of the current tab's nested Navigator. - await simulateSystemBack(); - await tester.pumpAndSettle(); - expect(find.text('Bottom nav - tab Home Tab - route _TabPage.home'), findsOneWidget); - - if (!kIsWeb && defaultTargetPlatform == TargetPlatform.android) { - expect(lastFrameworkHandlesBack, isFalse); - } - }); - - testWidgets('restoring the app preserves the navigation stack', (WidgetTester tester) async { - await tester.pumpWidget(const example.NavigatorPopHandlerApp()); - - expect(find.text('Bottom nav - tab Home Tab - route _TabPage.home'), findsOneWidget); - if (!kIsWeb && defaultTargetPlatform == TargetPlatform.android) { - expect(lastFrameworkHandlesBack, isFalse); - } - - // Go to the next route in this tab. - await tester.tap(find.text('Go to another route in this nested Navigator')); - await tester.pumpAndSettle(); - expect(find.text('Bottom nav - tab Home Tab - route _TabPage.one'), findsOneWidget); - if (!kIsWeb && defaultTargetPlatform == TargetPlatform.android) { - expect(lastFrameworkHandlesBack, isTrue); - } - - // Go to another tab. - await tester.tap(find.text('Go to One')); - await tester.pumpAndSettle(); - expect(find.text('Bottom nav - tab Tab One - route _TabPage.home'), findsOneWidget); + expect( + find.text('Bottom nav - tab Tab One - route _TabPage.home'), + findsOneWidget, + ); if (!kIsWeb && defaultTargetPlatform == TargetPlatform.android) { expect(lastFrameworkHandlesBack, isFalse); } await tester.restartAndRestore(); - expect(find.text('Bottom nav - tab Tab One - route _TabPage.home'), findsOneWidget); + expect( + find.text('Bottom nav - tab Tab One - route _TabPage.home'), + findsOneWidget, + ); if (!kIsWeb && defaultTargetPlatform == TargetPlatform.android) { expect(lastFrameworkHandlesBack, isFalse); } @@ -118,7 +151,10 @@ void main() { // Return to the home tab. The navigation state is preserved. await tester.tap(find.text('Go to Home')); await tester.pumpAndSettle(); - expect(find.text('Bottom nav - tab Home Tab - route _TabPage.one'), findsOneWidget); + expect( + find.text('Bottom nav - tab Home Tab - route _TabPage.one'), + findsOneWidget, + ); if (!kIsWeb && defaultTargetPlatform == TargetPlatform.android) { expect(lastFrameworkHandlesBack, isTrue); } @@ -126,7 +162,10 @@ void main() { // A back pops the navigation stack of the current tab's nested Navigator. await simulateSystemBack(); await tester.pumpAndSettle(); - expect(find.text('Bottom nav - tab Home Tab - route _TabPage.home'), findsOneWidget); + expect( + find.text('Bottom nav - tab Home Tab - route _TabPage.home'), + findsOneWidget, + ); if (!kIsWeb && defaultTargetPlatform == TargetPlatform.android) { expect(lastFrameworkHandlesBack, isFalse); } diff --git a/examples/api/test/widgets/navigator_utils.dart b/examples/api/test/widgets/navigator_utils.dart index a6f0a646b74..58b2ccf6220 100644 --- a/examples/api/test/widgets/navigator_utils.dart +++ b/examples/api/test/widgets/navigator_utils.dart @@ -10,9 +10,12 @@ import 'package:flutter_test/flutter_test.dart'; /// Sends the same platform channel message that the engine sends when it /// receives a system back. Future simulateSystemBack() { - return TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.handlePlatformMessage( - 'flutter/navigation', - const JSONMessageCodec().encodeMessage({'method': 'popRoute'}), - (ByteData? _) {}, - ); + return TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger + .handlePlatformMessage( + 'flutter/navigation', + const JSONMessageCodec().encodeMessage({ + 'method': 'popRoute', + }), + (ByteData? _) {}, + ); } diff --git a/examples/api/test/widgets/nested_scroll_view/nested_scroll_view.0_test.dart b/examples/api/test/widgets/nested_scroll_view/nested_scroll_view.0_test.dart index f27c0d472d0..7768df8a978 100644 --- a/examples/api/test/widgets/nested_scroll_view/nested_scroll_view.0_test.dart +++ b/examples/api/test/widgets/nested_scroll_view/nested_scroll_view.0_test.dart @@ -21,22 +21,33 @@ void main() { expect(find.text('Item 0'), findsOneWidget); expect(find.text('Item 14'), findsNothing); expect(find.text('Item 14', skipOffstage: false), findsOneWidget); - expect(find.textContaining(RegExp(r'Item \d\d?'), skipOffstage: false), findsAtLeast(15)); + expect( + find.textContaining(RegExp(r'Item \d\d?'), skipOffstage: false), + findsAtLeast(15), + ); await tester.tap(find.text('Tab 2')); await tester.pumpAndSettle(); - expect(find.textContaining(RegExp(r'Item \d\d?'), skipOffstage: false), findsAtLeast(15)); + expect( + find.textContaining(RegExp(r'Item \d\d?'), skipOffstage: false), + findsAtLeast(15), + ); }); testWidgets('Shrinks app bar on scroll', (WidgetTester tester) async { await tester.pumpWidget(const example.NestedScrollViewExampleApp()); - final double initialAppBarHeight = tester.getTopLeft(find.byType(TabBarView)).dy; + final double initialAppBarHeight = tester + .getTopLeft(find.byType(TabBarView)) + .dy; expect(find.text('Item 1'), findsOneWidget); await tester.ensureVisible(find.text('Item 14', skipOffstage: false)); await tester.pump(); expect(find.text('Item 1'), findsNothing); - expect(tester.getTopLeft(find.byType(TabBarView)).dy, lessThan(initialAppBarHeight)); + expect( + tester.getTopLeft(find.byType(TabBarView)).dy, + lessThan(initialAppBarHeight), + ); }); } diff --git a/examples/api/test/widgets/nested_scroll_view/nested_scroll_view.1_test.dart b/examples/api/test/widgets/nested_scroll_view/nested_scroll_view.1_test.dart index 4019ca3f757..e724ea6f14f 100644 --- a/examples/api/test/widgets/nested_scroll_view/nested_scroll_view.1_test.dart +++ b/examples/api/test/widgets/nested_scroll_view/nested_scroll_view.1_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/widgets/nested_scroll_view/nested_scroll_vie import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Hides app bar after scrolling down', (WidgetTester tester) async { + testWidgets('Hides app bar after scrolling down', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.NestedScrollViewExampleApp()); expect(find.text('Floating Nested SliverAppBar'), findsOneWidget); expect(find.byType(NestedScrollView), findsOneWidget); diff --git a/examples/api/test/widgets/nested_scroll_view/nested_scroll_view.2_test.dart b/examples/api/test/widgets/nested_scroll_view/nested_scroll_view.2_test.dart index 456a3ae7f82..ffba318029b 100644 --- a/examples/api/test/widgets/nested_scroll_view/nested_scroll_view.2_test.dart +++ b/examples/api/test/widgets/nested_scroll_view/nested_scroll_view.2_test.dart @@ -9,14 +9,18 @@ import 'package:flutter_api_samples/widgets/nested_scroll_view/nested_scroll_vie import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Hides app bar after scrolling past first item', (WidgetTester tester) async { + testWidgets('Hides app bar after scrolling past first item', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.NestedScrollViewExampleApp()); expect(find.text('Snapping Nested SliverAppBar'), findsOneWidget); expect(find.byType(NestedScrollView), findsOneWidget); expect(find.text('Item 0'), findsOneWidget); while (find.text('Item 0').evaluate().isNotEmpty) { - await tester.sendEventToBinding(const PointerScrollEvent(scrollDelta: Offset(0.0, 1.0))); + await tester.sendEventToBinding( + const PointerScrollEvent(scrollDelta: Offset(0.0, 1.0)), + ); await tester.pump(); } diff --git a/examples/api/test/widgets/nested_scroll_view/nested_scroll_view_state.0_test.dart b/examples/api/test/widgets/nested_scroll_view/nested_scroll_view_state.0_test.dart index d09fa9b1b7a..19a6f2eb20f 100644 --- a/examples/api/test/widgets/nested_scroll_view/nested_scroll_view_state.0_test.dart +++ b/examples/api/test/widgets/nested_scroll_view/nested_scroll_view_state.0_test.dart @@ -9,11 +9,16 @@ import 'package:flutter_api_samples/widgets/nested_scroll_view/nested_scroll_vie import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Access the outer and inner controllers', (WidgetTester tester) async { + testWidgets('Access the outer and inner controllers', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.NestedScrollViewStateExampleApp()); expect(find.byType(NestedScrollView), findsOne); - expect(find.widgetWithText(SliverAppBar, 'NestedScrollViewState Demo!'), findsOne); + expect( + find.widgetWithText(SliverAppBar, 'NestedScrollViewState Demo!'), + findsOne, + ); expect(find.byType(CustomScrollView), findsOne); final example.NestedScrollViewStateExample widget = tester @@ -27,7 +32,9 @@ void main() { expect(outerController.offset, 0); expect(innerController.offset, 0); - await tester.sendEventToBinding(const PointerScrollEvent(scrollDelta: Offset(0.0, 10.0))); + await tester.sendEventToBinding( + const PointerScrollEvent(scrollDelta: Offset(0.0, 10.0)), + ); await tester.pump(); await tester.pumpAndSettle(); diff --git a/examples/api/test/widgets/notification_listener/notification.0_test.dart b/examples/api/test/widgets/notification_listener/notification.0_test.dart index f8656a77c21..cd3d15ec1d2 100644 --- a/examples/api/test/widgets/notification_listener/notification.0_test.dart +++ b/examples/api/test/widgets/notification_listener/notification.0_test.dart @@ -5,7 +5,8 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/notification_listener/notification.0.dart' as example; +import 'package:flutter_api_samples/widgets/notification_listener/notification.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -33,7 +34,9 @@ void main() { debugPrint = originalDebugPrint; }); - testWidgets('Scrolling the scroll view triggers the notification', (WidgetTester tester) async { + testWidgets('Scrolling the scroll view triggers the notification', ( + WidgetTester tester, + ) async { final DebugPrintCallback originalDebugPrint = debugPrint; final List logs = []; debugPrint = (String? message, {int? wrapWidth}) { @@ -56,7 +59,9 @@ void main() { debugPrint = originalDebugPrint; }); - testWidgets('Changing tabs triggers the notification', (WidgetTester tester) async { + testWidgets('Changing tabs triggers the notification', ( + WidgetTester tester, + ) async { final DebugPrintCallback originalDebugPrint = debugPrint; final List logs = []; debugPrint = (String? message, {int? wrapWidth}) { diff --git a/examples/api/test/widgets/overflow_bar/overflow_bar.0_test.dart b/examples/api/test/widgets/overflow_bar/overflow_bar.0_test.dart index e3996e72f77..8e46590b4c2 100644 --- a/examples/api/test/widgets/overflow_bar/overflow_bar.0_test.dart +++ b/examples/api/test/widgets/overflow_bar/overflow_bar.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/overflow_bar/overflow_bar.0.dart' as example; +import 'package:flutter_api_samples/widgets/overflow_bar/overflow_bar.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -14,7 +15,10 @@ void main() { // `widgetType`, ensuring that the given widgets exist // inside of an OverflowBar. Finder buttonsFinder(Type widgetType) { - return find.descendant(of: find.byType(OverflowBar), matching: find.byType(widgetType)); + return find.descendant( + of: find.byType(OverflowBar), + matching: find.byType(widgetType), + ); } expect(buttonsFinder(TextButton), findsNWidgets(2)); diff --git a/examples/api/test/widgets/overlay/overlay_portal.0_test.dart b/examples/api/test/widgets/overlay/overlay_portal.0_test.dart index e03d1d95325..49da8d9be83 100644 --- a/examples/api/test/widgets/overlay/overlay_portal.0_test.dart +++ b/examples/api/test/widgets/overlay/overlay_portal.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/rendering.dart'; -import 'package:flutter_api_samples/widgets/overlay/overlay_portal.0.dart' as example; +import 'package:flutter_api_samples/widgets/overlay/overlay_portal.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -21,22 +22,32 @@ void main() { expect(find.text(tooltipText), findsNothing); }); - testWidgets('Tooltip is shown at the right location', (WidgetTester tester) async { + testWidgets('Tooltip is shown at the right location', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.OverlayPortalExampleApp()); await tester.tap(find.byType(example.ClickableTooltipWidget)); await tester.pump(); - final Size canvasSize = tester.getSize(find.byType(example.OverlayPortalExampleApp)); - expect(tester.getBottomRight(find.text(tooltipText)), canvasSize - const Size(50, 50)); + final Size canvasSize = tester.getSize( + find.byType(example.OverlayPortalExampleApp), + ); + expect( + tester.getBottomRight(find.text(tooltipText)), + canvasSize - const Size(50, 50), + ); }); - testWidgets('Tooltip is shown with the right font size', (WidgetTester tester) async { + testWidgets('Tooltip is shown with the right font size', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.OverlayPortalExampleApp()); await tester.tap(find.byType(example.ClickableTooltipWidget)); await tester.pump(); final TextSpan textSpan = - tester.renderObject(find.text(tooltipText)).text as TextSpan; + tester.renderObject(find.text(tooltipText)).text + as TextSpan; expect(textSpan.style?.fontSize, 50); }); } diff --git a/examples/api/test/widgets/overscroll_indicator/glowing_overscroll_indicator.0_test.dart b/examples/api/test/widgets/overscroll_indicator/glowing_overscroll_indicator.0_test.dart index 89c24ad00be..45f144dd725 100644 --- a/examples/api/test/widgets/overscroll_indicator/glowing_overscroll_indicator.0_test.dart +++ b/examples/api/test/widgets/overscroll_indicator/glowing_overscroll_indicator.0_test.dart @@ -9,13 +9,20 @@ import 'package:flutter_api_samples/widgets/overscroll_indicator/glowing_overscr import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Displays widget tree when the example app is run', (WidgetTester tester) async { - await tester.pumpWidget(const example.GlowingOverscrollIndicatorExampleApp()); + testWidgets('Displays widget tree when the example app is run', ( + WidgetTester tester, + ) async { + await tester.pumpWidget( + const example.GlowingOverscrollIndicatorExampleApp(), + ); expect( find.descendant( of: find.byType(Scaffold), - matching: find.widgetWithText(AppBar, 'GlowingOverscrollIndicator Sample'), + matching: find.widgetWithText( + AppBar, + 'GlowingOverscrollIndicator Sample', + ), ), findsOne, ); @@ -37,7 +44,10 @@ void main() { ); expect( - find.descendant(of: customScrollViewFinder, matching: find.byType(SliverToBoxAdapter)), + find.descendant( + of: customScrollViewFinder, + matching: find.byType(SliverToBoxAdapter), + ), findsOne, ); @@ -64,7 +74,9 @@ void main() { matching: find.byType(GlowingOverscrollIndicator), ), ); - final RenderSliver sliverAppBar = tester.renderObject(sliverAppBarFinder); + final RenderSliver sliverAppBar = tester.renderObject( + sliverAppBarFinder, + ); final Matrix4 transform = overscrollIndicator.getTransformTo(sliverAppBar); final Offset? offset = MatrixUtils.getAsTranslation(transform); expect(offset?.dy, 0); @@ -94,7 +106,10 @@ void main() { await tester.drag(find.byType(CustomScrollView), const Offset(0, 500)); await tester.pump(); - expect(leadingPaintOffset, MediaQuery.paddingOf(context).top + kToolbarHeight); + expect( + leadingPaintOffset, + MediaQuery.paddingOf(context).top + kToolbarHeight, + ); expect(overscrollNotified, isTrue); }); } diff --git a/examples/api/test/widgets/overscroll_indicator/glowing_overscroll_indicator.1_test.dart b/examples/api/test/widgets/overscroll_indicator/glowing_overscroll_indicator.1_test.dart index e00bdf44454..da7c0e57902 100644 --- a/examples/api/test/widgets/overscroll_indicator/glowing_overscroll_indicator.1_test.dart +++ b/examples/api/test/widgets/overscroll_indicator/glowing_overscroll_indicator.1_test.dart @@ -9,13 +9,20 @@ import 'package:flutter_api_samples/widgets/overscroll_indicator/glowing_overscr import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Displays widget tree when the example app is run', (WidgetTester tester) async { - await tester.pumpWidget(const example.GlowingOverscrollIndicatorExampleApp()); + testWidgets('Displays widget tree when the example app is run', ( + WidgetTester tester, + ) async { + await tester.pumpWidget( + const example.GlowingOverscrollIndicatorExampleApp(), + ); expect( find.descendant( of: find.byType(Scaffold), - matching: find.widgetWithText(AppBar, 'GlowingOverscrollIndicator Sample'), + matching: find.widgetWithText( + AppBar, + 'GlowingOverscrollIndicator Sample', + ), ), findsOne, ); @@ -39,7 +46,10 @@ void main() { final Finder customScrollViewFinder = find.byType(CustomScrollView); expect( - find.descendant(of: customScrollViewFinder, matching: find.byType(SliverToBoxAdapter)), + find.descendant( + of: customScrollViewFinder, + matching: find.byType(SliverToBoxAdapter), + ), findsOne, ); diff --git a/examples/api/test/widgets/page/page_can_pop.0_test.dart b/examples/api/test/widgets/page/page_can_pop.0_test.dart index 0941c9099f1..bbf84386b48 100644 --- a/examples/api/test/widgets/page/page_can_pop.0_test.dart +++ b/examples/api/test/widgets/page/page_can_pop.0_test.dart @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:flutter_api_samples/widgets/page/page_can_pop.0.dart' as example; +import 'package:flutter_api_samples/widgets/page/page_can_pop.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; import '../navigator_utils.dart'; diff --git a/examples/api/test/widgets/page_storage/page_storage.0_test.dart b/examples/api/test/widgets/page_storage/page_storage.0_test.dart index 4a2c26767c6..33c3b351c84 100644 --- a/examples/api/test/widgets/page_storage/page_storage.0_test.dart +++ b/examples/api/test/widgets/page_storage/page_storage.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/page_storage/page_storage.0.dart' as example; +import 'package:flutter_api_samples/widgets/page_storage/page_storage.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/widgets/page_transitions_builder/page_transitions_builder.0_test.dart b/examples/api/test/widgets/page_transitions_builder/page_transitions_builder.0_test.dart index 74708ec22d1..be304cf5a8b 100644 --- a/examples/api/test/widgets/page_transitions_builder/page_transitions_builder.0_test.dart +++ b/examples/api/test/widgets/page_transitions_builder/page_transitions_builder.0_test.dart @@ -21,7 +21,10 @@ void main() { // Verify we're on the second page expect(find.text('Second Page'), findsOneWidget); - expect(find.text('This page appeared with a custom transition!'), findsOneWidget); + expect( + find.text('This page appeared with a custom transition!'), + findsOneWidget, + ); // Go back await tester.tap(find.byType(BackButton)); @@ -32,27 +35,31 @@ void main() { expect(find.text('Navigate with Custom Transition'), findsOneWidget); }); - testWidgets('SlideRightPageTransitionsBuilder creates slide and fade transitions', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.PageTransitionsBuilderExampleApp()); + testWidgets( + 'SlideRightPageTransitionsBuilder creates slide and fade transitions', + (WidgetTester tester) async { + await tester.pumpWidget(const example.PageTransitionsBuilderExampleApp()); - // Navigate to second page - await tester.tap(find.byType(ElevatedButton)); + // Navigate to second page + await tester.tap(find.byType(ElevatedButton)); - // Pump one frame to start the animation - await tester.pump(); + // Pump one frame to start the animation + await tester.pump(); - // The transition should be in progress - await tester.pump(const Duration(milliseconds: 150)); + // The transition should be in progress + await tester.pump(const Duration(milliseconds: 150)); - // The second page should be visible but still animating - expect(find.text('Second Page'), findsOneWidget); + // The second page should be visible but still animating + expect(find.text('Second Page'), findsOneWidget); - // Complete the animation - await tester.pumpAndSettle(); + // Complete the animation + await tester.pumpAndSettle(); - // The second page should be fully visible - expect(find.text('This page appeared with a custom transition!'), findsOneWidget); - }); + // The second page should be fully visible + expect( + find.text('This page appeared with a custom transition!'), + findsOneWidget, + ); + }, + ); } diff --git a/examples/api/test/widgets/page_view/page_view.0_test.dart b/examples/api/test/widgets/page_view/page_view.0_test.dart index e6282b95c7d..7c398e2bcd7 100644 --- a/examples/api/test/widgets/page_view/page_view.0_test.dart +++ b/examples/api/test/widgets/page_view/page_view.0_test.dart @@ -3,28 +3,41 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/page_view/page_view.0.dart' as example; +import 'package:flutter_api_samples/widgets/page_view/page_view.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('PageView swipe gestures on mobile platforms', (WidgetTester tester) async { - await tester.pumpWidget(const example.PageViewExampleApp()); + testWidgets( + 'PageView swipe gestures on mobile platforms', + (WidgetTester tester) async { + await tester.pumpWidget(const example.PageViewExampleApp()); - // Verify that first page is shown initially. - expect(find.text('First Page'), findsOneWidget); + // Verify that first page is shown initially. + expect(find.text('First Page'), findsOneWidget); - // Swipe to the left. - await tester.fling(find.text('First Page'), const Offset(-300.0, 0.0), 3000); - await tester.pumpAndSettle(); - // Verify that the second page is shown. - expect(find.text('Second Page'), findsOneWidget); + // Swipe to the left. + await tester.fling( + find.text('First Page'), + const Offset(-300.0, 0.0), + 3000, + ); + await tester.pumpAndSettle(); + // Verify that the second page is shown. + expect(find.text('Second Page'), findsOneWidget); - // Swipe back to the right. - await tester.fling(find.text('Second Page'), const Offset(300.0, 0.0), 3000); - await tester.pumpAndSettle(); - // Verify that first page is shown. - expect(find.text('First Page'), findsOneWidget); - }, variant: TargetPlatformVariant.mobile()); + // Swipe back to the right. + await tester.fling( + find.text('Second Page'), + const Offset(300.0, 0.0), + 3000, + ); + await tester.pumpAndSettle(); + // Verify that first page is shown. + expect(find.text('First Page'), findsOneWidget); + }, + variant: TargetPlatformVariant.mobile(), + ); testWidgets( 'PageView navigation using forward/backward buttons on desktop platforms', diff --git a/examples/api/test/widgets/page_view/page_view.1_test.dart b/examples/api/test/widgets/page_view/page_view.1_test.dart index 5971aec97f6..7e973f4b5e7 100644 --- a/examples/api/test/widgets/page_view/page_view.1_test.dart +++ b/examples/api/test/widgets/page_view/page_view.1_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/page_view/page_view.1.dart' as example; +import 'package:flutter_api_samples/widgets/page_view/page_view.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('tapping Reverse button should reverse PageView', (WidgetTester tester) async { + testWidgets('tapping Reverse button should reverse PageView', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.PageViewExampleApp()); final Finder pageView = find.byType(PageView); final Finder reverseFinder = find.text('Reverse items'); diff --git a/examples/api/test/widgets/pop_scope/pop_scope.0_test.dart b/examples/api/test/widgets/pop_scope/pop_scope.0_test.dart index 7ab4c491ed0..91997532a2c 100644 --- a/examples/api/test/widgets/pop_scope/pop_scope.0_test.dart +++ b/examples/api/test/widgets/pop_scope/pop_scope.0_test.dart @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:flutter_api_samples/widgets/pop_scope/pop_scope.0.dart' as example; +import 'package:flutter_api_samples/widgets/pop_scope/pop_scope.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; import '../navigator_utils.dart'; diff --git a/examples/api/test/widgets/pop_scope/pop_scope.1_test.dart b/examples/api/test/widgets/pop_scope/pop_scope.1_test.dart index 0276ed62d00..c8aa993284a 100644 --- a/examples/api/test/widgets/pop_scope/pop_scope.1_test.dart +++ b/examples/api/test/widgets/pop_scope/pop_scope.1_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/pop_scope/pop_scope.1.dart' as example; +import 'package:flutter_api_samples/widgets/pop_scope/pop_scope.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; import '../navigator_utils.dart'; @@ -31,7 +32,9 @@ void main() { expect(find.text('Page Two'), findsOneWidget); }); - testWidgets('Can choose to go back with pop result', (WidgetTester tester) async { + testWidgets('Can choose to go back with pop result', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.NavigatorPopHandlerApp()); expect(find.text('Page One'), findsOneWidget); @@ -58,6 +61,9 @@ void main() { expect(find.text('Page One'), findsOneWidget); expect(find.text('Page Two'), findsNothing); expect(find.text('Are you sure?'), findsNothing); - expect(find.text('Hello John, whose favorite food is Apple.'), findsOneWidget); + expect( + find.text('Hello John, whose favorite food is Apple.'), + findsOneWidget, + ); }); } diff --git a/examples/api/test/widgets/preferred_size/preferred_size.0_test.dart b/examples/api/test/widgets/preferred_size/preferred_size.0_test.dart index aecd5152360..c104ce5b943 100644 --- a/examples/api/test/widgets/preferred_size/preferred_size.0_test.dart +++ b/examples/api/test/widgets/preferred_size/preferred_size.0_test.dart @@ -3,20 +3,29 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/preferred_size/preferred_size.0.dart' as example; +import 'package:flutter_api_samples/widgets/preferred_size/preferred_size.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('PreferredSize determines the height of AppBarContent', (WidgetTester tester) async { + testWidgets('PreferredSize determines the height of AppBarContent', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.PreferredSizeExampleApp()); final PreferredSize preferredSize = tester.widget( - find.ancestor(of: find.byType(example.AppBarContent), matching: find.byType(PreferredSize)), + find.ancestor( + of: find.byType(example.AppBarContent), + matching: find.byType(PreferredSize), + ), ); final RenderBox appBarContent = tester.renderObject(find.byType(example.AppBarContent)) as RenderBox; - expect(preferredSize.preferredSize.height, equals(appBarContent.size.height)); + expect( + preferredSize.preferredSize.height, + equals(appBarContent.size.height), + ); }); } diff --git a/examples/api/test/widgets/radio_group/radio_group.0_test.dart b/examples/api/test/widgets/radio_group/radio_group.0_test.dart index 2ce9bfacef2..216e74f203b 100644 --- a/examples/api/test/widgets/radio_group/radio_group.0_test.dart +++ b/examples/api/test/widgets/radio_group/radio_group.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/radio_group/radio_group.0.dart' as example; +import 'package:flutter_api_samples/widgets/radio_group/radio_group.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -16,28 +17,42 @@ void main() { final Finder listTile2 = find.widgetWithText(ListTile, 'Thomas Jefferson'); expect(listTile2, findsOneWidget); - final Finder radioButton1 = find.byType(Radio).first; - final Finder radioButton2 = find.byType(Radio).last; - final Finder radioGroup = find.byType(RadioGroup).last; + final Finder radioButton1 = find + .byType(Radio) + .first; + final Finder radioButton2 = find + .byType(Radio) + .last; + final Finder radioGroup = find + .byType(RadioGroup) + .last; await tester.tap(radioButton1); await tester.pumpAndSettle(); expect( - tester.widget>(radioGroup).groupValue, + tester + .widget>(radioGroup) + .groupValue, tester.widget>(radioButton1).value, ); expect( - tester.widget>(radioGroup).groupValue, + tester + .widget>(radioGroup) + .groupValue, isNot(tester.widget>(radioButton2).value), ); await tester.tap(radioButton2); await tester.pumpAndSettle(); expect( - tester.widget>(radioGroup).groupValue, + tester + .widget>(radioGroup) + .groupValue, isNot(tester.widget>(radioButton1).value), ); expect( - tester.widget>(radioGroup).groupValue, + tester + .widget>(radioGroup) + .groupValue, tester.widget>(radioButton2).value, ); }); diff --git a/examples/api/test/widgets/raw_menu_anchor/raw_menu_anchor.0_test.dart b/examples/api/test/widgets/raw_menu_anchor/raw_menu_anchor.0_test.dart index 5136e127c8c..ef70b7d42d1 100644 --- a/examples/api/test/widgets/raw_menu_anchor/raw_menu_anchor.0_test.dart +++ b/examples/api/test/widgets/raw_menu_anchor/raw_menu_anchor.0_test.dart @@ -4,7 +4,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_api_samples/widgets/raw_menu_anchor/raw_menu_anchor.0.dart' as example; +import 'package:flutter_api_samples/widgets/raw_menu_anchor/raw_menu_anchor.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; String get catLabel => example.Animal.cat.label; @@ -26,8 +27,16 @@ void main() { expect(find.text(felisCatusLabel), findsOneWidget); expect(find.text(dogLabel), findsOneWidget); expect( - tester.getRect(find.ancestor(of: find.text(catLabel), matching: find.byType(TapRegion))), - rectMoreOrLessEquals(const Rect.fromLTRB(447.2, 328.0, 626.3, 532.0), epsilon: 0.1), + tester.getRect( + find.ancestor( + of: find.text(catLabel), + matching: find.byType(TapRegion), + ), + ), + rectMoreOrLessEquals( + const Rect.fromLTRB(447.2, 328.0, 626.3, 532.0), + epsilon: 0.1, + ), ); // Close the menu. @@ -72,7 +81,9 @@ void main() { expect(find.text(felisCatusLabel), findsNothing); }); - testWidgets('Check appears next to selected item', (WidgetTester tester) async { + testWidgets('Check appears next to selected item', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.RawMenuAnchorApp()); await tester.tap(find.text('Select One')); @@ -89,8 +100,16 @@ void main() { await tester.pump(); expect( - tester.getRect(find.ancestor(of: find.text(catLabel), matching: find.byType(TapRegion))), - rectMoreOrLessEquals(const Rect.fromLTRB(447.2, 328.0, 626.3, 532.0), epsilon: 0.1), + tester.getRect( + find.ancestor( + of: find.text(catLabel), + matching: find.byType(TapRegion), + ), + ), + rectMoreOrLessEquals( + const Rect.fromLTRB(447.2, 328.0, 626.3, 532.0), + epsilon: 0.1, + ), ); expect( diff --git a/examples/api/test/widgets/raw_menu_anchor/raw_menu_anchor.1_test.dart b/examples/api/test/widgets/raw_menu_anchor/raw_menu_anchor.1_test.dart index c50b26f31ee..f0680d59e77 100644 --- a/examples/api/test/widgets/raw_menu_anchor/raw_menu_anchor.1_test.dart +++ b/examples/api/test/widgets/raw_menu_anchor/raw_menu_anchor.1_test.dart @@ -5,11 +5,14 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; -import 'package:flutter_api_samples/widgets/raw_menu_anchor/raw_menu_anchor.1.dart' as example; +import 'package:flutter_api_samples/widgets/raw_menu_anchor/raw_menu_anchor.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; Future hoverOver(WidgetTester tester, Offset location) async { - final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); + final TestGesture gesture = await tester.createGesture( + kind: PointerDeviceKind.mouse, + ); addTearDown(gesture.removePointer); await gesture.moveTo(location); await tester.pumpAndSettle(); @@ -17,20 +20,21 @@ Future hoverOver(WidgetTester tester, Offset location) async { } void main() { - testWidgets('Initializes with correct number of menu items in expected position', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.RawMenuAnchorGroupApp()); - expect(find.byType(RawMenuAnchorGroup).evaluate().length, 1); - for (final example.MenuItem item in example.menuItems) { - expect(find.text(item.label), findsOneWidget); - } - expect(find.byType(RawMenuAnchor).evaluate().length, 4); - expect( - tester.getRect(find.byType(RawMenuAnchorGroup).first), - const Rect.fromLTRB(233.0, 284.0, 567.0, 316.0), - ); - }); + testWidgets( + 'Initializes with correct number of menu items in expected position', + (WidgetTester tester) async { + await tester.pumpWidget(const example.RawMenuAnchorGroupApp()); + expect(find.byType(RawMenuAnchorGroup).evaluate().length, 1); + for (final example.MenuItem item in example.menuItems) { + expect(find.text(item.label), findsOneWidget); + } + expect(find.byType(RawMenuAnchor).evaluate().length, 4); + expect( + tester.getRect(find.byType(RawMenuAnchorGroup).first), + const Rect.fromLTRB(233.0, 284.0, 567.0, 316.0), + ); + }, + ); testWidgets('Menu can be traversed', (WidgetTester tester) async { await tester.pumpWidget(const example.RawMenuAnchorGroupApp()); diff --git a/examples/api/test/widgets/raw_menu_anchor/raw_menu_anchor.2_test.dart b/examples/api/test/widgets/raw_menu_anchor/raw_menu_anchor.2_test.dart index 67655d25c98..267a3b791de 100644 --- a/examples/api/test/widgets/raw_menu_anchor/raw_menu_anchor.2_test.dart +++ b/examples/api/test/widgets/raw_menu_anchor/raw_menu_anchor.2_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/raw_menu_anchor/raw_menu_anchor.2.dart' as example; +import 'package:flutter_api_samples/widgets/raw_menu_anchor/raw_menu_anchor.2.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -15,26 +16,38 @@ void main() { await tester.pump(); final Finder message = find - .ancestor(of: find.textContaining('ANIMATION STATUS:'), matching: find.byType(Material)) + .ancestor( + of: find.textContaining('ANIMATION STATUS:'), + matching: find.byType(Material), + ) .first; expect(find.text('Open'), findsNothing); expect(find.text('Close'), findsOneWidget); expect(message, findsOneWidget); - expect(tester.getRect(message), const Rect.fromLTRB(400.0, 328.0, 400.0, 328.0)); + expect( + tester.getRect(message), + const Rect.fromLTRB(400.0, 328.0, 400.0, 328.0), + ); await tester.pump(const Duration(milliseconds: 500)); expect( tester.getRect(message), - rectMoreOrLessEquals(const Rect.fromLTRB(325.0, 328.0, 475.0, 528.0), epsilon: 0.1), + rectMoreOrLessEquals( + const Rect.fromLTRB(325.0, 328.0, 475.0, 528.0), + epsilon: 0.1, + ), ); await tester.pump(const Duration(milliseconds: 1100)); expect( tester.getRect(message), - rectMoreOrLessEquals(const Rect.fromLTRB(325.0, 328.0, 475.0, 528.0), epsilon: 0.1), + rectMoreOrLessEquals( + const Rect.fromLTRB(325.0, 328.0, 475.0, 528.0), + epsilon: 0.1, + ), ); // Close the menu. @@ -45,7 +58,10 @@ void main() { expect( tester.getRect(message), - rectMoreOrLessEquals(const Rect.fromLTRB(362.5, 353.0, 437.5, 403.0), epsilon: 0.1), + rectMoreOrLessEquals( + const Rect.fromLTRB(362.5, 353.0, 437.5, 403.0), + epsilon: 0.1, + ), ); await tester.pump(const Duration(milliseconds: 920)); @@ -55,7 +71,9 @@ void main() { expect(find.text('Open'), findsOneWidget); }); - testWidgets('Panel text contains the animation status', (WidgetTester tester) async { + testWidgets('Panel text contains the animation status', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.RawMenuAnchorAnimationApp()); // Open the menu. diff --git a/examples/api/test/widgets/raw_menu_anchor/raw_menu_anchor.3_test.dart b/examples/api/test/widgets/raw_menu_anchor/raw_menu_anchor.3_test.dart index abee2bc7b94..dcae1358238 100644 --- a/examples/api/test/widgets/raw_menu_anchor/raw_menu_anchor.3_test.dart +++ b/examples/api/test/widgets/raw_menu_anchor/raw_menu_anchor.3_test.dart @@ -5,20 +5,26 @@ import 'dart:ui' as ui; import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/raw_menu_anchor/raw_menu_anchor.3.dart' as example; +import 'package:flutter_api_samples/widgets/raw_menu_anchor/raw_menu_anchor.3.dart' + as example; import 'package:flutter_test/flutter_test.dart'; -String getPanelText(int i, AnimationStatus status) => 'Panel $i:\n${status.name}'; +String getPanelText(int i, AnimationStatus status) => + 'Panel $i:\n${status.name}'; Future hoverOver(WidgetTester tester, Offset location) async { - final TestGesture gesture = await tester.createGesture(kind: ui.PointerDeviceKind.mouse); + final TestGesture gesture = await tester.createGesture( + kind: ui.PointerDeviceKind.mouse, + ); addTearDown(gesture.removePointer); await gesture.moveTo(location); return gesture; } void main() { - testWidgets('Root menu opens when anchor button is pressed', (WidgetTester tester) async { + testWidgets('Root menu opens when anchor button is pressed', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.RawMenuAnchorSubmenuAnimationApp()); final Finder button = find.byType(FilledButton); @@ -26,31 +32,45 @@ void main() { await tester.pump(); final Finder panel = find - .ancestor(of: find.textContaining('Submenu 0'), matching: find.byType(ExcludeFocus)) + .ancestor( + of: find.textContaining('Submenu 0'), + matching: find.byType(ExcludeFocus), + ) .first; expect( tester.getRect(panel), - rectMoreOrLessEquals(const ui.Rect.fromLTRB(347.8, 324.0, 534.7, 324.0), epsilon: 0.1), + rectMoreOrLessEquals( + const ui.Rect.fromLTRB(347.8, 324.0, 534.7, 324.0), + epsilon: 0.1, + ), ); await tester.pump(const Duration(milliseconds: 100)); expect( tester.getRect(panel), - rectMoreOrLessEquals(const ui.Rect.fromLTRB(347.8, 324.0, 534.7, 499.7), epsilon: 0.1), + rectMoreOrLessEquals( + const ui.Rect.fromLTRB(347.8, 324.0, 534.7, 499.7), + epsilon: 0.1, + ), ); await tester.pump(const Duration(milliseconds: 101)); expect( tester.getRect(panel), - rectMoreOrLessEquals(const ui.Rect.fromLTRB(347.8, 324.0, 534.7, 516.0), epsilon: 0.1), + rectMoreOrLessEquals( + const ui.Rect.fromLTRB(347.8, 324.0, 534.7, 516.0), + epsilon: 0.1, + ), ); expect(find.textContaining('Submenu'), findsNWidgets(4)); }); - testWidgets('Hover traversal opens one submenu at a time', (WidgetTester tester) async { + testWidgets('Hover traversal opens one submenu at a time', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.RawMenuAnchorSubmenuAnimationApp()); // Open root menu. @@ -58,23 +78,39 @@ void main() { await tester.pump(); await tester.pump(const Duration(milliseconds: 50)); - final Finder menuItem = find.widgetWithText(MenuItemButton, 'Submenu 0').first; + final Finder menuItem = find + .widgetWithText(MenuItemButton, 'Submenu 0') + .first; await hoverOver(tester, tester.getCenter(menuItem)); await tester.pump(); await tester.pump(const Duration(milliseconds: 201)); for (int i = 1; i < 4; i++) { - final Finder menuItem = find.widgetWithText(MenuItemButton, 'Submenu $i').first; + final Finder menuItem = find + .widgetWithText(MenuItemButton, 'Submenu $i') + .first; await hoverOver(tester, tester.getCenter(menuItem)); await tester.pump(); - expect(find.text(getPanelText(i - 1, AnimationStatus.reverse)), findsOneWidget); - expect(find.text(getPanelText(i, AnimationStatus.forward)), findsOneWidget); + expect( + find.text(getPanelText(i - 1, AnimationStatus.reverse)), + findsOneWidget, + ); + expect( + find.text(getPanelText(i, AnimationStatus.forward)), + findsOneWidget, + ); await tester.pump(const Duration(milliseconds: 201)); - expect(find.text(getPanelText(i - 1, AnimationStatus.dismissed)), findsNothing); - expect(find.text(getPanelText(i, AnimationStatus.completed)), findsOneWidget); + expect( + find.text(getPanelText(i - 1, AnimationStatus.dismissed)), + findsNothing, + ); + expect( + find.text(getPanelText(i, AnimationStatus.completed)), + findsOneWidget, + ); } }); @@ -87,38 +123,57 @@ void main() { await tester.pump(const Duration(milliseconds: 201)); // Start hovering over submenu item - final Finder menuItem = find.widgetWithText(MenuItemButton, 'Submenu 0').first; + final Finder menuItem = find + .widgetWithText(MenuItemButton, 'Submenu 0') + .first; await hoverOver(tester, tester.getCenter(menuItem)); await tester.pump(); final Finder panel = find - .ancestor(of: find.textContaining('Panel 0'), matching: find.byType(ExcludeFocus)) + .ancestor( + of: find.textContaining('Panel 0'), + matching: find.byType(ExcludeFocus), + ) .first; // 25% through, 70% height await tester.pump(const Duration(milliseconds: 50)); - expect(tester.getSize(panel).height, moreOrLessEquals(0.7 * 120, epsilon: 1)); + expect( + tester.getSize(panel).height, + moreOrLessEquals(0.7 * 120, epsilon: 1), + ); // 50% through, 91.5% height await tester.pump(const Duration(milliseconds: 50)); - expect(tester.getSize(panel).height, moreOrLessEquals(0.91 * 120, epsilon: 1)); + expect( + tester.getSize(panel).height, + moreOrLessEquals(0.91 * 120, epsilon: 1), + ); // 100% through, full height await tester.pump(const Duration(milliseconds: 101)); expect(tester.getSize(panel).height, moreOrLessEquals(120, epsilon: 1)); // Close submenu - final Finder menuItem1 = find.widgetWithText(MenuItemButton, 'Submenu 1').first; + final Finder menuItem1 = find + .widgetWithText(MenuItemButton, 'Submenu 1') + .first; await hoverOver(tester, tester.getCenter(menuItem1)); await tester.pump(); // 25% through, ~98% height await tester.pump(const Duration(milliseconds: 50)); - expect(tester.getSize(panel).height, moreOrLessEquals(0.98 * 120, epsilon: 1)); + expect( + tester.getSize(panel).height, + moreOrLessEquals(0.98 * 120, epsilon: 1), + ); // 50% through, ~91.5% height await tester.pump(const Duration(milliseconds: 50)); - expect(tester.getSize(panel).height, moreOrLessEquals(0.91 * 120, epsilon: 1)); + expect( + tester.getSize(panel).height, + moreOrLessEquals(0.91 * 120, epsilon: 1), + ); }); testWidgets('Outside tap closes all menus', (WidgetTester tester) async { diff --git a/examples/api/test/widgets/repeating_animation_builder/repeating_animation_builder.0_test.dart b/examples/api/test/widgets/repeating_animation_builder/repeating_animation_builder.0_test.dart index c3350c9bbf2..9a374293756 100644 --- a/examples/api/test/widgets/repeating_animation_builder/repeating_animation_builder.0_test.dart +++ b/examples/api/test/widgets/repeating_animation_builder/repeating_animation_builder.0_test.dart @@ -8,8 +8,12 @@ import 'package:flutter_api_samples/widgets/repeating_animation_builder/repeatin import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('RepeatingAnimationBuilder animates continuously', (WidgetTester tester) async { - await tester.pumpWidget(const example.RepeatingAnimationBuilderExampleApp()); + testWidgets('RepeatingAnimationBuilder animates continuously', ( + WidgetTester tester, + ) async { + await tester.pumpWidget( + const example.RepeatingAnimationBuilderExampleApp(), + ); // Verify animation is happening by checking Transform changes final Transform initial = tester.widget(find.byType(Transform).first); @@ -19,8 +23,12 @@ void main() { expect(initial.transform, isNot(equals(after.transform))); }); - testWidgets('Play/pause button controls animation', (WidgetTester tester) async { - await tester.pumpWidget(const example.RepeatingAnimationBuilderExampleApp()); + testWidgets('Play/pause button controls animation', ( + WidgetTester tester, + ) async { + await tester.pumpWidget( + const example.RepeatingAnimationBuilderExampleApp(), + ); // Initially playing (pause icon visible) expect(find.byIcon(Icons.pause), findsOneWidget); @@ -42,8 +50,12 @@ void main() { expect(find.byIcon(Icons.pause), findsOneWidget); }); - testWidgets('Reverse toggle changes animation direction', (WidgetTester tester) async { - await tester.pumpWidget(const example.RepeatingAnimationBuilderExampleApp()); + testWidgets('Reverse toggle changes animation direction', ( + WidgetTester tester, + ) async { + await tester.pumpWidget( + const example.RepeatingAnimationBuilderExampleApp(), + ); // Check initial state Switch switchWidget = tester.widget(find.byType(Switch)); diff --git a/examples/api/test/widgets/restoration/restoration_mixin.0_test.dart b/examples/api/test/widgets/restoration/restoration_mixin.0_test.dart index 383bb24fe0e..fcae320b1ab 100644 --- a/examples/api/test/widgets/restoration/restoration_mixin.0_test.dart +++ b/examples/api/test/widgets/restoration/restoration_mixin.0_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/restoration/restoration_mixin.0.dart' as example; +import 'package:flutter_api_samples/widgets/restoration/restoration_mixin.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('The state of the counter can be restored', (WidgetTester tester) async { + testWidgets('The state of the counter can be restored', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.RestorationExampleApp()); expect(find.widgetWithText(AppBar, 'Restorable Counter'), findsOne); diff --git a/examples/api/test/widgets/restoration_properties/restorable_value.0_test.dart b/examples/api/test/widgets/restoration_properties/restorable_value.0_test.dart index d3740bc5e3b..1c3ca7e1819 100644 --- a/examples/api/test/widgets/restoration_properties/restorable_value.0_test.dart +++ b/examples/api/test/widgets/restoration_properties/restorable_value.0_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/widgets/restoration_properties/restorable_va import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Increments answer on OutlinedButton tap', (WidgetTester tester) async { + testWidgets('Increments answer on OutlinedButton tap', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.RestorableValueExampleApp()); // Verify that the initial answer value in the example equals 42. @@ -22,7 +24,9 @@ void main() { expect(find.text('43'), findsOneWidget); }); - testWidgets('Restores answer value after restart', (WidgetTester tester) async { + testWidgets('Restores answer value after restart', ( + WidgetTester tester, + ) async { await tester.pumpWidget( const MaterialApp( home: RootRestorationScope( diff --git a/examples/api/test/widgets/routes/flexible_route_transitions.0_test.dart b/examples/api/test/widgets/routes/flexible_route_transitions.0_test.dart index d1efdde7fd7..eea610265ab 100644 --- a/examples/api/test/widgets/routes/flexible_route_transitions.0_test.dart +++ b/examples/api/test/widgets/routes/flexible_route_transitions.0_test.dart @@ -2,11 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:flutter_api_samples/widgets/routes/flexible_route_transitions.0.dart' as example; +import 'package:flutter_api_samples/widgets/routes/flexible_route_transitions.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Flexible Transitions App is able to build', (WidgetTester tester) async { + testWidgets('Flexible Transitions App is able to build', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.FlexibleRouteTransitionsApp()); expect(find.text('Zoom Page'), findsOneWidget); @@ -39,15 +42,24 @@ void main() { await tester.pump(const Duration(milliseconds: 10)); // The current Y coordinate of the page title should be lower than it was // before as the page slides upwards. - expect(tester.getTopLeft(find.text('Zoom Page')).dy, lessThan(lastYPosition)); + expect( + tester.getTopLeft(find.text('Zoom Page')).dy, + lessThan(lastYPosition), + ); lastYPosition = tester.getTopLeft(find.text('Zoom Page')).dy; await tester.pump(const Duration(milliseconds: 10)); - expect(tester.getTopLeft(find.text('Zoom Page')).dy, lessThan(lastYPosition)); + expect( + tester.getTopLeft(find.text('Zoom Page')).dy, + lessThan(lastYPosition), + ); lastYPosition = tester.getTopLeft(find.text('Zoom Page')).dy; await tester.pump(const Duration(milliseconds: 10)); - expect(tester.getTopLeft(find.text('Zoom Page')).dy, lessThan(lastYPosition)); + expect( + tester.getTopLeft(find.text('Zoom Page')).dy, + lessThan(lastYPosition), + ); lastYPosition = tester.getTopLeft(find.text('Zoom Page')).dy; await tester.pumpAndSettle(); diff --git a/examples/api/test/widgets/routes/flexible_route_transitions.1_test.dart b/examples/api/test/widgets/routes/flexible_route_transitions.1_test.dart index 31f4bbd134c..c187338c343 100644 --- a/examples/api/test/widgets/routes/flexible_route_transitions.1_test.dart +++ b/examples/api/test/widgets/routes/flexible_route_transitions.1_test.dart @@ -9,7 +9,9 @@ import 'package:flutter_test/flutter_test.dart'; import '../navigator_utils.dart'; void main() { - testWidgets('Flexible Transitions App is able to build', (WidgetTester tester) async { + testWidgets('Flexible Transitions App is able to build', ( + WidgetTester tester, + ) async { await tester.pumpWidget(FlexibleRouteTransitionsApp()); expect(find.text('Zoom Transition'), findsOneWidget); diff --git a/examples/api/test/widgets/routes/popup_route.0_test.dart b/examples/api/test/widgets/routes/popup_route.0_test.dart index d06a4b6064a..0691274da77 100644 --- a/examples/api/test/widgets/routes/popup_route.0_test.dart +++ b/examples/api/test/widgets/routes/popup_route.0_test.dart @@ -4,12 +4,16 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_api_samples/widgets/routes/popup_route.0.dart' as example; +import 'package:flutter_api_samples/widgets/routes/popup_route.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Dismiss dialog with tap on the scrim and escape key', (WidgetTester tester) async { - const String dialogText = 'Tap in the scrim or press escape key to dismiss.'; + testWidgets('Dismiss dialog with tap on the scrim and escape key', ( + WidgetTester tester, + ) async { + const String dialogText = + 'Tap in the scrim or press escape key to dismiss.'; await tester.pumpWidget(const example.PopupRouteApp()); diff --git a/examples/api/test/widgets/routes/route_observer.0_test.dart b/examples/api/test/widgets/routes/route_observer.0_test.dart index 72763a9058b..3c79c476398 100644 --- a/examples/api/test/widgets/routes/route_observer.0_test.dart +++ b/examples/api/test/widgets/routes/route_observer.0_test.dart @@ -2,11 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:flutter_api_samples/widgets/routes/route_observer.0.dart' as example; +import 'package:flutter_api_samples/widgets/routes/route_observer.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('RouteObserver notifies RouteAware widget', (WidgetTester tester) async { + testWidgets('RouteObserver notifies RouteAware widget', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.RouteObserverApp()); // Check the initial RouteObserver logs. diff --git a/examples/api/test/widgets/routes/show_general_dialog.0_test.dart b/examples/api/test/widgets/routes/show_general_dialog.0_test.dart index 42acb2bf9a3..21415f5d446 100644 --- a/examples/api/test/widgets/routes/show_general_dialog.0_test.dart +++ b/examples/api/test/widgets/routes/show_general_dialog.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/routes/show_general_dialog.0.dart' as example; +import 'package:flutter_api_samples/widgets/routes/show_general_dialog.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/widgets/safe_area/safe_area.0_test.dart b/examples/api/test/widgets/safe_area/safe_area.0_test.dart index f360d1ed6d9..a7353d2977c 100644 --- a/examples/api/test/widgets/safe_area/safe_area.0_test.dart +++ b/examples/api/test/widgets/safe_area/safe_area.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/safe_area/safe_area.0.dart' as example; +import 'package:flutter_api_samples/widgets/safe_area/safe_area.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; example.InsetsState get insetsState => example.InsetsState.instance; @@ -20,7 +21,9 @@ void main() { expect(find.byType(SafeArea), findsNWidgets(4)); }); - testWidgets('ListTile removes side padding from its content', (WidgetTester tester) async { + testWidgets('ListTile removes side padding from its content', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.Insets()); late BuildContext context; @@ -44,7 +47,9 @@ void main() { expect(padding.right, 0); }); - testWidgets('AppBar removes top padding of Scaffold body', (WidgetTester tester) async { + testWidgets('AppBar removes top padding of Scaffold body', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.Insets()); final BuildContext context = tester.element(find.text('no safe area')); @@ -83,20 +88,28 @@ void main() { }); // Regression test for https://github.com/flutter/flutter/issues/159340. - testWidgets('App displays without layout issues', (WidgetTester tester) async { + testWidgets('App displays without layout issues', ( + WidgetTester tester, + ) async { // Set the app's size to to match the default DartPad demo screen. await tester.pumpWidget( - const Center(child: SizedBox(width: 500.0, height: 480.0, child: example.Insets())), + const Center( + child: SizedBox(width: 500.0, height: 480.0, child: example.Insets()), + ), ); - double appScreenHeight() => tester.getRect(find.byType(example.Insets)).height; + double appScreenHeight() => + tester.getRect(find.byType(example.Insets)).height; expect(appScreenHeight(), 480); expect(insetsState.insets, const EdgeInsets.fromLTRB(8.0, 25.0, 8.0, 12.0)); // Drag each slider to its maximum value. for (int index = 0; index < 3; index++) { - await tester.drag(find.byType(Slider).at(index), const Offset(500.0, 0.0)); + await tester.drag( + find.byType(Slider).at(index), + const Offset(500.0, 0.0), + ); await tester.pumpAndSettle(); expect(tester.takeException(), isNull); } diff --git a/examples/api/test/widgets/scroll_end_notification/scroll_end_notification.0_test.dart b/examples/api/test/widgets/scroll_end_notification/scroll_end_notification.0_test.dart index c8394e3f1b1..ca082987ec9 100644 --- a/examples/api/test/widgets/scroll_end_notification/scroll_end_notification.0_test.dart +++ b/examples/api/test/widgets/scroll_end_notification/scroll_end_notification.0_test.dart @@ -15,7 +15,10 @@ void main() { expect(find.byType(Scrollbar), findsOneWidget); ScrollPosition getScrollPosition() { - return tester.widget(find.byType(CustomScrollView)).controller!.position; + return tester + .widget(find.byType(CustomScrollView)) + .controller! + .position; } // Viewport is 600 pixels high, each item's height is 100, 6 items are visible. diff --git a/examples/api/test/widgets/scroll_end_notification/scroll_end_notification.1_test.dart b/examples/api/test/widgets/scroll_end_notification/scroll_end_notification.1_test.dart index 85488bb2fc1..fc7c2938b1c 100644 --- a/examples/api/test/widgets/scroll_end_notification/scroll_end_notification.1_test.dart +++ b/examples/api/test/widgets/scroll_end_notification/scroll_end_notification.1_test.dart @@ -11,12 +11,17 @@ void main() { testWidgets('SliverAutoScroll example', (WidgetTester tester) async { await tester.pumpWidget(const example.SliverAutoScrollExampleApp()); - final double itemHeight = tester.getSize(find.widgetWithText(Card, 'Item 0.15')).height; + final double itemHeight = tester + .getSize(find.widgetWithText(Card, 'Item 0.15')) + .height; // The scroll view is 600 pixels high and the big orange // "AlignedItem" is preceded by 15 regular items. Scroll up enough // to make it partially visible. - await tester.drag(find.byType(CustomScrollView), Offset(0, 600 - 15.5 * itemHeight)); + await tester.drag( + find.byType(CustomScrollView), + Offset(0, 600 - 15.5 * itemHeight), + ); await tester.pumpAndSettle(); final Finder alignedItem = find.widgetWithText(Card, 'Aligned Item'); @@ -32,13 +37,19 @@ void main() { // Scroll up a little and the "AlignedItem" does not auto-scroll, because // it's fully visible. - await tester.drag(find.byType(CustomScrollView), Offset(0, -2 * itemHeight)); + await tester.drag( + find.byType(CustomScrollView), + Offset(0, -2 * itemHeight), + ); await tester.pumpAndSettle(); expect(tester.getRect(alignedItem).bottom, 600 - itemHeight); // Scroll up far enough to make the AlignedItem partially visible and to trigger // an auto-scroll that aligns it with the top of the viewport. - await tester.drag(find.byType(CustomScrollView), Offset(0, -600 + itemHeight * 1.5)); + await tester.drag( + find.byType(CustomScrollView), + Offset(0, -600 + itemHeight * 1.5), + ); await tester.pumpAndSettle(); expect(tester.getRect(alignedItem).top, 0); diff --git a/examples/api/test/widgets/scroll_notification_observer/scroll_notification_observer.0_test.dart b/examples/api/test/widgets/scroll_notification_observer/scroll_notification_observer.0_test.dart index 57cdde1fbb7..8ea66116f62 100644 --- a/examples/api/test/widgets/scroll_notification_observer/scroll_notification_observer.0_test.dart +++ b/examples/api/test/widgets/scroll_notification_observer/scroll_notification_observer.0_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/widgets/scroll_notification_observer/scroll_ import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Scroll to top buttons appears when scrolling down', (WidgetTester tester) async { + testWidgets('Scroll to top buttons appears when scrolling down', ( + WidgetTester tester, + ) async { const String buttonText = 'Scroll to top'; await tester.pumpWidget(const example.ScrollNotificationObserverApp()); diff --git a/examples/api/test/widgets/scroll_position/is_scrolling_listener.0_test.dart b/examples/api/test/widgets/scroll_position/is_scrolling_listener.0_test.dart index a1075428096..0a66440c9d8 100644 --- a/examples/api/test/widgets/scroll_position/is_scrolling_listener.0_test.dart +++ b/examples/api/test/widgets/scroll_position/is_scrolling_listener.0_test.dart @@ -15,7 +15,10 @@ void main() { expect(find.byType(Scrollbar), findsOneWidget); ScrollPosition getScrollPosition() { - return tester.widget(find.byType(CustomScrollView)).controller!.position; + return tester + .widget(find.byType(CustomScrollView)) + .controller! + .position; } // Viewport is 600 pixels high, each item's height is 100, 6 items are visible. diff --git a/examples/api/test/widgets/scroll_position/scroll_controller_notification.0_test.dart b/examples/api/test/widgets/scroll_position/scroll_controller_notification.0_test.dart index db69001f411..b7d5aaa52b4 100644 --- a/examples/api/test/widgets/scroll_position/scroll_controller_notification.0_test.dart +++ b/examples/api/test/widgets/scroll_position/scroll_controller_notification.0_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/widgets/scroll_position/scroll_controller_no import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Can toggle between scroll notification types', (WidgetTester tester) async { + testWidgets('Can toggle between scroll notification types', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ScrollNotificationDemo()); expect(find.byType(CustomScrollView), findsOneWidget); @@ -25,6 +27,9 @@ void main() { expect(find.text('Last notification: Null'), findsOneWidget); await tester.drag(find.byType(CustomScrollView), const Offset(20.0, 20.0)); await tester.pumpAndSettle(); - expect(find.text('Last notification: UserScrollNotification'), findsOneWidget); + expect( + find.text('Last notification: UserScrollNotification'), + findsOneWidget, + ); }); } diff --git a/examples/api/test/widgets/scroll_position/scroll_controller_on_attach.0_test.dart b/examples/api/test/widgets/scroll_position/scroll_controller_on_attach.0_test.dart index b8d666b8a11..d93d8eba5a2 100644 --- a/examples/api/test/widgets/scroll_position/scroll_controller_on_attach.0_test.dart +++ b/examples/api/test/widgets/scroll_position/scroll_controller_on_attach.0_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/widgets/scroll_position/scroll_controller_on import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Can toggle between scroll notification types', (WidgetTester tester) async { + testWidgets('Can toggle between scroll notification types', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ScrollControllerDemo()); expect(find.byType(CustomScrollView), findsOneWidget); @@ -16,7 +18,7 @@ void main() { Material appBarMaterial = tester.widget( find.descendant(of: find.byType(AppBar), matching: find.byType(Material)), ); - expect(appBarMaterial.color, Colors.redAccent[700]!.withOpacity(.85)); + expect(appBarMaterial.color, Colors.redAccent[700]!.withValues(alpha: .85)); final TestGesture gesture = await tester.startGesture( tester.getCenter(find.byType(CustomScrollView)), ); @@ -26,7 +28,7 @@ void main() { appBarMaterial = tester.widget( find.descendant(of: find.byType(AppBar), matching: find.byType(Material)), ); - expect(appBarMaterial.color, Colors.green[800]!.withOpacity(.85)); + expect(appBarMaterial.color, Colors.green[800]!.withValues(alpha: .85)); await gesture.up(); await tester.pumpAndSettle(); diff --git a/examples/api/test/widgets/scroll_position/scroll_metrics_notification.0_test.dart b/examples/api/test/widgets/scroll_position/scroll_metrics_notification.0_test.dart index 9757e1e7431..e118630ddad 100644 --- a/examples/api/test/widgets/scroll_position/scroll_metrics_notification.0_test.dart +++ b/examples/api/test/widgets/scroll_position/scroll_metrics_notification.0_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/widgets/scroll_position/scroll_metrics_notif import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('A snackbar is shown when the scroll metrics change', (WidgetTester tester) async { + testWidgets('A snackbar is shown when the scroll metrics change', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ScrollMetricsDemo()); expect(find.widgetWithText(AppBar, 'ScrollMetrics Demo'), findsOne); diff --git a/examples/api/test/widgets/scroll_view/custom_scroll_view.1_test.dart b/examples/api/test/widgets/scroll_view/custom_scroll_view.1_test.dart index 359a243ea79..d920bac0c3b 100644 --- a/examples/api/test/widgets/scroll_view/custom_scroll_view.1_test.dart +++ b/examples/api/test/widgets/scroll_view/custom_scroll_view.1_test.dart @@ -3,15 +3,21 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/scroll_view/custom_scroll_view.1.dart' as example; +import 'package:flutter_api_samples/widgets/scroll_view/custom_scroll_view.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('What should be visible in the initial state.', (WidgetTester tester) async { + testWidgets('What should be visible in the initial state.', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.CustomScrollViewExampleApp()); expect( - find.descendant(of: find.byType(IconButton), matching: find.byIcon(Icons.add)), + find.descendant( + of: find.byType(IconButton), + matching: find.byIcon(Icons.add), + ), findsOne, ); expect(find.byType(SliverList), findsOne); diff --git a/examples/api/test/widgets/scroll_view/list_view.0_test.dart b/examples/api/test/widgets/scroll_view/list_view.0_test.dart index 0475b969e68..c38f089b643 100644 --- a/examples/api/test/widgets/scroll_view/list_view.0_test.dart +++ b/examples/api/test/widgets/scroll_view/list_view.0_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/scroll_view/list_view.0.dart' as example; +import 'package:flutter_api_samples/widgets/scroll_view/list_view.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('long press ListTile should enable edit mode', (WidgetTester tester) async { + testWidgets('long press ListTile should enable edit mode', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ListViewExampleApp()); final Finder listView = find.byType(ListView); @@ -22,7 +25,9 @@ void main() { expect(checkBoxFinder, findsWidgets); }); - testWidgets('Pressing cross button should disable edit mode', (WidgetTester tester) async { + testWidgets('Pressing cross button should disable edit mode', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ListViewExampleApp()); final Finder listView = find.byType(ListView); diff --git a/examples/api/test/widgets/scroll_view/list_view.1_test.dart b/examples/api/test/widgets/scroll_view/list_view.1_test.dart index 3d0fed75701..2fae0529494 100644 --- a/examples/api/test/widgets/scroll_view/list_view.1_test.dart +++ b/examples/api/test/widgets/scroll_view/list_view.1_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/scroll_view/list_view.1.dart' as example; +import 'package:flutter_api_samples/widgets/scroll_view/list_view.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('tapping Reverse button should reverse ListView', (WidgetTester tester) async { + testWidgets('tapping Reverse button should reverse ListView', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ListViewExampleApp()); final Finder listView = find.byType(ListView); final Finder reverseFinder = find.text('Reverse items'); diff --git a/examples/api/test/widgets/scrollbar/raw_scrollbar.0_test.dart b/examples/api/test/widgets/scrollbar/raw_scrollbar.0_test.dart index 7c70c813f5f..2fa5c4a9957 100644 --- a/examples/api/test/widgets/scrollbar/raw_scrollbar.0_test.dart +++ b/examples/api/test/widgets/scrollbar/raw_scrollbar.0_test.dart @@ -4,7 +4,8 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/scrollbar/raw_scrollbar.0.dart' as example; +import 'package:flutter_api_samples/widgets/scrollbar/raw_scrollbar.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/widgets/scrollbar/raw_scrollbar.1_test.dart b/examples/api/test/widgets/scrollbar/raw_scrollbar.1_test.dart index 67476292e0d..55996f6d5f8 100644 --- a/examples/api/test/widgets/scrollbar/raw_scrollbar.1_test.dart +++ b/examples/api/test/widgets/scrollbar/raw_scrollbar.1_test.dart @@ -4,33 +4,35 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/scrollbar/raw_scrollbar.1.dart' as example; +import 'package:flutter_api_samples/widgets/scrollbar/raw_scrollbar.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('When thumbVisibility is true, the scrollbar thumb remains visible', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.RawScrollbarExampleApp()); + testWidgets( + 'When thumbVisibility is true, the scrollbar thumb remains visible', + (WidgetTester tester) async { + await tester.pumpWidget(const example.RawScrollbarExampleApp()); - expect(find.widgetWithText(AppBar, 'RawScrollbar Sample'), findsOne); - expect(find.byType(RawScrollbar), findsOne); - expect(find.byType(GridView), findsOne); - expect(find.byType(RawScrollbar), paints..clipRect()); + expect(find.widgetWithText(AppBar, 'RawScrollbar Sample'), findsOne); + expect(find.byType(RawScrollbar), findsOne); + expect(find.byType(GridView), findsOne); + expect(find.byType(RawScrollbar), paints..clipRect()); - expect(find.text('item 0'), findsOne); - expect(find.text('item 1'), findsOne); - expect(find.text('item 2'), findsOne); + expect(find.text('item 0'), findsOne); + expect(find.text('item 1'), findsOne); + expect(find.text('item 2'), findsOne); - final TestPointer pointer = TestPointer(1, PointerDeviceKind.mouse); - pointer.hover(tester.getCenter(find.byType(GridView))); - await tester.sendEventToBinding(pointer.scroll(const Offset(0.0, 1000))); - await tester.pumpAndSettle(); + final TestPointer pointer = TestPointer(1, PointerDeviceKind.mouse); + pointer.hover(tester.getCenter(find.byType(GridView))); + await tester.sendEventToBinding(pointer.scroll(const Offset(0.0, 1000))); + await tester.pumpAndSettle(); - expect(find.byType(RawScrollbar), paints..clipRect()); + expect(find.byType(RawScrollbar), paints..clipRect()); - expect(find.text('item 15'), findsOne); - expect(find.text('item 16'), findsOne); - expect(find.text('item 17'), findsOne); - }); + expect(find.text('item 15'), findsOne); + expect(find.text('item 16'), findsOne); + expect(find.text('item 17'), findsOne); + }, + ); } diff --git a/examples/api/test/widgets/scrollbar/raw_scrollbar.2_test.dart b/examples/api/test/widgets/scrollbar/raw_scrollbar.2_test.dart index 5c6a5dc3a80..a19aba73d41 100644 --- a/examples/api/test/widgets/scrollbar/raw_scrollbar.2_test.dart +++ b/examples/api/test/widgets/scrollbar/raw_scrollbar.2_test.dart @@ -4,7 +4,8 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/scrollbar/raw_scrollbar.2.dart' as example; +import 'package:flutter_api_samples/widgets/scrollbar/raw_scrollbar.2.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/widgets/scrollbar/raw_scrollbar.desktop.0_test.dart b/examples/api/test/widgets/scrollbar/raw_scrollbar.desktop.0_test.dart index 0b73c54768b..31cf99956da 100644 --- a/examples/api/test/widgets/scrollbar/raw_scrollbar.desktop.0_test.dart +++ b/examples/api/test/widgets/scrollbar/raw_scrollbar.desktop.0_test.dart @@ -3,15 +3,20 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/scrollbar/raw_scrollbar.desktop.0.dart' as example; +import 'package:flutter_api_samples/widgets/scrollbar/raw_scrollbar.desktop.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Can hide default scrollbar on desktop', (WidgetTester tester) async { - await tester.pumpWidget(const example.ScrollbarApp()); + testWidgets( + 'Can hide default scrollbar on desktop', + (WidgetTester tester) async { + await tester.pumpWidget(const example.ScrollbarApp()); - // Two from left list view where scroll configuration is not set. - // One from right list view where scroll configuration is set. - expect(find.byType(Scrollbar), findsNWidgets(3)); - }, variant: TargetPlatformVariant.desktop()); + // Two from left list view where scroll configuration is not set. + // One from right list view where scroll configuration is set. + expect(find.byType(Scrollbar), findsNWidgets(3)); + }, + variant: TargetPlatformVariant.desktop(), + ); } diff --git a/examples/api/test/widgets/scrollbar/raw_scrollbar.shape.0_test.dart b/examples/api/test/widgets/scrollbar/raw_scrollbar.shape.0_test.dart index ce3b18ac3d1..c1d7c9cdc09 100644 --- a/examples/api/test/widgets/scrollbar/raw_scrollbar.shape.0_test.dart +++ b/examples/api/test/widgets/scrollbar/raw_scrollbar.shape.0_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/scrollbar/raw_scrollbar.shape.0.dart' as example; +import 'package:flutter_api_samples/widgets/scrollbar/raw_scrollbar.shape.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('The thumb shape is a stadium border', (WidgetTester tester) async { + testWidgets('The thumb shape is a stadium border', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ShapeExampleApp()); expect(find.byType(RawScrollbar), findsOne); @@ -24,7 +27,13 @@ void main() { paints ..path(color: Colors.blue) ..rrect( - rrect: RRect.fromLTRBR(786.5, 1.5, 798.5, 178.5, const Radius.circular(6)), + rrect: RRect.fromLTRBR( + 786.5, + 1.5, + 798.5, + 178.5, + const Radius.circular(6), + ), color: Colors.brown, ), ); diff --git a/examples/api/test/widgets/shared_app_data/shared_app_data.0_test.dart b/examples/api/test/widgets/shared_app_data/shared_app_data.0_test.dart index 682b3a25621..6449546651f 100644 --- a/examples/api/test/widgets/shared_app_data/shared_app_data.0_test.dart +++ b/examples/api/test/widgets/shared_app_data/shared_app_data.0_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/shared_app_data/shared_app_data.0.dart' as example; +import 'package:flutter_api_samples/widgets/shared_app_data/shared_app_data.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Verify correct labels are displayed', (WidgetTester tester) async { + testWidgets('Verify correct labels are displayed', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.SharedAppDataExampleApp()); expect(find.text('SharedAppData Sample'), findsOneWidget); @@ -26,7 +29,10 @@ void main() { counter++; await tester.tap( - find.ancestor(of: find.text('change foo'), matching: find.byType(ElevatedButton)), + find.ancestor( + of: find.text('change foo'), + matching: find.byType(ElevatedButton), + ), ); await tester.pump(); @@ -43,7 +49,10 @@ void main() { counter++; await tester.tap( - find.ancestor(of: find.text('change bar'), matching: find.byType(ElevatedButton)), + find.ancestor( + of: find.text('change bar'), + matching: find.byType(ElevatedButton), + ), ); await tester.pump(); @@ -74,8 +83,14 @@ void main() { ); await tester.pump(); - expect(find.text('foo: ${fooCounter == 0 ? 'initial' : 'FOO $fooCounter'}'), findsOneWidget); - expect(find.text('bar: ${barCounter == 0 ? 'initial' : 'BAR $barCounter'}'), findsOneWidget); + expect( + find.text('foo: ${fooCounter == 0 ? 'initial' : 'FOO $fooCounter'}'), + findsOneWidget, + ); + expect( + find.text('bar: ${barCounter == 0 ? 'initial' : 'BAR $barCounter'}'), + findsOneWidget, + ); } }); } diff --git a/examples/api/test/widgets/shared_app_data/shared_app_data.1_test.dart b/examples/api/test/widgets/shared_app_data/shared_app_data.1_test.dart index 08152fe8094..9bd1ace7df3 100644 --- a/examples/api/test/widgets/shared_app_data/shared_app_data.1_test.dart +++ b/examples/api/test/widgets/shared_app_data/shared_app_data.1_test.dart @@ -3,16 +3,21 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/shared_app_data/shared_app_data.1.dart' as example; +import 'package:flutter_api_samples/widgets/shared_app_data/shared_app_data.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { example.SharedObject getSharedObject(WidgetTester tester) { - final BuildContext context = tester.element(find.byType(example.CustomWidget)); + final BuildContext context = tester.element( + find.byType(example.CustomWidget), + ); return example.SharedObject.of(context); } - testWidgets('Verify correct labels are displayed', (WidgetTester tester) async { + testWidgets('Verify correct labels are displayed', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.SharedAppDataExampleApp()); final example.SharedObject sharedObject = getSharedObject(tester); diff --git a/examples/api/test/widgets/shortcuts/callback_shortcuts.0_test.dart b/examples/api/test/widgets/shortcuts/callback_shortcuts.0_test.dart index 67a3d225399..bccadbf5d49 100644 --- a/examples/api/test/widgets/shortcuts/callback_shortcuts.0_test.dart +++ b/examples/api/test/widgets/shortcuts/callback_shortcuts.0_test.dart @@ -3,20 +3,31 @@ // found in the LICENSE file. import 'package:flutter/services.dart'; -import 'package:flutter_api_samples/widgets/shortcuts/callback_shortcuts.0.dart' as example; +import 'package:flutter_api_samples/widgets/shortcuts/callback_shortcuts.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Verify correct labels are displayed', (WidgetTester tester) async { + testWidgets('Verify correct labels are displayed', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.CallbackShortcutsApp()); expect(find.text('CallbackShortcuts Sample'), findsOneWidget); - expect(find.text('Press the up arrow key to add to the counter'), findsOneWidget); - expect(find.text('Press the down arrow key to subtract from the counter'), findsOneWidget); + expect( + find.text('Press the up arrow key to add to the counter'), + findsOneWidget, + ); + expect( + find.text('Press the down arrow key to subtract from the counter'), + findsOneWidget, + ); expect(find.text('count: 0'), findsOneWidget); }); - testWidgets('Up and down arrow press updates counter', (WidgetTester tester) async { + testWidgets('Up and down arrow press updates counter', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.CallbackShortcutsApp()); int counter = 0; diff --git a/examples/api/test/widgets/shortcuts/character_activator.0_test.dart b/examples/api/test/widgets/shortcuts/character_activator.0_test.dart index 2cbe45260e7..bfb9a869043 100644 --- a/examples/api/test/widgets/shortcuts/character_activator.0_test.dart +++ b/examples/api/test/widgets/shortcuts/character_activator.0_test.dart @@ -4,7 +4,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_api_samples/widgets/shortcuts/character_activator.0.dart' as example; +import 'package:flutter_api_samples/widgets/shortcuts/character_activator.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -16,7 +17,9 @@ void main() { expect(find.text('Press question mark for help'), findsOneWidget); }); - testWidgets('shows snack bar on question key pressed', (WidgetTester tester) async { + testWidgets('shows snack bar on question key pressed', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.CharacterActivatorExampleApp()); final Finder snackBarFinder = find.ancestor( diff --git a/examples/api/test/widgets/shortcuts/logical_key_set.0_test.dart b/examples/api/test/widgets/shortcuts/logical_key_set.0_test.dart index 57f6e300958..56f42d616e7 100644 --- a/examples/api/test/widgets/shortcuts/logical_key_set.0_test.dart +++ b/examples/api/test/widgets/shortcuts/logical_key_set.0_test.dart @@ -3,11 +3,15 @@ // found in the LICENSE file. import 'package:flutter/services.dart'; -import 'package:flutter_api_samples/widgets/shortcuts/logical_key_set.0.dart' as example; +import 'package:flutter_api_samples/widgets/shortcuts/logical_key_set.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - Future sendKeyCombination(WidgetTester tester, List keys) async { + Future sendKeyCombination( + WidgetTester tester, + List keys, + ) async { for (final LogicalKeyboardKey key in keys) { await tester.sendKeyDownEvent(key); } @@ -16,7 +20,9 @@ void main() { } } - testWidgets('Verify correct labels are displayed', (WidgetTester tester) async { + testWidgets('Verify correct labels are displayed', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.LogicalKeySetExampleApp()); expect(find.text('LogicalKeySet Sample'), findsOneWidget); @@ -35,14 +41,22 @@ void main() { await sendKeyCombination( tester, counter.isEven - ? [LogicalKeyboardKey.controlLeft, LogicalKeyboardKey.keyC] - : [LogicalKeyboardKey.keyC, LogicalKeyboardKey.controlLeft], + ? [ + LogicalKeyboardKey.controlLeft, + LogicalKeyboardKey.keyC, + ] + : [ + LogicalKeyboardKey.keyC, + LogicalKeyboardKey.controlLeft, + ], ); await tester.pump(); } }); - testWidgets('CtrlRight+C key combination updates counter', (WidgetTester tester) async { + testWidgets('CtrlRight+C key combination updates counter', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.LogicalKeySetExampleApp()); for (int counter = 0; counter < 10; counter++) { @@ -56,7 +70,9 @@ void main() { } }); - testWidgets('CtrlLeft+A+C key combination does not update counter', (WidgetTester tester) async { + testWidgets('CtrlLeft+A+C key combination does not update counter', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.LogicalKeySetExampleApp()); for (int counter = 0; counter < 10; counter++) { @@ -71,7 +87,9 @@ void main() { } }); - testWidgets('CtrlRight+A+C key combination does not update counter', (WidgetTester tester) async { + testWidgets('CtrlRight+A+C key combination does not update counter', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.LogicalKeySetExampleApp()); for (int counter = 0; counter < 10; counter++) { diff --git a/examples/api/test/widgets/shortcuts/shortcuts.0_test.dart b/examples/api/test/widgets/shortcuts/shortcuts.0_test.dart index 303e61ec78a..740de7b615e 100644 --- a/examples/api/test/widgets/shortcuts/shortcuts.0_test.dart +++ b/examples/api/test/widgets/shortcuts/shortcuts.0_test.dart @@ -3,20 +3,31 @@ // found in the LICENSE file. import 'package:flutter/services.dart'; -import 'package:flutter_api_samples/widgets/shortcuts/shortcuts.0.dart' as example; +import 'package:flutter_api_samples/widgets/shortcuts/shortcuts.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Verify correct labels are displayed', (WidgetTester tester) async { + testWidgets('Verify correct labels are displayed', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ShortcutsExampleApp()); expect(find.text('Shortcuts Sample'), findsOneWidget); - expect(find.text('Add to the counter by pressing the up arrow key'), findsOneWidget); - expect(find.text('Subtract from the counter by pressing the down arrow key'), findsOneWidget); + expect( + find.text('Add to the counter by pressing the up arrow key'), + findsOneWidget, + ); + expect( + find.text('Subtract from the counter by pressing the down arrow key'), + findsOneWidget, + ); expect(find.text('count: 0'), findsOneWidget); }); - testWidgets('Up and down arrow press updates counter', (WidgetTester tester) async { + testWidgets('Up and down arrow press updates counter', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ShortcutsExampleApp()); int counter = 0; diff --git a/examples/api/test/widgets/shortcuts/shortcuts.1_test.dart b/examples/api/test/widgets/shortcuts/shortcuts.1_test.dart index 7083aa67972..8bf7b06e487 100644 --- a/examples/api/test/widgets/shortcuts/shortcuts.1_test.dart +++ b/examples/api/test/widgets/shortcuts/shortcuts.1_test.dart @@ -4,20 +4,31 @@ import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; -import 'package:flutter_api_samples/widgets/shortcuts/shortcuts.1.dart' as example; +import 'package:flutter_api_samples/widgets/shortcuts/shortcuts.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Verify correct labels are displayed', (WidgetTester tester) async { + testWidgets('Verify correct labels are displayed', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ShortcutsExampleApp()); expect(find.text('Shortcuts Sample'), findsOneWidget); - expect(find.text('Add to the counter by pressing the up arrow key'), findsOneWidget); - expect(find.text('Subtract from the counter by pressing the down arrow key'), findsOneWidget); + expect( + find.text('Add to the counter by pressing the up arrow key'), + findsOneWidget, + ); + expect( + find.text('Subtract from the counter by pressing the down arrow key'), + findsOneWidget, + ); expect(find.text('count: 0'), findsOneWidget); }); - testWidgets('Up and down arrow press updates counter', (WidgetTester tester) async { + testWidgets('Up and down arrow press updates counter', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ShortcutsExampleApp()); int counter = 0; @@ -44,11 +55,16 @@ void main() { }); // Regression test for https://github.com/flutter/flutter/issues/156806. - testWidgets('SingleActivator is used instead of LogicalKeySet', (WidgetTester tester) async { + testWidgets('SingleActivator is used instead of LogicalKeySet', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ShortcutsExampleApp()); final Shortcuts shortcuts = tester.firstWidget( - find.descendant(of: find.byType(example.ShortcutsExample), matching: find.byType(Shortcuts)), + find.descendant( + of: find.byType(example.ShortcutsExample), + matching: find.byType(Shortcuts), + ), ); expect(shortcuts.shortcuts.length, 2); diff --git a/examples/api/test/widgets/shortcuts/single_activator.0_test.dart b/examples/api/test/widgets/shortcuts/single_activator.0_test.dart index aba7021732f..00d59cfafce 100644 --- a/examples/api/test/widgets/shortcuts/single_activator.0_test.dart +++ b/examples/api/test/widgets/shortcuts/single_activator.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/services.dart'; -import 'package:flutter_api_samples/widgets/shortcuts/single_activator.0.dart' as example; +import 'package:flutter_api_samples/widgets/shortcuts/single_activator.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -18,11 +19,16 @@ void main() { testWidgets('displays correct labels', (WidgetTester tester) async { await tester.pumpWidget(const example.SingleActivatorExampleApp()); - expect(find.text('Add to the counter by pressing Ctrl+C'), findsOneWidget); + expect( + find.text('Add to the counter by pressing Ctrl+C'), + findsOneWidget, + ); expect(find.text('count: 0'), findsOneWidget); }); - testWidgets('updates counter when Ctrl-C combination pressed', (WidgetTester tester) async { + testWidgets('updates counter when Ctrl-C combination pressed', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.SingleActivatorExampleApp()); for (int counter = 0; counter < 10; counter++) { diff --git a/examples/api/test/widgets/single_child_scroll_view/single_child_scroll_view.0_test.dart b/examples/api/test/widgets/single_child_scroll_view/single_child_scroll_view.0_test.dart index d697c4e740b..493525e1e92 100644 --- a/examples/api/test/widgets/single_child_scroll_view/single_child_scroll_view.0_test.dart +++ b/examples/api/test/widgets/single_child_scroll_view/single_child_scroll_view.0_test.dart @@ -8,39 +8,70 @@ import 'package:flutter_api_samples/widgets/single_child_scroll_view/single_chil import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('The children should be spaced out equally when the screen is big enough', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.SingleChildScrollViewExampleApp()); + testWidgets( + 'The children should be spaced out equally when the screen is big enough', + (WidgetTester tester) async { + await tester.pumpWidget(const example.SingleChildScrollViewExampleApp()); - expect(find.text('Fixed Height Content'), findsExactly(2)); - expect(tester.getTopLeft(find.byType(Container).first), const Offset(0, 90)); - expect(tester.getTopLeft(find.byType(Container).last), const Offset(0, 390)); + expect(find.text('Fixed Height Content'), findsExactly(2)); + expect( + tester.getTopLeft(find.byType(Container).first), + const Offset(0, 90), + ); + expect( + tester.getTopLeft(find.byType(Container).last), + const Offset(0, 390), + ); - await tester.fling(find.byType(SingleChildScrollView).last, const Offset(0, -100), 10.0); + await tester.fling( + find.byType(SingleChildScrollView).last, + const Offset(0, -100), + 10.0, + ); - // The view should not scroll when the screen is big enough. - expect(tester.getTopLeft(find.byType(Container).first), const Offset(0, 90)); - expect(tester.getTopLeft(find.byType(Container).last), const Offset(0, 390)); - }); + // The view should not scroll when the screen is big enough. + expect( + tester.getTopLeft(find.byType(Container).first), + const Offset(0, 90), + ); + expect( + tester.getTopLeft(find.byType(Container).last), + const Offset(0, 390), + ); + }, + ); - testWidgets('The view should be scrollable when the screen is not big enough', ( - WidgetTester tester, - ) async { - tester.view - ..physicalSize = const Size(400, 200) - ..devicePixelRatio = 1; - addTearDown(tester.view.reset); - await tester.pumpWidget(const example.SingleChildScrollViewExampleApp()); + testWidgets( + 'The view should be scrollable when the screen is not big enough', + (WidgetTester tester) async { + tester.view + ..physicalSize = const Size(400, 200) + ..devicePixelRatio = 1; + addTearDown(tester.view.reset); + await tester.pumpWidget(const example.SingleChildScrollViewExampleApp()); - expect(find.text('Fixed Height Content'), findsExactly(2)); - expect(tester.getTopLeft(find.byType(Container).first), Offset.zero); - expect(tester.getTopLeft(find.byType(Container).last), const Offset(0, 120)); + expect(find.text('Fixed Height Content'), findsExactly(2)); + expect(tester.getTopLeft(find.byType(Container).first), Offset.zero); + expect( + tester.getTopLeft(find.byType(Container).last), + const Offset(0, 120), + ); - await tester.fling(find.byType(SingleChildScrollView).last, const Offset(0, -40), 10.0); + await tester.fling( + find.byType(SingleChildScrollView).last, + const Offset(0, -40), + 10.0, + ); - // The view should scroll when the screen is not big enough. - expect(tester.getTopLeft(find.byType(Container).first), const Offset(0, -40)); - expect(tester.getTopLeft(find.byType(Container).last), const Offset(0, 80)); - }); + // The view should scroll when the screen is not big enough. + expect( + tester.getTopLeft(find.byType(Container).first), + const Offset(0, -40), + ); + expect( + tester.getTopLeft(find.byType(Container).last), + const Offset(0, 80), + ); + }, + ); } diff --git a/examples/api/test/widgets/single_child_scroll_view/single_child_scroll_view.1_test.dart b/examples/api/test/widgets/single_child_scroll_view/single_child_scroll_view.1_test.dart index 71436b49ce1..a721c2ef6de 100644 --- a/examples/api/test/widgets/single_child_scroll_view/single_child_scroll_view.1_test.dart +++ b/examples/api/test/widgets/single_child_scroll_view/single_child_scroll_view.1_test.dart @@ -8,49 +8,71 @@ import 'package:flutter_api_samples/widgets/single_child_scroll_view/single_chil import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('The flexible child should fill the space if the screen is big enough', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.SingleChildScrollViewExampleApp()); + testWidgets( + 'The flexible child should fill the space if the screen is big enough', + (WidgetTester tester) async { + await tester.pumpWidget(const example.SingleChildScrollViewExampleApp()); - final Finder fixedHeightFinder = find.widgetWithText(Container, 'Fixed Height Content'); - final Finder flexibleHeightFinder = find.widgetWithText(Container, 'Flexible Content'); - expect(tester.getTopLeft(fixedHeightFinder), Offset.zero); - expect(tester.getSize(fixedHeightFinder), const Size(800, 120)); - expect(tester.getTopLeft(flexibleHeightFinder), const Offset(0, 120)); - expect(tester.getSize(flexibleHeightFinder), const Size(800, 480)); + final Finder fixedHeightFinder = find.widgetWithText( + Container, + 'Fixed Height Content', + ); + final Finder flexibleHeightFinder = find.widgetWithText( + Container, + 'Flexible Content', + ); + expect(tester.getTopLeft(fixedHeightFinder), Offset.zero); + expect(tester.getSize(fixedHeightFinder), const Size(800, 120)); + expect(tester.getTopLeft(flexibleHeightFinder), const Offset(0, 120)); + expect(tester.getSize(flexibleHeightFinder), const Size(800, 480)); - await tester.fling(find.byType(SingleChildScrollView).last, const Offset(0, -100), 10.0); + await tester.fling( + find.byType(SingleChildScrollView).last, + const Offset(0, -100), + 10.0, + ); - // The view should not scroll when the screen is big enough. - expect(tester.getTopLeft(fixedHeightFinder), Offset.zero); - expect(tester.getSize(fixedHeightFinder), const Size(800, 120)); - expect(tester.getTopLeft(flexibleHeightFinder), const Offset(0, 120)); - expect(tester.getSize(flexibleHeightFinder), const Size(800, 480)); - }); + // The view should not scroll when the screen is big enough. + expect(tester.getTopLeft(fixedHeightFinder), Offset.zero); + expect(tester.getSize(fixedHeightFinder), const Size(800, 120)); + expect(tester.getTopLeft(flexibleHeightFinder), const Offset(0, 120)); + expect(tester.getSize(flexibleHeightFinder), const Size(800, 480)); + }, + ); - testWidgets('The view should be scrollable when the screen is not big enough', ( - WidgetTester tester, - ) async { - tester.view - ..physicalSize = const Size(400, 200) - ..devicePixelRatio = 1; - addTearDown(tester.view.reset); - await tester.pumpWidget(const example.SingleChildScrollViewExampleApp()); + testWidgets( + 'The view should be scrollable when the screen is not big enough', + (WidgetTester tester) async { + tester.view + ..physicalSize = const Size(400, 200) + ..devicePixelRatio = 1; + addTearDown(tester.view.reset); + await tester.pumpWidget(const example.SingleChildScrollViewExampleApp()); - final Finder fixedHeightFinder = find.widgetWithText(Container, 'Fixed Height Content'); - final Finder flexibleHeightFinder = find.widgetWithText(Container, 'Flexible Content'); - expect(tester.getTopLeft(fixedHeightFinder), Offset.zero); - expect(tester.getSize(fixedHeightFinder), const Size(400, 120)); - expect(tester.getTopLeft(flexibleHeightFinder), const Offset(0, 120)); - expect(tester.getSize(flexibleHeightFinder), const Size(400, 120)); + final Finder fixedHeightFinder = find.widgetWithText( + Container, + 'Fixed Height Content', + ); + final Finder flexibleHeightFinder = find.widgetWithText( + Container, + 'Flexible Content', + ); + expect(tester.getTopLeft(fixedHeightFinder), Offset.zero); + expect(tester.getSize(fixedHeightFinder), const Size(400, 120)); + expect(tester.getTopLeft(flexibleHeightFinder), const Offset(0, 120)); + expect(tester.getSize(flexibleHeightFinder), const Size(400, 120)); - await tester.fling(find.byType(SingleChildScrollView).last, const Offset(0, -40), 10.0); + await tester.fling( + find.byType(SingleChildScrollView).last, + const Offset(0, -40), + 10.0, + ); - // The view should scroll when the screen is not big enough. - expect(tester.getTopLeft(fixedHeightFinder), const Offset(0, -40)); - expect(tester.getSize(fixedHeightFinder), const Size(400, 120)); - expect(tester.getTopLeft(flexibleHeightFinder), const Offset(0, 80)); - expect(tester.getSize(flexibleHeightFinder), const Size(400, 120)); - }); + // The view should scroll when the screen is not big enough. + expect(tester.getTopLeft(fixedHeightFinder), const Offset(0, -40)); + expect(tester.getSize(fixedHeightFinder), const Size(400, 120)); + expect(tester.getTopLeft(flexibleHeightFinder), const Offset(0, 80)); + expect(tester.getSize(flexibleHeightFinder), const Size(400, 120)); + }, + ); } diff --git a/examples/api/test/widgets/sliver/decorated_sliver.0_test.dart b/examples/api/test/widgets/sliver/decorated_sliver.0_test.dart index ee398124277..b64d9ceecfe 100644 --- a/examples/api/test/widgets/sliver/decorated_sliver.0_test.dart +++ b/examples/api/test/widgets/sliver/decorated_sliver.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/sliver/decorated_sliver.0.dart' as example; +import 'package:flutter_api_samples/widgets/sliver/decorated_sliver.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -17,53 +18,57 @@ void main() { expect(blueSkyText, findsOneWidget); }); - testWidgets('Verify the sliver with key `radial-gradient` has a RadialGradient', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.SliverDecorationExampleApp()); + testWidgets( + 'Verify the sliver with key `radial-gradient` has a RadialGradient', + (WidgetTester tester) async { + await tester.pumpWidget(const example.SliverDecorationExampleApp()); - final DecoratedSliver radialDecoratedSliver = tester.widget( - find.byKey(const ValueKey('radial-gradient')), - ); - expect( - radialDecoratedSliver.decoration, - const BoxDecoration( - gradient: RadialGradient( - center: Alignment(-0.5, -0.6), - radius: 0.15, - colors: [Color(0xFFEEEEEE), Color(0xFF111133)], - stops: [0.4, 0.8], + final DecoratedSliver radialDecoratedSliver = tester + .widget( + find.byKey(const ValueKey('radial-gradient')), + ); + expect( + radialDecoratedSliver.decoration, + const BoxDecoration( + gradient: RadialGradient( + center: Alignment(-0.5, -0.6), + radius: 0.15, + colors: [Color(0xFFEEEEEE), Color(0xFF111133)], + stops: [0.4, 0.8], + ), ), - ), - ); - }); + ); + }, + ); - testWidgets('Verify that the sliver with key `linear-gradient` has a LinearGradient', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.SliverDecorationExampleApp()); + testWidgets( + 'Verify that the sliver with key `linear-gradient` has a LinearGradient', + (WidgetTester tester) async { + await tester.pumpWidget(const example.SliverDecorationExampleApp()); - final DecoratedSliver linearDecoratedSliver = tester.widget( - find.byKey(const ValueKey('linear-gradient')), - ); - expect( - linearDecoratedSliver.decoration, - const BoxDecoration( - gradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0xFF111133), - Color(0xFF1A237E), - Color(0xFF283593), - Color(0xFF3949AB), - Color(0xFF3F51B5), - Color(0xFF1976D2), - Color(0xFF1E88E5), - Color(0xFF42A5F5), - ], + final DecoratedSliver linearDecoratedSliver = tester + .widget( + find.byKey(const ValueKey('linear-gradient')), + ); + expect( + linearDecoratedSliver.decoration, + const BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [ + Color(0xFF111133), + Color(0xFF1A237E), + Color(0xFF283593), + Color(0xFF3949AB), + Color(0xFF3F51B5), + Color(0xFF1976D2), + Color(0xFF1E88E5), + Color(0xFF42A5F5), + ], + ), ), - ), - ); - }); + ); + }, + ); } diff --git a/examples/api/test/widgets/sliver/decorated_sliver.1_test.dart b/examples/api/test/widgets/sliver/decorated_sliver.1_test.dart index 47ccab7480b..082deb28900 100644 --- a/examples/api/test/widgets/sliver/decorated_sliver.1_test.dart +++ b/examples/api/test/widgets/sliver/decorated_sliver.1_test.dart @@ -3,29 +3,40 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/sliver/decorated_sliver.1.dart' as example; +import 'package:flutter_api_samples/widgets/sliver/decorated_sliver.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('CustomScrollView clipBehavior is Clip.none when is Clipped is false', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const MaterialApp(home: example.DecoratedSliverClipExample())); + testWidgets( + 'CustomScrollView clipBehavior is Clip.none when is Clipped is false', + (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp(home: example.DecoratedSliverClipExample()), + ); - final CustomScrollView customScrollView = tester.widget(find.byType(CustomScrollView)); + final CustomScrollView customScrollView = tester.widget( + find.byType(CustomScrollView), + ); - expect(customScrollView.clipBehavior, equals(Clip.none)); - }); + expect(customScrollView.clipBehavior, equals(Clip.none)); + }, + ); testWidgets('Verify the DecoratedSliver has shadow property in decoration', ( WidgetTester tester, ) async { await tester.pumpWidget( - const MaterialApp(home: example.ResizableCustomScrollView(isClipped: false)), + const MaterialApp( + home: example.ResizableCustomScrollView(isClipped: false), + ), ); - final DecoratedSliver decoratedSliver = tester.widget(find.byType(DecoratedSliver)); - final ShapeDecoration shapeDecoration = decoratedSliver.decoration as ShapeDecoration; + final DecoratedSliver decoratedSliver = tester.widget( + find.byType(DecoratedSliver), + ); + final ShapeDecoration shapeDecoration = + decoratedSliver.decoration as ShapeDecoration; expect(shapeDecoration.shadows, isNotEmpty); }); diff --git a/examples/api/test/widgets/sliver/pinned_header_sliver.0_test.dart b/examples/api/test/widgets/sliver/pinned_header_sliver.0_test.dart index 364801d350b..7c780d3dba1 100644 --- a/examples/api/test/widgets/sliver/pinned_header_sliver.0_test.dart +++ b/examples/api/test/widgets/sliver/pinned_header_sliver.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/sliver/pinned_header_sliver.0.dart' as example; +import 'package:flutter_api_samples/widgets/sliver/pinned_header_sliver.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/widgets/sliver/pinned_header_sliver.1_test.dart b/examples/api/test/widgets/sliver/pinned_header_sliver.1_test.dart index a0ad79a7d3f..f715f2504eb 100644 --- a/examples/api/test/widgets/sliver/pinned_header_sliver.1_test.dart +++ b/examples/api/test/widgets/sliver/pinned_header_sliver.1_test.dart @@ -3,18 +3,24 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/sliver/pinned_header_sliver.1.dart' as example; +import 'package:flutter_api_samples/widgets/sliver/pinned_header_sliver.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('PinnedHeaderSliver iOS Settings example', (WidgetTester tester) async { + testWidgets('PinnedHeaderSliver iOS Settings example', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.SettingsAppBarApp()); // Verify that the app contains a header: a SliverPersistentHeader // with an AnimatedOpacity widget below it, and a Text('Settings') below that. expect(find.byType(PinnedHeaderSliver), findsOneWidget); expect( - find.descendant(of: find.byType(PinnedHeaderSliver), matching: find.byType(AnimatedOpacity)), + find.descendant( + of: find.byType(PinnedHeaderSliver), + matching: find.byType(AnimatedOpacity), + ), findsOneWidget, ); expect(find.widgetWithText(AnimatedOpacity, 'Settings'), findsOneWidget); @@ -23,7 +29,10 @@ void main() { // with a Text('Settings') widget below it. expect(find.widgetWithText(SliverToBoxAdapter, 'Settings'), findsOneWidget); - final Finder headerOpacity = find.widgetWithText(AnimatedOpacity, 'Settings'); + final Finder headerOpacity = find.widgetWithText( + AnimatedOpacity, + 'Settings', + ); expect(tester.widget(headerOpacity).opacity, 0); // Scroll up: the header's opacity goes to 1 and the title disappears. diff --git a/examples/api/test/widgets/sliver/sliver_constrained_cross_axis.0_test.dart b/examples/api/test/widgets/sliver/sliver_constrained_cross_axis.0_test.dart index 710caac4dfa..5e915b91207 100644 --- a/examples/api/test/widgets/sliver/sliver_constrained_cross_axis.0_test.dart +++ b/examples/api/test/widgets/sliver/sliver_constrained_cross_axis.0_test.dart @@ -4,14 +4,21 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; -import 'package:flutter_api_samples/widgets/sliver/sliver_constrained_cross_axis.0.dart' as example; +import 'package:flutter_api_samples/widgets/sliver/sliver_constrained_cross_axis.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('SliverConstrainedCrossAxis example', (WidgetTester tester) async { - await tester.pumpWidget(const example.SliverConstrainedCrossAxisExampleApp()); + testWidgets('SliverConstrainedCrossAxis example', ( + WidgetTester tester, + ) async { + await tester.pumpWidget( + const example.SliverConstrainedCrossAxisExampleApp(), + ); - final RenderSliverList renderSliverList = tester.renderObject(find.byType(SliverList)); + final RenderSliverList renderSliverList = tester.renderObject( + find.byType(SliverList), + ); expect(renderSliverList.constraints.crossAxisExtent, equals(200)); }); } diff --git a/examples/api/test/widgets/sliver/sliver_cross_axis_group.0_test.dart b/examples/api/test/widgets/sliver/sliver_cross_axis_group.0_test.dart index c828c91faaf..c1e90872431 100644 --- a/examples/api/test/widgets/sliver/sliver_cross_axis_group.0_test.dart +++ b/examples/api/test/widgets/sliver/sliver_cross_axis_group.0_test.dart @@ -4,7 +4,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; -import 'package:flutter_api_samples/widgets/sliver/sliver_cross_axis_group.0.dart' as example; +import 'package:flutter_api_samples/widgets/sliver/sliver_cross_axis_group.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -16,7 +17,8 @@ void main() { ); expect(renderSliverGroup, isNotNull); - final double crossAxisExtent = renderSliverGroup.constraints.crossAxisExtent; + final double crossAxisExtent = + renderSliverGroup.constraints.crossAxisExtent; final List renderSliverLists = tester .renderObjectList(find.byType(SliverList)) @@ -29,16 +31,26 @@ void main() { const double expectedSecondExtent = 200; final double expectedThirdExtent = 2 * (crossAxisExtent - 200) / 3; expect(firstList.constraints.crossAxisExtent, equals(expectedFirstExtent)); - expect(secondList.constraints.crossAxisExtent, equals(expectedSecondExtent)); + expect( + secondList.constraints.crossAxisExtent, + equals(expectedSecondExtent), + ); expect(thirdList.constraints.crossAxisExtent, equals(expectedThirdExtent)); // Also check that the paint offsets are correct. final RenderSliverConstrainedCrossAxis renderConstrained = tester - .renderObject(find.byType(SliverConstrainedCrossAxis)); + .renderObject( + find.byType(SliverConstrainedCrossAxis), + ); - expect((firstList.parentData! as SliverPhysicalParentData).paintOffset.dx, equals(0)); expect( - (renderConstrained.parentData! as SliverPhysicalParentData).paintOffset.dx, + (firstList.parentData! as SliverPhysicalParentData).paintOffset.dx, + equals(0), + ); + expect( + (renderConstrained.parentData! as SliverPhysicalParentData) + .paintOffset + .dx, equals(expectedFirstExtent), ); expect( diff --git a/examples/api/test/widgets/sliver/sliver_ensure_semantics.0_test.dart b/examples/api/test/widgets/sliver/sliver_ensure_semantics.0_test.dart index 651d98d6f8d..7cb30bd3ece 100644 --- a/examples/api/test/widgets/sliver/sliver_ensure_semantics.0_test.dart +++ b/examples/api/test/widgets/sliver/sliver_ensure_semantics.0_test.dart @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:flutter_api_samples/widgets/sliver/sliver_ensure_semantics.0.dart' as example; +import 'package:flutter_api_samples/widgets/sliver/sliver_ensure_semantics.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/widgets/sliver/sliver_floating_header.0_test.dart b/examples/api/test/widgets/sliver/sliver_floating_header.0_test.dart index 54833de7779..2adcf4cee64 100644 --- a/examples/api/test/widgets/sliver/sliver_floating_header.0_test.dart +++ b/examples/api/test/widgets/sliver/sliver_floating_header.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/sliver/sliver_floating_header.0.dart' as example; +import 'package:flutter_api_samples/widgets/sliver/sliver_floating_header.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -15,15 +16,24 @@ void main() { ); final double headerHeight = tester.getSize(headerText).height; - await tester.drag(find.byType(CustomScrollView), Offset(0, -2 * headerHeight)); + await tester.drag( + find.byType(CustomScrollView), + Offset(0, -2 * headerHeight), + ); await tester.pumpAndSettle(); expect(headerText, findsNothing); - await tester.drag(find.byType(CustomScrollView), Offset(0, 0.5 * headerHeight)); + await tester.drag( + find.byType(CustomScrollView), + Offset(0, 0.5 * headerHeight), + ); await tester.pumpAndSettle(); expect(headerText, findsOneWidget); - await tester.drag(find.byType(CustomScrollView), Offset(0, -0.5 * headerHeight)); + await tester.drag( + find.byType(CustomScrollView), + Offset(0, -0.5 * headerHeight), + ); await tester.pumpAndSettle(); expect(headerText, findsNothing); }); diff --git a/examples/api/test/widgets/sliver/sliver_list.0_test.dart b/examples/api/test/widgets/sliver/sliver_list.0_test.dart index 20c66eecf0a..033ec5fa1ca 100644 --- a/examples/api/test/widgets/sliver/sliver_list.0_test.dart +++ b/examples/api/test/widgets/sliver/sliver_list.0_test.dart @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:flutter_api_samples/widgets/sliver/sliver_list.0.dart' as example; +import 'package:flutter_api_samples/widgets/sliver/sliver_list.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/widgets/sliver/sliver_main_axis_group.0_test.dart b/examples/api/test/widgets/sliver/sliver_main_axis_group.0_test.dart index 4b5e5e8d84c..9995a89d6b6 100644 --- a/examples/api/test/widgets/sliver/sliver_main_axis_group.0_test.dart +++ b/examples/api/test/widgets/sliver/sliver_main_axis_group.0_test.dart @@ -4,7 +4,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; -import 'package:flutter_api_samples/widgets/sliver/sliver_main_axis_group.0.dart' as example; +import 'package:flutter_api_samples/widgets/sliver/sliver_main_axis_group.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -18,9 +19,8 @@ void main() { final RenderSliverPersistentHeader renderAppBar = tester .renderObject(find.byType(SliverAppBar)); - final RenderSliverList renderSliverList = tester.renderObject( - find.byType(SliverList), - ); + final RenderSliverList renderSliverList = tester + .renderObject(find.byType(SliverList)); final RenderSliverToBoxAdapter renderSliverAdapter = tester .renderObject( find.descendant( @@ -34,6 +34,9 @@ void main() { expect(renderAppBar.geometry!.scrollExtent, equals(70.0)); expect(renderSliverList.geometry!.scrollExtent, equals(100.0 * 5)); expect(renderSliverAdapter.geometry!.scrollExtent, equals(100.0)); - expect(renderSliverGroup.geometry!.scrollExtent, equals(70.0 + 100.0 * 5 + 100.0)); + expect( + renderSliverGroup.geometry!.scrollExtent, + equals(70.0 + 100.0 * 5 + 100.0), + ); }); } diff --git a/examples/api/test/widgets/sliver/sliver_opacity.1_test.dart b/examples/api/test/widgets/sliver/sliver_opacity.1_test.dart index 168fe96afe9..78bee88eeb6 100644 --- a/examples/api/test/widgets/sliver/sliver_opacity.1_test.dart +++ b/examples/api/test/widgets/sliver/sliver_opacity.1_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/sliver/sliver_opacity.1.dart' as example; +import 'package:flutter_api_samples/widgets/sliver/sliver_opacity.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/widgets/sliver/sliver_resizing_header.0_test.dart b/examples/api/test/widgets/sliver/sliver_resizing_header.0_test.dart index 0f0bba5334d..3ad5b5d323c 100644 --- a/examples/api/test/widgets/sliver/sliver_resizing_header.0_test.dart +++ b/examples/api/test/widgets/sliver/sliver_resizing_header.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/sliver/sliver_resizing_header.0.dart' as example; +import 'package:flutter_api_samples/widgets/sliver/sliver_resizing_header.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/widgets/sliver/sliver_tree.0_test.dart b/examples/api/test/widgets/sliver/sliver_tree.0_test.dart index cacea24e696..969a8125018 100644 --- a/examples/api/test/widgets/sliver/sliver_tree.0_test.dart +++ b/examples/api/test/widgets/sliver/sliver_tree.0_test.dart @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:flutter_api_samples/widgets/sliver/sliver_tree.0.dart' as example; +import 'package:flutter_api_samples/widgets/sliver/sliver_tree.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/widgets/sliver/sliver_tree.1_test.dart b/examples/api/test/widgets/sliver/sliver_tree.1_test.dart index 8382fb61e7e..1123213c60c 100644 --- a/examples/api/test/widgets/sliver/sliver_tree.1_test.dart +++ b/examples/api/test/widgets/sliver/sliver_tree.1_test.dart @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:flutter_api_samples/widgets/sliver/sliver_tree.1.dart' as example; +import 'package:flutter_api_samples/widgets/sliver/sliver_tree.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/widgets/sliver_fill/sliver_fill_remaining.0_test.dart b/examples/api/test/widgets/sliver_fill/sliver_fill_remaining.0_test.dart index 01745cb09a6..acb25ddbf14 100644 --- a/examples/api/test/widgets/sliver_fill/sliver_fill_remaining.0_test.dart +++ b/examples/api/test/widgets/sliver_fill/sliver_fill_remaining.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/sliver_fill/sliver_fill_remaining.0.dart' as example; +import 'package:flutter_api_samples/widgets/sliver_fill/sliver_fill_remaining.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -15,33 +16,53 @@ void main() { expect(find.byType(CustomScrollView), findsOneWidget); expect( - find.descendant(of: find.byType(SliverToBoxAdapter), matching: find.byType(Container)), + find.descendant( + of: find.byType(SliverToBoxAdapter), + matching: find.byType(Container), + ), findsOneWidget, ); final Container upperContainer = tester.widget( - find.descendant(of: find.byType(SliverToBoxAdapter), matching: find.byType(Container)), + find.descendant( + of: find.byType(SliverToBoxAdapter), + matching: find.byType(Container), + ), ); expect(upperContainer.color, Colors.amber[300]); expect(find.byType(SliverFillRemaining), findsOneWidget); expect( - find.descendant(of: find.byType(SliverFillRemaining), matching: find.byType(Container)), + find.descendant( + of: find.byType(SliverFillRemaining), + matching: find.byType(Container), + ), findsOneWidget, ); expect(find.byIcon(Icons.sentiment_very_satisfied), findsOneWidget); final Icon lowerIcon = tester.widget( - find.descendant(of: find.byType(SliverFillRemaining), matching: find.byType(Icon)), + find.descendant( + of: find.byType(SliverFillRemaining), + matching: find.byType(Icon), + ), ); expect(lowerIcon.color, Colors.blue[900]); final double total = tester.getSize(find.byType(CustomScrollView)).height; final double upperHeight = tester .getSize( - find.descendant(of: find.byType(SliverToBoxAdapter), matching: find.byType(Container)), + find.descendant( + of: find.byType(SliverToBoxAdapter), + matching: find.byType(Container), + ), ) .height; final double lowerHeight = tester - .getSize(find.descendant(of: find.byType(SliverFillRemaining), matching: find.byType(Icon))) + .getSize( + find.descendant( + of: find.byType(SliverFillRemaining), + matching: find.byType(Icon), + ), + ) .height; expect(upperHeight + lowerHeight, equals(total)); }); diff --git a/examples/api/test/widgets/sliver_fill/sliver_fill_remaining.1_test.dart b/examples/api/test/widgets/sliver_fill/sliver_fill_remaining.1_test.dart index 9e365bbfe41..85a2e40fbc7 100644 --- a/examples/api/test/widgets/sliver_fill/sliver_fill_remaining.1_test.dart +++ b/examples/api/test/widgets/sliver_fill/sliver_fill_remaining.1_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/sliver_fill/sliver_fill_remaining.1.dart' as example; +import 'package:flutter_api_samples/widgets/sliver_fill/sliver_fill_remaining.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -13,19 +14,22 @@ void main() { expect(find.byType(CustomScrollView), findsOneWidget); expect( find.byWidgetPredicate( - (Widget widget) => (widget is Container) && widget.color == Colors.amber[200], + (Widget widget) => + (widget is Container) && widget.color == Colors.amber[200], ), findsNWidgets(2), ); expect( find.byWidgetPredicate( - (Widget widget) => (widget is Container) && widget.color == Colors.blue[200], + (Widget widget) => + (widget is Container) && widget.color == Colors.blue[200], ), findsOneWidget, ); expect( find.byWidgetPredicate( - (Widget widget) => (widget is Container) && widget.color == Colors.orange[300], + (Widget widget) => + (widget is Container) && widget.color == Colors.orange[300], ), findsOneWidget, ); @@ -37,7 +41,9 @@ void main() { testWidgets('Fills up all available space', (WidgetTester tester) async { await tester.pumpWidget(const example.SliverFillRemainingExampleApp()); - final double listSpace = tester.getSize(find.byType(CustomScrollView)).height; + final double listSpace = tester + .getSize(find.byType(CustomScrollView)) + .height; double contentHeight = 0.0; for (final Widget widget in tester.widgetList( find.byWidgetPredicate( diff --git a/examples/api/test/widgets/sliver_fill/sliver_fill_remaining.2_test.dart b/examples/api/test/widgets/sliver_fill/sliver_fill_remaining.2_test.dart index 59a22e5f70d..38b2837ae3f 100644 --- a/examples/api/test/widgets/sliver_fill/sliver_fill_remaining.2_test.dart +++ b/examples/api/test/widgets/sliver_fill/sliver_fill_remaining.2_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/sliver_fill/sliver_fill_remaining.2.dart' as example; +import 'package:flutter_api_samples/widgets/sliver_fill/sliver_fill_remaining.2.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -15,14 +16,16 @@ void main() { expect( find.byWidgetPredicate( - (Widget widget) => (widget is Container) && widget.color == Colors.indigo[200], + (Widget widget) => + (widget is Container) && widget.color == Colors.indigo[200], skipOffstage: false, ), findsNWidgets(3), ); expect( find.byWidgetPredicate( - (Widget widget) => (widget is Container) && widget.color == Colors.orange[200], + (Widget widget) => + (widget is Container) && widget.color == Colors.orange[200], ), findsNWidgets(2), ); @@ -32,6 +35,9 @@ void main() { await tester.scrollUntilVisible(find.byType(SliverFillRemaining), 20); expect(find.byType(SliverFillRemaining), findsOneWidget); expect(find.byIcon(Icons.pan_tool), findsOneWidget); - expect(tester.widget(find.byIcon(Icons.pan_tool)).color, Colors.blueGrey); + expect( + tester.widget(find.byIcon(Icons.pan_tool)).color, + Colors.blueGrey, + ); }); } diff --git a/examples/api/test/widgets/sliver_fill/sliver_fill_remaining.3_test.dart b/examples/api/test/widgets/sliver_fill/sliver_fill_remaining.3_test.dart index 8bd6785d282..f934c14f132 100644 --- a/examples/api/test/widgets/sliver_fill/sliver_fill_remaining.3_test.dart +++ b/examples/api/test/widgets/sliver_fill/sliver_fill_remaining.3_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/sliver_fill/sliver_fill_remaining.3.dart' as example; +import 'package:flutter_api_samples/widgets/sliver_fill/sliver_fill_remaining.3.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -13,7 +14,9 @@ void main() { expect(find.byType(ElevatedButton), findsOneWidget); expect(find.text('Bottom Pinned Button!'), findsOneWidget); expect(find.byType(CustomScrollView), findsOneWidget); - final CustomScrollView scroll = tester.widget(find.byType(CustomScrollView)); + final CustomScrollView scroll = tester.widget( + find.byType(CustomScrollView), + ); expect( scroll.physics, isA().having( @@ -25,20 +28,24 @@ void main() { expect( find.byWidgetPredicate( - (Widget widget) => (widget is Container) && widget.color == Colors.tealAccent[700], + (Widget widget) => + (widget is Container) && widget.color == Colors.tealAccent[700], ), findsOneWidget, ); expect( find.byWidgetPredicate( - (Widget widget) => (widget is Container) && widget.color == Colors.teal[100], + (Widget widget) => + (widget is Container) && widget.color == Colors.teal[100], ), findsOneWidget, ); expect(find.byType(Container), findsNWidgets(2)); expect(find.byType(SliverFillRemaining), findsOneWidget); - final SliverFillRemaining fill = tester.widget(find.byType(SliverFillRemaining)); + final SliverFillRemaining fill = tester.widget( + find.byType(SliverFillRemaining), + ); expect(fill.hasScrollBody, false); expect(fill.fillOverscroll, true); }); diff --git a/examples/api/test/widgets/slotted_render_object_widget/slotted_multi_child_render_object_widget_mixin.0_test.dart b/examples/api/test/widgets/slotted_render_object_widget/slotted_multi_child_render_object_widget_mixin.0_test.dart index c59dd1abbd7..a0eb4345d02 100644 --- a/examples/api/test/widgets/slotted_render_object_widget/slotted_multi_child_render_object_widget_mixin.0_test.dart +++ b/examples/api/test/widgets/slotted_render_object_widget/slotted_multi_child_render_object_widget_mixin.0_test.dart @@ -8,7 +8,9 @@ import 'package:flutter_api_samples/widgets/slotted_render_object_widget/slotted import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('shows two widgets arranged diagonally', (WidgetTester tester) async { + testWidgets('shows two widgets arranged diagonally', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.ExampleWidget()); expect(find.text('topLeft'), findsOneWidget); @@ -19,10 +21,19 @@ void main() { tester.getTopLeft(findContainerWithText('bottomRight')), ); - expect(tester.getSize(findContainerWithText('topLeft')), const Size(200, 100)); - expect(tester.getSize(findContainerWithText('bottomRight')), const Size(30, 60)); + expect( + tester.getSize(findContainerWithText('topLeft')), + const Size(200, 100), + ); + expect( + tester.getSize(findContainerWithText('bottomRight')), + const Size(30, 60), + ); - expect(tester.getSize(find.byType(example.Diagonal)), const Size(200 + 30, 100 + 60)); + expect( + tester.getSize(find.byType(example.Diagonal)), + const Size(200 + 30, 100 + 60), + ); }); } diff --git a/examples/api/test/widgets/system_context_menu/system_context_menu.0_test.dart b/examples/api/test/widgets/system_context_menu/system_context_menu.0_test.dart index dac71823cd5..0a0473613a8 100644 --- a/examples/api/test/widgets/system_context_menu/system_context_menu.0_test.dart +++ b/examples/api/test/widgets/system_context_menu/system_context_menu.0_test.dart @@ -20,7 +20,8 @@ void main() { data: mediaQueryData.copyWith( // Faking this value, which is usually set to true only on // devices running iOS 16+. - supportsShowingSystemContextMenu: defaultTargetPlatform == TargetPlatform.iOS, + supportsShowingSystemContextMenu: + defaultTargetPlatform == TargetPlatform.iOS, ), child: const example.SystemContextMenuExampleApp(), ); diff --git a/examples/api/test/widgets/system_context_menu/system_context_menu.1_test.dart b/examples/api/test/widgets/system_context_menu/system_context_menu.1_test.dart index d4739c66dec..6f86197da16 100644 --- a/examples/api/test/widgets/system_context_menu/system_context_menu.1_test.dart +++ b/examples/api/test/widgets/system_context_menu/system_context_menu.1_test.dart @@ -14,22 +14,21 @@ void main() { 'shows custom menu items in system context menu on iOS', (WidgetTester tester) async { final List> itemsReceived = >[]; - TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler( - SystemChannels.platform, - (MethodCall methodCall) async { - if (methodCall.method == 'ContextMenu.showSystemContextMenu') { - final Map arguments = methodCall.arguments as Map; - final List items = arguments['items'] as List; - itemsReceived.addAll(items.cast>()); - } - return null; - }, - ); + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger + .setMockMethodCallHandler(SystemChannels.platform, ( + MethodCall methodCall, + ) async { + if (methodCall.method == 'ContextMenu.showSystemContextMenu') { + final Map arguments = + methodCall.arguments as Map; + final List items = arguments['items'] as List; + itemsReceived.addAll(items.cast>()); + } + return null; + }); addTearDown(() { - TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler( - SystemChannels.platform, - null, - ); + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger + .setMockMethodCallHandler(SystemChannels.platform, null); }); await tester.pumpWidget( @@ -38,7 +37,8 @@ void main() { final MediaQueryData mediaQueryData = MediaQuery.of(context); return MediaQuery( data: mediaQueryData.copyWith( - supportsShowingSystemContextMenu: defaultTargetPlatform == TargetPlatform.iOS, + supportsShowingSystemContextMenu: + defaultTargetPlatform == TargetPlatform.iOS, ), child: const example.SystemContextMenuExampleApp(), ); @@ -81,7 +81,9 @@ void main() { builder: (BuildContext context) { final MediaQueryData mediaQueryData = MediaQuery.of(context); return MediaQuery( - data: mediaQueryData.copyWith(supportsShowingSystemContextMenu: true), + data: mediaQueryData.copyWith( + supportsShowingSystemContextMenu: true, + ), child: const example.SystemContextMenuExampleApp(), ); }, @@ -105,7 +107,9 @@ void main() { final List items = contextMenu.items; final IOSSystemContextMenuItemCustom clearItem = items .whereType() - .firstWhere((IOSSystemContextMenuItemCustom item) => item.title == 'Clear Text'); + .firstWhere( + (IOSSystemContextMenuItemCustom item) => item.title == 'Clear Text', + ); clearItem.onPressed(); await tester.pumpAndSettle(); @@ -115,14 +119,11 @@ void main() { // iOS system menus auto-close after custom actions on real devices. // Simulate this by sending the platform dismiss message. - final ByteData? messageBytes = const JSONMessageCodec().encodeMessage({ - 'method': 'ContextMenu.onDismissSystemContextMenu', - }); - await TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.handlePlatformMessage( - 'flutter/platform', - messageBytes, - (_) {}, + final ByteData? messageBytes = const JSONMessageCodec().encodeMessage( + {'method': 'ContextMenu.onDismissSystemContextMenu'}, ); + await TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger + .handlePlatformMessage('flutter/platform', messageBytes, (_) {}); await tester.pump(); expect(find.byType(SystemContextMenu), findsNothing); diff --git a/examples/api/test/widgets/tap_region/text_field_tap_region.0_test.dart b/examples/api/test/widgets/tap_region/text_field_tap_region.0_test.dart index 53f2b2d2562..4f024c1c43f 100644 --- a/examples/api/test/widgets/tap_region/text_field_tap_region.0_test.dart +++ b/examples/api/test/widgets/tap_region/text_field_tap_region.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/tap_region/text_field_tap_region.0.dart' as example; +import 'package:flutter_api_samples/widgets/tap_region/text_field_tap_region.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -23,7 +24,10 @@ void main() { await tester.pump(); expect(getFieldValue(tester).text, equals('0')); - expect(getFieldValue(tester).selection, equals(const TextSelection.collapsed(offset: 1))); + expect( + getFieldValue(tester).selection, + equals(const TextSelection.collapsed(offset: 1)), + ); await tester.tap(find.byIcon(Icons.add)); await tester.pumpAndSettle(); @@ -64,7 +68,10 @@ void main() { await tester.enterText(find.byType(TextField), '123'); await tester.pumpAndSettle(); expect(getFieldValue(tester).text, equals('123')); - expect(getFieldValue(tester).selection, equals(const TextSelection.collapsed(offset: 3))); + expect( + getFieldValue(tester).selection, + equals(const TextSelection.collapsed(offset: 3)), + ); await tester.tap(find.byIcon(Icons.remove)); await tester.pumpAndSettle(); diff --git a/examples/api/test/widgets/text/text.0_test.dart b/examples/api/test/widgets/text/text.0_test.dart index 70b57cabe77..54eacab5917 100644 --- a/examples/api/test/widgets/text/text.0_test.dart +++ b/examples/api/test/widgets/text/text.0_test.dart @@ -18,7 +18,9 @@ void main() { // Because this example uses Material 3 and a light brightness, the text color // should be the color scheme `onSurface` color. - final Color textColor = ColorScheme.fromSeed(seedColor: Colors.purple).onSurface; + final Color textColor = ColorScheme.fromSeed( + seedColor: Colors.purple, + ).onSurface; expect(text.text.style!.color, textColor); }); } diff --git a/examples/api/test/widgets/text_editing_intents/editable_text_tap_up_outside_intent.0_test.dart b/examples/api/test/widgets/text_editing_intents/editable_text_tap_up_outside_intent.0_test.dart index ee9cd9522c7..865426c71a7 100644 --- a/examples/api/test/widgets/text_editing_intents/editable_text_tap_up_outside_intent.0_test.dart +++ b/examples/api/test/widgets/text_editing_intents/editable_text_tap_up_outside_intent.0_test.dart @@ -28,7 +28,9 @@ void main() { expect(textField.focusNode!.hasFocus, false); }); - testWidgets('Does not unfocus TextField on scroll', (WidgetTester tester) async { + testWidgets('Does not unfocus TextField on scroll', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.SampleApp()); final Finder finder = find.byType(TextField); diff --git a/examples/api/test/widgets/text_magnifier/text_magnifier.0_test.dart b/examples/api/test/widgets/text_magnifier/text_magnifier.0_test.dart index 465b1632e6c..629c47eb53a 100644 --- a/examples/api/test/widgets/text_magnifier/text_magnifier.0_test.dart +++ b/examples/api/test/widgets/text_magnifier/text_magnifier.0_test.dart @@ -4,30 +4,42 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; -import 'package:flutter_api_samples/widgets/text_magnifier/text_magnifier.0.dart' as example; +import 'package:flutter_api_samples/widgets/text_magnifier/text_magnifier.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; -List _globalize(Iterable points, RenderBox box) { +List _globalize( + Iterable points, + RenderBox box, +) { return points.map((TextSelectionPoint point) { return TextSelectionPoint(box.localToGlobal(point.point), point.direction); }).toList(); } -RenderEditable _findRenderEditable>(WidgetTester tester) { - return (tester.state(find.byType(TextField)) as TextSelectionGestureDetectorBuilderDelegate) +RenderEditable _findRenderEditable>( + WidgetTester tester, +) { + return (tester.state(find.byType(TextField)) + as TextSelectionGestureDetectorBuilderDelegate) .editableTextKey .currentState! .renderEditable; } -Offset _textOffsetToPosition>(WidgetTester tester, int offset) { +Offset _textOffsetToPosition>( + WidgetTester tester, + int offset, +) { final RenderEditable renderEditable = _findRenderEditable(tester); final List endpoints = renderEditable .getEndpointsForSelection(TextSelection.collapsed(offset: offset)) .map( - (TextSelectionPoint point) => - TextSelectionPoint(renderEditable.localToGlobal(point.point), point.direction), + (TextSelectionPoint point) => TextSelectionPoint( + renderEditable.localToGlobal(point.point), + point.direction, + ), ) .toList(); @@ -74,7 +86,9 @@ void main() { testWidgets( 'should show custom magnifier on drag', (WidgetTester tester) async { - await tester.pumpWidget(const example.TextMagnifierExampleApp(text: defaultText)); + await tester.pumpWidget( + const example.TextMagnifierExampleApp(text: defaultText), + ); await showMagnifier(tester, defaultText.indexOf('e')); expect(find.byType(example.CustomMagnifier), findsOneWidget); @@ -88,15 +102,21 @@ void main() { TargetPlatform.iOS, TargetPlatform.android, }), - skip: true, // This image is flaky. https://github.com/flutter/flutter/issues/144350 + // This image is flaky. https://github.com/flutter/flutter/issues/144350 + skip: true, ); - testWidgets('should show custom magnifier in RTL', (WidgetTester tester) async { + testWidgets('should show custom magnifier in RTL', ( + WidgetTester tester, + ) async { const String text = 'أثارت زر'; const String textToTapOn = 'ت'; await tester.pumpWidget( - const example.TextMagnifierExampleApp(textDirection: TextDirection.rtl, text: text), + const example.TextMagnifierExampleApp( + textDirection: TextDirection.rtl, + text: text, + ), ); await showMagnifier(tester, text.indexOf(textToTapOn)); diff --git a/examples/api/test/widgets/transitions/align_transition.0_test.dart b/examples/api/test/widgets/transitions/align_transition.0_test.dart index 86f1813f892..6cc56c127a1 100644 --- a/examples/api/test/widgets/transitions/align_transition.0_test.dart +++ b/examples/api/test/widgets/transitions/align_transition.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/transitions/align_transition.0.dart' as example; +import 'package:flutter_api_samples/widgets/transitions/align_transition.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -18,7 +19,8 @@ void main() { ); expect( find.byWidgetPredicate( - (Widget padding) => padding is Padding && padding.padding == const EdgeInsets.all(8.0), + (Widget padding) => + padding is Padding && padding.padding == const EdgeInsets.all(8.0), ), findsOneWidget, ); @@ -26,22 +28,34 @@ void main() { expect(find.byType(AlignTransition), findsOneWidget); }); - testWidgets('Animates repeatedly every 2 seconds', (WidgetTester tester) async { + testWidgets('Animates repeatedly every 2 seconds', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.AlignTransitionExampleApp()); final Finder paddingFinder = find.byWidgetPredicate( - (Widget padding) => padding is Padding && padding.padding == const EdgeInsets.all(8.0), + (Widget padding) => + padding is Padding && padding.padding == const EdgeInsets.all(8.0), ); - expect(tester.getBottomLeft(paddingFinder), tester.getBottomLeft(find.byType(AlignTransition))); + expect( + tester.getBottomLeft(paddingFinder), + tester.getBottomLeft(find.byType(AlignTransition)), + ); await tester.pump(const Duration(seconds: 2)); await tester.pump(); - expect(tester.getCenter(paddingFinder), tester.getCenter(find.byType(AlignTransition))); + expect( + tester.getCenter(paddingFinder), + tester.getCenter(find.byType(AlignTransition)), + ); await tester.pump(const Duration(seconds: 2)); await tester.pump(); - expect(tester.getBottomLeft(paddingFinder), tester.getBottomLeft(find.byType(AlignTransition))); + expect( + tester.getBottomLeft(paddingFinder), + tester.getBottomLeft(find.byType(AlignTransition)), + ); }); } diff --git a/examples/api/test/widgets/transitions/animated_builder.0_test.dart b/examples/api/test/widgets/transitions/animated_builder.0_test.dart index 48d02b1faee..91e495cdf58 100644 --- a/examples/api/test/widgets/transitions/animated_builder.0_test.dart +++ b/examples/api/test/widgets/transitions/animated_builder.0_test.dart @@ -5,7 +5,8 @@ import 'dart:math' as math; import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/transitions/animated_builder.0.dart' as example; +import 'package:flutter_api_samples/widgets/transitions/animated_builder.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -15,13 +16,18 @@ void main() { expect(find.byType(Container), findsOneWidget); expect( tester.widget(find.byType(Container)), - isA().having((Container container) => container.color, 'color', Colors.green), + isA().having( + (Container container) => container.color, + 'color', + Colors.green, + ), ); expect( find.byWidgetPredicate( (Widget widget) => - widget is Transform && widget.transform == Transform.rotate(angle: 0.0).transform, + widget is Transform && + widget.transform == Transform.rotate(angle: 0.0).transform, ), findsOneWidget, ); @@ -32,7 +38,8 @@ void main() { expect( find.byWidgetPredicate( (Widget widget) => - widget is Transform && widget.transform == Transform.rotate(angle: math.pi).transform, + widget is Transform && + widget.transform == Transform.rotate(angle: math.pi).transform, ), findsOneWidget, ); diff --git a/examples/api/test/widgets/transitions/animated_widget.0_test.dart b/examples/api/test/widgets/transitions/animated_widget.0_test.dart index e1daf56606f..dd0277bf5a2 100644 --- a/examples/api/test/widgets/transitions/animated_widget.0_test.dart +++ b/examples/api/test/widgets/transitions/animated_widget.0_test.dart @@ -5,7 +5,8 @@ import 'dart:math' as math; import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/transitions/animated_widget.0.dart' as example; +import 'package:flutter_api_samples/widgets/transitions/animated_widget.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -14,13 +15,18 @@ void main() { expect(find.byType(Container), findsOneWidget); expect( tester.widget(find.byType(Container)), - isA().having((Container container) => container.color, 'color', Colors.green), + isA().having( + (Container container) => container.color, + 'color', + Colors.green, + ), ); expect( find.byWidgetPredicate( (Widget widget) => - widget is Transform && widget.transform == Transform.rotate(angle: 0.0).transform, + widget is Transform && + widget.transform == Transform.rotate(angle: 0.0).transform, ), findsOneWidget, ); @@ -31,7 +37,8 @@ void main() { expect( find.byWidgetPredicate( (Widget widget) => - widget is Transform && widget.transform == Transform.rotate(angle: math.pi).transform, + widget is Transform && + widget.transform == Transform.rotate(angle: math.pi).transform, ), findsOneWidget, ); diff --git a/examples/api/test/widgets/transitions/decorated_box_transition.0_test.dart b/examples/api/test/widgets/transitions/decorated_box_transition.0_test.dart index 2ec3d8bebd0..b74b5c0fea6 100644 --- a/examples/api/test/widgets/transitions/decorated_box_transition.0_test.dart +++ b/examples/api/test/widgets/transitions/decorated_box_transition.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/transitions/decorated_box_transition.0.dart' as example; +import 'package:flutter_api_samples/widgets/transitions/decorated_box_transition.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -12,11 +13,17 @@ void main() { expect(find.byType(FlutterLogo), findsOneWidget); expect(find.byType(Center), findsOneWidget); expect( - find.descendant(of: find.byType(Center), matching: find.byType(FlutterLogo)), + find.descendant( + of: find.byType(Center), + matching: find.byType(FlutterLogo), + ), findsOneWidget, ); expect( - find.ancestor(of: find.byType(FlutterLogo), matching: find.byType(Container)), + find.ancestor( + of: find.byType(FlutterLogo), + matching: find.byType(Container), + ), findsAtLeast(1), ); expect(find.byType(DecoratedBoxTransition), findsOneWidget); diff --git a/examples/api/test/widgets/transitions/default_text_style_transition.0_test.dart b/examples/api/test/widgets/transitions/default_text_style_transition.0_test.dart index a204896f740..17e1fd9b782 100644 --- a/examples/api/test/widgets/transitions/default_text_style_transition.0_test.dart +++ b/examples/api/test/widgets/transitions/default_text_style_transition.0_test.dart @@ -8,19 +8,30 @@ import 'package:flutter_api_samples/widgets/transitions/default_text_style_trans import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Transforms text style periodically', (WidgetTester tester) async { - await tester.pumpWidget(const example.DefaultTextStyleTransitionExampleApp()); + testWidgets('Transforms text style periodically', ( + WidgetTester tester, + ) async { + await tester.pumpWidget( + const example.DefaultTextStyleTransitionExampleApp(), + ); expect(find.byType(Center), findsOneWidget); expect(find.byType(Text), findsOneWidget); expect(find.text('Flutter'), findsOneWidget); - expect(find.descendant(of: find.byType(Center), matching: find.byType(Text)), findsOneWidget); + expect( + find.descendant(of: find.byType(Center), matching: find.byType(Text)), + findsOneWidget, + ); expect(find.byType(DefaultTextStyleTransition), findsOneWidget); expect( tester.widget(find.byType(DefaultTextStyleTransition)), isA().having( (DefaultTextStyleTransition transition) => transition.style.value, 'style', - const TextStyle(fontSize: 50, color: Colors.blue, fontWeight: FontWeight.w900), + const TextStyle( + fontSize: 50, + color: Colors.blue, + fontWeight: FontWeight.w900, + ), ), ); @@ -32,7 +43,11 @@ void main() { isA().having( (DefaultTextStyleTransition transition) => transition.style.value, 'style', - const TextStyle(fontSize: 50, color: Colors.red, fontWeight: FontWeight.w100), + const TextStyle( + fontSize: 50, + color: Colors.red, + fontWeight: FontWeight.w100, + ), ), ); @@ -44,7 +59,11 @@ void main() { isA().having( (DefaultTextStyleTransition transition) => transition.style.value, 'style', - const TextStyle(fontSize: 50, color: Colors.blue, fontWeight: FontWeight.w900), + const TextStyle( + fontSize: 50, + color: Colors.blue, + fontWeight: FontWeight.w900, + ), ), ); }); diff --git a/examples/api/test/widgets/transitions/fade_transition.0_test.dart b/examples/api/test/widgets/transitions/fade_transition.0_test.dart index 1a04ca801f8..6fac690ff51 100644 --- a/examples/api/test/widgets/transitions/fade_transition.0_test.dart +++ b/examples/api/test/widgets/transitions/fade_transition.0_test.dart @@ -5,11 +5,14 @@ import 'dart:ui'; import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/transitions/fade_transition.0.dart' as example; +import 'package:flutter_api_samples/widgets/transitions/fade_transition.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Shows FlutterLogo inside a FadeTransition', (WidgetTester tester) async { + testWidgets('Shows FlutterLogo inside a FadeTransition', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.FadeTransitionExampleApp()); expect( @@ -41,7 +44,10 @@ void main() { final double t = example.FadeTransitionExampleApp.curve.transform(0.5); fadeTransition = tester.widget(fadeTransitionFinder); - expect(fadeTransition.opacity.value, equals(lerpDouble(beginOpacity, endOpacity, t))); + expect( + fadeTransition.opacity.value, + equals(lerpDouble(beginOpacity, endOpacity, t)), + ); // Advance animation to the end. await tester.pump(example.FadeTransitionExampleApp.duration ~/ 2); @@ -53,7 +59,10 @@ void main() { await tester.pump(example.FadeTransitionExampleApp.duration ~/ 2); fadeTransition = tester.widget(fadeTransitionFinder); - expect(fadeTransition.opacity.value, equals(lerpDouble(beginOpacity, endOpacity, t))); + expect( + fadeTransition.opacity.value, + equals(lerpDouble(beginOpacity, endOpacity, t)), + ); // Advance animation to the end. await tester.pump(example.FadeTransitionExampleApp.duration ~/ 2); diff --git a/examples/api/test/widgets/transitions/listenable_builder.0_test.dart b/examples/api/test/widgets/transitions/listenable_builder.0_test.dart index 45bbc60f737..f54f746dd70 100644 --- a/examples/api/test/widgets/transitions/listenable_builder.0_test.dart +++ b/examples/api/test/widgets/transitions/listenable_builder.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/transitions/listenable_builder.0.dart' as example; +import 'package:flutter_api_samples/widgets/transitions/listenable_builder.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -16,10 +17,13 @@ void main() { matching: find.byType(Container), ) .first; - Finder findChild() => find.descendant(of: findContainer(), matching: find.byType(Column)).first; + Finder findChild() => find + .descendant(of: findContainer(), matching: find.byType(Column)) + .first; bool childHasFocus() => Focus.of(tester.element(findChild())).hasFocus; Container getContainer() => tester.widget(findContainer()) as Container; - ShapeDecoration getDecoration() => getContainer().decoration! as ShapeDecoration; + ShapeDecoration getDecoration() => + getContainer().decoration! as ShapeDecoration; OutlinedBorder getBorder() => getDecoration().shape as OutlinedBorder; expect(find.text('Company'), findsOneWidget); diff --git a/examples/api/test/widgets/transitions/listenable_builder.1_test.dart b/examples/api/test/widgets/transitions/listenable_builder.1_test.dart index ee164f98846..0d520a0b1f2 100644 --- a/examples/api/test/widgets/transitions/listenable_builder.1_test.dart +++ b/examples/api/test/widgets/transitions/listenable_builder.1_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/transitions/listenable_builder.1.dart' as example; +import 'package:flutter_api_samples/widgets/transitions/listenable_builder.1.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { diff --git a/examples/api/test/widgets/transitions/listenable_builder.2_test.dart b/examples/api/test/widgets/transitions/listenable_builder.2_test.dart index cd8748d58af..8ef6d5bffd7 100644 --- a/examples/api/test/widgets/transitions/listenable_builder.2_test.dart +++ b/examples/api/test/widgets/transitions/listenable_builder.2_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/transitions/listenable_builder.2.dart' as example; +import 'package:flutter_api_samples/widgets/transitions/listenable_builder.2.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -13,7 +14,10 @@ void main() { expect(find.text('Current counter value:'), findsOneWidget); expect(find.byIcon(Icons.add), findsOneWidget); expect( - find.descendant(of: find.byType(FloatingActionButton), matching: find.byIcon(Icons.add)), + find.descendant( + of: find.byType(FloatingActionButton), + matching: find.byIcon(Icons.add), + ), findsOneWidget, ); diff --git a/examples/api/test/widgets/transitions/listenable_builder.3_test.dart b/examples/api/test/widgets/transitions/listenable_builder.3_test.dart index be38bab01ca..95d6f8fcd33 100644 --- a/examples/api/test/widgets/transitions/listenable_builder.3_test.dart +++ b/examples/api/test/widgets/transitions/listenable_builder.3_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/transitions/listenable_builder.3.dart' as example; +import 'package:flutter_api_samples/widgets/transitions/listenable_builder.3.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -16,12 +17,27 @@ void main() { expect(find.text('Current values:'), findsOneWidget); expect(find.byIcon(Icons.add), findsOneWidget); - expect((tester.widget(listContent) as example.ListBody).listNotifier.values.isEmpty, isTrue); + expect( + (tester.widget(listContent) as example.ListBody) + .listNotifier + .values + .isEmpty, + isTrue, + ); await tester.tap(find.byType(FloatingActionButton).first); await tester.pumpAndSettle(); - expect((tester.widget(listContent) as example.ListBody).listNotifier.values.isEmpty, isFalse); - expect((tester.widget(listContent) as example.ListBody).listNotifier.values, [1464685455]); + expect( + (tester.widget(listContent) as example.ListBody) + .listNotifier + .values + .isEmpty, + isFalse, + ); + expect( + (tester.widget(listContent) as example.ListBody).listNotifier.values, + [1464685455], + ); expect(find.text('1464685455'), findsOneWidget); }); } diff --git a/examples/api/test/widgets/transitions/matrix_transition.0_test.dart b/examples/api/test/widgets/transitions/matrix_transition.0_test.dart index eeb2c82a454..2f7044c2f17 100644 --- a/examples/api/test/widgets/transitions/matrix_transition.0_test.dart +++ b/examples/api/test/widgets/transitions/matrix_transition.0_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/transitions/matrix_transition.0.dart' as example; +import 'package:flutter_api_samples/widgets/transitions/matrix_transition.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Shows Flutter logo inside a MatrixTransition', (WidgetTester tester) async { + testWidgets('Shows Flutter logo inside a MatrixTransition', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.MatrixTransitionExampleApp()); final Finder transformFinder = find.ancestor( diff --git a/examples/api/test/widgets/transitions/positioned_transition.0_test.dart b/examples/api/test/widgets/transitions/positioned_transition.0_test.dart index 75c5458c2a9..75d474fd8ef 100644 --- a/examples/api/test/widgets/transitions/positioned_transition.0_test.dart +++ b/examples/api/test/widgets/transitions/positioned_transition.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/transitions/positioned_transition.0.dart' as example; +import 'package:flutter_api_samples/widgets/transitions/positioned_transition.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -14,7 +15,9 @@ void main() { expect(find.byType(PositionedTransition), findsOneWidget); }); - testWidgets('Animates repeatedly every 2 seconds', (WidgetTester tester) async { + testWidgets('Animates repeatedly every 2 seconds', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.PositionedTransitionExampleApp()); expect( diff --git a/examples/api/test/widgets/transitions/relative_positioned_transition.0_test.dart b/examples/api/test/widgets/transitions/relative_positioned_transition.0_test.dart index 85637846875..85e02ff98b8 100644 --- a/examples/api/test/widgets/transitions/relative_positioned_transition.0_test.dart +++ b/examples/api/test/widgets/transitions/relative_positioned_transition.0_test.dart @@ -9,14 +9,20 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('Shows flutter logo in transition', (WidgetTester tester) async { - await tester.pumpWidget(const example.RelativePositionedTransitionExampleApp()); + await tester.pumpWidget( + const example.RelativePositionedTransitionExampleApp(), + ); expect(find.byType(FlutterLogo), findsOneWidget); expect(find.byType(Padding), findsAtLeast(1)); expect(find.byType(RelativePositionedTransition), findsOneWidget); }); - testWidgets('Animates repeatedly every 2 seconds', (WidgetTester tester) async { - await tester.pumpWidget(const example.RelativePositionedTransitionExampleApp()); + testWidgets('Animates repeatedly every 2 seconds', ( + WidgetTester tester, + ) async { + await tester.pumpWidget( + const example.RelativePositionedTransitionExampleApp(), + ); expect( tester.getSize(find.byType(FlutterLogo)), diff --git a/examples/api/test/widgets/transitions/rotation_transition.0_test.dart b/examples/api/test/widgets/transitions/rotation_transition.0_test.dart index fad6f3b7682..9a4940c9068 100644 --- a/examples/api/test/widgets/transitions/rotation_transition.0_test.dart +++ b/examples/api/test/widgets/transitions/rotation_transition.0_test.dart @@ -3,11 +3,14 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/transitions/rotation_transition.0.dart' as example; +import 'package:flutter_api_samples/widgets/transitions/rotation_transition.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Shows flutter logo in rotation transition', (WidgetTester tester) async { + testWidgets('Shows flutter logo in rotation transition', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.RotationTransitionExampleApp()); expect( find.byWidgetPredicate( @@ -21,7 +24,10 @@ void main() { expect(find.byType(FlutterLogo), findsOneWidget); expect(find.byType(Padding), findsAtLeast(1)); expect( - find.descendant(of: find.byType(Center), matching: find.byType(FlutterLogo)), + find.descendant( + of: find.byType(Center), + matching: find.byType(FlutterLogo), + ), findsOneWidget, ); @@ -46,7 +52,9 @@ void main() { widget is RotationTransition && widget.turns is CurvedAnimation && (widget.turns as CurvedAnimation).parent is AnimationController && - ((widget.turns as CurvedAnimation).parent as AnimationController).value == 0.5 && + ((widget.turns as CurvedAnimation).parent as AnimationController) + .value == + 0.5 && widget.turns.status == AnimationStatus.reverse, ), findsOneWidget, diff --git a/examples/api/test/widgets/transitions/scale_transition.0_test.dart b/examples/api/test/widgets/transitions/scale_transition.0_test.dart index f20c4d2c979..bd84ecac7e2 100644 --- a/examples/api/test/widgets/transitions/scale_transition.0_test.dart +++ b/examples/api/test/widgets/transitions/scale_transition.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/transitions/scale_transition.0.dart' as example; +import 'package:flutter_api_samples/widgets/transitions/scale_transition.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -12,7 +13,10 @@ void main() { expect(find.byType(FlutterLogo), findsOneWidget); expect(find.byType(Center), findsOneWidget); expect( - find.descendant(of: find.byType(Center), matching: find.byType(ScaleTransition)), + find.descendant( + of: find.byType(Center), + matching: find.byType(ScaleTransition), + ), findsOneWidget, ); expect( diff --git a/examples/api/test/widgets/transitions/size_transition.0_test.dart b/examples/api/test/widgets/transitions/size_transition.0_test.dart index eb6137fd21e..67f209f7930 100644 --- a/examples/api/test/widgets/transitions/size_transition.0_test.dart +++ b/examples/api/test/widgets/transitions/size_transition.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/transitions/size_transition.0.dart' as example; +import 'package:flutter_api_samples/widgets/transitions/size_transition.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -12,7 +13,10 @@ void main() { expect(find.byType(FlutterLogo), findsOneWidget); expect(find.byType(Center), findsOneWidget); expect( - find.descendant(of: find.byType(Center), matching: find.byType(FlutterLogo)), + find.descendant( + of: find.byType(Center), + matching: find.byType(FlutterLogo), + ), findsOneWidget, ); expect(find.byType(SizeTransition), findsOneWidget); @@ -20,8 +24,16 @@ void main() { expect( tester.widget(find.byType(SizeTransition)), isA() - .having((SizeTransition transition) => transition.axis, 'axis', Axis.horizontal) - .having((SizeTransition transition) => transition.axisAlignment, 'axis alignment', -1) + .having( + (SizeTransition transition) => transition.axis, + 'axis', + Axis.horizontal, + ) + .having( + (SizeTransition transition) => transition.axisAlignment, + 'axis alignment', + -1, + ) .having( (SizeTransition transition) => transition.sizeFactor, 'factor', diff --git a/examples/api/test/widgets/transitions/slide_transition.0_test.dart b/examples/api/test/widgets/transitions/slide_transition.0_test.dart index 7dd51699174..e9e160e2164 100644 --- a/examples/api/test/widgets/transitions/slide_transition.0_test.dart +++ b/examples/api/test/widgets/transitions/slide_transition.0_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/transitions/slide_transition.0.dart' as example; +import 'package:flutter_api_samples/widgets/transitions/slide_transition.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -22,15 +23,21 @@ void main() { ); }); - testWidgets('Animates repeatedly every 2 seconds', (WidgetTester tester) async { + testWidgets('Animates repeatedly every 2 seconds', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.SlideTransitionExampleApp()); - expect(tester.getCenter(find.byType(FlutterLogo)), tester.getCenter(find.byType(Center))); + expect( + tester.getCenter(find.byType(FlutterLogo)), + tester.getCenter(find.byType(Center)), + ); await tester.pump(const Duration(seconds: 2)); await tester.pump(); - final double width = tester.getSize(find.byType(FlutterLogo)).width + 2 * 8.0; + final double width = + tester.getSize(find.byType(FlutterLogo)).width + 2 * 8.0; expect( tester.getCenter(find.byType(FlutterLogo)).dx, tester.getCenter(find.byType(Center)).dx + 1.5 * width, @@ -39,6 +46,9 @@ void main() { await tester.pump(const Duration(seconds: 2)); await tester.pump(); - expect(tester.getCenter(find.byType(FlutterLogo)), tester.getCenter(find.byType(Center))); + expect( + tester.getCenter(find.byType(FlutterLogo)), + tester.getCenter(find.byType(Center)), + ); }); } diff --git a/examples/api/test/widgets/transitions/sliver_fade_transition.0_test.dart b/examples/api/test/widgets/transitions/sliver_fade_transition.0_test.dart index 0e6927e2399..19ebbb246dc 100644 --- a/examples/api/test/widgets/transitions/sliver_fade_transition.0_test.dart +++ b/examples/api/test/widgets/transitions/sliver_fade_transition.0_test.dart @@ -4,7 +4,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; -import 'package:flutter_api_samples/widgets/transitions/sliver_fade_transition.0.dart' as example; +import 'package:flutter_api_samples/widgets/transitions/sliver_fade_transition.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -15,13 +16,15 @@ void main() { expect(find.byType(CustomScrollView), findsOneWidget); expect( find.byWidgetPredicate( - (Widget widget) => widget is Container && widget.color == Colors.indigo[200], + (Widget widget) => + widget is Container && widget.color == Colors.indigo[200], ), findsNWidgets(3), ); expect( find.byWidgetPredicate( - (Widget widget) => widget is Container && widget.color == Colors.orange[200], + (Widget widget) => + widget is Container && widget.color == Colors.orange[200], ), findsNWidgets(2), ); diff --git a/examples/api/test/widgets/tween_animation_builder/tween_animation_builder.0_test.dart b/examples/api/test/widgets/tween_animation_builder/tween_animation_builder.0_test.dart index 72bbba628c1..f3439eb0e28 100644 --- a/examples/api/test/widgets/tween_animation_builder/tween_animation_builder.0_test.dart +++ b/examples/api/test/widgets/tween_animation_builder/tween_animation_builder.0_test.dart @@ -37,7 +37,9 @@ void main() { expect(iconButton.iconSize, equals(endSize)); }); - testWidgets('Animates icon size on IconButton tap', (WidgetTester tester) async { + testWidgets('Animates icon size on IconButton tap', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.TweenAnimationBuilderExampleApp()); await tester.pumpAndSettle(); @@ -91,7 +93,9 @@ void main() { expect(iconButton.iconSize, equals(beginSize)); }); - testWidgets('Animation target can be updated during the animation', (WidgetTester tester) async { + testWidgets('Animation target can be updated during the animation', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.TweenAnimationBuilderExampleApp()); await tester.pumpAndSettle(); diff --git a/examples/api/test/widgets/undo_history/undo_history_controller.0_test.dart b/examples/api/test/widgets/undo_history/undo_history_controller.0_test.dart index f2e20b23c76..226660e465d 100644 --- a/examples/api/test/widgets/undo_history/undo_history_controller.0_test.dart +++ b/examples/api/test/widgets/undo_history/undo_history_controller.0_test.dart @@ -3,48 +3,50 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/undo_history/undo_history_controller.0.dart' as example; +import 'package:flutter_api_samples/widgets/undo_history/undo_history_controller.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('The undo history controller should undo and redo the history changes', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.UndoHistoryControllerExampleApp()); + testWidgets( + 'The undo history controller should undo and redo the history changes', + (WidgetTester tester) async { + await tester.pumpWidget(const example.UndoHistoryControllerExampleApp()); - // Equals to UndoHistoryState._kThrottleDuration. - const Duration kThrottleDuration = Duration(milliseconds: 500); + // Equals to UndoHistoryState._kThrottleDuration. + const Duration kThrottleDuration = Duration(milliseconds: 500); - expect(find.byType(TextField), findsOne); - expect(find.widgetWithText(TextButton, 'Undo'), findsOne); - expect(find.widgetWithText(TextButton, 'Redo'), findsOne); + expect(find.byType(TextField), findsOne); + expect(find.widgetWithText(TextButton, 'Undo'), findsOne); + expect(find.widgetWithText(TextButton, 'Redo'), findsOne); - await tester.enterText(find.byType(TextField), '1st change'); - await tester.pump(kThrottleDuration); - expect(find.text('1st change'), findsOne); + await tester.enterText(find.byType(TextField), '1st change'); + await tester.pump(kThrottleDuration); + expect(find.text('1st change'), findsOne); - await tester.enterText(find.byType(TextField), '2nd change'); - await tester.pump(kThrottleDuration); - expect(find.text('2nd change'), findsOne); + await tester.enterText(find.byType(TextField), '2nd change'); + await tester.pump(kThrottleDuration); + expect(find.text('2nd change'), findsOne); - await tester.enterText(find.byType(TextField), '3rd change'); - await tester.pump(kThrottleDuration); - expect(find.text('3rd change'), findsOne); + await tester.enterText(find.byType(TextField), '3rd change'); + await tester.pump(kThrottleDuration); + expect(find.text('3rd change'), findsOne); - await tester.tap(find.text('Undo')); - await tester.pump(); - expect(find.text('2nd change'), findsOne); + await tester.tap(find.text('Undo')); + await tester.pump(); + expect(find.text('2nd change'), findsOne); - await tester.tap(find.text('Undo')); - await tester.pump(); - expect(find.text('1st change'), findsOne); + await tester.tap(find.text('Undo')); + await tester.pump(); + expect(find.text('1st change'), findsOne); - await tester.tap(find.text('Redo')); - await tester.pump(); - expect(find.text('2nd change'), findsOne); + await tester.tap(find.text('Redo')); + await tester.pump(); + expect(find.text('2nd change'), findsOne); - await tester.tap(find.text('Redo')); - await tester.pump(); - expect(find.text('3rd change'), findsOne); - }); + await tester.tap(find.text('Redo')); + await tester.pump(); + expect(find.text('3rd change'), findsOne); + }, + ); } diff --git a/examples/api/test/widgets/value_listenable_builder/value_listenable_builder.0_test.dart b/examples/api/test/widgets/value_listenable_builder/value_listenable_builder.0_test.dart index c9fa244f111..86e97ab1651 100644 --- a/examples/api/test/widgets/value_listenable_builder/value_listenable_builder.0_test.dart +++ b/examples/api/test/widgets/value_listenable_builder/value_listenable_builder.0_test.dart @@ -13,13 +13,19 @@ void main() { String getCount() { return (tester.widget( - find.descendant(of: find.byType(example.CountDisplay), matching: find.byType(Text)), + find.descendant( + of: find.byType(example.CountDisplay), + matching: find.byType(Text), + ), ) as Text) .data!; } - expect(find.text('You have pushed the button this many times:'), findsOneWidget); + expect( + find.text('You have pushed the button this many times:'), + findsOneWidget, + ); expect(find.text('0'), findsOneWidget); expect(find.byIcon(Icons.plus_one), findsOneWidget); expect(getCount(), equals('0')); diff --git a/examples/api/test/widgets/widget_state/widget_state_border_side.0_test.dart b/examples/api/test/widgets/widget_state/widget_state_border_side.0_test.dart index bcdb85df010..402a83ca07e 100644 --- a/examples/api/test/widgets/widget_state/widget_state_border_side.0_test.dart +++ b/examples/api/test/widgets/widget_state/widget_state_border_side.0_test.dart @@ -27,7 +27,9 @@ void main() { await tester.pumpWidget(const example.WidgetStateBorderSideExampleApp()); // Hover over the FilterChip. - final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); + final TestGesture gesture = await tester.createGesture( + kind: PointerDeviceKind.mouse, + ); await gesture.moveTo(tester.getCenter(find.byType(FilterChip))); await tester.pumpAndSettle(); @@ -57,17 +59,21 @@ void main() { expect(findByBorderColor(Colors.red), findsOneWidget); }); - testWidgets('FilterChip displays the correct border color when not selected', ( - WidgetTester tester, - ) async { - await tester.pumpWidget(const example.WidgetStateBorderSideExampleApp()); + testWidgets( + 'FilterChip displays the correct border color when not selected', + (WidgetTester tester) async { + await tester.pumpWidget(const example.WidgetStateBorderSideExampleApp()); - await tester.tap(find.byType(FilterChip)); - await tester.pumpAndSettle(); + await tester.tap(find.byType(FilterChip)); + await tester.pumpAndSettle(); - final ThemeData theme = Theme.of(tester.element(find.byType(FilterChip))); + final ThemeData theme = Theme.of(tester.element(find.byType(FilterChip))); - // FilterChip's border color defaults to ColorScheme.outlineVariant. - expect(findByBorderColor(theme.colorScheme.outlineVariant), findsOneWidget); - }); + // FilterChip's border color defaults to ColorScheme.outlineVariant. + expect( + findByBorderColor(theme.colorScheme.outlineVariant), + findsOneWidget, + ); + }, + ); } diff --git a/examples/api/test/widgets/widget_state/widget_state_mouse_cursor.0_test.dart b/examples/api/test/widgets/widget_state/widget_state_mouse_cursor.0_test.dart index 8faed3943b1..8f0e01cbe7d 100644 --- a/examples/api/test/widgets/widget_state/widget_state_mouse_cursor.0_test.dart +++ b/examples/api/test/widgets/widget_state/widget_state_mouse_cursor.0_test.dart @@ -11,10 +11,14 @@ import 'package:flutter_api_samples/widgets/widget_state/widget_state_mouse_curs import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('ListTile displays correct mouse cursor when disabled', (WidgetTester tester) async { + testWidgets('ListTile displays correct mouse cursor when disabled', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.WidgetStateMouseCursorExampleApp()); - final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); + final TestGesture gesture = await tester.createGesture( + kind: PointerDeviceKind.mouse, + ); await gesture.addPointer(location: tester.getCenter(find.byType(ListTile))); addTearDown(gesture.removePointer); @@ -38,14 +42,18 @@ void main() { expect(listTile.enabled, isTrue); }); - testWidgets('ListTile displays correct mouse cursor when enabled', (WidgetTester tester) async { + testWidgets('ListTile displays correct mouse cursor when enabled', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.WidgetStateMouseCursorExampleApp()); // Enable ListTile using Switch. await tester.tap(find.byType(Switch)); await tester.pumpAndSettle(); - final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); + final TestGesture gesture = await tester.createGesture( + kind: PointerDeviceKind.mouse, + ); await gesture.addPointer(location: tester.getCenter(find.byType(ListTile))); addTearDown(gesture.removePointer); diff --git a/examples/api/test/widgets/widget_state/widget_state_outlined_border.0_test.dart b/examples/api/test/widgets/widget_state/widget_state_outlined_border.0_test.dart index f3c37335df0..37de86ea1f9 100644 --- a/examples/api/test/widgets/widget_state/widget_state_outlined_border.0_test.dart +++ b/examples/api/test/widgets/widget_state/widget_state_outlined_border.0_test.dart @@ -20,11 +20,19 @@ void main() { ); } - testWidgets('FilterChip displays the correct border when selected', (WidgetTester tester) async { - await tester.pumpWidget(const example.WidgetStateOutlinedBorderExampleApp()); + testWidgets('FilterChip displays the correct border when selected', ( + WidgetTester tester, + ) async { + await tester.pumpWidget( + const example.WidgetStateOutlinedBorderExampleApp(), + ); expect( - findBorderShape(const RoundedRectangleBorder(side: BorderSide(color: Colors.transparent))), + findBorderShape( + const RoundedRectangleBorder( + side: BorderSide(color: Colors.transparent), + ), + ), findsOne, ); }); @@ -32,7 +40,9 @@ void main() { testWidgets('FilterChip displays the correct border when not selected', ( WidgetTester tester, ) async { - await tester.pumpWidget(const example.WidgetStateOutlinedBorderExampleApp()); + await tester.pumpWidget( + const example.WidgetStateOutlinedBorderExampleApp(), + ); await tester.tap(find.byType(FilterChip)); await tester.pumpAndSettle(); diff --git a/examples/api/test/widgets/widget_state/widget_state_property.0_test.dart b/examples/api/test/widgets/widget_state/widget_state_property.0_test.dart index f035bd2113a..62f48654f5e 100644 --- a/examples/api/test/widgets/widget_state/widget_state_property.0_test.dart +++ b/examples/api/test/widgets/widget_state/widget_state_property.0_test.dart @@ -5,7 +5,8 @@ import 'dart:ui'; import 'package:flutter/material.dart'; -import 'package:flutter_api_samples/widgets/widget_state/widget_state_property.0.dart' as example; +import 'package:flutter_api_samples/widgets/widget_state/widget_state_property.0.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -16,19 +17,25 @@ void main() { return textStyle.color; } - testWidgets('Displays red colored text by default', (WidgetTester tester) async { + testWidgets('Displays red colored text by default', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.WidgetStatePropertyExampleApp()); expect(getTextColor(tester), Colors.red); }); - testWidgets('Displays blue colored text when button is hovered', (WidgetTester tester) async { + testWidgets('Displays blue colored text when button is hovered', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.WidgetStatePropertyExampleApp()); expect(getTextColor(tester), Colors.red); // Hover over the TextButton. - final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); + final TestGesture gesture = await tester.createGesture( + kind: PointerDeviceKind.mouse, + ); await gesture.moveTo(tester.getCenter(find.byType(TextButton))); await tester.pumpAndSettle(); @@ -36,7 +43,9 @@ void main() { expect(getTextColor(tester), Colors.blue); }); - testWidgets('Displays blue colored text when button is pressed', (WidgetTester tester) async { + testWidgets('Displays blue colored text when button is pressed', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.WidgetStatePropertyExampleApp()); expect(getTextColor(tester), Colors.red); @@ -50,7 +59,9 @@ void main() { expect(getTextColor(tester), Colors.blue); }); - testWidgets('Displays blue colored text when button is focused', (WidgetTester tester) async { + testWidgets('Displays blue colored text when button is focused', ( + WidgetTester tester, + ) async { await tester.pumpWidget(const example.WidgetStatePropertyExampleApp()); expect(getTextColor(tester), Colors.red); diff --git a/examples/api/test/widgets/windows/tooltip.0_test.dart b/examples/api/test/widgets/windows/tooltip.0_test.dart index ef4e6016160..a0ac3445821 100644 --- a/examples/api/test/widgets/windows/tooltip.0_test.dart +++ b/examples/api/test/widgets/windows/tooltip.0_test.dart @@ -6,7 +6,9 @@ import 'package:flutter_api_samples/widgets/windows/tooltip.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Calling tooltip main returns normally', (WidgetTester tester) async { + testWidgets('Calling tooltip main returns normally', ( + WidgetTester tester, + ) async { expect(() => example.main(), returnsNormally); }); } diff --git a/packages/flutter/lib/src/cupertino/checkbox.dart b/packages/flutter/lib/src/cupertino/checkbox.dart index 6a749ed4f3d..cdb39832dfb 100644 --- a/packages/flutter/lib/src/cupertino/checkbox.dart +++ b/packages/flutter/lib/src/cupertino/checkbox.dart @@ -213,7 +213,7 @@ class CupertinoCheckbox extends StatefulWidget { /// onChanged: (_){}, /// fillColor: WidgetStateProperty.resolveWith((Set states) { /// if (states.contains(WidgetState.disabled)) { - /// return Colors.orange.withOpacity(.32); + /// return Colors.orange.withValues(alpha: .32); /// } /// return Colors.orange; /// }) diff --git a/packages/flutter/lib/src/cupertino/radio.dart b/packages/flutter/lib/src/cupertino/radio.dart index 217f363ee1f..aef72b01fe3 100644 --- a/packages/flutter/lib/src/cupertino/radio.dart +++ b/packages/flutter/lib/src/cupertino/radio.dart @@ -143,7 +143,9 @@ class CupertinoRadio extends StatefulWidget { /// ```dart /// CupertinoRadio( /// value: SingingCharacter.lafayette, + /// // ignore: deprecated_member_use /// groupValue: _character, + /// // ignore: deprecated_member_use /// onChanged: (SingingCharacter? newValue) { /// setState(() { /// _character = newValue; diff --git a/packages/flutter/lib/src/cupertino/switch.dart b/packages/flutter/lib/src/cupertino/switch.dart index a69cc68b38d..9859379f359 100644 --- a/packages/flutter/lib/src/cupertino/switch.dart +++ b/packages/flutter/lib/src/cupertino/switch.dart @@ -308,7 +308,7 @@ class CupertinoSwitch extends StatefulWidget { /// onChanged: (bool value) { }, /// trackOutlineColor: WidgetStateProperty.resolveWith((Set states) { /// if (states.contains(WidgetState.disabled)) { - /// return CupertinoColors.activeOrange.withOpacity(.48); + /// return CupertinoColors.activeOrange.withValues(alpha: .48); /// } /// return null; // Use the default color. /// }), diff --git a/packages/flutter/lib/src/foundation/diagnostics.dart b/packages/flutter/lib/src/foundation/diagnostics.dart index be5d84f8a5c..283cf2a854d 100644 --- a/packages/flutter/lib/src/foundation/diagnostics.dart +++ b/packages/flutter/lib/src/foundation/diagnostics.dart @@ -3007,6 +3007,7 @@ String describeIdentity(Object? object) => /// /// void validateDescribeEnum() { /// assert(Day.monday.toString() == 'Day.monday'); +/// // ignore: deprecated_member_use /// assert(describeEnum(Day.monday) == 'monday'); /// assert(Day.monday.name == 'monday'); // preferred for real enums /// } diff --git a/packages/flutter/lib/src/material/button_bar.dart b/packages/flutter/lib/src/material/button_bar.dart index bd3c75205f3..e24ecc856de 100644 --- a/packages/flutter/lib/src/material/button_bar.dart +++ b/packages/flutter/lib/src/material/button_bar.dart @@ -26,6 +26,7 @@ import 'dialog.dart'; /// /// ```dart /// // Before +/// // ignore: deprecated_member_use /// ButtonBar( /// alignment: MainAxisAlignment.spaceEvenly, /// children: [ diff --git a/packages/flutter/lib/src/material/button_bar_theme.dart b/packages/flutter/lib/src/material/button_bar_theme.dart index b7379edec88..cbafcc24141 100644 --- a/packages/flutter/lib/src/material/button_bar_theme.dart +++ b/packages/flutter/lib/src/material/button_bar_theme.dart @@ -280,6 +280,7 @@ class ButtonBarTheme extends InheritedWidget { /// Typical usage is as follows: /// /// ```dart + /// // ignore: deprecated_member_use /// ButtonBarThemeData theme = ButtonBarTheme.of(context); /// ``` static ButtonBarThemeData of(BuildContext context) { diff --git a/packages/flutter/lib/src/material/button_style.dart b/packages/flutter/lib/src/material/button_style.dart index 9a3068f5579..74ebec4e6eb 100644 --- a/packages/flutter/lib/src/material/button_style.dart +++ b/packages/flutter/lib/src/material/button_style.dart @@ -64,7 +64,7 @@ typedef ButtonLayerBuilder = /// backgroundColor: WidgetStateProperty.resolveWith( /// (Set states) { /// if (states.contains(WidgetState.pressed)) { -/// return Theme.of(context).colorScheme.primary.withOpacity(0.5); +/// return Theme.of(context).colorScheme.primary.withValues(alpha: 0.5); /// } /// return null; // Use the component's default. /// }, diff --git a/packages/flutter/lib/src/material/checkbox.dart b/packages/flutter/lib/src/material/checkbox.dart index c50f6c9d184..a3923751026 100644 --- a/packages/flutter/lib/src/material/checkbox.dart +++ b/packages/flutter/lib/src/material/checkbox.dart @@ -226,7 +226,7 @@ class Checkbox extends StatefulWidget { /// onChanged: (_){}, /// fillColor: WidgetStateProperty.resolveWith((Set states) { /// if (states.contains(WidgetState.disabled)) { - /// return Colors.orange.withOpacity(.32); + /// return Colors.orange.withValues(alpha: .32); /// } /// return Colors.orange; /// }) diff --git a/packages/flutter/lib/src/material/data_table.dart b/packages/flutter/lib/src/material/data_table.dart index 12d743a7ae4..cd402da05ef 100644 --- a/packages/flutter/lib/src/material/data_table.dart +++ b/packages/flutter/lib/src/material/data_table.dart @@ -240,7 +240,7 @@ class DataRow { /// DataRow( /// color: WidgetStateProperty.resolveWith((Set states) { /// if (states.contains(WidgetState.selected)) { - /// return Theme.of(context).colorScheme.primary.withOpacity(0.08); + /// return Theme.of(context).colorScheme.primary.withValues(alpha: 0.08); /// } /// return null; // Use the default value. /// }), @@ -588,7 +588,7 @@ class DataTable extends StatelessWidget { /// DataTable( /// dataRowColor: WidgetStateProperty.resolveWith((Set states) { /// if (states.contains(WidgetState.selected)) { - /// return Theme.of(context).colorScheme.primary.withOpacity(0.08); + /// return Theme.of(context).colorScheme.primary.withValues(alpha: 0.08); /// } /// return null; // Use the default value. /// }), @@ -663,7 +663,7 @@ class DataTable extends StatelessWidget { /// rows: _rows, /// headingRowColor: WidgetStateProperty.resolveWith((Set states) { /// if (states.contains(WidgetState.hovered)) { - /// return Theme.of(context).colorScheme.primary.withOpacity(0.08); + /// return Theme.of(context).colorScheme.primary.withValues(alpha: 0.08); /// } /// return null; // Use the default value. /// }), diff --git a/packages/flutter/lib/src/material/date_picker_theme.dart b/packages/flutter/lib/src/material/date_picker_theme.dart index 0a9a297f5f1..17b6018f9cc 100644 --- a/packages/flutter/lib/src/material/date_picker_theme.dart +++ b/packages/flutter/lib/src/material/date_picker_theme.dart @@ -218,13 +218,13 @@ class DatePickerThemeData with Diagnosticable { /// ```dart /// dayOverlayColor: WidgetStateProperty.resolveWith((Set states) { /// if (states.contains(WidgetState.pressed)) { - /// return Colors.blue.withOpacity(0.12); + /// return Colors.blue.withValues(alpha: 0.12); /// } /// if (states.contains(WidgetState.hovered)) { - /// return Colors.blue.withOpacity(0.08); + /// return Colors.blue.withValues(alpha: 0.08); /// } /// if (states.contains(WidgetState.focused)) { - /// return Colors.blue.withOpacity(0.12); + /// return Colors.blue.withValues(alpha: 0.12); /// } /// return null; // Use the default color. /// }) diff --git a/packages/flutter/lib/src/material/icon_button.dart b/packages/flutter/lib/src/material/icon_button.dart index e04c8a1dec2..4c75ee817cf 100644 --- a/packages/flutter/lib/src/material/icon_button.dart +++ b/packages/flutter/lib/src/material/icon_button.dart @@ -401,7 +401,7 @@ class IconButton extends StatelessWidget { /// /// ```dart /// IconButton( - /// focusColor: Colors.orange.withOpacity(0.3), + /// focusColor: Colors.orange.withValues(alpha: 0.3), /// icon: const Icon(Icons.sunny), /// onPressed: () { /// // ... @@ -421,7 +421,7 @@ class IconButton extends StatelessWidget { /// /// ```dart /// IconButton( - /// hoverColor: Colors.orange.withOpacity(0.3), + /// hoverColor: Colors.orange.withValues(alpha: 0.3), /// icon: const Icon(Icons.ac_unit), /// onPressed: () { /// // ... @@ -474,7 +474,7 @@ class IconButton extends StatelessWidget { /// /// ```dart /// IconButton( - /// highlightColor: Colors.orange.withOpacity(0.3), + /// highlightColor: Colors.orange.withValues(alpha: 0.3), /// icon: const Icon(Icons.question_mark), /// onPressed: () { /// // ... diff --git a/packages/flutter/lib/src/material/material_state.dart b/packages/flutter/lib/src/material/material_state.dart index c9fa4f7285f..8698163f3f0 100644 --- a/packages/flutter/lib/src/material/material_state.dart +++ b/packages/flutter/lib/src/material/material_state.dart @@ -112,6 +112,7 @@ typedef MaterialPropertyResolver = WidgetPropertyResolver; /// This example defines a [MaterialStateColor] with a const constructor. /// /// ```dart +/// // ignore: deprecated_member_use /// class MyColor extends MaterialStateColor { /// const MyColor() : super(_defaultColor); /// @@ -119,7 +120,9 @@ typedef MaterialPropertyResolver = WidgetPropertyResolver; /// static const int _pressedColor = 0xdeadbeef; /// /// @override +/// // ignore: deprecated_member_use /// Color resolve(Set states) { +/// // ignore: deprecated_member_use /// if (states.contains(MaterialState.pressed)) { /// return const Color(_pressedColor); /// } diff --git a/packages/flutter/lib/src/material/menu_style.dart b/packages/flutter/lib/src/material/menu_style.dart index 3ea2f96f6ac..31201cfead5 100644 --- a/packages/flutter/lib/src/material/menu_style.dart +++ b/packages/flutter/lib/src/material/menu_style.dart @@ -55,7 +55,7 @@ import 'theme_data.dart'; /// backgroundColor: WidgetStateProperty.resolveWith( /// (Set states) { /// if (states.contains(WidgetState.focused)) { -/// return Theme.of(context).colorScheme.primary.withOpacity(0.5); +/// return Theme.of(context).colorScheme.primary.withValues(alpha: 0.5); /// } /// return null; // Use the component's default. /// }, diff --git a/packages/flutter/lib/src/material/radio.dart b/packages/flutter/lib/src/material/radio.dart index c265b819006..47eb710d084 100644 --- a/packages/flutter/lib/src/material/radio.dart +++ b/packages/flutter/lib/src/material/radio.dart @@ -216,7 +216,9 @@ class Radio extends StatefulWidget { /// ```dart /// Radio( /// value: SingingCharacter.lafayette, + /// // ignore: deprecated_member_use /// groupValue: _character, + /// // ignore: deprecated_member_use /// onChanged: (SingingCharacter? newValue) { /// setState(() { /// _character = newValue; @@ -275,7 +277,7 @@ class Radio extends StatefulWidget { /// value: 1, /// fillColor: WidgetStateProperty.resolveWith((Set states) { /// if (states.contains(WidgetState.disabled)) { - /// return Colors.orange.withOpacity(.32); + /// return Colors.orange.withValues(alpha: .32); /// } /// return Colors.orange; /// }) diff --git a/packages/flutter/lib/src/material/radio_list_tile.dart b/packages/flutter/lib/src/material/radio_list_tile.dart index 4c8cb217aa3..dc40689105f 100644 --- a/packages/flutter/lib/src/material/radio_list_tile.dart +++ b/packages/flutter/lib/src/material/radio_list_tile.dart @@ -294,7 +294,9 @@ class RadioListTile extends StatefulWidget { /// RadioListTile( /// title: const Text('Lafayette'), /// value: SingingCharacter.lafayette, + /// // ignore: deprecated_member_use /// groupValue: _character, + /// // ignore: deprecated_member_use /// onChanged: (SingingCharacter? newValue) { /// setState(() { /// _character = newValue; diff --git a/packages/flutter/lib/src/material/switch.dart b/packages/flutter/lib/src/material/switch.dart index 93fd7c91194..725457cf93b 100644 --- a/packages/flutter/lib/src/material/switch.dart +++ b/packages/flutter/lib/src/material/switch.dart @@ -323,7 +323,7 @@ class Switch extends StatelessWidget { /// onChanged: (bool value) { }, /// thumbColor: WidgetStateProperty.resolveWith((Set states) { /// if (states.contains(WidgetState.disabled)) { - /// return Colors.orange.withOpacity(.48); + /// return Colors.orange.withValues(alpha: .48); /// } /// return Colors.orange; /// }), @@ -364,7 +364,7 @@ class Switch extends StatelessWidget { /// onChanged: (bool value) { }, /// thumbColor: WidgetStateProperty.resolveWith((Set states) { /// if (states.contains(WidgetState.disabled)) { - /// return Colors.orange.withOpacity(.48); + /// return Colors.orange.withValues(alpha: .48); /// } /// return Colors.orange; /// }), @@ -405,7 +405,7 @@ class Switch extends StatelessWidget { /// onChanged: (bool value) { }, /// trackOutlineColor: WidgetStateProperty.resolveWith((Set states) { /// if (states.contains(WidgetState.disabled)) { - /// return Colors.orange.withOpacity(.48); + /// return Colors.orange.withValues(alpha: .48); /// } /// return null; // Use the default color. /// }), diff --git a/packages/flutter/lib/src/material/time_picker_theme.dart b/packages/flutter/lib/src/material/time_picker_theme.dart index 443c278ef66..7eced5047fd 100644 --- a/packages/flutter/lib/src/material/time_picker_theme.dart +++ b/packages/flutter/lib/src/material/time_picker_theme.dart @@ -98,7 +98,7 @@ class TimePickerThemeData with Diagnosticable { /// ```dart /// BorderSide( /// color: Color.alphaBlend( - /// Theme.of(context).colorScheme.onSurface.withOpacity(0.38), + /// Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.38), /// Theme.of(context).colorScheme.surface, /// ), /// ), @@ -112,9 +112,9 @@ class TimePickerThemeData with Diagnosticable { /// if the segment is selected or not. /// /// By default, if the segment is selected, the overall theme's - /// `ColorScheme.primary.withOpacity(0.12)` is used when the overall theme's + /// `ColorScheme.primary.withValues(alpha: 0.12)` is used when the overall theme's /// brightness is [Brightness.light] and - /// `ColorScheme.primary.withOpacity(0.24)` is used when the overall theme's + /// `ColorScheme.primary.withValues(alpha: 0.24)` is used when the overall theme's /// brightness is [Brightness.dark]. /// If the segment is not selected, [Colors.transparent] is used to allow the /// [Dialog]'s color to be used. @@ -211,10 +211,11 @@ class TimePickerThemeData with Diagnosticable { /// /// If this is null, the time picker defaults to: /// - /// /// ```dart - /// Theme.of(context).colorScheme.onSurface.withOpacity( - /// Theme.of(context).colorScheme.brightness == Brightness.dark ? 1.0 : 0.6, + /// Theme.of(context).colorScheme.onSurface.withValues( + /// alpha: Theme.of(context).colorScheme.brightness == Brightness.dark + /// ? 1.0 + /// : 0.6, /// ) /// ``` final Color? entryModeIconColor; @@ -232,12 +233,12 @@ class TimePickerThemeData with Diagnosticable { /// if the segment is selected or not. /// /// By default, if the segment is selected, the overall theme's - /// `ColorScheme.primary.withOpacity(0.12)` is used when the overall theme's + /// `ColorScheme.primary.withValues(alpha: 0.12)` is used when the overall theme's /// brightness is [Brightness.light] and - /// `ColorScheme.primary.withOpacity(0.24)` is used when the overall theme's + /// `ColorScheme.primary.withValues(alpha: 0.24)` is used when the overall theme's /// brightness is [Brightness.dark]. /// If the segment is not selected, the overall theme's - /// `ColorScheme.onSurface.withOpacity(0.12)` is used. + /// `ColorScheme.onSurface.withValues(alpha: 0.12)` is used. final Color? hourMinuteColor; /// The shape of the hour and minute controls that the time picker uses. diff --git a/packages/flutter/lib/src/material/tooltip_theme.dart b/packages/flutter/lib/src/material/tooltip_theme.dart index 96d46c09ae2..7ac602353f5 100644 --- a/packages/flutter/lib/src/material/tooltip_theme.dart +++ b/packages/flutter/lib/src/material/tooltip_theme.dart @@ -309,7 +309,7 @@ class TooltipThemeData with Diagnosticable { /// TooltipTheme( /// data: TooltipThemeData( /// decoration: BoxDecoration( -/// color: Colors.blue.withOpacity(0.9), +/// color: Colors.blue.withValues(alpha: 0.9), /// borderRadius: BorderRadius.zero, /// ), /// ), diff --git a/packages/flutter/lib/src/services/hardware_keyboard.dart b/packages/flutter/lib/src/services/hardware_keyboard.dart index 84df5db22aa..90f7000aa87 100644 --- a/packages/flutter/lib/src/services/hardware_keyboard.dart +++ b/packages/flutter/lib/src/services/hardware_keyboard.dart @@ -796,6 +796,7 @@ enum KeyDataTransitMode { /// using [combineKeyEventResults]. /// /// ```dart +/// // ignore: deprecated_member_use /// void handleMessage(FocusNode node, KeyMessage message) { /// final List results = []; /// if (node.onKeyEvent != null) { @@ -803,7 +804,9 @@ enum KeyDataTransitMode { /// results.add(node.onKeyEvent!(node, event)); /// } /// } +/// // ignore: deprecated_member_use /// if (node.onKey != null && message.rawEvent != null) { +/// // ignore: deprecated_member_use /// results.add(node.onKey!(node, message.rawEvent!)); /// } /// final KeyEventResult result = combineKeyEventResults(results); diff --git a/packages/flutter/lib/src/widgets/basic.dart b/packages/flutter/lib/src/widgets/basic.dart index 8da742e099b..80229a1009a 100644 --- a/packages/flutter/lib/src/widgets/basic.dart +++ b/packages/flutter/lib/src/widgets/basic.dart @@ -529,7 +529,7 @@ class BackdropGroup extends InheritedWidget { /// sigmaY: 40, /// ), /// child: Container( -/// color: Colors.black.withOpacity(0.2), +/// color: Colors.black.withValues(alpha: 0.2), /// height: 200, /// child: const Text('Blur item'), /// ), @@ -8350,6 +8350,8 @@ typedef StatefulWidgetBuilder = Widget Function(BuildContext context, StateSette /// This example shows using an inline StatefulBuilder that rebuilds and that /// also has state. /// +// TODO(loic-sharma): Migrate to RadioGroup. +// https://github.com/flutter/flutter/issues/179088 /// ```dart /// await showDialog( /// context: context, @@ -8363,7 +8365,9 @@ typedef StatefulWidgetBuilder = Widget Function(BuildContext context, StateSette /// children: List.generate(4, (int index) { /// return Radio( /// value: index, +/// // ignore: deprecated_member_use /// groupValue: selectedRadio, +/// // ignore: deprecated_member_use /// onChanged: (int? value) { /// setState(() => selectedRadio = value); /// }, diff --git a/packages/flutter/lib/src/widgets/editable_text.dart b/packages/flutter/lib/src/widgets/editable_text.dart index d26edf53f29..a2bb92b77c6 100644 --- a/packages/flutter/lib/src/widgets/editable_text.dart +++ b/packages/flutter/lib/src/widgets/editable_text.dart @@ -797,7 +797,11 @@ class _DiscreteKeyFrameSimulation extends Simulation { /// ```dart /// onChanged: (String newText) { /// if (newText.isNotEmpty) { -/// SemanticsService.announce('\$$newText', Directionality.of(context)); +/// SemanticsService.sendAnnouncement( +/// View.of(context), +/// '\$$newText', +/// Directionality.of(context), +/// ); /// } /// } /// ``` diff --git a/packages/flutter/lib/src/widgets/ticker_provider.dart b/packages/flutter/lib/src/widgets/ticker_provider.dart index 06772ab983e..0d7fb6a5979 100644 --- a/packages/flutter/lib/src/widgets/ticker_provider.dart +++ b/packages/flutter/lib/src/widgets/ticker_provider.dart @@ -68,6 +68,7 @@ class TickerMode extends StatefulWidget { /// Typical usage is as follows: /// /// ```dart + /// // ignore: deprecated_member_use /// bool tickingEnabled = TickerMode.of(context); /// ``` @Deprecated(