[rename fixit] *Component* -> *Widget*

This patch renames StatelessComponent to StatelessWidget and
StatefulComponent to StatefulWidget.

Fixes #2308
This commit is contained in:
Adam Barth
2016-03-12 12:13:16 -08:00
parent 892063ac69
commit 95fc5ae070
152 changed files with 410 additions and 410 deletions

View File

@@ -15,7 +15,7 @@ const double _kCloseProgressThreshold = 0.5;
const Color _kTransparent = const Color(0x00000000);
const Color _kBarrierColor = Colors.black54;
class BottomSheet extends StatefulComponent {
class BottomSheet extends StatefulWidget {
BottomSheet({
Key key,
this.animationController,
@@ -117,7 +117,7 @@ class _ModalBottomSheetLayout extends SingleChildLayoutDelegate {
}
}
class _ModalBottomSheet<T> extends StatefulComponent {
class _ModalBottomSheet<T> extends StatefulWidget {
_ModalBottomSheet({ Key key, this.route }) : super(key: key);
final _ModalBottomSheetRoute<T> route;

View File

@@ -39,7 +39,7 @@ class ButtonTheme extends InheritedWidget {
///
/// MaterialButtons whose [onPressed] handler is null will be disabled. To have
/// an enabled button, make sure to pass a non-null value for onPressed.
abstract class MaterialButton extends StatefulComponent {
abstract class MaterialButton extends StatefulWidget {
MaterialButton({
Key key,
this.child,

View File

@@ -11,7 +11,7 @@ const EdgeInsets _kCardMargins = const EdgeInsets.all(4.0);
/// A material design card
///
/// <https://www.google.com/design/spec/components/cards.html>
class Card extends StatelessComponent {
class Card extends StatelessWidget {
const Card({ Key key, this.child, this.color }) : super(key: key);
final Widget child;

View File

@@ -21,7 +21,7 @@ import 'toggleable.dart';
/// the checkbox.
///
/// <https://www.google.com/design/spec/components/lists-controls.html#lists-controls-types-of-list-controls>
class Checkbox extends StatelessComponent {
class Checkbox extends StatelessWidget {
/// Constructs a checkbox
///
/// * `value` determines whether the checkbox is checked.

View File

@@ -21,7 +21,7 @@ const TextStyle _kLabelStyle = const TextStyle(
textBaseline: TextBaseline.alphabetic
);
class Chip extends StatelessComponent {
class Chip extends StatelessWidget {
const Chip({
Key key,
this.avatar,

View File

@@ -7,7 +7,7 @@ import 'package:flutter/widgets.dart';
import 'constants.dart';
import 'theme.dart';
class CircleAvatar extends StatelessComponent {
class CircleAvatar extends StatelessWidget {
CircleAvatar({
Key key,
this.child,

View File

@@ -17,7 +17,7 @@ import 'typography.dart';
enum _DatePickerMode { day, year }
class DatePicker extends StatefulComponent {
class DatePicker extends StatefulWidget {
DatePicker({
this.selectedDate,
this.onChanged,
@@ -105,7 +105,7 @@ class _DatePickerState extends State<DatePicker> {
}
// Shows the selected date in large font and toggles between year and day mode
class _DatePickerHeader extends StatelessComponent {
class _DatePickerHeader extends StatelessWidget {
_DatePickerHeader({ this.selectedDate, this.mode, this.onModeChanged }) {
assert(selectedDate != null);
assert(mode != null);
@@ -163,7 +163,7 @@ class _DatePickerHeader extends StatelessComponent {
}
// Fixed height component shows a single month and allows choosing a day
class DayPicker extends StatelessComponent {
class DayPicker extends StatelessWidget {
DayPicker({
this.selectedDate,
this.currentDate,
@@ -269,7 +269,7 @@ class DayPicker extends StatelessComponent {
}
}
class MonthPicker extends StatefulComponent {
class MonthPicker extends StatefulWidget {
MonthPicker({
Key key,
this.selectedDate,
@@ -351,7 +351,7 @@ class _MonthPickerState extends State<MonthPicker> {
}
// Scrollable list of years to allow picking a year
class YearPicker extends StatefulComponent {
class YearPicker extends StatefulWidget {
YearPicker({
Key key,
this.selectedDate,

View File

@@ -10,7 +10,7 @@ import 'dialog.dart';
import 'date_picker.dart';
import 'flat_button.dart';
class _DatePickerDialog extends StatefulComponent {
class _DatePickerDialog extends StatefulWidget {
_DatePickerDialog({
Key key,
this.initialDate,

View File

@@ -16,7 +16,7 @@ typedef Widget DialogBuilder(NavigatorState navigator);
/// A material design dialog
///
/// <https://www.google.com/design/spec/components/dialogs.html>
class Dialog extends StatelessComponent {
class Dialog extends StatelessWidget {
Dialog({
Key key,
this.title,

View File

@@ -6,7 +6,7 @@ import 'package:flutter/widgets.dart';
import 'theme.dart';
class Divider extends StatelessComponent {
class Divider extends StatelessWidget {
Divider({ Key key, this.height: 16.0, this.indent: 0.0, this.color }) : super(key: key) {
assert(height >= 1.0);
}

View File

@@ -26,7 +26,7 @@ const double _kEdgeDragWidth = 20.0;
const double _kMinFlingVelocity = 365.0;
const Duration _kBaseSettleDuration = const Duration(milliseconds: 246);
class Drawer extends StatelessComponent {
class Drawer extends StatelessWidget {
Drawer({
Key key,
this.elevation: 16,
@@ -47,7 +47,7 @@ class Drawer extends StatelessComponent {
}
}
class DrawerController extends StatefulComponent {
class DrawerController extends StatefulWidget {
DrawerController({
GlobalKey key,
this.child

View File

@@ -11,7 +11,7 @@ import 'theme.dart';
// TODO(jackson): This class should usually render the user's
// preferred banner image rather than a solid background
class DrawerHeader extends StatelessComponent {
class DrawerHeader extends StatelessWidget {
const DrawerHeader({ Key key, this.child }) : super(key: key);
final Widget child;

View File

@@ -11,7 +11,7 @@ import 'icons.dart';
import 'ink_well.dart';
import 'theme.dart';
class DrawerItem extends StatelessComponent {
class DrawerItem extends StatelessWidget {
const DrawerItem({
Key key,
this.icon,

View File

@@ -56,7 +56,7 @@ class _DropDownMenuPainter extends CustomPainter {
}
}
class _DropDownMenu<T> extends StatusTransitionComponent {
class _DropDownMenu<T> extends StatusTransitionWidget {
_DropDownMenu({
Key key,
_DropDownRoute<T> route
@@ -197,7 +197,7 @@ class _DropDownRoute<T> extends PopupRoute<_DropDownRouteResult<T>> {
}
}
class DropDownMenuItem<T> extends StatelessComponent {
class DropDownMenuItem<T> extends StatelessWidget {
DropDownMenuItem({
Key key,
this.value,
@@ -222,7 +222,7 @@ class DropDownMenuItem<T> extends StatelessComponent {
}
}
class DropDownButton<T> extends StatefulComponent {
class DropDownButton<T> extends StatefulWidget {
DropDownButton({
Key key,
this.items,

View File

@@ -11,7 +11,7 @@ import 'constants.dart';
import 'scaffold.dart';
import 'theme.dart';
class FlexibleSpaceBar extends StatefulComponent {
class FlexibleSpaceBar extends StatefulWidget {
FlexibleSpaceBar({ Key key, this.title, this.image }) : super(key: key);
final Widget title;

View File

@@ -33,7 +33,7 @@ const Interval _kChildSegueInterval = const Interval(0.65, 1.0);
///
/// See also:
/// * https://www.google.com/design/spec/components/buttons-floating-action-button.html
class FloatingActionButton extends StatefulComponent {
class FloatingActionButton extends StatefulWidget {
const FloatingActionButton({
Key key,
this.child,

View File

@@ -6,7 +6,7 @@ import 'package:flutter/widgets.dart';
/// Creates a [Stack] with the header anchored across the top or a footer across the
/// bottom. The [GridTileBar] class can be used to create grid tile headers and footers.
class GridTile extends StatelessComponent {
class GridTile extends StatelessWidget {
GridTile({ Key key, this.header, this.footer, this.child }) : super(key: key) {
assert(child != null);
}

View File

@@ -15,7 +15,7 @@ import 'typography.dart';
/// https://www.google.com/design/spec/components/grid-lists.html#grid-lists-specs
/// For a one-line header specify title and to add a second line specify caption.
/// Use left or right to add an icon.
class GridTileBar extends StatelessComponent {
class GridTileBar extends StatelessWidget {
GridTileBar({ Key key, this.backgroundColor, this.left, this.right, this.title, this.caption }) : super(key: key);
final Color backgroundColor;

View File

@@ -22,7 +22,7 @@ import 'theme.dart';
/// in your project's `flutter.yaml` file. This ensures that the
/// MaterialIcons font is included in your application. This font is
/// used to display the icons.
class Icon extends StatelessComponent {
class Icon extends StatelessWidget {
Icon({
Key key,
this.icon,

View File

@@ -20,7 +20,7 @@ import 'tooltip.dart';
///
/// If the [onPressed] callback is not specified or null, then the button will
/// be disabled, will not react to touch.
class IconButton extends StatelessComponent {
class IconButton extends StatelessWidget {
const IconButton({
Key key,
this.size: 24.0,

View File

@@ -24,7 +24,7 @@ import 'theme.dart';
/// at the top of its [build] function to call [debugCheckHasMaterial]:
///
/// assert(debugCheckHasMaterial(context));
class InkResponse extends StatefulComponent {
class InkResponse extends StatefulWidget {
InkResponse({
Key key,
this.child,

View File

@@ -14,7 +14,7 @@ import 'theme.dart';
export 'package:sky_services/editing/editing.mojom.dart' show KeyboardType;
/// A material design text input field.
class Input extends StatefulComponent {
class Input extends StatefulWidget {
Input({
Key key,
this.value: InputValue.empty,

View File

@@ -21,7 +21,7 @@ Map<MaterialListType, double> kListItemExtent = const <MaterialListType, double>
MaterialListType.threeLine: kThreeLineListItemHeight,
};
class MaterialList extends StatefulComponent {
class MaterialList extends StatefulWidget {
MaterialList({
Key key,
this.initialScrollOffset,

View File

@@ -15,7 +15,7 @@ import 'theme.dart';
/// isThreeLine: true is specified. If dense: true is specified then the overall
/// height of this list item and the size of the DefaultTextStyles that wrap
/// the [primary] and [secondary] widget are reduced.
class ListItem extends StatelessComponent {
class ListItem extends StatelessWidget {
ListItem({
Key key,
this.left,

View File

@@ -73,7 +73,7 @@ abstract class MaterialInkController {
/// list on the paper, and it's been scrolled), a LayoutChangedNotification must
/// be dispatched at the relevant subtree. (This in particular means that
/// Transitions should not be placed inside Material.)
class Material extends StatefulComponent {
class Material extends StatefulWidget {
Material({
Key key,
this.child,

View File

@@ -6,7 +6,7 @@ import 'dart:async';
import 'package:flutter/widgets.dart';
class _MaterialPageTransition extends AnimatedComponent {
class _MaterialPageTransition extends AnimatedWidget {
_MaterialPageTransition({
Key key,
Animation<double> animation,

View File

@@ -28,7 +28,7 @@ const double _kMenuVerticalPadding = 8.0;
const double _kMenuWidthStep = 56.0;
const double _kMenuScreenPadding = 8.0;
abstract class PopupMenuEntry<T> extends StatefulComponent {
abstract class PopupMenuEntry<T> extends StatefulWidget {
PopupMenuEntry({ Key key }) : super(key: key);
double get height;
@@ -159,7 +159,7 @@ class _CheckedPopupMenuItemState<T> extends _PopupMenuItemState<CheckedPopupMenu
}
}
class _PopupMenu<T> extends StatelessComponent {
class _PopupMenu<T> extends StatelessWidget {
_PopupMenu({
Key key,
this.route
@@ -357,7 +357,7 @@ typedef void PopupMenuItemSelected<T>(T value);
/// because an item was selected. The value passed to [onSelected] is the value of
/// the selected menu item. If child is null then a standard 'navigation/more_vert'
/// icon is created.
class PopupMenuButton<T> extends StatefulComponent {
class PopupMenuButton<T> extends StatefulWidget {
PopupMenuButton({
Key key,
this.items,

View File

@@ -14,7 +14,7 @@ const double _kCircularProgressIndicatorStrokeWidth = 4.0;
// TODO(hansmuller): implement the support for buffer indicator
abstract class ProgressIndicator extends StatefulComponent {
abstract class ProgressIndicator extends StatefulWidget {
ProgressIndicator({
Key key,
this.value

View File

@@ -14,7 +14,7 @@ const double _kDiameter = 16.0;
const double _kOuterRadius = _kDiameter / 2.0;
const double _kInnerRadius = 5.0;
class Radio<T> extends StatelessComponent {
class Radio<T> extends StatelessWidget {
Radio({
Key key,
this.value,

View File

@@ -107,7 +107,7 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate {
}
}
class _FloatingActionButtonTransition extends StatefulComponent {
class _FloatingActionButtonTransition extends StatefulWidget {
_FloatingActionButtonTransition({
Key key,
this.child
@@ -180,7 +180,7 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr
/// This class provides APIs for showing drawers, snackbars, and bottom sheets.
///
/// See: <https://www.google.com/design/spec/layout/structure.html>
class Scaffold extends StatefulComponent {
class Scaffold extends StatefulWidget {
Scaffold({
Key key,
this.toolBar,
@@ -572,7 +572,7 @@ class ScaffoldFeatureController<T extends Widget, U> {
final StateSetter setState;
}
class _PersistentBottomSheet extends StatefulComponent {
class _PersistentBottomSheet extends StatefulWidget {
_PersistentBottomSheet({
Key key,
this.animationController,

View File

@@ -7,7 +7,7 @@ import 'dart:ui' show Color, Offset;
import 'package:flutter/painting.dart';
// Based on http://www.google.com/design/spec/what-is-material/elevation-shadows.html
// Currently, only the elevation values that are bound to one or more components are
// Currently, only the elevation values that are bound to one or more widgets are
// defined here.
/// Map of elevation offsets used by material design to [BoxShadow] definitions.

View File

@@ -11,7 +11,7 @@ import 'constants.dart';
import 'debug.dart';
import 'theme.dart';
class Slider extends StatelessComponent {
class Slider extends StatelessWidget {
Slider({
Key key,
this.value,

View File

@@ -37,7 +37,7 @@ const Curve _snackBarFadeCurve = const Interval(0.72, 1.0, curve: Curves.fastOut
///
/// See also:
/// * https://www.google.com/design/spec/components/snackbars-toasts.html
class SnackBarAction extends StatelessComponent {
class SnackBarAction extends StatelessWidget {
SnackBarAction({Key key, this.label, this.onPressed }) : super(key: key) {
assert(label != null);
assert(onPressed != null);
@@ -70,7 +70,7 @@ class SnackBarAction extends StatelessComponent {
/// * [Scaffold.of] and [ScaffoldState.showSnackBar]
/// * [SnackBarAction]
/// * https://www.google.com/design/spec/components/snackbars-toasts.html
class SnackBar extends StatelessComponent {
class SnackBar extends StatelessWidget {
SnackBar({
Key key,
this.content,

View File

@@ -13,7 +13,7 @@ import 'shadows.dart';
import 'theme.dart';
import 'toggleable.dart';
class Switch extends StatelessComponent {
class Switch extends StatelessWidget {
Switch({ Key key, this.value, this.activeColor, this.onChanged })
: super(key: key);

View File

@@ -297,7 +297,7 @@ class TabLabel {
final TabLabelIconBuilder iconBuilder;
}
class _Tab extends StatelessComponent {
class _Tab extends StatelessWidget {
_Tab({
Key key,
this.onSelected,
@@ -395,7 +395,7 @@ abstract class TabBarSelectionAnimationListener {
void handleSelectionDeactivate();
}
class TabBarSelection<T> extends StatefulComponent {
class TabBarSelection<T> extends StatefulWidget {
TabBarSelection({
Key key,
this.value,
@@ -969,7 +969,7 @@ class _TabBarViewState<T> extends PageableListState<TabBarView<T>> implements Ta
}
}
class TabPageSelector<T> extends StatelessComponent {
class TabPageSelector<T> extends StatelessWidget {
const TabPageSelector({ Key key }) : super(key: key);
Widget _buildTabIndicator(TabBarSelectionState<T> selection, T tab, Animation<double> animation, ColorTween selectedColor, ColorTween previousColor) {

View File

@@ -89,7 +89,7 @@ class TimeOfDay {
enum _TimePickerMode { hour, minute }
class TimePicker extends StatefulComponent {
class TimePicker extends StatefulWidget {
TimePicker({
this.selectedTime,
this.onChanged
@@ -141,7 +141,7 @@ class _TimePickerState extends State<TimePicker> {
}
// TODO(ianh): Localize!
class _TimePickerHeader extends StatelessComponent {
class _TimePickerHeader extends StatelessWidget {
_TimePickerHeader({
this.selectedTime,
this.mode,
@@ -312,7 +312,7 @@ class _DialPainter extends CustomPainter {
}
}
class _Dial extends StatefulComponent {
class _Dial extends StatefulWidget {
_Dial({
this.selectedTime,
this.mode,

View File

@@ -10,7 +10,7 @@ import 'dialog.dart';
import 'time_picker.dart';
import 'flat_button.dart';
class _TimePickerDialog extends StatefulComponent {
class _TimePickerDialog extends StatefulWidget {
_TimePickerDialog({
Key key,
this.initialTime

View File

@@ -11,7 +11,7 @@ import 'material.dart';
import 'theme.dart';
import 'typography.dart';
class ToolBar extends StatelessComponent {
class ToolBar extends StatelessWidget {
ToolBar({
Key key,
this.left,

View File

@@ -18,7 +18,7 @@ const EdgeInsets _kDefaultTooltipScreenEdgeMargin = const EdgeInsets.all(10.0);
const Duration _kDefaultTooltipFadeDuration = const Duration(milliseconds: 200);
const Duration _kDefaultTooltipShowDuration = const Duration(seconds: 2);
class Tooltip extends StatefulComponent {
class Tooltip extends StatefulWidget {
Tooltip({
Key key,
this.message,
@@ -234,7 +234,7 @@ class _TooltipPositionDelegate extends SingleChildLayoutDelegate {
}
}
class _TooltipOverlay extends StatelessComponent {
class _TooltipOverlay extends StatelessWidget {
_TooltipOverlay({
Key key,
this.message,

View File

@@ -14,7 +14,7 @@ import 'theme_data.dart';
const Duration _kExpand = const Duration(milliseconds: 200);
class TwoLevelListItem extends StatelessComponent {
class TwoLevelListItem extends StatelessWidget {
TwoLevelListItem({
Key key,
this.left,
@@ -49,7 +49,7 @@ class TwoLevelListItem extends StatelessComponent {
}
}
class TwoLevelSublist extends StatefulComponent {
class TwoLevelSublist extends StatefulWidget {
TwoLevelSublist({ Key key, this.left, this.center, this.children }) : super(key: key);
final Widget left;
@@ -149,7 +149,7 @@ class _TwoLevelSublistState extends State<TwoLevelSublist> {
}
}
class TwoLevelList extends StatelessComponent {
class TwoLevelList extends StatelessWidget {
TwoLevelList({ Key key, this.items, this.type: MaterialListType.twoLine }) : super(key: key);
final List<Widget> items;

View File

@@ -36,7 +36,7 @@ typedef Widget RouteBuilder(RouteArguments args);
typedef Future<LocaleQueryData> LocaleChangedCallback(Locale locale);
class WidgetsApp extends StatefulComponent {
class WidgetsApp extends StatefulWidget {
WidgetsApp({
Key key,
this.title,

View File

@@ -191,7 +191,7 @@ class _ResolutionAwareAssetResolver extends _VariantAssetResolver {
/// icons/1.5x/heart.png
/// icons/2.0x/heart.png
/// ```
class AssetVendor extends StatefulComponent {
class AssetVendor extends StatefulWidget {
AssetVendor({
Key key,
this.bundle,

View File

@@ -888,7 +888,7 @@ class Viewport extends SingleChildRenderObjectWidget {
// CONTAINER
/// A convenience widget that combines common painting, positioning, and sizing widgets.
class Container extends StatelessComponent {
class Container extends StatelessWidget {
Container({
Key key,
this.child,
@@ -1090,8 +1090,8 @@ class IndexedStack extends StackRenderObjectWidgetBase {
/// Controls where a child of a [Stack] is positioned.
///
/// This widget must be a descendant of a [Stack], and the path from this widget
/// to its enclosing [Stack] must contain only components (e.g., not other
/// kinds of widgets, like [RenderObjectWidget]s).
/// to its enclosing [Stack] must contain only [StatelessWidget]s or
/// [StatefulWidget]s (not other kinds of widgets, like [RenderObjectWidget]s).
class Positioned extends ParentDataWidget<StackRenderObjectWidgetBase> {
Positioned({
Key key,
@@ -1426,8 +1426,8 @@ class Column extends Flex {
///
/// This widget must be a descendant of a [Flex], [Row], or [Column], and the
/// path from this widget to its enclosing [Flex], [Row], or [Column] must
/// contain only components (e.g., not other kinds of widgets, like
/// [RenderObjectWidget]s).
/// contain only [StatelessWidget]s or [StatefulWidget]s (not other kinds of
/// widgets, like [RenderObjectWidget]s).
class Flexible extends ParentDataWidget<Flex> {
Flexible({ Key key, this.flex: 1, Widget child })
: super(key: key, child: child);
@@ -1507,7 +1507,7 @@ class DefaultTextStyle extends InheritedWidget {
///
/// By default, the text will be styled using the closest enclosing
/// [DefaultTextStyle].
class Text extends StatelessComponent {
class Text extends StatelessWidget {
Text(this.data, { Key key, this.style }) : super(key: key) {
assert(data != null);
}
@@ -1666,7 +1666,7 @@ class RawImage extends LeafRenderObjectWidget {
/// This widget is rarely used directly. Instead, consider using [AssetImage] or
/// [NetworkImage], depending on whather you wish to display an image from the
/// assert bundle or from the network.
class RawImageResource extends StatefulComponent {
class RawImageResource extends StatefulWidget {
RawImageResource({
Key key,
this.image,
@@ -1785,7 +1785,7 @@ class _RawImageResourceState extends State<RawImageResource> {
}
/// Displays an image loaded from the network.
class NetworkImage extends StatelessComponent {
class NetworkImage extends StatelessWidget {
NetworkImage({
Key key,
this.src,
@@ -1910,7 +1910,7 @@ class DefaultAssetBundle extends InheritedWidget {
/// This widget lets you customize how images are loaded by supplying your own
/// image provider. Internally, [NetworkImage] uses an [ImageProvider] that
/// loads the image from the network.
class AsyncImage extends StatelessComponent {
class AsyncImage extends StatelessWidget {
AsyncImage({
Key key,
this.provider,
@@ -2000,7 +2000,7 @@ class AsyncImage extends StatelessComponent {
///
/// By default, asset image will load the image from the closest enclosing
/// [DefaultAssetBundle].
class AssetImage extends StatelessComponent {
class AssetImage extends StatelessWidget {
// Don't add asserts here unless absolutely necessary, since it will
// require removing the const constructor, which is an API change.
const AssetImage({
@@ -2293,7 +2293,7 @@ class Semantics extends SingleChildRenderObjectWidget {
/// Causes all the semantics of the subtree rooted at this node to be
/// merged into one node in the semantics tree. For example, if you
/// have a component with a Text node next to a checkbox widget, this
/// have a widget with a Text node next to a checkbox widget, this
/// could be used to merge the label from the Text node with the
/// "checked" semantic state of the checkbox into a single node that
/// had both the label and the checked state. Otherwise, the label
@@ -2353,7 +2353,7 @@ class MetaData extends SingleChildRenderObjectWidget {
}
}
class KeyedSubtree extends StatelessComponent {
class KeyedSubtree extends StatelessWidget {
KeyedSubtree({ Key key, this.child })
: super(key: key);
@@ -2363,7 +2363,7 @@ class KeyedSubtree extends StatelessComponent {
}
/// A platonic widget that invokes a closure to obtain its child widget.
class Builder extends StatelessComponent {
class Builder extends StatelessWidget {
Builder({ Key key, this.builder }) : super(key: key);
/// Called to obtain the child widget.
@@ -2377,7 +2377,7 @@ class Builder extends StatelessComponent {
}
typedef Widget StatefulWidgetBuilder(BuildContext context, StateSetter setState);
class StatefulBuilder extends StatefulComponent {
class StatefulBuilder extends StatefulWidget {
StatefulBuilder({ Key key, this.builder }) : super(key: key);
final StatefulWidgetBuilder builder;
_StatefulBuilderState createState() => new _StatefulBuilderState();

View File

@@ -50,7 +50,7 @@ class _CheckedModeBannerPainter extends CustomPainter {
/// Displays a banner saying "CHECKED" when running in checked mode.
/// Does nothing in release mode.
class CheckedModeBanner extends StatelessComponent {
class CheckedModeBanner extends StatelessWidget {
CheckedModeBanner({
Key key,
this.child

View File

@@ -9,7 +9,7 @@ import 'framework.dart';
export 'package:flutter/rendering.dart' show ChildViewConnection;
class ChildView extends StatelessComponent {
class ChildView extends StatelessWidget {
ChildView({ Key key, this.child }) : super(key: key);
final ChildViewConnection child;

View File

@@ -52,7 +52,7 @@ enum DismissDirection {
/// The [onDimissed] callback runs after Dismissable's size has collapsed to zero.
/// If the Dismissable is a list item, it must have a key that distinguishes it from
/// the other items and its onDismissed callback must remove the item from the list.
class Dismissable extends StatefulComponent {
class Dismissable extends StatefulWidget {
Dismissable({
Key key,
this.child,

View File

@@ -35,8 +35,8 @@ enum DragAnchor {
pointer,
}
/// Subclass this component to customize the gesture used to start a drag.
abstract class DraggableBase<T> extends StatefulComponent {
/// Subclass this widget to customize the gesture used to start a drag.
abstract class DraggableBase<T> extends StatefulWidget {
DraggableBase({
Key key,
this.data,
@@ -261,7 +261,7 @@ class _DraggableState<T> extends State<DraggableBase<T>> {
}
/// Receives data when a [Draggable] widget is dropped.
class DragTarget<T> extends StatefulComponent {
class DragTarget<T> extends StatefulWidget {
const DragTarget({
Key key,
this.builder,

View File

@@ -10,7 +10,7 @@ import 'media_query.dart';
import 'scrollable.dart';
// _noFocusedScope is used by Focus to track the case where none of the Focus
// component's subscopes (e.g. dialogs) are focused. This is distinct from the
// widget's subscopes (e.g. dialogs) are focused. This is distinct from the
// focused scope being null, which means that we haven't yet decided which scope
// is focused and whichever is the first scope to ask for focus will get it.
final GlobalKey _noFocusedScope = new GlobalKey();
@@ -91,7 +91,7 @@ class _FocusScope extends InheritedWidget {
/// focused at each level and it hasn't focused any of its enclosed Focus
/// widgets), then the widget this this global key actually has the focus in the
/// entire system.
class Focus extends StatefulComponent {
class Focus extends StatefulWidget {
Focus({
GlobalKey key,
this.child
@@ -205,7 +205,7 @@ class _FocusState extends State<Focus> {
super.dispose();
}
GlobalKey _focusedWidget; // when null, the first component to ask if it's focused will get the focus
GlobalKey _focusedWidget; // when null, the first widget to ask if it's focused will get the focus
GlobalKey _currentlyRegisteredWidgetRemovalListenerKey;
void _setFocusedWidget(GlobalKey key) {

View File

@@ -69,9 +69,9 @@ class ObjectKey extends Key {
typedef void GlobalKeyRemoveListener(GlobalKey key);
/// A GlobalKey is one that must be unique across the entire application. It is
/// used by components that need to communicate with other components across the
/// used by widgets that need to communicate with other widgets across the
/// application's element tree.
abstract class GlobalKey<T extends State<StatefulComponent>> extends Key {
abstract class GlobalKey<T extends State<StatefulWidget>> extends Key {
/// Constructs a LabeledGlobalKey, which is a GlobalKey with a label used for debugging.
/// The label is not used for comparing the identity of the key.
factory GlobalKey({ String debugLabel }) => new LabeledGlobalKey<T>(debugLabel); // the label is purely for debugging purposes and is otherwise ignored
@@ -119,8 +119,8 @@ abstract class GlobalKey<T extends State<StatefulComponent>> extends Key {
Widget get currentWidget => _currentElement?.widget;
T get currentState {
Element element = _currentElement;
if (element is StatefulComponentElement) {
StatefulComponentElement statefulElement = element;
if (element is StatefulElement) {
StatefulElement statefulElement = element;
return statefulElement.state;
}
return null;
@@ -179,7 +179,7 @@ abstract class GlobalKey<T extends State<StatefulComponent>> extends Key {
/// Each LabeledGlobalKey instance is a unique key.
/// The optional label can be used for documentary purposes. It does not affect
/// the key's identity.
class LabeledGlobalKey<T extends State<StatefulComponent>> extends GlobalKey<T> {
class LabeledGlobalKey<T extends State<StatefulWidget>> extends GlobalKey<T> {
const LabeledGlobalKey(this._debugLabel) : super.constructor();
final String _debugLabel;
String toString() => '[GlobalKey ${_debugLabel != null ? _debugLabel : hashCode}]';
@@ -241,42 +241,42 @@ abstract class Widget {
}
}
/// StatelessComponents describe a way to compose other Widgets to form reusable
/// StatelessWidgets describe a way to compose other Widgets to form reusable
/// parts, which doesn't depend on anything other than the configuration
/// information in the object itself. (For compositions that can change
/// dynamically, e.g. due to having an internal clock-driven state, or depending
/// on some system state, use [StatefulComponent].)
abstract class StatelessComponent extends Widget {
const StatelessComponent({ Key key }) : super(key: key);
/// on some system state, use [StatefulWidget].)
abstract class StatelessWidget extends Widget {
const StatelessWidget({ Key key }) : super(key: key);
/// StatelessComponents always use StatelessComponentElements to represent
/// StatelessWidget always use [StatelessElement]s to represent
/// themselves in the Element tree.
StatelessComponentElement createElement() => new StatelessComponentElement(this);
StatelessElement createElement() => new StatelessElement(this);
/// Returns another Widget out of which this StatelessComponent is built.
/// Returns another Widget out of which this StatelessWidget is built.
/// Typically that Widget will have been configured with further children,
/// such that really this function returns a tree of configuration.
///
/// The given build context object contains information about the location in
/// the tree at which this component is being built. For example, the context
/// the tree at which this widget is being built. For example, the context
/// provides the set of inherited widgets for this location in the tree.
Widget build(BuildContext context);
}
/// StatefulComponents provide the configuration for
/// [StatefulComponentElement]s, which wrap [State]s, which hold mutable state
/// StatefulWidgets provide the configuration for
/// [StatefulElement]s, which wrap [State]s, which hold mutable state
/// and can dynamically and spontaneously ask to be rebuilt.
abstract class StatefulComponent extends Widget {
const StatefulComponent({ Key key }) : super(key: key);
abstract class StatefulWidget extends Widget {
const StatefulWidget({ Key key }) : super(key: key);
/// StatefulComponents always use StatefulComponentElements to represent
/// StatefulWidget always use [StatefulElement]s to represent
/// themselves in the Element tree.
StatefulComponentElement createElement() => new StatefulComponentElement(this);
StatefulElement createElement() => new StatefulElement(this);
/// Returns an instance of the state to which this StatefulComponent is
/// Returns an instance of the state to which this StatefulWidget is
/// related, using this object as the configuration. Subclasses should
/// override this to return a new instance of the State class associated with
/// this StatefulComponent class, like this:
/// this StatefulWidget class, like this:
///
/// _MyState createState() => new _MyState();
State createState();
@@ -292,10 +292,10 @@ enum _StateLifecycle {
/// The signature of setState() methods.
typedef void StateSetter(VoidCallback fn);
/// The logic and internal state for a [StatefulComponent].
abstract class State<T extends StatefulComponent> {
/// The logic and internal state for a [StatefulWidget].
abstract class State<T extends StatefulWidget> {
/// The current configuration (an instance of the corresponding
/// StatefulComponent class).
/// [StatefulWidget] class).
T get config => _config;
T _config;
@@ -307,7 +307,7 @@ abstract class State<T extends StatefulComponent> {
bool _debugTypesAreRight(Widget widget) => widget is T;
/// Pointer to the owner Element object
StatefulComponentElement _element;
StatefulElement _element;
/// The context in which this object will be built
BuildContext get context => _element;
@@ -335,7 +335,7 @@ abstract class State<T extends StatefulComponent> {
/// setState(() { myState = newValue });
///
/// If you just change the state directly without calling setState(), then the
/// component will not be scheduled for rebuilding, meaning that its rendering
/// widget will not be scheduled for rebuilding, meaning that its rendering
/// will not be updated.
void setState(VoidCallback fn) {
assert(() {
@@ -376,12 +376,12 @@ abstract class State<T extends StatefulComponent> {
assert(() { _debugLifecycleState = _StateLifecycle.defunct; return true; });
}
/// Returns another Widget out of which this StatefulComponent is built.
/// Returns another Widget out of which this [StatefulWidget] is built.
/// Typically that Widget will have been configured with further children,
/// such that really this function returns a tree of configuration.
///
/// The given build context object contains information about the location in
/// the tree at which this component is being built. For example, the context
/// the tree at which this widget is being built. For example, the context
/// provides the set of inherited widgets for this location in the tree.
Widget build(BuildContext context);
@@ -410,13 +410,13 @@ abstract class State<T extends StatefulComponent> {
}
}
abstract class _ProxyComponent extends Widget {
const _ProxyComponent({ Key key, this.child }) : super(key: key);
abstract class _ProxyWidget extends Widget {
const _ProxyWidget({ Key key, this.child }) : super(key: key);
final Widget child;
}
abstract class ParentDataWidget<T extends RenderObjectWidget> extends _ProxyComponent {
abstract class ParentDataWidget<T extends RenderObjectWidget> extends _ProxyWidget {
const ParentDataWidget({ Key key, Widget child })
: super(key: key, child: child);
@@ -464,7 +464,7 @@ abstract class ParentDataWidget<T extends RenderObjectWidget> extends _ProxyComp
void applyParentData(RenderObject renderObject);
}
abstract class InheritedWidget extends _ProxyComponent {
abstract class InheritedWidget extends _ProxyWidget {
const InheritedWidget({ Key key, Widget child })
: super(key: key, child: child);
@@ -938,11 +938,11 @@ abstract class Element implements BuildContext {
State ancestorStateOfType(TypeMatcher matcher) {
Element ancestor = _parent;
while (ancestor != null) {
if (ancestor is StatefulComponentElement && matcher.check(ancestor.state))
if (ancestor is StatefulElement && matcher.check(ancestor.state))
break;
ancestor = ancestor._parent;
}
StatefulComponentElement statefulAncestor = ancestor;
StatefulElement statefulAncestor = ancestor;
return statefulAncestor?.state;
}
@@ -1047,7 +1047,7 @@ abstract class BuildableElement extends Element {
bool get dirty => _dirty;
bool _dirty = true;
// We let component authors call setState from initState, didUpdateConfig, and
// We let widget authors call setState from initState, didUpdateConfig, and
// build even when state is locked because its convenient and a no-op anyway.
// This flag ensures that this convenience is only allowed on the element
// currently undergoing initState, didUpdateConfig, or build.
@@ -1065,9 +1065,9 @@ abstract class BuildableElement extends Element {
static bool _debugBuilding = false;
static BuildableElement _debugCurrentBuildTarget;
/// Establishes a scope in which component build functions can run.
/// Establishes a scope in which widget build functions can run.
///
/// Inside a build scope, component build functions are allowed to run, but
/// Inside a build scope, widget build functions are allowed to run, but
/// State.setState() is forbidden. This mechanism prevents build functions
/// from transitively requiring other build functions to run, potentially
/// causing infinite loops.
@@ -1106,8 +1106,8 @@ abstract class BuildableElement extends Element {
/// rebuild in the next frame.
///
/// Since it is inefficient to build an element twice in one frame,
/// applications and components should be structured so as to only mark
/// components dirty during event handlers before the frame begins, not during
/// applications and widgets should be structured so as to only mark
/// widgets dirty during event handlers before the frame begins, not during
/// the build itself.
void markNeedsBuild() {
assert(_debugLifecycleState != _ElementLifecycle.defunct);
@@ -1130,7 +1130,7 @@ abstract class BuildableElement extends Element {
if (_debugStateLocked && (!_debugAllowIgnoredCallsToMarkNeedsBuild || !dirty)) {
throw new WidgetError(
'setState() or markNeedsBuild() called during build.\n'
'This component cannot be marked as needing to build because the framework '
'This widget cannot be marked as needing to build because the framework '
'is already in the process of building widgets. A widget can be marked as '
'needing to be built during the build phase only if one if its ancestors '
'is currently building. This exception is allowed because the framework '
@@ -1149,7 +1149,7 @@ abstract class BuildableElement extends Element {
}
/// Called by the binding when scheduleBuild() has been called to mark this
/// element dirty, and, in Components, by update() when the Widget has
/// element dirty, and, in components, by update() when the widget has
/// changed.
void rebuild() {
assert(_debugLifecycleState != _ElementLifecycle.initial);
@@ -1195,8 +1195,8 @@ abstract class BuildableElement extends Element {
typedef Widget WidgetBuilder(BuildContext context);
/// Base class for the instantiation of StatelessComponent, StatefulComponent,
/// and ProxyComponent widgets.
/// Base class for the instantiation of [StatelessWidget], [StatefulWidget],
/// and [_ProxyWidget] widgets.
abstract class ComponentElement extends BuildableElement {
ComponentElement(Widget widget) : super(widget);
@@ -1215,8 +1215,8 @@ abstract class ComponentElement extends BuildableElement {
rebuild();
}
/// Reinvokes the build() method of the StatelessComponent object (for
/// stateless components) or the State object (for stateful components) and
/// Reinvokes the build() method of the [StatelessWidget] object (for
/// stateless widgets) or the [State] object (for stateful widgets) and
/// then updates the widget tree.
///
/// Called automatically during mount() to generate the first build, and by
@@ -1270,15 +1270,15 @@ abstract class ComponentElement extends BuildableElement {
}
}
/// Instantiation of StatelessComponent widgets.
class StatelessComponentElement extends ComponentElement {
StatelessComponentElement(StatelessComponent widget) : super(widget) {
/// Instantiation of [StatelessWidget]s.
class StatelessElement extends ComponentElement {
StatelessElement(StatelessWidget widget) : super(widget) {
_builder = widget.build;
}
StatelessComponent get widget => super.widget;
StatelessWidget get widget => super.widget;
void update(StatelessComponent newWidget) {
void update(StatelessWidget newWidget) {
super.update(newWidget);
assert(widget == newWidget);
_builder = widget.build;
@@ -1287,9 +1287,9 @@ class StatelessComponentElement extends ComponentElement {
}
}
/// Instantiation of StatefulComponent widgets.
class StatefulComponentElement extends ComponentElement {
StatefulComponentElement(StatefulComponent widget)
/// Instantiation of [StatefulWidget]s.
class StatefulElement extends ComponentElement {
StatefulElement(StatefulWidget widget)
: _state = widget.createState(), super(widget) {
assert(_state._debugTypesAreRight(widget));
assert(_state._element == null);
@@ -1301,8 +1301,8 @@ class StatefulComponentElement extends ComponentElement {
assert(_state._debugLifecycleState == _StateLifecycle.created);
}
State<StatefulComponent> get state => _state;
State<StatefulComponent> _state;
State<StatefulWidget> get state => _state;
State<StatefulWidget> _state;
void _firstBuild() {
assert(_state._debugLifecycleState == _StateLifecycle.created);
@@ -1325,10 +1325,10 @@ class StatefulComponentElement extends ComponentElement {
super._firstBuild();
}
void update(StatefulComponent newWidget) {
void update(StatefulWidget newWidget) {
super.update(newWidget);
assert(widget == newWidget);
StatefulComponent oldConfig = _state._config;
StatefulWidget oldConfig = _state._config;
// Notice that we mark ourselves as dirty before calling didUpdateConfig to
// let authors call setState from within didUpdateConfig without triggering
// asserts.
@@ -1378,16 +1378,16 @@ class StatefulComponentElement extends ComponentElement {
}
abstract class _ProxyElement extends ComponentElement {
_ProxyElement(_ProxyComponent widget) : super(widget) {
_ProxyElement(_ProxyWidget widget) : super(widget) {
_builder = _build;
}
_ProxyComponent get widget => super.widget;
_ProxyWidget get widget => super.widget;
Widget _build(BuildContext context) => widget.child;
void update(_ProxyComponent newWidget) {
_ProxyComponent oldWidget = widget;
void update(_ProxyWidget newWidget) {
_ProxyWidget oldWidget = widget;
assert(widget != null);
assert(widget != newWidget);
super.update(newWidget);
@@ -1397,7 +1397,7 @@ abstract class _ProxyElement extends ComponentElement {
rebuild();
}
void notifyDescendants(_ProxyComponent oldWidget);
void notifyDescendants(_ProxyWidget oldWidget);
}
class ParentDataElement<T extends RenderObjectWidget> extends _ProxyElement {

View File

@@ -39,7 +39,7 @@ typedef GestureRecognizer GestureRecognizerFactory(GestureRecognizer recognizer)
/// [excludeFromSemantics] to true.
///
/// See http://flutter.io/gestures/ for additional information.
class GestureDetector extends StatelessComponent {
class GestureDetector extends StatelessWidget {
GestureDetector({
Key key,
this.child,
@@ -235,7 +235,7 @@ class GestureDetector extends StatelessComponent {
/// For common gestures, use a [GestureRecognizer].
/// RawGestureDetector is useful primarily when developing your
/// own gesture recognizers.
class RawGestureDetector extends StatefulComponent {
class RawGestureDetector extends StatefulWidget {
RawGestureDetector({
Key key,
this.child,

View File

@@ -46,7 +46,7 @@ class _GridPaperPainter extends CustomPainter {
/// Draws a rectalinear grid of 1px width lines at the specified color and interval.
/// Useful with a Stack for visualizing your layout along a grid.
class GridPaper extends StatelessComponent {
class GridPaper extends StatelessWidget {
GridPaper({
Key key,
this.color: const Color(0x7FC3E8F3),

View File

@@ -14,7 +14,7 @@ import 'pages.dart';
import 'transitions.dart';
// Heroes are the parts of an application's screen-to-screen transitions where a
// component from one screen shifts to a position on the other. For example,
// widget from one screen shifts to a position on the other. For example,
// album art from a list of albums growing to become the centerpiece of the
// album's details view. In this context, a screen is a navigator ModalRoute.
@@ -76,7 +76,7 @@ abstract class HeroHandle {
_HeroManifest _takeChild(Rect animationArea, Animation<double> currentAnimation);
}
class Hero extends StatefulComponent {
class Hero extends StatefulWidget {
Hero({
Key key,
this.tag,
@@ -104,7 +104,7 @@ class Hero extends StatefulComponent {
Map<Object, Map<Key, HeroState>> heroes = <Object, Map<Key, HeroState>>{};
void visitor(Element element) {
if (element.widget is Hero) {
StatefulComponentElement hero = element;
StatefulElement hero = element;
Hero heroWidget = element.widget;
Object tag = heroWidget.tag;
assert(tag != null);

View File

@@ -50,9 +50,9 @@ class Matrix4Tween extends Tween<Matrix4> {
}
}
/// An abstract widget for building components that gradually change their
/// An abstract widget for building widgets that gradually change their
/// values over a period of time.
abstract class AnimatedWidgetBase extends StatefulComponent {
abstract class AnimatedWidgetBase extends StatefulWidget {
AnimatedWidgetBase({
Key key,
this.curve: Curves.linear,

View File

@@ -123,7 +123,7 @@ class MimicOverlayEntry {
}
/// A widget that copies the appearance of another widget.
class Mimic extends StatelessComponent {
class Mimic extends StatelessWidget {
Mimic({ Key key, this.original }) : super(key: key);
/// A handle to the widget that this widget should copy.
@@ -140,7 +140,7 @@ class Mimic extends StatelessComponent {
///
/// This widget's State, [MimicableState], contains an API for initiating the
/// mimic operation.
class Mimicable extends StatefulComponent {
class Mimicable extends StatefulWidget {
Mimicable({ Key key, this.child }) : super(key: key);
final Widget child;

View File

@@ -190,8 +190,8 @@ class _MixedViewportElement extends RenderObjectElement {
renderObject.markNeedsLayout();
} else {
// We have to reinvoke our builders because they might return new data.
// Consider a stateful component that owns us. The builder it gives us
// includes some of the state from that component. The component calls
// Consider a stateful widget that owns us. The builder it gives us
// includes some of the state from that widget. The widget calls
// setState() on itself. It rebuilds. Part of that involves rebuilding
// us, but now what? If we don't reinvoke the builders. then they will
// not be rebuilt, and so the new state won't be used. Therefore, we use

View File

@@ -9,7 +9,7 @@ import 'navigator.dart';
import 'transitions.dart';
/// Prevents the user from interacting with widgets behind itself.
class ModalBarrier extends StatelessComponent {
class ModalBarrier extends StatelessWidget {
ModalBarrier({
Key key,
this.color,
@@ -45,7 +45,7 @@ class ModalBarrier extends StatelessComponent {
}
/// Prevents the user from interacting with widgets behind itself.
class AnimatedModalBarrier extends AnimatedComponent {
class AnimatedModalBarrier extends AnimatedWidget {
AnimatedModalBarrier({
Key key,
Animation<Color> color,

View File

@@ -135,7 +135,7 @@ class NavigatorObserver {
/// the navigator visually transition from one page to another by the widgets
/// around in the overlay. Similarly, the navigator can be used to show a dialog
/// by positioning the dialog widget above the current page.
class Navigator extends StatefulComponent {
class Navigator extends StatefulWidget {
Navigator({
Key key,
this.initialRoute,

View File

@@ -12,7 +12,7 @@ abstract class Notification {
/// Start bubbling this notification at the given build context.
void dispatch(BuildContext target) {
target.visitAncestorElements((Element element) {
if (element is StatelessComponentElement &&
if (element is StatelessElement &&
element.widget is NotificationListener<dynamic>) {
final NotificationListener<dynamic> widget = element.widget;
if (widget._dispatch(this)) // that function checks the type dynamically
@@ -24,7 +24,7 @@ abstract class Notification {
}
/// Listens for [Notification]s bubbling up the tree.
class NotificationListener<T extends Notification> extends StatelessComponent {
class NotificationListener<T extends Notification> extends StatelessWidget {
NotificationListener({
Key key,
this.child,

View File

@@ -49,7 +49,7 @@ class OverlayEntry {
String toString() => '$runtimeType@$hashCode(opaque: $opaque)';
}
class _OverlayEntry extends StatefulComponent {
class _OverlayEntry extends StatefulWidget {
_OverlayEntry(OverlayEntry entry) : entry = entry, super(key: entry._key);
final OverlayEntry entry;
_OverlayEntryState createState() => new _OverlayEntryState();
@@ -59,7 +59,7 @@ class _OverlayEntryState extends State<_OverlayEntry> {
}
/// A [Stack] of entries that can be managed independently.
class Overlay extends StatefulComponent {
class Overlay extends StatefulWidget {
Overlay({
Key key,
this.initialEntries: const <OverlayEntry>[]

View File

@@ -82,7 +82,7 @@ class PageStorageBucket {
}
/// Establishes a page storage bucket for this widget subtree.
class PageStorage extends StatelessComponent {
class PageStorage extends StatelessWidget {
PageStorage({
Key key,
this.child,

View File

@@ -6,7 +6,7 @@ import 'basic.dart';
import 'framework.dart';
/// A widget whose child can be mutated.
class Placeholder extends StatefulComponent {
class Placeholder extends StatefulWidget {
Placeholder({ Key key }) : super(key: key);
PlaceholderState createState() => new PlaceholderState();

View File

@@ -9,7 +9,7 @@ import 'package:sky_services/sky/input_event.mojom.dart' as mojom;
import 'basic.dart';
import 'framework.dart';
class RawKeyboardListener extends StatefulComponent {
class RawKeyboardListener extends StatefulWidget {
RawKeyboardListener({
Key key,
this.focused: false,

View File

@@ -336,7 +336,7 @@ class _ModalScopeStatus extends InheritedWidget {
}
}
class _ModalScope extends StatefulComponent {
class _ModalScope extends StatefulWidget {
_ModalScope({
Key key,
this.route

View File

@@ -34,7 +34,7 @@ typedef double SnapOffsetCallback(double scrollOffset, Size containerSize);
///
/// Widgets that subclass [Scrollable] typically use state objects that subclass
/// [ScrollableState].
abstract class Scrollable extends StatefulComponent {
abstract class Scrollable extends StatefulWidget {
Scrollable({
Key key,
this.initialScrollOffset,
@@ -604,7 +604,7 @@ class ScrollNotification extends Notification {
final double scrollOffset;
}
/// A simple scrollable widget that has a single child. Use this component if
/// A simple scrollable widget that has a single child. Use this widget if
/// you are not worried about offscreen widgets consuming resources.
class ScrollableViewport extends Scrollable {
ScrollableViewport({
@@ -668,7 +668,7 @@ class _ScrollableViewportState extends ScrollableState<ScrollableViewport> {
/// A mashup of [ScrollableViewport] and [BlockBody]. Useful when you have a small,
/// fixed number of children that you wish to arrange in a block layout and that
/// might exceed the height of its container (and therefore need to scroll).
class Block extends StatelessComponent {
class Block extends StatelessWidget {
Block({
Key key,
this.children: const <Widget>[],

View File

@@ -15,7 +15,7 @@ import 'gesture_detector.dart';
///
/// This widget is useful for understand how an app presents itself to
/// accessibility technology.
class SemanticsDebugger extends StatefulComponent {
class SemanticsDebugger extends StatefulWidget {
const SemanticsDebugger({ Key key, this.child }) : super(key: key);
final Widget child;

View File

@@ -5,16 +5,16 @@
import 'basic.dart';
import 'framework.dart';
/// A component that rebuilds when the given animation changes status.
abstract class StatusTransitionComponent extends StatefulComponent {
StatusTransitionComponent({
/// A widget that rebuilds when the given animation changes status.
abstract class StatusTransitionWidget extends StatefulWidget {
StatusTransitionWidget({
Key key,
this.animation
}) : super(key: key) {
assert(animation != null);
}
/// The animation to which this component is listening.
/// The animation to which this widget is listening.
final Animation<double> animation;
Widget build(BuildContext context);
@@ -22,13 +22,13 @@ abstract class StatusTransitionComponent extends StatefulComponent {
_StatusTransitionState createState() => new _StatusTransitionState();
}
class _StatusTransitionState extends State<StatusTransitionComponent> {
class _StatusTransitionState extends State<StatusTransitionWidget> {
void initState() {
super.initState();
config.animation.addStatusListener(_animationStatusChanged);
}
void didUpdateConfig(StatusTransitionComponent oldConfig) {
void didUpdateConfig(StatusTransitionWidget oldConfig) {
if (config.animation != oldConfig.animation) {
oldConfig.animation.removeStatusListener(_animationStatusChanged);
config.animation.addStatusListener(_animationStatusChanged);

View File

@@ -6,7 +6,7 @@ import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
/// Controls the description of this app in the operating system.
class Title extends StatelessComponent {
class Title extends StatelessWidget {
Title({
Key key,
this.title,

View File

@@ -12,22 +12,22 @@ import 'framework.dart';
export 'package:flutter/animation.dart' show AnimationDirection;
export 'package:flutter/rendering.dart' show RelativeRect;
/// A component that rebuilds when the given animation changes value.
/// A widget that rebuilds when the given animation changes value.
///
/// AnimatedComponent is most useful for stateless animated widgets. To use
/// AnimatedComponent, simply subclass it and implement the build function.
/// AnimatedWidget is most useful for stateless animated widgets. To use
/// AnimatedWidget, simply subclass it and implement the build function.
///
/// For more complex case involving additional state, consider using
/// [AnimatedBuilder].
abstract class AnimatedComponent extends StatefulComponent {
AnimatedComponent({
abstract class AnimatedWidget extends StatefulWidget {
AnimatedWidget({
Key key,
this.animation
}) : super(key: key) {
assert(animation != null);
}
/// The animation to which this component is listening.
/// The animation to which this widget is listening.
final Animation<Object> animation;
/// Override this function to build widgets that depend on the current value
@@ -35,7 +35,7 @@ abstract class AnimatedComponent extends StatefulComponent {
Widget build(BuildContext context);
/// Subclasses typically do not override this method.
_AnimatedComponentState createState() => new _AnimatedComponentState();
_AnimatedState createState() => new _AnimatedState();
void debugFillDescription(List<String> description) {
super.debugFillDescription(description);
@@ -43,13 +43,13 @@ abstract class AnimatedComponent extends StatefulComponent {
}
}
class _AnimatedComponentState extends State<AnimatedComponent> {
class _AnimatedState extends State<AnimatedWidget> {
void initState() {
super.initState();
config.animation.addListener(_handleTick);
}
void didUpdateConfig(AnimatedComponent oldConfig) {
void didUpdateConfig(AnimatedWidget oldConfig) {
if (config.animation != oldConfig.animation) {
oldConfig.animation.removeListener(_handleTick);
config.animation.addListener(_handleTick);
@@ -73,7 +73,7 @@ class _AnimatedComponentState extends State<AnimatedComponent> {
}
/// Animates the position of a widget relative to its normal position.
class SlideTransition extends AnimatedComponent {
class SlideTransition extends AnimatedWidget {
SlideTransition({
Key key,
Animation<FractionalOffset> position,
@@ -109,7 +109,7 @@ class SlideTransition extends AnimatedComponent {
}
/// Animates the scale of transformed widget.
class ScaleTransition extends AnimatedComponent {
class ScaleTransition extends AnimatedWidget {
ScaleTransition({
Key key,
Animation<double> scale,
@@ -145,7 +145,7 @@ class ScaleTransition extends AnimatedComponent {
}
/// Animates the rotation of a widget.
class RotationTransition extends AnimatedComponent {
class RotationTransition extends AnimatedWidget {
RotationTransition({
Key key,
Animation<double> turns,
@@ -172,7 +172,7 @@ class RotationTransition extends AnimatedComponent {
}
/// Animates a widget's width or height.
class SizeTransition extends AnimatedComponent {
class SizeTransition extends AnimatedWidget {
SizeTransition({
Key key,
this.axis: Axis.vertical,
@@ -209,7 +209,7 @@ class SizeTransition extends AnimatedComponent {
}
/// Animates the opacity of a widget.
class FadeTransition extends AnimatedComponent {
class FadeTransition extends AnimatedWidget {
FadeTransition({
Key key,
Animation<double> opacity,
@@ -248,7 +248,7 @@ class RelativeRectTween extends Tween<RelativeRect> {
/// position to and end position over the lifetime of the animation.
///
/// Only works if it's the child of a [Stack].
class PositionedTransition extends AnimatedComponent {
class PositionedTransition extends AnimatedWidget {
PositionedTransition({
Key key,
Animation<RelativeRect> rect,
@@ -278,7 +278,7 @@ typedef Widget TransitionBuilder(BuildContext context, Widget child);
/// A general-purpose widget for building animations.
///
/// AnimatedBuilder is useful for more complex components that wish to include
/// AnimatedBuilder is useful for more complex widgets that wish to include
/// an animation as part of a larger build function. To use AnimatedBuilder,
/// simply construct the widget and pass it a builder function.
///
@@ -294,8 +294,8 @@ typedef Widget TransitionBuilder(BuildContext context, Widget child);
/// performance significantly in some cases and is therefore a good practice.
///
/// For simple cases without additional state, consider using
/// [AnimatedComponent].
class AnimatedBuilder extends AnimatedComponent {
/// [AnimatedWidget].
class AnimatedBuilder extends AnimatedWidget {
AnimatedBuilder({
Key key,
Animation<Object> animation,

View File

@@ -5,8 +5,8 @@
import 'framework.dart';
/// A widget that has exactly one inflated instance in the tree.
abstract class UniqueComponent<T extends State> extends StatefulComponent {
UniqueComponent({ GlobalKey key }) : super(key: key) {
abstract class UniqueWidget<T extends State> extends StatefulWidget {
UniqueWidget({ GlobalKey key }) : super(key: key) {
assert(key != null);
}

View File

@@ -44,7 +44,7 @@ export 'src/widgets/semantics_debugger.dart';
export 'src/widgets/status_transitions.dart';
export 'src/widgets/title.dart';
export 'src/widgets/transitions.dart';
export 'src/widgets/unique_component.dart';
export 'src/widgets/unique_widget.dart';
export 'src/widgets/virtual_viewport.dart';
export 'package:vector_math/vector_math_64.dart' show Matrix4;

View File

@@ -9,7 +9,7 @@ import 'package:test/test.dart';
import 'test_widgets.dart';
class ProbeWidget extends StatefulComponent {
class ProbeWidget extends StatefulWidget {
ProbeWidgetState createState() => new ProbeWidgetState();
}
@@ -32,7 +32,7 @@ class ProbeWidgetState extends State<ProbeWidget> {
}
}
class BadWidget extends StatelessComponent {
class BadWidget extends StatelessWidget {
BadWidget(this.parentState);
final State parentState;
@@ -43,7 +43,7 @@ class BadWidget extends StatelessComponent {
}
}
class BadWidgetParent extends StatefulComponent {
class BadWidgetParent extends StatefulWidget {
BadWidgetParentState createState() => new BadWidgetParentState();
}
@@ -53,7 +53,7 @@ class BadWidgetParentState extends State<BadWidgetParent> {
}
}
class BadDisposeWidget extends StatefulComponent {
class BadDisposeWidget extends StatefulWidget {
BadDisposeWidgetState createState() => new BadDisposeWidgetState();
}
@@ -98,17 +98,17 @@ void main() {
expect(ProbeWidgetState.buildCount, equals(1));
tester.pumpWidget(new ProbeWidget());
expect(ProbeWidgetState.buildCount, equals(2));
tester.pumpWidget(new FlipComponent(
tester.pumpWidget(new FlipWidget(
key: flipKey,
left: new Container(),
right: new ProbeWidget()
));
expect(ProbeWidgetState.buildCount, equals(2));
FlipComponentState flipState1 = flipKey.currentState;
FlipWidgetState flipState1 = flipKey.currentState;
flipState1.flip();
tester.pump();
expect(ProbeWidgetState.buildCount, equals(3));
FlipComponentState flipState2 = flipKey.currentState;
FlipWidgetState flipState2 = flipKey.currentState;
flipState2.flip();
tester.pump();
expect(ProbeWidgetState.buildCount, equals(3));

View File

@@ -105,8 +105,8 @@ void dismissItem(WidgetTester tester, int item, { DismissDirection gestureDirect
tester.pumpWidget(widgetBuilder()); // rebuild after the callback removes the entry
}
class Test1215DismissableComponent extends StatelessComponent {
Test1215DismissableComponent(this.text);
class Test1215DismissableWidget extends StatelessWidget {
Test1215DismissableWidget(this.text);
final String text;
Widget build(BuildContext context) {
return new Dismissable(
@@ -270,8 +270,8 @@ void main() {
});
});
// This one is for a case where dssmissing a component above a previously
// dismissed component threw an exception, which was documented at the
// This one is for a case where dssmissing a widget above a previously
// dismissed widget threw an exception, which was documented at the
// now-obsolete URL https://github.com/flutter/engine/issues/1215 (the URL
// died in the migration to the new repo). Don't copy this test; it doesn't
// actually remove the dismissed widget, which is a violation of the
@@ -284,8 +284,8 @@ void main() {
height: 1000.0,
child: new Column(
children: <Widget>[
new Test1215DismissableComponent('1'),
new Test1215DismissableComponent('2')
new Test1215DismissableWidget('1'),
new Test1215DismissableWidget('2')
]
)
)

View File

@@ -13,7 +13,7 @@ class Item {
}
List<Item> items = <Item>[new Item(), new Item()];
class StatefulLeaf extends StatefulComponent {
class StatefulLeaf extends StatefulWidget {
StatefulLeaf({ GlobalKey key }) : super(key: key);
StatefulLeafState createState() => new StatefulLeafState();
}
@@ -23,7 +23,7 @@ class StatefulLeafState extends State<StatefulLeaf> {
Widget build(BuildContext context) => new Text('leaf');
}
class KeyedWrapper extends StatelessComponent {
class KeyedWrapper extends StatelessWidget {
KeyedWrapper(this.key1, this.key2);
Key key1, key2;
Widget build(BuildContext context) {

View File

@@ -6,7 +6,7 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/widgets.dart';
import 'package:test/test.dart';
class TestFocusable extends StatelessComponent {
class TestFocusable extends StatelessWidget {
TestFocusable({
GlobalKey key,
this.no,

View File

@@ -8,11 +8,11 @@ import 'package:test/test.dart';
List<String> ancestors = <String>[];
class TestComponent extends StatefulComponent {
TestComponentState createState() => new TestComponentState();
class TestWidget extends StatefulWidget {
TestWidgetState createState() => new TestWidgetState();
}
class TestComponentState extends State<TestComponent> {
class TestWidgetState extends State<TestWidget> {
void initState() {
super.initState();
context.visitAncestorElements((Element element) {
@@ -27,7 +27,7 @@ class TestComponentState extends State<TestComponent> {
void main() {
test('initState() is called when we are in the tree', () {
testWidgets((WidgetTester tester) {
tester.pumpWidget(new Container(child: new TestComponent()));
tester.pumpWidget(new Container(child: new TestWidget()));
expect(ancestors, equals(<String>['Container', 'RenderObjectToWidgetAdapter<RenderBox>']));
});
});

View File

@@ -17,7 +17,7 @@ void main() {
// so if our widget is 100 pixels tall, it should fit exactly 6 times.
Widget builder() {
return new FlipComponent(
return new FlipWidget(
left: new MixedViewport(
builder: (BuildContext context, int i) {
callbackTracker.add(i);
@@ -35,19 +35,19 @@ void main() {
tester.pumpWidget(builder());
StatefulComponentElement element = tester.findElement((Element element) => element.widget is FlipComponent);
FlipComponentState testComponent = element.state;
StatefulElement element = tester.findElement((Element element) => element.widget is FlipWidget);
FlipWidgetState testWidget = element.state;
expect(callbackTracker, equals([0, 1, 2, 3, 4, 5]));
callbackTracker.clear();
testComponent.flip();
testWidget.flip();
tester.pump();
expect(callbackTracker, equals([]));
callbackTracker.clear();
testComponent.flip();
testWidget.flip();
tester.pump();
expect(callbackTracker, equals([0, 1, 2, 3, 4, 5]));
@@ -75,7 +75,7 @@ void main() {
};
Widget builder() {
return new FlipComponent(
return new FlipWidget(
left: new MixedViewport(
builder: itemBuilder,
startOffset: offset
@@ -123,7 +123,7 @@ void main() {
};
Widget builder() {
return new FlipComponent(
return new FlipWidget(
left: new MixedViewport(
builder: itemBuilder,
startOffset: offset,

View File

@@ -62,8 +62,8 @@ void main() {
test('ModalBarrier pops the Navigator when dismissed', () {
testWidgets((WidgetTester tester) {
final Map<String, RouteBuilder> routes = <String, RouteBuilder>{
'/': (RouteArguments args) => new FirstComponent(),
'/modal': (RouteArguments args) => new SecondComponent(),
'/': (RouteArguments args) => new FirstWidget(),
'/modal': (RouteArguments args) => new SecondWidget(),
};
tester.pumpWidget(new MaterialApp(routes: routes));
@@ -87,7 +87,7 @@ void main() {
});
}
class FirstComponent extends StatelessComponent {
class FirstWidget extends StatelessWidget {
Widget build(BuildContext context) {
return new GestureDetector(
onTap: () {
@@ -100,7 +100,7 @@ class FirstComponent extends StatelessComponent {
}
}
class SecondComponent extends StatelessComponent {
class SecondWidget extends StatelessWidget {
Widget build(BuildContext context) {
return new ModalBarrier(
key: const ValueKey<String>('barrier'),

View File

@@ -113,7 +113,7 @@ void main() {
});
});
test('MultiChildRenderObjectElement with stateless components', () {
test('MultiChildRenderObjectElement with stateless widgets', () {
testWidgets((WidgetTester tester) {
tester.pumpWidget(
@@ -234,7 +234,7 @@ void main() {
});
});
test('MultiChildRenderObjectElement with stateful components', () {
test('MultiChildRenderObjectElement with stateful widgets', () {
testWidgets((WidgetTester tester) {
tester.pumpWidget(
new Stack(
@@ -250,7 +250,7 @@ void main() {
tester.pumpWidget(
new Stack(
children: <Widget>[
new FlipComponent(
new FlipWidget(
left: new DecoratedBox(decoration: kBoxDecorationA),
right: new DecoratedBox(decoration: kBoxDecorationB)
),
@@ -261,7 +261,7 @@ void main() {
checkTree(tester, <BoxDecoration>[kBoxDecorationA, kBoxDecorationC]);
flipStatefulComponent(tester);
flipStatefulWidget(tester);
tester.pump();
checkTree(tester, <BoxDecoration>[kBoxDecorationB, kBoxDecorationC]);
@@ -269,7 +269,7 @@ void main() {
tester.pumpWidget(
new Stack(
children: <Widget>[
new FlipComponent(
new FlipWidget(
left: new DecoratedBox(decoration: kBoxDecorationA),
right: new DecoratedBox(decoration: kBoxDecorationB)
),
@@ -279,7 +279,7 @@ void main() {
checkTree(tester, <BoxDecoration>[kBoxDecorationB]);
flipStatefulComponent(tester);
flipStatefulWidget(tester);
tester.pump();
checkTree(tester, <BoxDecoration>[kBoxDecorationA]);
@@ -287,7 +287,7 @@ void main() {
tester.pumpWidget(
new Stack(
children: <Widget>[
new FlipComponent(
new FlipWidget(
key: new Key('flip'),
left: new DecoratedBox(decoration: kBoxDecorationA),
right: new DecoratedBox(decoration: kBoxDecorationB)
@@ -300,7 +300,7 @@ void main() {
new Stack(
children: <Widget>[
new DecoratedBox(key: new Key('c'), decoration: kBoxDecorationC),
new FlipComponent(
new FlipWidget(
key: new Key('flip'),
left: new DecoratedBox(decoration: kBoxDecorationA),
right: new DecoratedBox(decoration: kBoxDecorationB)
@@ -311,7 +311,7 @@ void main() {
checkTree(tester, <BoxDecoration>[kBoxDecorationC, kBoxDecorationA]);
flipStatefulComponent(tester);
flipStatefulWidget(tester);
tester.pump();
checkTree(tester, <BoxDecoration>[kBoxDecorationC, kBoxDecorationB]);
@@ -319,7 +319,7 @@ void main() {
tester.pumpWidget(
new Stack(
children: <Widget>[
new FlipComponent(
new FlipWidget(
key: new Key('flip'),
left: new DecoratedBox(decoration: kBoxDecorationA),
right: new DecoratedBox(decoration: kBoxDecorationB)

View File

@@ -6,7 +6,7 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/material.dart';
import 'package:test/test.dart';
class FirstComponent extends StatelessComponent {
class FirstWidget extends StatelessWidget {
Widget build(BuildContext context) {
return new GestureDetector(
onTap: () {
@@ -22,11 +22,11 @@ class FirstComponent extends StatelessComponent {
}
}
class SecondComponent extends StatefulComponent {
SecondComponentState createState() => new SecondComponentState();
class SecondWidget extends StatefulWidget {
SecondWidgetState createState() => new SecondWidgetState();
}
class SecondComponentState extends State<SecondComponent> {
class SecondWidgetState extends State<SecondWidget> {
Widget build(BuildContext context) {
return new GestureDetector(
onTap: () => Navigator.pop(context),
@@ -42,8 +42,8 @@ class SecondComponentState extends State<SecondComponent> {
typedef void ExceptionCallback(dynamic exception);
class ThirdComponent extends StatelessComponent {
ThirdComponent({ this.targetKey, this.onException });
class ThirdWidget extends StatelessWidget {
ThirdWidget({ this.targetKey, this.onException });
final Key targetKey;
final ExceptionCallback onException;
@@ -64,11 +64,11 @@ class ThirdComponent extends StatelessComponent {
}
void main() {
test('Can navigator navigate to and from a stateful component', () {
test('Can navigator navigate to and from a stateful widget', () {
testWidgets((WidgetTester tester) {
final Map<String, RouteBuilder> routes = <String, RouteBuilder>{
'/': (RouteArguments args) => new FirstComponent(),
'/second': (RouteArguments args) => new SecondComponent(),
'/': (RouteArguments args) => new FirstWidget(),
'/second': (RouteArguments args) => new SecondWidget(),
};
tester.pumpWidget(new MaterialApp(routes: routes));
@@ -101,7 +101,7 @@ void main() {
testWidgets((WidgetTester tester) {
Key targetKey = new Key('foo');
dynamic exception;
Widget widget = new ThirdComponent(
Widget widget = new ThirdWidget(
targetKey: targetKey,
onException: (dynamic e) {
exception = e;

View File

@@ -6,7 +6,7 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/material.dart';
import 'package:test/test.dart' hide TypeMatcher;
class TestTransition extends AnimatedComponent {
class TestTransition extends AnimatedWidget {
TestTransition({
Key key,
this.childFirstHalf,

View File

@@ -210,7 +210,7 @@ void main() {
children: <Widget>[
new Positioned(
right: 10.0,
child: new FlipComponent(left: kDecoratedBoxA, right: kDecoratedBoxB)
child: new FlipWidget(left: kDecoratedBoxA, right: kDecoratedBoxB)
),
]
)
@@ -220,7 +220,7 @@ void main() {
new TestParentData(right: 10.0),
]);
flipStatefulComponent(tester);
flipStatefulWidget(tester);
tester.pump();
checkTree(tester, <TestParentData>[
@@ -232,7 +232,7 @@ void main() {
children: <Widget>[
new Positioned(
top: 7.0,
child: new FlipComponent(left: kDecoratedBoxA, right: kDecoratedBoxB)
child: new FlipWidget(left: kDecoratedBoxA, right: kDecoratedBoxB)
),
]
)
@@ -242,7 +242,7 @@ void main() {
new TestParentData(top: 7.0),
]);
flipStatefulComponent(tester);
flipStatefulWidget(tester);
tester.pump();
checkTree(tester, <TestParentData>[

View File

@@ -6,7 +6,7 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/material.dart';
import 'package:test/test.dart';
class ThePositiveNumbers extends StatelessComponent {
class ThePositiveNumbers extends StatelessWidget {
Widget build(BuildContext context) {
return new ScrollableLazyList(
itemExtent: 100.0,
@@ -47,7 +47,7 @@ void main() {
expect(tester.findText('10'), isNull);
expect(tester.findText('100'), isNull);
StatefulComponentElement target =
StatefulElement target =
tester.findElement((Element element) => element.widget is ScrollableLazyList);
ScrollableState targetState = target.state;
targetState.scrollTo(1000.0);

View File

@@ -11,8 +11,8 @@ final BoxDecoration kBoxDecorationA = new BoxDecoration();
final BoxDecoration kBoxDecorationB = new BoxDecoration();
final BoxDecoration kBoxDecorationC = new BoxDecoration();
class TestComponent extends StatelessComponent {
const TestComponent({ this.child });
class TestWidget extends StatelessWidget {
const TestWidget({ this.child });
final Widget child;
Widget build(BuildContext context) => child;
}
@@ -80,7 +80,7 @@ void main() {
tester.pumpWidget(new DecoratedBox(
decoration: kBoxDecorationA,
child: new TestComponent(
child: new TestWidget(
child: new DecoratedBox(
decoration: kBoxDecorationB
)
@@ -106,8 +106,8 @@ void main() {
tester.pumpWidget(new DecoratedBox(
decoration: kBoxDecorationA,
child: new TestComponent(
child: new TestComponent(
child: new TestWidget(
child: new TestWidget(
child: new DecoratedBox(
decoration: kBoxDecorationB
)

View File

@@ -6,7 +6,7 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/widgets.dart';
import 'package:test/test.dart';
class StateMarker extends StatefulComponent {
class StateMarker extends StatefulWidget {
StateMarker({ Key key, this.child }) : super(key: key);
final Widget child;

View File

@@ -17,7 +17,7 @@ void main() {
// so if our widget is 100 pixels tall, it should fit exactly 6 times.
Widget builder() {
return new FlipComponent(
return new FlipWidget(
left: new ScrollableLazyList(
itemBuilder: (BuildContext context, int start, int count) {
List<Widget> result = <Widget>[];
@@ -39,19 +39,19 @@ void main() {
tester.pumpWidget(builder());
StatefulComponentElement element = tester.findElement((Element element) => element.widget is FlipComponent);
FlipComponentState testComponent = element.state;
StatefulElement element = tester.findElement((Element element) => element.widget is FlipWidget);
FlipWidgetState testWidget = element.state;
expect(callbackTracker, equals([0, 1, 2, 3, 4, 5]));
callbackTracker.clear();
testComponent.flip();
testWidget.flip();
tester.pump();
expect(callbackTracker, equals([]));
callbackTracker.clear();
testComponent.flip();
testWidget.flip();
tester.pump();
expect(callbackTracker, equals([0, 1, 2, 3, 4, 5]));
@@ -81,7 +81,7 @@ void main() {
};
GlobalKey<ScrollableState<ScrollableLazyList>> scrollableKey = new GlobalKey<ScrollableState<ScrollableLazyList>>();
FlipComponent testComponent = new FlipComponent(
FlipWidget testWidget = new FlipWidget(
left: new ScrollableLazyList(
key: scrollableKey,
itemBuilder: itemBuilder,
@@ -91,7 +91,7 @@ void main() {
right: new Text('Not Today')
);
tester.pumpWidget(testComponent);
tester.pumpWidget(testWidget);
expect(callbackTracker, equals([1, 2, 3, 4]));
@@ -100,7 +100,7 @@ void main() {
scrollableKey.currentState.scrollTo(400.0);
// now only 3 should fit, numbered 2-4.
tester.pumpWidget(testComponent);
tester.pumpWidget(testWidget);
expect(callbackTracker, equals([2, 3, 4]));
@@ -131,7 +131,7 @@ void main() {
};
GlobalKey<ScrollableState<ScrollableLazyList>> scrollableKey = new GlobalKey<ScrollableState<ScrollableLazyList>>();
FlipComponent testComponent = new FlipComponent(
FlipWidget testWidget = new FlipWidget(
left: new ScrollableLazyList(
key: scrollableKey,
itemBuilder: itemBuilder,
@@ -142,7 +142,7 @@ void main() {
right: new Text('Not Today')
);
tester.pumpWidget(testComponent);
tester.pumpWidget(testWidget);
expect(callbackTracker, equals([1, 2, 3, 4, 5]));
@@ -151,7 +151,7 @@ void main() {
scrollableKey.currentState.scrollTo(400.0);
// now only 4 should fit, numbered 2-5.
tester.pumpWidget(testComponent);
tester.pumpWidget(testWidget);
expect(callbackTracker, equals([2, 3, 4, 5]));

View File

@@ -8,7 +8,7 @@ import 'package:test/test.dart';
ChangerState changer;
class Changer extends StatefulComponent {
class Changer extends StatefulWidget {
Changer(this.child);
final Widget child;
@@ -29,7 +29,7 @@ class ChangerState extends State<Changer> {
Widget build(BuildContext context) => _state ? new Wrapper(config.child) : config.child;
}
class Wrapper extends StatelessComponent {
class Wrapper extends StatelessWidget {
Wrapper(this.child);
final Widget child;
@@ -37,7 +37,7 @@ class Wrapper extends StatelessComponent {
Widget build(BuildContext context) => child;
}
class Leaf extends StatefulComponent {
class Leaf extends StatefulWidget {
LeafState createState() => new LeafState();
}

View File

@@ -6,7 +6,7 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/widgets.dart';
import 'package:test/test.dart';
class Inside extends StatefulComponent {
class Inside extends StatefulWidget {
InsideState createState() => new InsideState();
}
@@ -23,7 +23,7 @@ class InsideState extends State<Inside> {
}
}
class Middle extends StatefulComponent {
class Middle extends StatefulWidget {
Middle({ this.child });
final Inside child;
@@ -44,7 +44,7 @@ class MiddleState extends State<Middle> {
}
}
class Outside extends StatefulComponent {
class Outside extends StatefulWidget {
OutsideState createState() => new OutsideState();
}

View File

@@ -10,7 +10,7 @@ import 'package:test/test.dart';
import 'test_widgets.dart';
void main() {
test('Stateful component smoke test', () {
test('Stateful widget smoke test', () {
testWidgets((WidgetTester tester) {
void checkTree(BoxDecoration expectedDecoration) {
@@ -23,7 +23,7 @@ void main() {
}
tester.pumpWidget(
new FlipComponent(
new FlipWidget(
left: new DecoratedBox(decoration: kBoxDecorationA),
right: new DecoratedBox(decoration: kBoxDecorationB)
)
@@ -32,7 +32,7 @@ void main() {
checkTree(kBoxDecorationA);
tester.pumpWidget(
new FlipComponent(
new FlipWidget(
left: new DecoratedBox(decoration: kBoxDecorationB),
right: new DecoratedBox(decoration: kBoxDecorationA)
)
@@ -40,14 +40,14 @@ void main() {
checkTree(kBoxDecorationB);
flipStatefulComponent(tester);
flipStatefulWidget(tester);
tester.pump();
checkTree(kBoxDecorationA);
tester.pumpWidget(
new FlipComponent(
new FlipWidget(
left: new DecoratedBox(decoration: kBoxDecorationA),
right: new DecoratedBox(decoration: kBoxDecorationB)
)
@@ -57,11 +57,11 @@ void main() {
});
});
test('Don\'t rebuild subcomponents', () {
test('Don\'t rebuild subwidgets', () {
testWidgets((WidgetTester tester) {
tester.pumpWidget(
new FlipComponent(
key: new Key('rebuild test'), // this is so we don't get the state from the TestComponentConfig in the last test, but instead instantiate a new element with a new state.
new FlipWidget(
key: new Key('rebuild test'),
left: new TestBuildCounter(),
right: new DecoratedBox(decoration: kBoxDecorationB)
)
@@ -69,7 +69,7 @@ void main() {
expect(TestBuildCounter.buildCount, equals(1));
flipStatefulComponent(tester);
flipStatefulWidget(tester);
tester.pump();

View File

@@ -6,12 +6,12 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/widgets.dart';
import 'package:test/test.dart';
class InnerComponent extends StatefulComponent {
InnerComponent({ Key key }) : super(key: key);
InnerComponentState createState() => new InnerComponentState();
class InnerWidget extends StatefulWidget {
InnerWidget({ Key key }) : super(key: key);
InnerWidgetState createState() => new InnerWidgetState();
}
class InnerComponentState extends State<InnerComponent> {
class InnerWidgetState extends State<InnerWidget> {
bool _didInitState = false;
void initState() {
@@ -24,10 +24,10 @@ class InnerComponentState extends State<InnerComponent> {
}
}
class OuterContainer extends StatefulComponent {
class OuterContainer extends StatefulWidget {
OuterContainer({ Key key, this.child }) : super(key: key);
final InnerComponent child;
final InnerWidget child;
OuterContainerState createState() => new OuterContainerState();
}
@@ -44,20 +44,20 @@ void main() {
Key innerKey = new Key('inner');
Key outerKey = new Key('outer');
InnerComponent inner1 = new InnerComponent(key: innerKey);
InnerComponent inner2;
InnerWidget inner1 = new InnerWidget(key: innerKey);
InnerWidget inner2;
OuterContainer outer1 = new OuterContainer(key: outerKey, child: inner1);
OuterContainer outer2;
tester.pumpWidget(outer1);
StatefulComponentElement innerElement = tester.findElementByKey(innerKey);
InnerComponentState innerElementState = innerElement.state;
StatefulElement innerElement = tester.findElementByKey(innerKey);
InnerWidgetState innerElementState = innerElement.state;
expect(innerElementState.config, equals(inner1));
expect(innerElementState._didInitState, isTrue);
expect(innerElement.renderObject.attached, isTrue);
inner2 = new InnerComponent(key: innerKey);
inner2 = new InnerWidget(key: innerKey);
outer2 = new OuterContainer(key: outerKey, child: inner2);
tester.pumpWidget(outer2);
@@ -69,7 +69,7 @@ void main() {
expect(innerElementState._didInitState, isTrue);
expect(innerElement.renderObject.attached, isTrue);
StatefulComponentElement outerElement = tester.findElementByKey(outerKey);
StatefulElement outerElement = tester.findElementByKey(outerKey);
expect(outerElement.state.config, equals(outer2));
outerElement.state.setState(() {});
tester.pump();

View File

@@ -6,7 +6,7 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/widgets.dart';
import 'package:test/test.dart';
class TestWidget extends StatefulComponent {
class TestWidget extends StatefulWidget {
TestWidget({ this.child, this.persistentState, this.syncedState });
final Widget child;

View File

@@ -18,7 +18,7 @@ final BoxDecoration kBoxDecorationC = new BoxDecoration(
backgroundColor: const Color(0xFF0000FF)
);
class TestBuildCounter extends StatelessComponent {
class TestBuildCounter extends StatelessWidget {
static int buildCount = 0;
Widget build(BuildContext context) {
@@ -28,16 +28,16 @@ class TestBuildCounter extends StatelessComponent {
}
class FlipComponent extends StatefulComponent {
FlipComponent({ Key key, this.left, this.right }) : super(key: key);
class FlipWidget extends StatefulWidget {
FlipWidget({ Key key, this.left, this.right }) : super(key: key);
final Widget left;
final Widget right;
FlipComponentState createState() => new FlipComponentState();
FlipWidgetState createState() => new FlipWidgetState();
}
class FlipComponentState extends State<FlipComponent> {
class FlipWidgetState extends State<FlipWidget> {
bool _showLeft = true;
void flip() {
@@ -51,11 +51,11 @@ class FlipComponentState extends State<FlipComponent> {
}
}
void flipStatefulComponent(WidgetTester tester) {
StatefulComponentElement stateElement =
tester.findElement((Element element) => element is StatefulComponentElement);
void flipStatefulWidget(WidgetTester tester) {
StatefulElement stateElement =
tester.findElement((Element element) => element is StatefulElement);
expect(stateElement, isNotNull);
expect(stateElement.state is FlipComponentState, isTrue);
FlipComponentState state = stateElement.state;
expect(stateElement.state is FlipWidgetState, isTrue);
FlipWidgetState state = stateElement.state;
state.flip();
}

View File

@@ -15,7 +15,7 @@ typedef void MarkdownLinkCallback(String href);
/// https://daringfireball.net/projects/markdown/ The rendered markdown is
/// placed in a padded scrolling view port. If you do not want the scrolling
/// behaviour, use the [MarkdownBodyRaw] class instead.
class MarkdownRaw extends StatelessComponent {
class MarkdownRaw extends StatelessWidget {
/// Creates a new Markdown [Widget] that renders the markdown formatted string
/// passed in as [data]. By default the markdown will be rendered using the
@@ -82,7 +82,7 @@ class MarkdownRaw extends StatelessComponent {
/// https://daringfireball.net/projects/markdown/ This class doesn't implement
/// any scrolling behavior, if you want scrolling either wrap the widget in
/// a [ScrollableViewport] or use the [MarkdownRaw] widget.
class MarkdownBodyRaw extends StatefulComponent {
class MarkdownBodyRaw extends StatefulWidget {
/// Creates a new Markdown [Widget] that renders the markdown formatted string
/// passed in as [data]. You need to pass in a [markdownStyle] that defines

View File

@@ -92,8 +92,8 @@ class Instrumentation {
/// the given [runtimeType], if any. Returns null if there is no
/// matching element.
State findStateOfType(Type type) {
StatefulComponentElement element = findElement((Element element) {
return element is StatefulComponentElement && element.state.runtimeType == type;
StatefulElement element = findElement((Element element) {
return element is StatefulElement && element.state.runtimeType == type;
});
return element?.state;
}
@@ -103,8 +103,8 @@ class Instrumentation {
/// given configuration is not that of a stateful widget or if there
/// is no matching element.
State findStateByConfig(Widget config) {
StatefulComponentElement element = findElement((Element element) {
return element is StatefulComponentElement && element.state.config == config;
StatefulElement element = findElement((Element element) {
return element is StatefulElement && element.state.config == config;
});
return element?.state;
}

View File

@@ -336,7 +336,7 @@ class AnalyzeCommand extends FlutterCommand {
RegExp generalPattern = new RegExp(r'^\[(error|warning|hint|lint)\] (.+) \(([^(),]+), line ([0-9]+), col ([0-9]+)\)$');
RegExp allowedIdentifiersPattern = new RegExp(r'_?([A-Z]|_+)\b');
RegExp classesWithOptionalTypeArgumentsPattern = new RegExp(r'\b(GlobalKey|State|ScrollableState|Element|StatelessComponentElement|TypeMatcher)\b');
RegExp classesWithOptionalTypeArgumentsPattern = new RegExp(r'\b(GlobalKey|State|ScrollableState|Element|StatelessElement|TypeMatcher)\b');
RegExp constructorTearOffsPattern = new RegExp('.+#.+// analyzer doesn\'t like constructor tear-offs');
RegExp conflictingNamesPattern = new RegExp('^The imported libraries \'([^\']+)\' and \'([^\']+)\' cannot have the same name \'([^\']+)\'\$');
RegExp missingFilePattern = new RegExp('^Target of URI does not exist: \'([^\')]+)\'\$');

View File

@@ -19,7 +19,7 @@ void main() {
);
}
class FlutterDemo extends StatefulComponent {
class FlutterDemo extends StatefulWidget {
_FlutterDemoState createState() => new _FlutterDemoState();
}

View File

@@ -41,7 +41,7 @@ const double kIndicatorStrokeWidth = 2.0;
const Color kIndicatorColor = const Color(0xFFFF4081);
const double kIndicatorMargin = 2.0;
class Chart extends StatelessComponent {
class Chart extends StatelessWidget {
Chart({ Key key, this.data }) : super(key: key);
final ChartData data;