diff --git a/dev/bots/test/analyze-sample-code-test-input/known_broken_documentation.dart b/dev/bots/test/analyze-sample-code-test-input/known_broken_documentation.dart index bce048ca9e..e624931f1e 100644 --- a/dev/bots/test/analyze-sample-code-test-input/known_broken_documentation.dart +++ b/dev/bots/test/analyze-sample-code-test-input/known_broken_documentation.dart @@ -39,5 +39,5 @@ /// new Opacity( /// opacity: _visible ? 1.0 : 0.0, /// child: const Text('Poor wandering ones!'), -/// ), +/// ) /// ``` diff --git a/examples/catalog/lib/custom_a11y_traversal.dart b/examples/catalog/lib/custom_a11y_traversal.dart index 3d0b286031..518ea97b60 100644 --- a/examples/catalog/lib/custom_a11y_traversal.dart +++ b/examples/catalog/lib/custom_a11y_traversal.dart @@ -59,18 +59,18 @@ class RowColumnTraversal extends StatelessWidget { /// This function expresses the sort keys as a hierarchy, but it could just as /// easily have been a flat list: /// - /// ``` - /// Widget build(BuildContext context) { - /// return new Semantics( - /// sortOrder: new SemanticsSortOrder( - /// keys: [ - /// new OrdinalSortKey(columnOrder.toDouble()), - /// new OrdinalSortKey(rowOrder.toDouble()) - /// ], - /// ), - /// child: child, - /// ); - /// } + /// ```dart + /// Widget build(BuildContext context) { + /// return new Semantics( + /// sortOrder: new SemanticsSortOrder( + /// keys: [ + /// new OrdinalSortKey(columnOrder.toDouble()), + /// new OrdinalSortKey(rowOrder.toDouble()) + /// ], + /// ), + /// child: child, + /// ); + /// } /// ``` /// /// The resulting order is the same. diff --git a/packages/flutter/lib/src/material/app.dart b/packages/flutter/lib/src/material/app.dart index b0dc914bbc..3f32330ae7 100644 --- a/packages/flutter/lib/src/material/app.dart +++ b/packages/flutter/lib/src/material/app.dart @@ -181,12 +181,12 @@ class MaterialApp extends StatefulWidget { /// ```dart /// import 'package:flutter_localizations/flutter_localizations.dart'; /// MaterialApp( - /// localizationsDelegates: [ - /// // ... app-specific localization delegate[s] here - /// GlobalMaterialLocalizations.delegate, - /// GlobalWidgetsLocalizations.delegate, - /// ], - /// supportedLocales: [ + /// localizationsDelegates: [ + /// // ... app-specific localization delegate[s] here + /// GlobalMaterialLocalizations.delegate, + /// GlobalWidgetsLocalizations.delegate, + /// ], + /// supportedLocales: [ /// const Locale('en', 'US'), // English /// const Locale('he', 'IL'), // Hebrew /// // ... other locales the app supports diff --git a/packages/flutter/lib/src/material/bottom_navigation_bar.dart b/packages/flutter/lib/src/material/bottom_navigation_bar.dart index 724b6ac395..51e7ae87e8 100644 --- a/packages/flutter/lib/src/material/bottom_navigation_bar.dart +++ b/packages/flutter/lib/src/material/bottom_navigation_bar.dart @@ -79,47 +79,47 @@ enum BottomNavigationBarType { /// /// ```dart /// class MyHomePage extends StatefulWidget { -/// MyHomePage({Key key}) : super(key: key); +/// MyHomePage({Key key}) : super(key: key); /// -/// @override -/// _MyHomePageState createState() => _MyHomePageState(); +/// @override +/// _MyHomePageState createState() => _MyHomePageState(); /// } /// /// class _MyHomePageState extends State { -/// int _selectedIndex = 1; -/// final _widgetOptions = [ -/// Text('Index 0: Home'), -/// Text('Index 1: Business'), -/// Text('Index 2: School'), -/// ]; +/// int _selectedIndex = 1; +/// final _widgetOptions = [ +/// Text('Index 0: Home'), +/// Text('Index 1: Business'), +/// Text('Index 2: School'), +/// ]; /// -/// @override -/// Widget build(BuildContext context) { -/// return Scaffold( -/// appBar: AppBar( -/// title: Text('BottomNavigationBar Sample'), -/// ), -/// body: Center( -/// child: _widgetOptions.elementAt(_selectedIndex), -/// ), -/// bottomNavigationBar: BottomNavigationBar( -/// items: [ -/// BottomNavigationBarItem(icon: Icon(Icons.home), title: Text('Home')), -/// BottomNavigationBarItem(icon: Icon(Icons.business), title: Text('Business')), -/// BottomNavigationBarItem(icon: Icon(Icons.school), title: Text('School')), -/// ], -/// currentIndex: _selectedIndex, -/// fixedColor: Colors.deepPurple, -/// onTap: _onItemTapped, -/// ), -/// ); -/// } +/// @override +/// Widget build(BuildContext context) { +/// return Scaffold( +/// appBar: AppBar( +/// title: Text('BottomNavigationBar Sample'), +/// ), +/// body: Center( +/// child: _widgetOptions.elementAt(_selectedIndex), +/// ), +/// bottomNavigationBar: BottomNavigationBar( +/// items: [ +/// BottomNavigationBarItem(icon: Icon(Icons.home), title: Text('Home')), +/// BottomNavigationBarItem(icon: Icon(Icons.business), title: Text('Business')), +/// BottomNavigationBarItem(icon: Icon(Icons.school), title: Text('School')), +/// ], +/// currentIndex: _selectedIndex, +/// fixedColor: Colors.deepPurple, +/// onTap: _onItemTapped, +/// ), +/// ); +/// } /// -/// void _onItemTapped(int index) { -/// setState(() { -/// _selectedIndex = index; -/// }); -/// } +/// void _onItemTapped(int index) { +/// setState(() { +/// _selectedIndex = index; +/// }); +/// } /// } /// ``` /// diff --git a/packages/flutter/lib/src/material/button_theme.dart b/packages/flutter/lib/src/material/button_theme.dart index 3f2da547bb..c87996c3b1 100644 --- a/packages/flutter/lib/src/material/button_theme.dart +++ b/packages/flutter/lib/src/material/button_theme.dart @@ -265,6 +265,7 @@ class ButtonThemeData extends Diagnosticable { /// Simply a convenience that returns [minWidth] and [height] as a /// [BoxConstraints] object: + /// /// ```dart /// return BoxConstraints( /// minWidth: minWidth, diff --git a/packages/flutter/lib/src/material/icon_button.dart b/packages/flutter/lib/src/material/icon_button.dart index 68a8bdff13..93228202ef 100644 --- a/packages/flutter/lib/src/material/icon_button.dart +++ b/packages/flutter/lib/src/material/icon_button.dart @@ -151,7 +151,7 @@ class IconButton extends StatelessWidget { /// color: Colors.blue, /// onPressed: _handleTap, /// icon: Icons.widgets, - /// ), + /// ) /// ``` final Color color; diff --git a/packages/flutter/lib/src/material/typography.dart b/packages/flutter/lib/src/material/typography.dart index 8d1fbcf855..ec7765d748 100644 --- a/packages/flutter/lib/src/material/typography.dart +++ b/packages/flutter/lib/src/material/typography.dart @@ -68,7 +68,8 @@ enum ScriptCategory { /// `Typography(platform: platform)` which uses [englishLike2014], /// [dense2014] and [tall2014]. To use the 2018 text theme /// geometries, specify a typography value: -/// ``` +/// +/// ```dart /// Typography( /// platorm: platform, /// englishLike: Typography.englishLike2018, diff --git a/packages/flutter/lib/src/painting/decoration.dart b/packages/flutter/lib/src/painting/decoration.dart index 4c5cc2dff5..6321446540 100644 --- a/packages/flutter/lib/src/painting/decoration.dart +++ b/packages/flutter/lib/src/painting/decoration.dart @@ -33,7 +33,7 @@ abstract class Decoration extends Diagnosticable { /// /// This is intended to be used as follows: /// ```dart - /// assert(myDecoration.debugAssertIsValid()); + /// assert(myDecoration.debugAssertIsValid()); /// ``` bool debugAssertIsValid() => true; diff --git a/packages/flutter/lib/src/painting/image_provider.dart b/packages/flutter/lib/src/painting/image_provider.dart index 2b56396690..c8564b6fb7 100644 --- a/packages/flutter/lib/src/painting/image_provider.dart +++ b/packages/flutter/lib/src/painting/image_provider.dart @@ -700,8 +700,8 @@ class MemoryImage extends ImageProvider { /// it in the `assets` section: /// /// ```yaml -/// assets: -/// - packages/fancy_backgrounds/backgrounds/background1.png +/// assets: +/// - packages/fancy_backgrounds/backgrounds/background1.png /// ``` /// /// The `lib/` is implied, so it should not be included in the asset path. diff --git a/packages/flutter/lib/src/painting/image_resolution.dart b/packages/flutter/lib/src/painting/image_resolution.dart index b29727e452..73f38e0876 100644 --- a/packages/flutter/lib/src/painting/image_resolution.dart +++ b/packages/flutter/lib/src/painting/image_resolution.dart @@ -111,8 +111,8 @@ const String _kAssetManifestFileName = 'AssetManifest.json'; /// it in the `assets` section: /// /// ```yaml -/// assets: -/// - packages/fancy_backgrounds/backgrounds/background1.png +/// assets: +/// - packages/fancy_backgrounds/backgrounds/background1.png /// ``` /// /// The `lib/` is implied, so it should not be included in the asset path. diff --git a/packages/flutter/lib/src/scheduler/binding.dart b/packages/flutter/lib/src/scheduler/binding.dart index f02f046cce..d5df6a25b5 100644 --- a/packages/flutter/lib/src/scheduler/binding.dart +++ b/packages/flutter/lib/src/scheduler/binding.dart @@ -513,7 +513,7 @@ mixin SchedulerBinding on BindingBase, ServicesBinding { /// To call this function, use the following code: /// /// ```dart - /// SchedulerBinding.debugPrintTransientCallbackRegistrationStack(); + /// SchedulerBinding.debugPrintTransientCallbackRegistrationStack(); /// ``` static void debugPrintTransientCallbackRegistrationStack() { assert(() { diff --git a/packages/flutter/lib/src/widgets/icon.dart b/packages/flutter/lib/src/widgets/icon.dart index a4fbe69af1..7ccb35ef27 100644 --- a/packages/flutter/lib/src/widgets/icon.dart +++ b/packages/flutter/lib/src/widgets/icon.dart @@ -79,10 +79,10 @@ class Icon extends StatelessWidget { /// Typically, a material design color will be used, as follows: /// /// ```dart - /// Icon( - /// icon: Icons.widgets, - /// color: Colors.blue.shade400, - /// ), + /// Icon( + /// icon: Icons.widgets, + /// color: Colors.blue.shade400, + /// ) /// ``` final Color color; diff --git a/packages/flutter/lib/src/widgets/image.dart b/packages/flutter/lib/src/widgets/image.dart index b7d068a522..9e0ea3b1fd 100644 --- a/packages/flutter/lib/src/widgets/image.dart +++ b/packages/flutter/lib/src/widgets/image.dart @@ -368,8 +368,8 @@ class Image extends StatefulWidget { /// specify it in the assets section: /// /// ```yaml - /// assets: - /// - packages/fancy_backgrounds/backgrounds/background1.png + /// assets: + /// - packages/fancy_backgrounds/backgrounds/background1.png /// ``` /// /// The `lib/` is implied, so it should not be included in the asset path. diff --git a/packages/flutter/lib/src/widgets/navigator.dart b/packages/flutter/lib/src/widgets/navigator.dart index 0c40ac9942..b50025081e 100644 --- a/packages/flutter/lib/src/widgets/navigator.dart +++ b/packages/flutter/lib/src/widgets/navigator.dart @@ -595,18 +595,18 @@ class NavigatorObserver { /// /// ```dart /// class MyApp extends StatelessWidget { -/// @override -/// Widget build(BuildContext context) { -/// return MaterialApp( -/// // ...some parameters omitted... -/// // MaterialApp contains our top-level Navigator -/// initialRoute: '/', -/// routes: { -/// '/': (BuildContext context) => HomePage(), -/// '/signup': (BuildContext context) => SignUpPage(), -/// }, -/// ); -/// } +/// @override +/// Widget build(BuildContext context) { +/// return MaterialApp( +/// // ...some parameters omitted... +/// // MaterialApp contains our top-level Navigator +/// initialRoute: '/', +/// routes: { +/// '/': (BuildContext context) => HomePage(), +/// '/signup': (BuildContext context) => SignUpPage(), +/// }, +/// ); +/// } /// } /// /// class SignUpPage extends StatelessWidget { diff --git a/packages/flutter/lib/src/widgets/platform_view.dart b/packages/flutter/lib/src/widgets/platform_view.dart index 0b1580f044..d698a6fa97 100644 --- a/packages/flutter/lib/src/widgets/platform_view.dart +++ b/packages/flutter/lib/src/widgets/platform_view.dart @@ -117,6 +117,7 @@ class AndroidView extends StatefulWidget { /// /// For example, with the following setup vertical drags will not be dispatched to the Android /// view as the vertical drag gesture is claimed by the parent [GestureDetector]. + /// /// ```dart /// GestureDetector( /// onVerticalDragStart: (DragStartDetails d) {}, @@ -125,8 +126,10 @@ class AndroidView extends StatefulWidget { /// ), /// ) /// ``` + /// /// To get the [AndroidView] to claim the vertical drag gestures we can pass a vertical drag /// gesture recognizer factory in [gestureRecognizers] e.g: + /// /// ```dart /// GestureDetector( /// onVerticalDragStart: (DragStartDetails details) {}, @@ -247,6 +250,7 @@ class UiKitView extends StatefulWidget { /// /// For example, with the following setup vertical drags will not be dispatched to the UIKit /// view as the vertical drag gesture is claimed by the parent [GestureDetector]. + /// /// ```dart /// GestureDetector( /// onVerticalDragStart: (DragStartDetails details) {}, @@ -255,8 +259,10 @@ class UiKitView extends StatefulWidget { /// ), /// ) /// ``` + /// /// To get the [UiKitView] to claim the vertical drag gestures we can pass a vertical drag /// gesture recognizer factory in [gestureRecognizers] e.g: + /// /// ```dart /// GestureDetector( /// onVerticalDragStart: (DragStartDetails details) {}, diff --git a/packages/flutter/lib/src/widgets/scroll_controller.dart b/packages/flutter/lib/src/widgets/scroll_controller.dart index d537b82389..fd50a467db 100644 --- a/packages/flutter/lib/src/widgets/scroll_controller.dart +++ b/packages/flutter/lib/src/widgets/scroll_controller.dart @@ -297,11 +297,11 @@ class ScrollController extends ChangeNotifier { /// controller: _trackingScrollController, /// children: List.generate(100, (int i) => Text('page 0 item $i')).toList(), /// ), -/// ListView( -/// controller: _trackingScrollController, -/// children: List.generate(200, (int i) => Text('page 1 item $i')).toList(), -/// ), -/// ListView( +/// ListView( +/// controller: _trackingScrollController, +/// children: List.generate(200, (int i) => Text('page 1 item $i')).toList(), +/// ), +/// ListView( /// controller: _trackingScrollController, /// children: List.generate(300, (int i) => Text('page 2 item $i')).toList(), /// ), diff --git a/packages/flutter/lib/src/widgets/scroll_physics.dart b/packages/flutter/lib/src/widgets/scroll_physics.dart index f043f872b7..5dff934dc2 100644 --- a/packages/flutter/lib/src/widgets/scroll_physics.dart +++ b/packages/flutter/lib/src/widgets/scroll_physics.dart @@ -41,6 +41,7 @@ class ScrollPhysics { /// ScrollPhysics that has [ancestor] as its parent. /// /// This method is typically used to define [applyTo] methods like: + /// /// ```dart /// FooScrollPhysics applyTo(ScrollPhysics ancestor) { /// return FooScrollPhysics(parent: buildParent(ancestor)); diff --git a/packages/flutter/lib/src/widgets/text.dart b/packages/flutter/lib/src/widgets/text.dart index 05a14d1721..683e80eb8b 100644 --- a/packages/flutter/lib/src/widgets/text.dart +++ b/packages/flutter/lib/src/widgets/text.dart @@ -337,7 +337,6 @@ class Text extends StatelessWidget { /// /// ```dart /// Text(r'$$', semanticsLabel: 'Double dollars') - /// /// ``` final String semanticsLabel; diff --git a/packages/flutter/test/rendering/mock_canvas.dart b/packages/flutter/test/rendering/mock_canvas.dart index 5956dc8dff..23c7322dbd 100644 --- a/packages/flutter/test/rendering/mock_canvas.dart +++ b/packages/flutter/test/rendering/mock_canvas.dart @@ -28,7 +28,7 @@ import 'recording_canvas.dart'; /// To specify the pattern, call the methods on the returned object. For example: /// /// ```dart -/// expect(myRenderObject, paints..circle(radius: 10.0)..circle(radius: 20.0)); +/// expect(myRenderObject, paints..circle(radius: 10.0)..circle(radius: 20.0)); /// ``` /// /// This particular pattern would verify that the render object `myRenderObject` diff --git a/packages/flutter/test/widgets/semantics_tester.dart b/packages/flutter/test/widgets/semantics_tester.dart index 6b2f204055..01e5baae84 100644 --- a/packages/flutter/test/widgets/semantics_tester.dart +++ b/packages/flutter/test/widgets/semantics_tester.dart @@ -495,6 +495,7 @@ class SemanticsTester { /// )); /// semantics.dispose(); /// }); + /// ``` /// /// At this point the unit test should automatically pass because it was /// generated from the actual [SemanticsNode]s. Next time the semantics tree diff --git a/packages/flutter_driver/lib/src/driver/driver.dart b/packages/flutter_driver/lib/src/driver/driver.dart index a70bb24ff7..b5c4e42115 100644 --- a/packages/flutter_driver/lib/src/driver/driver.dart +++ b/packages/flutter_driver/lib/src/driver/driver.dart @@ -601,12 +601,12 @@ class FlutterDriver { /// /// ```dart /// test('enters text in a text field', () async { - /// var textField = find.byValueKey('enter-text-field'); - /// await driver.tap(textField); // acquire focus - /// await driver.enterText('Hello!'); // enter text - /// await driver.waitFor(find.text('Hello!')); // verify text appears on UI - /// await driver.enterText('World!'); // enter another piece of text - /// await driver.waitFor(find.text('World!')); // verify new text appears + /// var textField = find.byValueKey('enter-text-field'); + /// await driver.tap(textField); // acquire focus + /// await driver.enterText('Hello!'); // enter text + /// await driver.waitFor(find.text('Hello!')); // verify text appears on UI + /// await driver.enterText('World!'); // enter another piece of text + /// await driver.waitFor(find.text('World!')); // verify new text appears /// }); /// ``` Future enterText(String text, { Duration timeout }) async { diff --git a/packages/flutter_test/lib/src/widget_tester.dart b/packages/flutter_test/lib/src/widget_tester.dart index b50ab03417..dc3720f7ce 100644 --- a/packages/flutter_test/lib/src/widget_tester.dart +++ b/packages/flutter_test/lib/src/widget_tester.dart @@ -59,11 +59,11 @@ typedef WidgetTesterCallback = Future Function(WidgetTester widgetTester); /// ## Sample code /// /// ```dart -/// testWidgets('MyWidget', (WidgetTester tester) async { -/// await tester.pumpWidget(new MyWidget()); -/// await tester.tap(find.text('Save')); -/// expect(find.text('Success'), findsOneWidget); -/// }); +/// testWidgets('MyWidget', (WidgetTester tester) async { +/// await tester.pumpWidget(new MyWidget()); +/// await tester.tap(find.text('Save')); +/// expect(find.text('Success'), findsOneWidget); +/// }); /// ``` @isTest void testWidgets(String description, WidgetTesterCallback callback, {