From db75aa768c1887cba29c9a46bd2162b9bd88b3ea Mon Sep 17 00:00:00 2001 From: Ian Hickson Date: Mon, 12 Jun 2017 19:46:38 -0700 Subject: [PATCH] Fix analyzer errors in sample code (#10648) --- packages/flutter/lib/foundation.dart | 5 +++-- .../lib/src/material/tab_controller.dart | 20 +++++++++++++------ packages/flutter/lib/src/widgets/text.dart | 2 +- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/packages/flutter/lib/foundation.dart b/packages/flutter/lib/foundation.dart index aee7024c1b..704a8b755f 100644 --- a/packages/flutter/lib/foundation.dart +++ b/packages/flutter/lib/foundation.dart @@ -17,13 +17,14 @@ export 'package:meta/meta.dart' show required; // Examples can assume: +// String _name; // bool _first; // bool _lights; // bool _visible; // double _volume; -// dynamic _selection; -// dynamic _last; // dynamic _calculation; +// dynamic _last; +// dynamic _selection; export 'src/foundation/assertions.dart'; export 'src/foundation/basic_types.dart'; diff --git a/packages/flutter/lib/src/material/tab_controller.dart b/packages/flutter/lib/src/material/tab_controller.dart index 7508357265..1c7b8eb10e 100644 --- a/packages/flutter/lib/src/material/tab_controller.dart +++ b/packages/flutter/lib/src/material/tab_controller.dart @@ -14,12 +14,24 @@ import 'constants.dart'; /// The selected tab's index can be changed with [animateTo]. /// /// A stateful widget that builds a [TabBar] or a [TabBarView] can create -/// a TabController and share it directly. +/// a [TabController] and share it directly. +/// +/// When the [TabBar] and [TabBarView] don't have a convenient stateful +/// ancestor, a [TabController] can be shared with the [DefaultTabController] +/// inherited widget. /// /// ## Sample code /// +/// This widget introduces a [Scaffold] with an [AppBar] and a [TabBar]. +/// /// ```dart -/// class _MyDemoState extends State with SingleTickerProviderStateMixin { +/// class MyTabbedPage extends StatefulWidget { +/// const MyTabbedPage({ Key key }) : super(key: key); +/// @override +/// _MyTabbedPageState createState() => new _MyTabbedPageState(); +/// } +/// +/// class _MyTabbedPageState extends State with SingleTickerProviderStateMixin { /// final List myTabs = [ /// new Tab(text: 'LEFT'), /// new Tab(text: 'RIGHT'), @@ -58,10 +70,6 @@ import 'constants.dart'; /// } /// } /// ``` -/// -/// When the [TabBar] and [TabBarView] don't have a convenient stateful -/// ancestor, a TabController can be shared with the [DefaultTabController] -/// inherited widget. class TabController extends ChangeNotifier { /// Creates an object that manages the state required by [TabBar] and a [TabBarView]. /// diff --git a/packages/flutter/lib/src/widgets/text.dart b/packages/flutter/lib/src/widgets/text.dart index 5c104cd2cc..d56fa01579 100644 --- a/packages/flutter/lib/src/widgets/text.dart +++ b/packages/flutter/lib/src/widgets/text.dart @@ -143,7 +143,7 @@ class DefaultTextStyle extends InheritedWidget { /// /// ```dart /// new Text( -/// 'Hello, $name! How are you?', +/// 'Hello, $_name! How are you?', /// textAlign: TextAlign.center, /// overflow: TextOverflow.ellipsis, /// style: new TextStyle(fontWeight: FontWeight.bold),