[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

@@ -51,7 +51,7 @@ class PianoKey {
}
}
class PianoApp extends StatelessComponent {
class PianoApp extends StatelessWidget {
final List<PianoKey> keys = <PianoKey>[
new PianoKey(Colors.red[500], chimes),
new PianoKey(Colors.orange[500], chainsaw),

View File

@@ -46,7 +46,7 @@ class _MyAutoLayoutDelegate extends AutoLayoutDelegate {
bool shouldUpdateConstraints(_MyAutoLayoutDelegate oldDelegate) => true;
}
class ColoredBoxes extends StatefulComponent {
class ColoredBoxes extends StatefulWidget {
_ColoredBoxesState createState() => new _ColoredBoxesState();
}

View File

@@ -54,7 +54,7 @@ class _GesturePainter extends CustomPainter {
}
}
class GestureDemo extends StatefulComponent {
class GestureDemo extends StatefulWidget {
_GestureDemoState createState() => new _GestureDemoState();
}

View File

@@ -4,7 +4,7 @@
import 'package:flutter/material.dart';
class AdaptedListItem extends StatelessComponent {
class AdaptedListItem extends StatelessWidget {
AdaptedListItem({ Key key, this.name }) : super(key: key);
final String name;
@@ -26,7 +26,7 @@ class AdaptedListItem extends StatelessComponent {
}
}
class AdaptedGridItem extends StatelessComponent {
class AdaptedGridItem extends StatelessWidget {
AdaptedGridItem({ Key key, this.name }) : super(key: key);
final String name;
@@ -65,7 +65,7 @@ const double _kListItemExtent = 50.0;
const double _kMaxTileWidth = 150.0;
const double _kGridViewBreakpoint = 450.0;
class AdaptiveContainer extends StatelessComponent {
class AdaptiveContainer extends StatelessWidget {
AdaptiveContainer({ Key key, this.names }) : super(key: key);
final List<String> names;

View File

@@ -16,7 +16,7 @@ RenderBox initCircle() {
);
}
class SectorApp extends StatefulComponent {
class SectorApp extends StatefulWidget {
SectorAppState createState() => new SectorAppState();
}

View File

@@ -16,7 +16,7 @@ void addFlexChildSolidColor(RenderFlex parent, Color backgroundColor, { int flex
}
// Solid colour, Widget version
class Rectangle extends StatelessComponent {
class Rectangle extends StatelessWidget {
Rectangle(this.color, { Key key }) : super(key: key);
final Color color;
Widget build(BuildContext context) {

View File

@@ -4,7 +4,7 @@
import 'package:flutter/widgets.dart';
class SpinningSquare extends StatefulComponent {
class SpinningSquare extends StatefulWidget {
_SpinningSquareState createState() => new _SpinningSquareState();
}

View File

@@ -57,7 +57,7 @@ Widget toStyledText(String name, String text) {
Widget toPlainText(String name, String text) => new Text(name + ":" + text);
class SpeakerSeparator extends StatelessComponent {
class SpeakerSeparator extends StatelessWidget {
Widget build(BuildContext context) {
return new Container(
constraints: const BoxConstraints.expand(height: 0.0),
@@ -71,7 +71,7 @@ class SpeakerSeparator extends StatelessComponent {
}
}
class StyledTextDemo extends StatefulComponent {
class StyledTextDemo extends StatefulWidget {
_StyledTextDemoState createState() => new _StyledTextDemoState();
}

View File

@@ -55,7 +55,7 @@ class _ButtonDemo {
int get hashCode => hashValues(title.hashCode, text.hashCode);
}
class ButtonsDemo extends StatefulComponent {
class ButtonsDemo extends StatefulWidget {
_ButtonsDemoState createState() => new _ButtonsDemoState();
}

View File

@@ -36,7 +36,7 @@ final List<TravelDestination> destinations = <TravelDestination>[
)
];
class TravelDestinationItem extends StatelessComponent {
class TravelDestinationItem extends StatelessWidget {
TravelDestinationItem({ Key key, this.destination }) : super(key: key) {
assert(destination != null && destination.isValid);
}
@@ -114,7 +114,7 @@ class TravelDestinationItem extends StatelessComponent {
}
}
class CardsDemo extends StatelessComponent {
class CardsDemo extends StatelessWidget {
Widget build(BuildContext context) {
return new Scaffold(
toolBar: new ToolBar(

View File

@@ -4,7 +4,7 @@
import 'package:flutter/material.dart';
class ChipDemo extends StatefulComponent {
class ChipDemo extends StatefulWidget {
_ChipDemoState createState() => new _ChipDemoState();
}

View File

@@ -41,7 +41,7 @@ const List<ColorSwatch> colorSwatches = const <ColorSwatch>[
];
class ColorItem extends StatelessComponent {
class ColorItem extends StatelessWidget {
ColorItem({ Key key, this.index, this.color, this.prefix: '' }) : super(key: key) {
assert(index != null);
assert(color != null);
@@ -71,7 +71,7 @@ class ColorItem extends StatelessComponent {
}
}
class ColorSwatchTabView extends StatelessComponent {
class ColorSwatchTabView extends StatelessWidget {
ColorSwatchTabView({ Key key, this.swatch }) : super(key: key) {
assert(swatch != null && swatch.isValid);
}
@@ -106,7 +106,7 @@ class ColorSwatchTabView extends StatelessComponent {
}
}
class ColorsDemo extends StatelessComponent {
class ColorsDemo extends StatelessWidget {
Widget build(BuildContext context) {
return new TabBarSelection<ColorSwatch>(
values: colorSwatches,

View File

@@ -7,7 +7,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
class DatePickerDemo extends StatefulComponent {
class DatePickerDemo extends StatefulWidget {
_DatePickerDemoState createState() => new _DatePickerDemoState();
}

View File

@@ -20,7 +20,7 @@ const String _alertWithTitleText =
"Let Google help apps determine location. This means sending anyonmous location "
"data to Google, even when no apps are running.";
class DialogDemoItem extends StatelessComponent {
class DialogDemoItem extends StatelessWidget {
DialogDemoItem({ Key key, this.icon, this.color, this.text, this.onPressed }) : super(key: key);
final IconData icon;
@@ -53,7 +53,7 @@ class DialogDemoItem extends StatelessComponent {
}
}
class DialogDemo extends StatefulComponent {
class DialogDemo extends StatefulWidget {
DialogDemoState createState() => new DialogDemoState();
}

View File

@@ -4,7 +4,7 @@
import 'package:flutter/material.dart';
class DropDownDemo extends StatefulComponent {
class DropDownDemo extends StatefulWidget {
_DropDownDemoState createState() => new _DropDownDemoState();
}

View File

@@ -13,7 +13,7 @@ import 'package:vector_math/vector_math_64.dart' as vec;
ImageMap _images;
SpriteSheet _sprites;
class FitnessDemo extends StatelessComponent {
class FitnessDemo extends StatelessWidget {
FitnessDemo({ Key key }) : super(key: key);
Widget build(BuildContext context) {
@@ -26,7 +26,7 @@ class FitnessDemo extends StatelessComponent {
}
}
class _FitnessDemoContents extends StatefulComponent {
class _FitnessDemoContents extends StatefulWidget {
_FitnessDemoContents({ Key key }) : super(key: key);
_FitnessDemoContentsState createState() => new _FitnessDemoContentsState();
}
@@ -510,7 +510,7 @@ class _JumpingJackPart extends Sprite {
}
}
class _Fireworks extends StatefulComponent {
class _Fireworks extends StatefulWidget {
_Fireworks({ Key key }) : super(key: key);
_FireworksState createState() => new _FireworksState();

View File

@@ -5,7 +5,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
class _ContactCategory extends StatelessComponent {
class _ContactCategory extends StatelessWidget {
_ContactCategory({ Key key, this.icon, this.children }) : super(key: key);
final IconData icon;
@@ -33,7 +33,7 @@ class _ContactCategory extends StatelessComponent {
}
}
class _ContactItem extends StatelessComponent {
class _ContactItem extends StatelessWidget {
_ContactItem({ Key key, this.icon, this.lines }) : super(key: key) {
assert(lines.length > 1);
}
@@ -67,7 +67,7 @@ class _ContactItem extends StatelessComponent {
}
}
class FlexibleSpaceDemo extends StatefulComponent {
class FlexibleSpaceDemo extends StatefulWidget {
FlexibleSpaceDemoState createState() => new FlexibleSpaceDemoState();
}

View File

@@ -15,7 +15,7 @@ enum DismissDialogAction {
save,
}
class DateTimeItem extends StatelessComponent {
class DateTimeItem extends StatelessWidget {
DateTimeItem({ Key key, DateTime dateTime, this.onChanged })
: date = new DateTime(dateTime.year, dateTime.month, dateTime.day),
time = new TimeOfDay(hour: dateTime.hour, minute: dateTime.minute),
@@ -92,7 +92,7 @@ class DateTimeItem extends StatelessComponent {
}
}
class FullScreenDialogDemo extends StatefulComponent {
class FullScreenDialogDemo extends StatefulWidget {
FullScreenDialogDemoState createState() => new FullScreenDialogDemoState();
}

View File

@@ -28,7 +28,7 @@ final List<Photo> photos = new List<Photo>.generate(16, (int index) {
return const Photo(assetName: 'packages/flutter_gallery_assets/kangaroo_valley_safari.png');
});
class GridDemoPhotoItem extends StatelessComponent {
class GridDemoPhotoItem extends StatelessWidget {
GridDemoPhotoItem({ Key key, this.photo, this.tileStyle }) : super(key: key) {
assert(photo != null && photo.isValid);
assert(tileStyle != null);
@@ -128,7 +128,7 @@ class GridListDemoGridDelegate extends FixedColumnCountGridDelegate {
}
}
class GridListDemo extends StatefulComponent {
class GridListDemo extends StatefulWidget {
GridListDemo({ Key key }) : super(key: key);
GridListDemoState createState() => new GridListDemoState();

View File

@@ -4,7 +4,7 @@
import 'package:flutter/material.dart';
class IconsDemo extends StatefulComponent {
class IconsDemo extends StatefulWidget {
IconsDemoState createState() => new IconsDemoState();
}

View File

@@ -25,7 +25,7 @@ class LeaveBehindItem {
final String body;
}
class LeaveBehindDemo extends StatefulComponent {
class LeaveBehindDemo extends StatefulWidget {
LeaveBehindDemo({ Key key }) : super(key: key);
LeaveBehindDemoState createState() => new LeaveBehindDemoState();

View File

@@ -10,7 +10,7 @@ enum ListDemoItemSize {
threeLine
}
class ListDemo extends StatefulComponent {
class ListDemo extends StatefulWidget {
ListDemo({ Key key }) : super(key: key);
ListDemoState createState() => new ListDemoState();

View File

@@ -4,7 +4,7 @@
import 'package:flutter/material.dart';
class MenuDemo extends StatefulComponent {
class MenuDemo extends StatefulWidget {
MenuDemo({ Key key }) : super(key: key);
MenuDemoState createState() => new MenuDemoState();

View File

@@ -4,7 +4,7 @@
import 'package:flutter/material.dart';
class ModalBottomSheetDemo extends StatelessComponent {
class ModalBottomSheetDemo extends StatelessWidget {
final TextStyle textStyle = new TextStyle(
color: Colors.indigo[400],
fontSize: 24.0,

View File

@@ -4,7 +4,7 @@
import 'package:flutter/material.dart';
class PageSelectorDemo extends StatelessComponent {
class PageSelectorDemo extends StatelessWidget {
void _handleArrowButtonPress(BuildContext context, int delta) {
final TabBarSelectionState<IconData> selection = TabBarSelection.of/*<IconData>*/(context);

View File

@@ -4,7 +4,7 @@
import 'package:flutter/material.dart';
class PersistentBottomSheetDemo extends StatelessComponent {
class PersistentBottomSheetDemo extends StatelessWidget {
final TextStyle textStyle = new TextStyle(
color: Colors.indigo[400],

View File

@@ -4,7 +4,7 @@
import 'package:flutter/material.dart';
class ProgressIndicatorDemo extends StatefulComponent {
class ProgressIndicatorDemo extends StatefulWidget {
_ProgressIndicatorDemoState createState() => new _ProgressIndicatorDemoState();
}

View File

@@ -6,7 +6,7 @@ import 'package:flutter/material.dart';
import 'flexible_space_demo.dart';
class _BarGraphic extends StatelessComponent {
class _BarGraphic extends StatelessWidget {
_BarGraphic({ Key key, this.height, this.color, this.leftText, this.rightText: '' })
: super(key: key) {
assert(height != null);
@@ -74,7 +74,7 @@ class _FlexibleSpaceGraphic extends _BarGraphic {
);
}
class _TechniqueItem extends StatelessComponent {
class _TechniqueItem extends StatelessWidget {
_TechniqueItem({ this.titleText, this.barGraphics, this.builder });
final String titleText;
@@ -110,7 +110,7 @@ const String _introText =
"it appears behind the device's status bar. When a flexible space Widget is "
"specified it is stacked on top of the ToolBar.";
class ScrollingTechniquesDemo extends StatelessComponent {
class ScrollingTechniquesDemo extends StatelessWidget {
Widget build(BuildContext context) {
return new Scaffold(
toolBar: new ToolBar(center: new Text('Scrolling Techniques')),

View File

@@ -4,7 +4,7 @@
import 'package:flutter/material.dart';
class SliderDemo extends StatefulComponent {
class SliderDemo extends StatefulWidget {
_SliderDemoState createState() => new _SliderDemoState();
}

View File

@@ -17,7 +17,7 @@ const String _text2 =
const String _text3 =
"By default snackbars automatically disappear after a few seconds ";
class SnackBarDemo extends StatelessComponent {
class SnackBarDemo extends StatelessWidget {
SnackBarDemo({ Key key }) : super(key: key);
Widget buildBody(BuildContext context) {

View File

@@ -4,7 +4,7 @@
import 'package:flutter/material.dart';
class TabsDemo extends StatelessComponent {
class TabsDemo extends StatelessWidget {
final List<IconData> icons = <IconData>[
Icons.event,
Icons.home,

View File

@@ -25,7 +25,7 @@ const String _explanatoryText =
"with a FloatingActionButton that the Scaffold distinguishes from the others "
"by its key.";
class TabsFabDemo extends StatefulComponent {
class TabsFabDemo extends StatefulWidget {
_TabsFabDemoState createState() => new _TabsFabDemoState();
}

View File

@@ -4,7 +4,7 @@
import 'package:flutter/material.dart';
class TextFieldDemo extends StatefulComponent {
class TextFieldDemo extends StatefulWidget {
TextFieldDemo({ Key key }) : super(key: key);
TextFieldDemoState createState() => new TextFieldDemoState();

View File

@@ -6,7 +6,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
class TimePickerDemo extends StatefulComponent {
class TimePickerDemo extends StatefulWidget {
_TimePickerDemoState createState() => new _TimePickerDemoState();
}

View File

@@ -4,7 +4,7 @@
import 'package:flutter/material.dart';
class ToggleControlsDemo extends StatefulComponent {
class ToggleControlsDemo extends StatefulWidget {
_ToggleControlsDemoState createState() => new _ToggleControlsDemoState();
}

View File

@@ -9,7 +9,7 @@ const String _introText =
"a long press. Tooltip messages are also used by services that make Flutter "
"apps accessible, like screen readers.";
class TooltipDemo extends StatelessComponent {
class TooltipDemo extends StatelessWidget {
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
return new Scaffold(

View File

@@ -4,7 +4,7 @@
import 'package:flutter/material.dart';
class TwoLevelListDemo extends StatelessComponent {
class TwoLevelListDemo extends StatelessWidget {
Widget build(BuildContext context) {
return new Scaffold(
toolBar: new ToolBar(center: new Text('Expand/Collapse List Control')),

View File

@@ -5,7 +5,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
class TextStyleItem extends StatelessComponent {
class TextStyleItem extends StatelessWidget {
TextStyleItem({ Key key, this.name, this.style, this.text }) : super(key: key) {
assert(name != null);
assert(style != null);
@@ -37,7 +37,7 @@ class TextStyleItem extends StatelessComponent {
}
}
class TypographyDemo extends StatelessComponent {
class TypographyDemo extends StatelessWidget {
Widget build(BuildContext context) {
final TextTheme textTheme = Theme.of(context).textTheme;
final List<Widget> styleItems = <Widget>[

View File

@@ -17,7 +17,7 @@ enum WeatherType {
snow
}
class WeatherDemo extends StatefulComponent {
class WeatherDemo extends StatefulWidget {
WeatherDemo({ Key key }) : super(key: key);
_WeatherDemoState createState() => new _WeatherDemoState();
}
@@ -125,7 +125,7 @@ class _WeatherDemoState extends State<WeatherDemo> {
const double _kWeatherButtonSize = 56.0;
const double _kWeatherIconSize = 36.0;
class WeatherButton extends StatelessComponent {
class WeatherButton extends StatelessWidget {
WeatherButton({ this.icon, this.selected, this.onPressed, Key key }) : super(key: key);
final String icon;

View File

@@ -6,7 +6,7 @@ import 'package:flutter/material.dart';
import 'home.dart';
class GalleryApp extends StatefulComponent {
class GalleryApp extends StatefulWidget {
GalleryApp({ Key key }) : super(key: key);
static GalleryAppState of(BuildContext context) => context.ancestorStateOfType(const TypeMatcher<GalleryAppState>());

View File

@@ -8,7 +8,7 @@ import 'package:flutter/widgets.dart';
import 'app.dart';
class GalleryDrawer extends StatelessComponent {
class GalleryDrawer extends StatelessWidget {
GalleryDrawer({ Key key }) : super(key: key);
void _changeTheme(BuildContext context, bool value) {

View File

@@ -39,7 +39,7 @@ import '../demo/two_level_list_demo.dart';
import '../demo/typography_demo.dart';
import '../demo/weather_demo.dart';
class GalleryHome extends StatefulComponent {
class GalleryHome extends StatefulWidget {
GalleryHome({ Key key }) : super(key: key);
GalleryHomeState createState() => new GalleryHomeState();

View File

@@ -7,7 +7,7 @@ import 'package:flutter/widgets.dart';
import 'demo.dart';
class GallerySection extends StatelessComponent {
class GallerySection extends StatelessWidget {
GallerySection({ this.title, this.image, this.colors, this.demos });
final String title;

View File

@@ -23,7 +23,7 @@ import 'stock_strings.dart';
import 'stock_symbol_viewer.dart';
import 'stock_types.dart';
class StocksApp extends StatefulComponent {
class StocksApp extends StatefulWidget {
StocksAppState createState() => new StocksAppState();
}

View File

@@ -50,7 +50,7 @@ class StockArrowPainter extends CustomPainter {
}
}
class StockArrow extends StatelessComponent {
class StockArrow extends StatelessWidget {
StockArrow({ Key key, this.percentChange }) : super(key: key);
final double percentChange;

View File

@@ -18,7 +18,7 @@ typedef void ModeUpdater(StockMode mode);
enum _StockMenuItem { autorefresh, refresh, speedUp, speedDown }
enum StockHomeTab { market, portfolio }
class _NotImplementedDialog extends StatelessComponent {
class _NotImplementedDialog extends StatelessWidget {
Widget build(BuildContext context) {
return new Dialog(
title: new Text('Not Implemented'),
@@ -50,7 +50,7 @@ class _NotImplementedDialog extends StatelessComponent {
}
}
class StockHome extends StatefulComponent {
class StockHome extends StatefulWidget {
const StockHome(this.stocks, this.symbols, this.configuration, this.updater);
final Map<String, Stock> stocks;
@@ -355,7 +355,7 @@ class StockHomeState extends State<StockHome> {
}
}
class _CreateCompanySheet extends StatefulComponent {
class _CreateCompanySheet extends StatefulWidget {
_CreateCompanySheetState createState() => new _CreateCompanySheetState();
}

View File

@@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
import 'stock_data.dart';
import 'stock_row.dart';
class StockList extends StatelessComponent {
class StockList extends StatelessWidget {
StockList({ Key key, this.keySalt, this.stocks, this.onOpen, this.onShow, this.onAction }) : super(key: key);
final Object keySalt;

View File

@@ -30,7 +30,7 @@ class StockRowPartKey extends Key {
typedef void StockRowActionCallback(Stock stock, Key arrowKey);
class StockRow extends StatelessComponent {
class StockRow extends StatelessWidget {
StockRow({
Stock stock,
Object keySalt,

View File

@@ -6,7 +6,7 @@ import 'package:flutter/material.dart';
import 'stock_types.dart';
class StockSettings extends StatefulComponent {
class StockSettings extends StatefulWidget {
const StockSettings(this.configuration, this.updater);
final StockConfiguration configuration;

View File

@@ -8,7 +8,7 @@ import 'stock_data.dart';
import 'stock_arrow.dart';
import 'stock_row.dart';
class StockSymbolView extends StatelessComponent {
class StockSymbolView extends StatelessWidget {
StockSymbolView({ this.stock });
final Stock stock;
@@ -66,7 +66,7 @@ class StockSymbolView extends StatelessComponent {
}
}
class StockSymbolPage extends StatelessComponent {
class StockSymbolPage extends StatelessWidget {
StockSymbolPage({ this.stock });
final Stock stock;
@@ -88,7 +88,7 @@ class StockSymbolPage extends StatelessComponent {
}
}
class StockSymbolBottomSheet extends StatelessComponent {
class StockSymbolBottomSheet extends StatelessWidget {
StockSymbolBottomSheet({ this.stock });
final Stock stock;