Commit 89a7fdfc authored by xster's avatar xster Committed by GitHub

Rename State.config to widget everywhere (#9273)

Rename State.config to State.widget
Rename State.didUpdateConfig to State.didUpdateWidget
Renamed all State subclasses' local variables named config to something else
parent a5593b16
...@@ -58,16 +58,16 @@ class DotState extends State<Dot> { ...@@ -58,16 +58,16 @@ class DotState extends State<Dot> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new GestureDetector( return new GestureDetector(
onTap: config.tappable ? () { setState(() { taps += 1; }); } : null, onTap: widget.tappable ? () { setState(() { taps += 1; }); } : null,
child: new Container( child: new Container(
width: config.size, width: widget.size,
height: config.size, height: widget.size,
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: config.color, backgroundColor: widget.color,
border: new Border.all(width: taps.toDouble()), border: new Border.all(width: taps.toDouble()),
shape: BoxShape.circle shape: BoxShape.circle
), ),
child: config.child child: widget.child
) )
); );
} }
......
...@@ -123,12 +123,12 @@ class _PointDemoState extends State<_PointDemo> { ...@@ -123,12 +123,12 @@ class _PointDemoState extends State<_PointDemo> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_animation = new CurvedAnimation(parent: config.controller, curve: Curves.fastOutSlowIn); _animation = new CurvedAnimation(parent: widget.controller, curve: Curves.fastOutSlowIn);
} }
@override @override
void dispose() { void dispose() {
config.controller.value = 0.0; widget.controller.value = 0.0;
super.dispose(); super.dispose();
} }
...@@ -169,7 +169,7 @@ class _PointDemoState extends State<_PointDemo> { ...@@ -169,7 +169,7 @@ class _PointDemoState extends State<_PointDemo> {
void _handleDragCancel() { void _handleDragCancel() {
_dragTarget = null; _dragTarget = null;
config.controller.value = 0.0; widget.controller.value = 0.0;
} }
void _handleDragEnd(DragEndDetails details) { void _handleDragEnd(DragEndDetails details) {
...@@ -288,12 +288,12 @@ class _RectangleDemoState extends State<_RectangleDemo> { ...@@ -288,12 +288,12 @@ class _RectangleDemoState extends State<_RectangleDemo> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_animation = new CurvedAnimation(parent: config.controller, curve: Curves.fastOutSlowIn); _animation = new CurvedAnimation(parent: widget.controller, curve: Curves.fastOutSlowIn);
} }
@override @override
void dispose() { void dispose() {
config.controller.value = 0.0; widget.controller.value = 0.0;
super.dispose(); super.dispose();
} }
...@@ -333,7 +333,7 @@ class _RectangleDemoState extends State<_RectangleDemo> { ...@@ -333,7 +333,7 @@ class _RectangleDemoState extends State<_RectangleDemo> {
void _handleDragCancel() { void _handleDragCancel() {
_dragTarget = null; _dragTarget = null;
config.controller.value = 0.0; widget.controller.value = 0.0;
} }
void _handleDragEnd(DragEndDetails details) { void _handleDragEnd(DragEndDetails details) {
......
...@@ -53,31 +53,31 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -53,31 +53,31 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
new ComponentDemoTabData( new ComponentDemoTabData(
tabName: 'RAISED', tabName: 'RAISED',
description: _raisedText, description: _raisedText,
widget: buildRaisedButton(), demoWidget: buildRaisedButton(),
exampleCodeTag: _raisedCode, exampleCodeTag: _raisedCode,
), ),
new ComponentDemoTabData( new ComponentDemoTabData(
tabName: 'FLAT', tabName: 'FLAT',
description: _flatText, description: _flatText,
widget: buildFlatButton(), demoWidget: buildFlatButton(),
exampleCodeTag: _flatCode, exampleCodeTag: _flatCode,
), ),
new ComponentDemoTabData( new ComponentDemoTabData(
tabName: 'DROPDOWN', tabName: 'DROPDOWN',
description: _dropdownText, description: _dropdownText,
widget: buildDropdownButton(), demoWidget: buildDropdownButton(),
exampleCodeTag: _dropdownCode, exampleCodeTag: _dropdownCode,
), ),
new ComponentDemoTabData( new ComponentDemoTabData(
tabName: 'ICON', tabName: 'ICON',
description: _iconText, description: _iconText,
widget: buildIconButton(), demoWidget: buildIconButton(),
exampleCodeTag: _iconCode, exampleCodeTag: _iconCode,
), ),
new ComponentDemoTabData( new ComponentDemoTabData(
tabName: 'ACTION', tabName: 'ACTION',
description: _actionText, description: _actionText,
widget: buildActionButton(), demoWidget: buildActionButton(),
exampleCodeTag: _actionCode, exampleCodeTag: _actionCode,
), ),
]; ];
......
...@@ -42,10 +42,10 @@ class _ChipDemoState extends State<ChipDemo> { ...@@ -42,10 +42,10 @@ class _ChipDemoState extends State<ChipDemo> {
return new Scaffold( return new Scaffold(
appBar: new AppBar(title: const Text('Chips')), appBar: new AppBar(title: const Text('Chips')),
body: new ListView( body: new ListView(
children: chips.map((Widget widget) { children: chips.map((Widget chip) {
return new Container( return new Container(
height: 100.0, height: 100.0,
child: new Center(child: widget) child: new Center(child: chip)
); );
}).toList() }).toList()
) )
......
...@@ -130,7 +130,7 @@ class _GridPhotoViewerState extends State<GridPhotoViewer> with SingleTickerProv ...@@ -130,7 +130,7 @@ class _GridPhotoViewerState extends State<GridPhotoViewer> with SingleTickerProv
transform: new Matrix4.identity() transform: new Matrix4.identity()
..translate(_offset.dx, _offset.dy) ..translate(_offset.dx, _offset.dy)
..scale(_scale), ..scale(_scale),
child: new Image.asset(config.photo.assetName, fit: BoxFit.cover), child: new Image.asset(widget.photo.assetName, fit: BoxFit.cover),
), ),
), ),
); );
......
...@@ -39,19 +39,19 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> { ...@@ -39,19 +39,19 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> {
new ComponentDemoTabData( new ComponentDemoTabData(
tabName: "CHECKBOX", tabName: "CHECKBOX",
description: _checkboxText, description: _checkboxText,
widget: buildCheckbox(), demoWidget: buildCheckbox(),
exampleCodeTag: _checkboxCode exampleCodeTag: _checkboxCode
), ),
new ComponentDemoTabData( new ComponentDemoTabData(
tabName: "RADIO", tabName: "RADIO",
description: _radioText, description: _radioText,
widget: buildRadio(), demoWidget: buildRadio(),
exampleCodeTag: _radioCode exampleCodeTag: _radioCode
), ),
new ComponentDemoTabData( new ComponentDemoTabData(
tabName: "SWITCH", tabName: "SWITCH",
description: _switchText, description: _switchText,
widget: buildSwitch(), demoWidget: buildSwitch(),
exampleCodeTag: _switchCode exampleCodeTag: _switchCode
) )
]; ];
......
...@@ -147,13 +147,13 @@ class _RecipeGridPageState extends State<RecipeGridPage> { ...@@ -147,13 +147,13 @@ class _RecipeGridPageState extends State<RecipeGridPage> {
), ),
delegate: new SliverChildBuilderDelegate( delegate: new SliverChildBuilderDelegate(
(BuildContext context, int index) { (BuildContext context, int index) {
final Recipe recipe = config.recipes[index]; final Recipe recipe = widget.recipes[index];
return new RecipeCard( return new RecipeCard(
recipe: recipe, recipe: recipe,
onTap: () { showRecipePage(context, recipe); }, onTap: () { showRecipePage(context, recipe); },
); );
}, },
childCount: config.recipes.length, childCount: widget.recipes.length,
), ),
), ),
); );
...@@ -209,7 +209,7 @@ class _PestoLogoState extends State<PestoLogo> { ...@@ -209,7 +209,7 @@ class _PestoLogoState extends State<PestoLogo> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Transform( return new Transform(
transform: new Matrix4.identity()..scale(config.height / kLogoHeight), transform: new Matrix4.identity()..scale(widget.height / kLogoHeight),
alignment: FractionalOffset.topCenter, alignment: FractionalOffset.topCenter,
child: new SizedBox( child: new SizedBox(
width: kLogoWidth, width: kLogoWidth,
...@@ -217,13 +217,13 @@ class _PestoLogoState extends State<PestoLogo> { ...@@ -217,13 +217,13 @@ class _PestoLogoState extends State<PestoLogo> {
overflow: Overflow.visible, overflow: Overflow.visible,
children: <Widget>[ children: <Widget>[
new Positioned.fromRect( new Positioned.fromRect(
rect: _imageRectTween.lerp(config.t), rect: _imageRectTween.lerp(widget.t),
child: new Image.asset(_kSmallLogoImage, fit: BoxFit.contain), child: new Image.asset(_kSmallLogoImage, fit: BoxFit.contain),
), ),
new Positioned.fromRect( new Positioned.fromRect(
rect: _textRectTween.lerp(config.t), rect: _textRectTween.lerp(widget.t),
child: new Opacity( child: new Opacity(
opacity: _textOpacity.transform(config.t), opacity: _textOpacity.transform(widget.t),
child: new Text('PESTO', style: titleStyle, textAlign: TextAlign.center), child: new Text('PESTO', style: titleStyle, textAlign: TextAlign.center),
), ),
), ),
...@@ -311,7 +311,7 @@ class _RecipePageState extends State<RecipePage> { ...@@ -311,7 +311,7 @@ class _RecipePageState extends State<RecipePage> {
final double appBarHeight = _getAppBarHeight(context); final double appBarHeight = _getAppBarHeight(context);
final Size screenSize = MediaQuery.of(context).size; final Size screenSize = MediaQuery.of(context).size;
final bool fullWidth = (screenSize.width < _kRecipePageMaxWidth); final bool fullWidth = (screenSize.width < _kRecipePageMaxWidth);
final bool isFavorite = _favoriteRecipes.contains(config.recipe); final bool isFavorite = _favoriteRecipes.contains(widget.recipe);
return new Scaffold( return new Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
body: new Stack( body: new Stack(
...@@ -322,9 +322,9 @@ class _RecipePageState extends State<RecipePage> { ...@@ -322,9 +322,9 @@ class _RecipePageState extends State<RecipePage> {
right: 0.0, right: 0.0,
height: appBarHeight + _kFabHalfSize, height: appBarHeight + _kFabHalfSize,
child: new Hero( child: new Hero(
tag: config.recipe.imagePath, tag: widget.recipe.imagePath,
child: new Image.asset( child: new Image.asset(
config.recipe.imagePath, widget.recipe.imagePath,
fit: fullWidth ? BoxFit.fitWidth : BoxFit.cover, fit: fullWidth ? BoxFit.fitWidth : BoxFit.cover,
), ),
), ),
...@@ -363,7 +363,7 @@ class _RecipePageState extends State<RecipePage> { ...@@ -363,7 +363,7 @@ class _RecipePageState extends State<RecipePage> {
new Container( new Container(
padding: const EdgeInsets.only(top: _kFabHalfSize), padding: const EdgeInsets.only(top: _kFabHalfSize),
width: fullWidth ? null : _kRecipePageMaxWidth, width: fullWidth ? null : _kRecipePageMaxWidth,
child: new RecipeSheet(recipe: config.recipe), child: new RecipeSheet(recipe: widget.recipe),
), ),
new Positioned( new Positioned(
right: 16.0, right: 16.0,
...@@ -398,10 +398,10 @@ class _RecipePageState extends State<RecipePage> { ...@@ -398,10 +398,10 @@ class _RecipePageState extends State<RecipePage> {
void _toggleFavorite() { void _toggleFavorite() {
setState(() { setState(() {
if (_favoriteRecipes.contains(config.recipe)) if (_favoriteRecipes.contains(widget.recipe))
_favoriteRecipes.remove(config.recipe); _favoriteRecipes.remove(widget.recipe);
else else
_favoriteRecipes.add(config.recipe); _favoriteRecipes.add(widget.recipe);
}); });
} }
} }
......
...@@ -236,7 +236,7 @@ class _OrderPageState extends State<OrderPage> { ...@@ -236,7 +236,7 @@ class _OrderPageState extends State<OrderPage> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
scaffoldKey = new GlobalKey<ScaffoldState>(debugLabel: 'Shrine Order ${config.order}'); scaffoldKey = new GlobalKey<ScaffoldState>(debugLabel: 'Shrine Order ${widget.order}');
} }
Order get currentOrder => ShrineOrderRoute.of(context).order; Order get currentOrder => ShrineOrderRoute.of(context).order;
...@@ -249,7 +249,7 @@ class _OrderPageState extends State<OrderPage> { ...@@ -249,7 +249,7 @@ class _OrderPageState extends State<OrderPage> {
final Order newOrder = currentOrder.copyWith(quantity: quantity, inCart: inCart); final Order newOrder = currentOrder.copyWith(quantity: quantity, inCart: inCart);
if (currentOrder != newOrder) { if (currentOrder != newOrder) {
setState(() { setState(() {
config.shoppingCart[newOrder.product] = newOrder; widget.shoppingCart[newOrder.product] = newOrder;
currentOrder = newOrder; currentOrder = newOrder;
}); });
} }
...@@ -263,8 +263,8 @@ class _OrderPageState extends State<OrderPage> { ...@@ -263,8 +263,8 @@ class _OrderPageState extends State<OrderPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new ShrinePage( return new ShrinePage(
scaffoldKey: scaffoldKey, scaffoldKey: scaffoldKey,
products: config.products, products: widget.products,
shoppingCart: config.shoppingCart, shoppingCart: widget.shoppingCart,
floatingActionButton: new FloatingActionButton( floatingActionButton: new FloatingActionButton(
onPressed: () { onPressed: () {
updateOrder(inCart: true); updateOrder(inCart: true);
...@@ -284,7 +284,7 @@ class _OrderPageState extends State<OrderPage> { ...@@ -284,7 +284,7 @@ class _OrderPageState extends State<OrderPage> {
slivers: <Widget>[ slivers: <Widget>[
new SliverToBoxAdapter( new SliverToBoxAdapter(
child: new _Heading( child: new _Heading(
product: config.order.product, product: widget.order.product,
quantity: currentOrder.quantity, quantity: currentOrder.quantity,
quantityChanged: (int value) { updateOrder(quantity: value); }, quantityChanged: (int value) { updateOrder(quantity: value); },
), ),
...@@ -298,8 +298,8 @@ class _OrderPageState extends State<OrderPage> { ...@@ -298,8 +298,8 @@ class _OrderPageState extends State<OrderPage> {
crossAxisSpacing: 8.0, crossAxisSpacing: 8.0,
), ),
delegate: new SliverChildListDelegate( delegate: new SliverChildListDelegate(
config.products widget.products
.where((Product product) => product != config.order.product) .where((Product product) => product != widget.order.product)
.map((Product product) { .map((Product product) {
return new Card( return new Card(
elevation: 1, elevation: 1,
......
...@@ -53,7 +53,7 @@ class ShrinePageState extends State<ShrinePage> { ...@@ -53,7 +53,7 @@ class ShrinePageState extends State<ShrinePage> {
void _showShoppingCart() { void _showShoppingCart() {
showModalBottomSheet<Null>(context: context, builder: (BuildContext context) { showModalBottomSheet<Null>(context: context, builder: (BuildContext context) {
if (config.shoppingCart.isEmpty) { if (widget.shoppingCart.isEmpty) {
return const Padding( return const Padding(
padding: const EdgeInsets.all(24.0), padding: const EdgeInsets.all(24.0),
child: const Text('The shopping cart is empty') child: const Text('The shopping cart is empty')
...@@ -61,7 +61,7 @@ class ShrinePageState extends State<ShrinePage> { ...@@ -61,7 +61,7 @@ class ShrinePageState extends State<ShrinePage> {
} }
return new ListView( return new ListView(
padding: kMaterialListPadding, padding: kMaterialListPadding,
children: config.shoppingCart.values.map((Order order) { children: widget.shoppingCart.values.map((Order order) {
return new ListTile( return new ListTile(
title: new Text(order.product.name), title: new Text(order.product.name),
leading: new Text('${order.quantity}'), leading: new Text('${order.quantity}'),
...@@ -73,23 +73,23 @@ class ShrinePageState extends State<ShrinePage> { ...@@ -73,23 +73,23 @@ class ShrinePageState extends State<ShrinePage> {
} }
void _sortByPrice() { void _sortByPrice() {
config.products.sort((Product a, Product b) => a.price.compareTo(b.price)); widget.products.sort((Product a, Product b) => a.price.compareTo(b.price));
} }
void _sortByProduct() { void _sortByProduct() {
config.products.sort((Product a, Product b) => a.name.compareTo(b.name)); widget.products.sort((Product a, Product b) => a.name.compareTo(b.name));
} }
void _emptyCart() { void _emptyCart() {
config.shoppingCart.clear(); widget.shoppingCart.clear();
config.scaffoldKey.currentState.showSnackBar(new SnackBar(content: const Text('Shopping cart is empty'))); widget.scaffoldKey.currentState.showSnackBar(new SnackBar(content: const Text('Shopping cart is empty')));
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final ShrineTheme theme = ShrineTheme.of(context); final ShrineTheme theme = ShrineTheme.of(context);
return new Scaffold( return new Scaffold(
key: config.scaffoldKey, key: widget.scaffoldKey,
appBar: new AppBar( appBar: new AppBar(
elevation: _appBarElevation, elevation: _appBarElevation,
backgroundColor: theme.appBarBackgroundColor, backgroundColor: theme.appBarBackgroundColor,
...@@ -142,10 +142,10 @@ class ShrinePageState extends State<ShrinePage> { ...@@ -142,10 +142,10 @@ class ShrinePageState extends State<ShrinePage> {
) )
] ]
), ),
floatingActionButton: config.floatingActionButton, floatingActionButton: widget.floatingActionButton,
body: new NotificationListener<ScrollNotification>( body: new NotificationListener<ScrollNotification>(
onNotification: _handleScrollNotification, onNotification: _handleScrollNotification,
child: config.body child: widget.body
) )
); );
} }
......
...@@ -84,13 +84,13 @@ class GalleryAppState extends State<GalleryApp> { ...@@ -84,13 +84,13 @@ class GalleryAppState extends State<GalleryApp> {
}); });
}, },
showPerformanceOverlay: _showPerformanceOverlay, showPerformanceOverlay: _showPerformanceOverlay,
onShowPerformanceOverlayChanged: config.enablePerformanceOverlay ? (bool value) { onShowPerformanceOverlayChanged: widget.enablePerformanceOverlay ? (bool value) {
setState(() { setState(() {
_showPerformanceOverlay = value; _showPerformanceOverlay = value;
}); });
} : null, } : null,
checkerboardRasterCacheImages: _checkerboardRasterCacheImages, checkerboardRasterCacheImages: _checkerboardRasterCacheImages,
onCheckerboardRasterCacheImagesChanged: config.checkerboardRasterCacheImages ? (bool value) { onCheckerboardRasterCacheImagesChanged: widget.checkerboardRasterCacheImages ? (bool value) {
setState(() { setState(() {
_checkerboardRasterCacheImages = value; _checkerboardRasterCacheImages = value;
}); });
...@@ -118,12 +118,12 @@ class GalleryAppState extends State<GalleryApp> { ...@@ -118,12 +118,12 @@ class GalleryAppState extends State<GalleryApp> {
} }
}); });
}, },
onSendFeedback: config.onSendFeedback, onSendFeedback: widget.onSendFeedback,
); );
if (config.updateUrlFetcher != null) { if (widget.updateUrlFetcher != null) {
home = new Updater( home = new Updater(
updateUrlFetcher: config.updateUrlFetcher, updateUrlFetcher: widget.updateUrlFetcher,
child: home, child: home,
); );
} }
......
...@@ -9,13 +9,13 @@ import 'syntax_highlighter.dart'; ...@@ -9,13 +9,13 @@ import 'syntax_highlighter.dart';
class ComponentDemoTabData { class ComponentDemoTabData {
ComponentDemoTabData({ ComponentDemoTabData({
this.widget, this.demoWidget,
this.exampleCodeTag, this.exampleCodeTag,
this.description, this.description,
this.tabName this.tabName
}); });
final Widget widget; final Widget demoWidget;
final String exampleCodeTag; final String exampleCodeTag;
final String description; final String description;
final String tabName; final String tabName;
...@@ -85,7 +85,7 @@ class TabbedComponentDemoScaffold extends StatelessWidget { ...@@ -85,7 +85,7 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
style: Theme.of(context).textTheme.subhead style: Theme.of(context).textTheme.subhead
) )
), ),
new Expanded(child: demo.widget) new Expanded(child: demo.demoWidget)
], ],
); );
}).toList(), }).toList(),
...@@ -110,7 +110,7 @@ class FullScreenCodeDialogState extends State<FullScreenCodeDialog> { ...@@ -110,7 +110,7 @@ class FullScreenCodeDialogState extends State<FullScreenCodeDialog> {
@override @override
void didChangeDependencies() { void didChangeDependencies() {
getExampleCode(config.exampleCodeTag, DefaultAssetBundle.of(context)).then<Null>((String code) { getExampleCode(widget.exampleCodeTag, DefaultAssetBundle.of(context)).then<Null>((String code) {
if (mounted) { if (mounted) {
setState(() { setState(() {
_exampleCode = code; _exampleCode = code;
......
...@@ -45,7 +45,7 @@ class _GalleryDrawerHeaderState extends State<GalleryDrawerHeader> { ...@@ -45,7 +45,7 @@ class _GalleryDrawerHeaderState extends State<GalleryDrawerHeader> {
: FlutterLogoStyle.markOnly, : FlutterLogoStyle.markOnly,
lightColor: _logoColor.shade400, lightColor: _logoColor.shade400,
darkColor: _logoColor.shade900, darkColor: _logoColor.shade900,
textColor: config.light ? const Color(0xFF616161) : const Color(0xFF9E9E9E), textColor: widget.light ? const Color(0xFF616161) : const Color(0xFF9E9E9E),
), ),
duration: const Duration(milliseconds: 750), duration: const Duration(milliseconds: 750),
child: new GestureDetector( child: new GestureDetector(
......
...@@ -153,16 +153,16 @@ class GalleryHomeState extends State<GalleryHome> with SingleTickerProviderState ...@@ -153,16 +153,16 @@ class GalleryHomeState extends State<GalleryHome> with SingleTickerProviderState
Widget home = new Scaffold( Widget home = new Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
drawer: new GalleryDrawer( drawer: new GalleryDrawer(
useLightTheme: config.useLightTheme, useLightTheme: widget.useLightTheme,
onThemeChanged: config.onThemeChanged, onThemeChanged: widget.onThemeChanged,
timeDilation: config.timeDilation, timeDilation: widget.timeDilation,
onTimeDilationChanged: config.onTimeDilationChanged, onTimeDilationChanged: widget.onTimeDilationChanged,
showPerformanceOverlay: config.showPerformanceOverlay, showPerformanceOverlay: widget.showPerformanceOverlay,
onShowPerformanceOverlayChanged: config.onShowPerformanceOverlayChanged, onShowPerformanceOverlayChanged: widget.onShowPerformanceOverlayChanged,
checkerboardRasterCacheImages: config.checkerboardRasterCacheImages, checkerboardRasterCacheImages: widget.checkerboardRasterCacheImages,
onCheckerboardRasterCacheImagesChanged: config.onCheckerboardRasterCacheImagesChanged, onCheckerboardRasterCacheImagesChanged: widget.onCheckerboardRasterCacheImagesChanged,
onPlatformChanged: config.onPlatformChanged, onPlatformChanged: widget.onPlatformChanged,
onSendFeedback: config.onSendFeedback, onSendFeedback: widget.onSendFeedback,
), ),
body: new CustomScrollView( body: new CustomScrollView(
slivers: <Widget>[ slivers: <Widget>[
......
...@@ -38,7 +38,7 @@ class UpdaterState extends State<Updater> { ...@@ -38,7 +38,7 @@ class UpdaterState extends State<Updater> {
} }
_lastUpdateCheck = new DateTime.now(); _lastUpdateCheck = new DateTime.now();
final String updateUrl = await config.updateUrlFetcher(); final String updateUrl = await widget.updateUrlFetcher();
if (updateUrl != null) { if (updateUrl != null) {
final bool wantsUpdate = await showDialog(context: context, child: _buildDialog()); final bool wantsUpdate = await showDialog(context: context, child: _buildDialog());
if (wantsUpdate != null && wantsUpdate) if (wantsUpdate != null && wantsUpdate)
...@@ -68,5 +68,5 @@ class UpdaterState extends State<Updater> { ...@@ -68,5 +68,5 @@ class UpdaterState extends State<Updater> {
} }
@override @override
Widget build(BuildContext context) => config.child; Widget build(BuildContext context) => widget.child;
} }
...@@ -87,8 +87,8 @@ class StockHomeState extends State<StockHome> { ...@@ -87,8 +87,8 @@ class StockHomeState extends State<StockHome> {
} }
void _handleStockModeChange(StockMode value) { void _handleStockModeChange(StockMode value) {
if (config.updater != null) if (widget.updater != null)
config.updater(config.configuration.copyWith(stockMode: value)); widget.updater(widget.configuration.copyWith(stockMode: value));
} }
void _handleStockMenu(BuildContext context, _StockMenuItem value) { void _handleStockMenu(BuildContext context, _StockMenuItem value) {
...@@ -148,7 +148,7 @@ class StockHomeState extends State<StockHome> { ...@@ -148,7 +148,7 @@ class StockHomeState extends State<StockHome> {
title: const Text('Optimistic'), title: const Text('Optimistic'),
trailing: new Radio<StockMode>( trailing: new Radio<StockMode>(
value: StockMode.optimistic, value: StockMode.optimistic,
groupValue: config.configuration.stockMode, groupValue: widget.configuration.stockMode,
onChanged: _handleStockModeChange, onChanged: _handleStockModeChange,
), ),
onTap: () { onTap: () {
...@@ -160,7 +160,7 @@ class StockHomeState extends State<StockHome> { ...@@ -160,7 +160,7 @@ class StockHomeState extends State<StockHome> {
title: const Text('Pessimistic'), title: const Text('Pessimistic'),
trailing: new Radio<StockMode>( trailing: new Radio<StockMode>(
value: StockMode.pessimistic, value: StockMode.pessimistic,
groupValue: config.configuration.stockMode, groupValue: widget.configuration.stockMode,
onChanged: _handleStockModeChange, onChanged: _handleStockModeChange,
), ),
onTap: () { onTap: () {
...@@ -234,7 +234,7 @@ class StockHomeState extends State<StockHome> { ...@@ -234,7 +234,7 @@ class StockHomeState extends State<StockHome> {
} }
Iterable<Stock> _getStockList(Iterable<String> symbols) { Iterable<Stock> _getStockList(Iterable<String> symbols) {
return symbols.map((String symbol) => config.stocks[symbol]) return symbols.map((String symbol) => widget.stocks[symbol])
.where((Stock stock) => stock != null); .where((Stock stock) => stock != null);
} }
...@@ -330,7 +330,7 @@ class StockHomeState extends State<StockHome> { ...@@ -330,7 +330,7 @@ class StockHomeState extends State<StockHome> {
drawer: _buildDrawer(context), drawer: _buildDrawer(context),
body: new TabBarView( body: new TabBarView(
children: <Widget>[ children: <Widget>[
_buildStockTab(context, StockHomeTab.market, config.symbols), _buildStockTab(context, StockHomeTab.market, widget.symbols),
_buildStockTab(context, StockHomeTab.portfolio, portfolioSymbols), _buildStockTab(context, StockHomeTab.portfolio, portfolioSymbols),
], ],
), ),
......
...@@ -19,48 +19,48 @@ class StockSettings extends StatefulWidget { ...@@ -19,48 +19,48 @@ class StockSettings extends StatefulWidget {
class StockSettingsState extends State<StockSettings> { class StockSettingsState extends State<StockSettings> {
void _handleOptimismChanged(bool value) { void _handleOptimismChanged(bool value) {
value ??= false; value ??= false;
sendUpdates(config.configuration.copyWith(stockMode: value ? StockMode.optimistic : StockMode.pessimistic)); sendUpdates(widget.configuration.copyWith(stockMode: value ? StockMode.optimistic : StockMode.pessimistic));
} }
void _handleBackupChanged(bool value) { void _handleBackupChanged(bool value) {
sendUpdates(config.configuration.copyWith(backupMode: value ? BackupMode.enabled : BackupMode.disabled)); sendUpdates(widget.configuration.copyWith(backupMode: value ? BackupMode.enabled : BackupMode.disabled));
} }
void _handleShowGridChanged(bool value) { void _handleShowGridChanged(bool value) {
sendUpdates(config.configuration.copyWith(debugShowGrid: value)); sendUpdates(widget.configuration.copyWith(debugShowGrid: value));
} }
void _handleShowSizesChanged(bool value) { void _handleShowSizesChanged(bool value) {
sendUpdates(config.configuration.copyWith(debugShowSizes: value)); sendUpdates(widget.configuration.copyWith(debugShowSizes: value));
} }
void _handleShowBaselinesChanged(bool value) { void _handleShowBaselinesChanged(bool value) {
sendUpdates(config.configuration.copyWith(debugShowBaselines: value)); sendUpdates(widget.configuration.copyWith(debugShowBaselines: value));
} }
void _handleShowLayersChanged(bool value) { void _handleShowLayersChanged(bool value) {
sendUpdates(config.configuration.copyWith(debugShowLayers: value)); sendUpdates(widget.configuration.copyWith(debugShowLayers: value));
} }
void _handleShowPointersChanged(bool value) { void _handleShowPointersChanged(bool value) {
sendUpdates(config.configuration.copyWith(debugShowPointers: value)); sendUpdates(widget.configuration.copyWith(debugShowPointers: value));
} }
void _handleShowRainbowChanged(bool value) { void _handleShowRainbowChanged(bool value) {
sendUpdates(config.configuration.copyWith(debugShowRainbow: value)); sendUpdates(widget.configuration.copyWith(debugShowRainbow: value));
} }
void _handleShowPerformanceOverlayChanged(bool value) { void _handleShowPerformanceOverlayChanged(bool value) {
sendUpdates(config.configuration.copyWith(showPerformanceOverlay: value)); sendUpdates(widget.configuration.copyWith(showPerformanceOverlay: value));
} }
void _handleShowSemanticsDebuggerChanged(bool value) { void _handleShowSemanticsDebuggerChanged(bool value) {
sendUpdates(config.configuration.copyWith(showSemanticsDebugger: value)); sendUpdates(widget.configuration.copyWith(showSemanticsDebugger: value));
} }
void _confirmOptimismChange() { void _confirmOptimismChange() {
switch (config.configuration.stockMode) { switch (widget.configuration.stockMode) {
case StockMode.optimistic: case StockMode.optimistic:
_handleOptimismChanged(false); _handleOptimismChanged(false);
break; break;
...@@ -91,8 +91,8 @@ class StockSettingsState extends State<StockSettings> { ...@@ -91,8 +91,8 @@ class StockSettingsState extends State<StockSettings> {
} }
void sendUpdates(StockConfiguration value) { void sendUpdates(StockConfiguration value) {
if (config.updater != null) if (widget.updater != null)
config.updater(value); widget.updater(value);
} }
Widget buildAppBar(BuildContext context) { Widget buildAppBar(BuildContext context) {
...@@ -108,34 +108,34 @@ class StockSettingsState extends State<StockSettings> { ...@@ -108,34 +108,34 @@ class StockSettingsState extends State<StockSettings> {
title: const Text('Everything is awesome'), title: const Text('Everything is awesome'),
onTap: _confirmOptimismChange, onTap: _confirmOptimismChange,
trailing: new Checkbox( trailing: new Checkbox(
value: config.configuration.stockMode == StockMode.optimistic, value: widget.configuration.stockMode == StockMode.optimistic,
onChanged: (bool value) => _confirmOptimismChange(), onChanged: (bool value) => _confirmOptimismChange(),
), ),
), ),
new ListTile( new ListTile(
leading: const Icon(Icons.backup), leading: const Icon(Icons.backup),
title: const Text('Back up stock list to the cloud'), title: const Text('Back up stock list to the cloud'),
onTap: () { _handleBackupChanged(!(config.configuration.backupMode == BackupMode.enabled)); }, onTap: () { _handleBackupChanged(!(widget.configuration.backupMode == BackupMode.enabled)); },
trailing: new Switch( trailing: new Switch(
value: config.configuration.backupMode == BackupMode.enabled, value: widget.configuration.backupMode == BackupMode.enabled,
onChanged: _handleBackupChanged, onChanged: _handleBackupChanged,
), ),
), ),
new ListTile( new ListTile(
leading: const Icon(Icons.picture_in_picture), leading: const Icon(Icons.picture_in_picture),
title: const Text('Show rendering performance overlay'), title: const Text('Show rendering performance overlay'),
onTap: () { _handleShowPerformanceOverlayChanged(!config.configuration.showPerformanceOverlay); }, onTap: () { _handleShowPerformanceOverlayChanged(!widget.configuration.showPerformanceOverlay); },
trailing: new Switch( trailing: new Switch(
value: config.configuration.showPerformanceOverlay, value: widget.configuration.showPerformanceOverlay,
onChanged: _handleShowPerformanceOverlayChanged, onChanged: _handleShowPerformanceOverlayChanged,
), ),
), ),
new ListTile( new ListTile(
leading: const Icon(Icons.accessibility), leading: const Icon(Icons.accessibility),
title: const Text('Show semantics overlay'), title: const Text('Show semantics overlay'),
onTap: () { _handleShowSemanticsDebuggerChanged(!config.configuration.showSemanticsDebugger); }, onTap: () { _handleShowSemanticsDebuggerChanged(!widget.configuration.showSemanticsDebugger); },
trailing: new Switch( trailing: new Switch(
value: config.configuration.showSemanticsDebugger, value: widget.configuration.showSemanticsDebugger,
onChanged: _handleShowSemanticsDebuggerChanged, onChanged: _handleShowSemanticsDebuggerChanged,
), ),
), ),
...@@ -146,54 +146,54 @@ class StockSettingsState extends State<StockSettings> { ...@@ -146,54 +146,54 @@ class StockSettingsState extends State<StockSettings> {
new ListTile( new ListTile(
leading: const Icon(Icons.border_clear), leading: const Icon(Icons.border_clear),
title: const Text('Show material grid (for debugging)'), title: const Text('Show material grid (for debugging)'),
onTap: () { _handleShowGridChanged(!config.configuration.debugShowGrid); }, onTap: () { _handleShowGridChanged(!widget.configuration.debugShowGrid); },
trailing: new Switch( trailing: new Switch(
value: config.configuration.debugShowGrid, value: widget.configuration.debugShowGrid,
onChanged: _handleShowGridChanged, onChanged: _handleShowGridChanged,
), ),
), ),
new ListTile( new ListTile(
leading: const Icon(Icons.border_all), leading: const Icon(Icons.border_all),
title: const Text('Show construction lines (for debugging)'), title: const Text('Show construction lines (for debugging)'),
onTap: () { _handleShowSizesChanged(!config.configuration.debugShowSizes); }, onTap: () { _handleShowSizesChanged(!widget.configuration.debugShowSizes); },
trailing: new Switch( trailing: new Switch(
value: config.configuration.debugShowSizes, value: widget.configuration.debugShowSizes,
onChanged: _handleShowSizesChanged, onChanged: _handleShowSizesChanged,
), ),
), ),
new ListTile( new ListTile(
leading: const Icon(Icons.format_color_text), leading: const Icon(Icons.format_color_text),
title: const Text('Show baselines (for debugging)'), title: const Text('Show baselines (for debugging)'),
onTap: () { _handleShowBaselinesChanged(!config.configuration.debugShowBaselines); }, onTap: () { _handleShowBaselinesChanged(!widget.configuration.debugShowBaselines); },
trailing: new Switch( trailing: new Switch(
value: config.configuration.debugShowBaselines, value: widget.configuration.debugShowBaselines,
onChanged: _handleShowBaselinesChanged, onChanged: _handleShowBaselinesChanged,
), ),
), ),
new ListTile( new ListTile(
leading: const Icon(Icons.filter_none), leading: const Icon(Icons.filter_none),
title: const Text('Show layer boundaries (for debugging)'), title: const Text('Show layer boundaries (for debugging)'),
onTap: () { _handleShowLayersChanged(!config.configuration.debugShowLayers); }, onTap: () { _handleShowLayersChanged(!widget.configuration.debugShowLayers); },
trailing: new Switch( trailing: new Switch(
value: config.configuration.debugShowLayers, value: widget.configuration.debugShowLayers,
onChanged: _handleShowLayersChanged, onChanged: _handleShowLayersChanged,
), ),
), ),
new ListTile( new ListTile(
leading: const Icon(Icons.mouse), leading: const Icon(Icons.mouse),
title: const Text('Show pointer hit-testing (for debugging)'), title: const Text('Show pointer hit-testing (for debugging)'),
onTap: () { _handleShowPointersChanged(!config.configuration.debugShowPointers); }, onTap: () { _handleShowPointersChanged(!widget.configuration.debugShowPointers); },
trailing: new Switch( trailing: new Switch(
value: config.configuration.debugShowPointers, value: widget.configuration.debugShowPointers,
onChanged: _handleShowPointersChanged, onChanged: _handleShowPointersChanged,
), ),
), ),
new ListTile( new ListTile(
leading: const Icon(Icons.gradient), leading: const Icon(Icons.gradient),
title: const Text('Show repaint rainbow (for debugging)'), title: const Text('Show repaint rainbow (for debugging)'),
onTap: () { _handleShowRainbowChanged(!config.configuration.debugShowRainbow); }, onTap: () { _handleShowRainbowChanged(!widget.configuration.debugShowRainbow); },
trailing: new Switch( trailing: new Switch(
value: config.configuration.debugShowRainbow, value: widget.configuration.debugShowRainbow,
onChanged: _handleShowRainbowChanged, onChanged: _handleShowRainbowChanged,
), ),
), ),
......
...@@ -43,14 +43,14 @@ class _CupertinoActivityIndicatorState extends State<CupertinoActivityIndicator> ...@@ -43,14 +43,14 @@ class _CupertinoActivityIndicatorState extends State<CupertinoActivityIndicator>
vsync: this, vsync: this,
); );
if (config.animating) if (widget.animating)
_controller.repeat(); _controller.repeat();
} }
@override @override
void didUpdateConfig(CupertinoActivityIndicator oldConfig) { void didUpdateWidget(CupertinoActivityIndicator oldWidget) {
if (config.animating != oldConfig.animating) { if (widget.animating != oldWidget.animating) {
if (config.animating) if (widget.animating)
_controller.repeat(); _controller.repeat();
else else
_controller.stop(); _controller.stop();
......
...@@ -115,7 +115,7 @@ class _CupertinoButtonState extends State<CupertinoButton> with SingleTickerProv ...@@ -115,7 +115,7 @@ class _CupertinoButtonState extends State<CupertinoButton> with SingleTickerProv
void _setTween() { void _setTween() {
_opacityTween = new Tween<double>( _opacityTween = new Tween<double>(
begin: 1.0, begin: 1.0,
end: config.pressedOpacity, end: widget.pressedOpacity,
); );
} }
...@@ -138,8 +138,8 @@ class _CupertinoButtonState extends State<CupertinoButton> with SingleTickerProv ...@@ -138,8 +138,8 @@ class _CupertinoButtonState extends State<CupertinoButton> with SingleTickerProv
} }
@override @override
void didUpdateConfig(CupertinoButton old) { void didUpdateWidget(CupertinoButton old) {
super.didUpdateConfig(old); super.didUpdateWidget(old);
_setTween(); _setTween();
} }
...@@ -157,19 +157,19 @@ class _CupertinoButtonState extends State<CupertinoButton> with SingleTickerProv ...@@ -157,19 +157,19 @@ class _CupertinoButtonState extends State<CupertinoButton> with SingleTickerProv
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final bool enabled = config.enabled; final bool enabled = widget.enabled;
final Color backgroundColor = config.color; final Color backgroundColor = widget.color;
return new Listener( return new Listener(
onPointerDown: enabled ? _handleTapDown : null, onPointerDown: enabled ? _handleTapDown : null,
onPointerUp: enabled ? _handleTapUp : null, onPointerUp: enabled ? _handleTapUp : null,
onPointerCancel: enabled ? _handleTapCancel : null, onPointerCancel: enabled ? _handleTapCancel : null,
child: new GestureDetector( child: new GestureDetector(
onTap: config.onPressed, onTap: widget.onPressed,
child: new ConstrainedBox( child: new ConstrainedBox(
constraints: new BoxConstraints( constraints: new BoxConstraints(
minWidth: config.minSize, minWidth: widget.minSize,
minHeight: config.minSize, minHeight: widget.minSize,
), ),
child: new FadeTransition( child: new FadeTransition(
opacity: _opacityTween.animate(new CurvedAnimation( opacity: _opacityTween.animate(new CurvedAnimation(
...@@ -184,8 +184,8 @@ class _CupertinoButtonState extends State<CupertinoButton> with SingleTickerProv ...@@ -184,8 +184,8 @@ class _CupertinoButtonState extends State<CupertinoButton> with SingleTickerProv
: backgroundColor, : backgroundColor,
), ),
child: new Padding( child: new Padding(
padding: config.padding != null padding: widget.padding != null
? config.padding ? widget.padding
: backgroundColor != null : backgroundColor != null
? _kBackgroundButtonPadding ? _kBackgroundButtonPadding
: _kButtonPadding, : _kButtonPadding,
...@@ -198,7 +198,7 @@ class _CupertinoButtonState extends State<CupertinoButton> with SingleTickerProv ...@@ -198,7 +198,7 @@ class _CupertinoButtonState extends State<CupertinoButton> with SingleTickerProv
: enabled : enabled
? _kButtonTextStyle ? _kButtonTextStyle
: _kDisabledButtonTextStyle, : _kDisabledButtonTextStyle,
child: config.child, child: widget.child,
), ),
), ),
), ),
......
...@@ -123,17 +123,17 @@ class CupertinoSlider extends StatefulWidget { ...@@ -123,17 +123,17 @@ class CupertinoSlider extends StatefulWidget {
class _CupertinoSliderState extends State<CupertinoSlider> with TickerProviderStateMixin { class _CupertinoSliderState extends State<CupertinoSlider> with TickerProviderStateMixin {
void _handleChanged(double value) { void _handleChanged(double value) {
assert(config.onChanged != null); assert(widget.onChanged != null);
config.onChanged(value * (config.max - config.min) + config.min); widget.onChanged(value * (widget.max - widget.min) + widget.min);
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new _CupertinoSliderRenderObjectWidget( return new _CupertinoSliderRenderObjectWidget(
value: (config.value - config.min) / (config.max - config.min), value: (widget.value - widget.min) / (widget.max - widget.min),
divisions: config.divisions, divisions: widget.divisions,
activeColor: config.activeColor, activeColor: widget.activeColor,
onChanged: config.onChanged != null ? _handleChanged : null, onChanged: widget.onChanged != null ? _handleChanged : null,
vsync: this, vsync: this,
); );
} }
......
...@@ -79,9 +79,9 @@ class _CupertinoSwitchState extends State<CupertinoSwitch> with TickerProviderSt ...@@ -79,9 +79,9 @@ class _CupertinoSwitchState extends State<CupertinoSwitch> with TickerProviderSt
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new _CupertinoSwitchRenderObjectWidget( return new _CupertinoSwitchRenderObjectWidget(
value: config.value, value: widget.value,
activeColor: config.activeColor, activeColor: widget.activeColor,
onChanged: config.onChanged, onChanged: widget.onChanged,
vsync: this, vsync: this,
); );
} }
......
...@@ -421,13 +421,13 @@ class _LicensePageState extends State<LicensePage> { ...@@ -421,13 +421,13 @@ class _LicensePageState extends State<LicensePage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final String name = config.applicationName ?? _defaultApplicationName(context); final String name = widget.applicationName ?? _defaultApplicationName(context);
final String version = config.applicationVersion ?? _defaultApplicationVersion(context); final String version = widget.applicationVersion ?? _defaultApplicationVersion(context);
final List<Widget> contents = <Widget>[ final List<Widget> contents = <Widget>[
new Text(name, style: Theme.of(context).textTheme.headline, textAlign: TextAlign.center), new Text(name, style: Theme.of(context).textTheme.headline, textAlign: TextAlign.center),
new Text(version, style: Theme.of(context).textTheme.body1, textAlign: TextAlign.center), new Text(version, style: Theme.of(context).textTheme.body1, textAlign: TextAlign.center),
new Container(height: 18.0), new Container(height: 18.0),
new Text(config.applicationLegalese ?? '', style: Theme.of(context).textTheme.caption, textAlign: TextAlign.center), new Text(widget.applicationLegalese ?? '', style: Theme.of(context).textTheme.caption, textAlign: TextAlign.center),
new Container(height: 18.0), new Container(height: 18.0),
new Text('Powered by Flutter', style: Theme.of(context).textTheme.body1, textAlign: TextAlign.center), new Text('Powered by Flutter', style: Theme.of(context).textTheme.body1, textAlign: TextAlign.center),
new Container(height: 24.0), new Container(height: 24.0),
......
...@@ -206,47 +206,47 @@ class _MaterialAppState extends State<MaterialApp> { ...@@ -206,47 +206,47 @@ class _MaterialAppState extends State<MaterialApp> {
} }
Route<dynamic> _onGenerateRoute(RouteSettings settings) { Route<dynamic> _onGenerateRoute(RouteSettings settings) {
WidgetBuilder builder = config.routes[settings.name]; WidgetBuilder builder = widget.routes[settings.name];
if (builder == null && config.home != null && settings.name == Navigator.defaultRouteName) if (builder == null && widget.home != null && settings.name == Navigator.defaultRouteName)
builder = (BuildContext context) => config.home; builder = (BuildContext context) => widget.home;
if (builder != null) { if (builder != null) {
return new MaterialPageRoute<Null>( return new MaterialPageRoute<Null>(
builder: builder, builder: builder,
settings: settings settings: settings
); );
} }
if (config.onGenerateRoute != null) if (widget.onGenerateRoute != null)
return config.onGenerateRoute(settings); return widget.onGenerateRoute(settings);
return null; return null;
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final ThemeData theme = config.theme ?? new ThemeData.fallback(); final ThemeData theme = widget.theme ?? new ThemeData.fallback();
Widget result = new AnimatedTheme( Widget result = new AnimatedTheme(
data: theme, data: theme,
isMaterialAppTheme: true, isMaterialAppTheme: true,
child: new WidgetsApp( child: new WidgetsApp(
key: new GlobalObjectKey(this), key: new GlobalObjectKey(this),
title: config.title, title: widget.title,
textStyle: _errorTextStyle, textStyle: _errorTextStyle,
// blue is the primary color of the default theme // blue is the primary color of the default theme
color: config.color ?? theme?.primaryColor ?? Colors.blue, color: widget.color ?? theme?.primaryColor ?? Colors.blue,
navigatorObservers: navigatorObservers:
new List<NavigatorObserver>.from(config.navigatorObservers) new List<NavigatorObserver>.from(widget.navigatorObservers)
..add(_heroController), ..add(_heroController),
initialRoute: config.initialRoute, initialRoute: widget.initialRoute,
onGenerateRoute: _onGenerateRoute, onGenerateRoute: _onGenerateRoute,
onLocaleChanged: config.onLocaleChanged, onLocaleChanged: widget.onLocaleChanged,
showPerformanceOverlay: config.showPerformanceOverlay, showPerformanceOverlay: widget.showPerformanceOverlay,
checkerboardRasterCacheImages: config.checkerboardRasterCacheImages, checkerboardRasterCacheImages: widget.checkerboardRasterCacheImages,
showSemanticsDebugger: config.showSemanticsDebugger, showSemanticsDebugger: widget.showSemanticsDebugger,
debugShowCheckedModeBanner: config.debugShowCheckedModeBanner debugShowCheckedModeBanner: widget.debugShowCheckedModeBanner
) )
); );
assert(() { assert(() {
if (config.debugShowMaterialGrid) { if (widget.debugShowMaterialGrid) {
result = new GridPaper( result = new GridPaper(
color: const Color(0xE0F9BBE0), color: const Color(0xE0F9BBE0),
interval: 8.0, interval: 8.0,
......
...@@ -353,17 +353,17 @@ class _AppBarState extends State<AppBar> { ...@@ -353,17 +353,17 @@ class _AppBarState extends State<AppBar> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final ThemeData themeData = Theme.of(context); final ThemeData themeData = Theme.of(context);
IconThemeData appBarIconTheme = config.iconTheme ?? themeData.primaryIconTheme; IconThemeData appBarIconTheme = widget.iconTheme ?? themeData.primaryIconTheme;
TextStyle centerStyle = config.textTheme?.title ?? themeData.primaryTextTheme.title; TextStyle centerStyle = widget.textTheme?.title ?? themeData.primaryTextTheme.title;
TextStyle sideStyle = config.textTheme?.body1 ?? themeData.primaryTextTheme.body1; TextStyle sideStyle = widget.textTheme?.body1 ?? themeData.primaryTextTheme.body1;
final Brightness brightness = config.brightness ?? themeData.primaryColorBrightness; final Brightness brightness = widget.brightness ?? themeData.primaryColorBrightness;
SystemChrome.setSystemUIOverlayStyle(brightness == Brightness.dark SystemChrome.setSystemUIOverlayStyle(brightness == Brightness.dark
? SystemUiOverlayStyle.light ? SystemUiOverlayStyle.light
: SystemUiOverlayStyle.dark); : SystemUiOverlayStyle.dark);
if (config.toolbarOpacity != 1.0) { if (widget.toolbarOpacity != 1.0) {
final double opacity = const Interval(0.25, 1.0, curve: Curves.fastOutSlowIn).transform(config.toolbarOpacity); final double opacity = const Interval(0.25, 1.0, curve: Curves.fastOutSlowIn).transform(widget.toolbarOpacity);
if (centerStyle?.color != null) if (centerStyle?.color != null)
centerStyle = centerStyle.copyWith(color: centerStyle.color.withOpacity(opacity)); centerStyle = centerStyle.copyWith(color: centerStyle.color.withOpacity(opacity));
if (sideStyle?.color != null) if (sideStyle?.color != null)
...@@ -374,7 +374,7 @@ class _AppBarState extends State<AppBar> { ...@@ -374,7 +374,7 @@ class _AppBarState extends State<AppBar> {
} }
final List<Widget> toolbarChildren = <Widget>[]; final List<Widget> toolbarChildren = <Widget>[];
Widget leading = config.leading; Widget leading = widget.leading;
if (leading == null) { if (leading == null) {
if (_hasDrawer) { if (_hasDrawer) {
leading = new IconButton( leading = new IconButton(
...@@ -396,7 +396,7 @@ class _AppBarState extends State<AppBar> { ...@@ -396,7 +396,7 @@ class _AppBarState extends State<AppBar> {
); );
} }
if (config.title != null) { if (widget.title != null) {
toolbarChildren.add( toolbarChildren.add(
new LayoutId( new LayoutId(
id: _ToolbarSlot.title, id: _ToolbarSlot.title,
...@@ -404,19 +404,19 @@ class _AppBarState extends State<AppBar> { ...@@ -404,19 +404,19 @@ class _AppBarState extends State<AppBar> {
style: centerStyle, style: centerStyle,
softWrap: false, softWrap: false,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
child: config.title, child: widget.title,
), ),
), ),
); );
} }
if (config.actions != null && config.actions.isNotEmpty) { if (widget.actions != null && widget.actions.isNotEmpty) {
toolbarChildren.add( toolbarChildren.add(
new LayoutId( new LayoutId(
id: _ToolbarSlot.actions, id: _ToolbarSlot.actions,
child: new Row( child: new Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: config.actions, children: widget.actions,
), ),
), ),
); );
...@@ -426,7 +426,7 @@ class _AppBarState extends State<AppBar> { ...@@ -426,7 +426,7 @@ class _AppBarState extends State<AppBar> {
padding: const EdgeInsets.only(right: 4.0), padding: const EdgeInsets.only(right: 4.0),
child: new CustomMultiChildLayout( child: new CustomMultiChildLayout(
delegate: new _ToolbarLayout( delegate: new _ToolbarLayout(
centerTitle: config._getEffectiveCenterTitle(themeData), centerTitle: widget._getEffectiveCenterTitle(themeData),
), ),
children: toolbarChildren, children: toolbarChildren,
), ),
...@@ -448,7 +448,7 @@ class _AppBarState extends State<AppBar> { ...@@ -448,7 +448,7 @@ class _AppBarState extends State<AppBar> {
), ),
); );
if (config.bottom != null) { if (widget.bottom != null) {
appBar = new Column( appBar = new Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
...@@ -458,34 +458,34 @@ class _AppBarState extends State<AppBar> { ...@@ -458,34 +458,34 @@ class _AppBarState extends State<AppBar> {
child: appBar, child: appBar,
), ),
), ),
config.bottomOpacity == 1.0 ? config.bottom : new Opacity( widget.bottomOpacity == 1.0 ? widget.bottom : new Opacity(
opacity: const Interval(0.25, 1.0, curve: Curves.fastOutSlowIn).transform(config.bottomOpacity), opacity: const Interval(0.25, 1.0, curve: Curves.fastOutSlowIn).transform(widget.bottomOpacity),
child: config.bottom, child: widget.bottom,
), ),
], ],
); );
} }
// The padding applies to the toolbar and tabbar, not the flexible space. // The padding applies to the toolbar and tabbar, not the flexible space.
if (config.primary) { if (widget.primary) {
appBar = new Padding( appBar = new Padding(
padding: new EdgeInsets.only(top: MediaQuery.of(context).padding.top), padding: new EdgeInsets.only(top: MediaQuery.of(context).padding.top),
child: appBar, child: appBar,
); );
} }
if (config.flexibleSpace != null) { if (widget.flexibleSpace != null) {
appBar = new Stack( appBar = new Stack(
children: <Widget>[ children: <Widget>[
config.flexibleSpace, widget.flexibleSpace,
new Positioned(top: 0.0, left: 0.0, right: 0.0, child: appBar), new Positioned(top: 0.0, left: 0.0, right: 0.0, child: appBar),
], ],
); );
} }
return new Material( return new Material(
color: config.backgroundColor ?? themeData.primaryColor, color: widget.backgroundColor ?? themeData.primaryColor,
elevation: config.elevation, elevation: widget.elevation,
child: new Align( child: new Align(
alignment: FractionalOffset.topCenter, alignment: FractionalOffset.topCenter,
child: appBar, child: appBar,
......
...@@ -164,21 +164,21 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr ...@@ -164,21 +164,21 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_controllers = new List<AnimationController>.generate(config.items.length, (int index) { _controllers = new List<AnimationController>.generate(widget.items.length, (int index) {
return new AnimationController( return new AnimationController(
duration: kThemeAnimationDuration, duration: kThemeAnimationDuration,
vsync: this, vsync: this,
)..addListener(_rebuild); )..addListener(_rebuild);
}); });
_animations = new List<CurvedAnimation>.generate(config.items.length, (int index) { _animations = new List<CurvedAnimation>.generate(widget.items.length, (int index) {
return new CurvedAnimation( return new CurvedAnimation(
parent: _controllers[index], parent: _controllers[index],
curve: Curves.fastOutSlowIn, curve: Curves.fastOutSlowIn,
reverseCurve: Curves.fastOutSlowIn.flipped reverseCurve: Curves.fastOutSlowIn.flipped
); );
}); });
_controllers[config.currentIndex].value = 1.0; _controllers[widget.currentIndex].value = 1.0;
_backgroundColor = config.items[config.currentIndex].backgroundColor; _backgroundColor = widget.items[widget.currentIndex].backgroundColor;
} }
@override @override
...@@ -198,12 +198,12 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr ...@@ -198,12 +198,12 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
} }
double get _maxWidth { double get _maxWidth {
assert(config.type != null); assert(widget.type != null);
switch (config.type) { switch (widget.type) {
case BottomNavigationBarType.fixed: case BottomNavigationBarType.fixed:
return config.items.length * _kActiveMaxWidth; return widget.items.length * _kActiveMaxWidth;
case BottomNavigationBarType.shifting: case BottomNavigationBarType.shifting:
return _kActiveMaxWidth + (config.items.length - 1) * _kInactiveMaxWidth; return _kActiveMaxWidth + (widget.items.length - 1) * _kInactiveMaxWidth;
} }
return null; return null;
} }
...@@ -257,7 +257,7 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr ...@@ -257,7 +257,7 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
} }
FractionalOffset _circleOffset(int index) { FractionalOffset _circleOffset(int index) {
final double iconSize = config.iconSize; final double iconSize = widget.iconSize;
final Tween<double> yOffsetTween = new Tween<double>( final Tween<double> yOffsetTween = new Tween<double>(
begin: (18.0 + iconSize / 2.0) / kBottomNavigationBarHeight, // 18dp + icon center begin: (18.0 + iconSize / 2.0) / kBottomNavigationBarHeight, // 18dp + icon center
end: (6.0 + iconSize / 2.0) / kBottomNavigationBarHeight // 6dp + icon center end: (6.0 + iconSize / 2.0) / kBottomNavigationBarHeight // 6dp + icon center
...@@ -270,12 +270,12 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr ...@@ -270,12 +270,12 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
} }
void _pushCircle(int index) { void _pushCircle(int index) {
if (config.items[index].backgroundColor != null) if (widget.items[index].backgroundColor != null)
_circles.add( _circles.add(
new _Circle( new _Circle(
state: this, state: this,
index: index, index: index,
color: config.items[index].backgroundColor, color: widget.items[index].backgroundColor,
vsync: this, vsync: this,
)..controller.addStatusListener((AnimationStatus status) { )..controller.addStatusListener((AnimationStatus status) {
if (status == AnimationStatus.completed) { if (status == AnimationStatus.completed) {
...@@ -290,37 +290,37 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr ...@@ -290,37 +290,37 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
} }
@override @override
void didUpdateConfig(BottomNavigationBar oldConfig) { void didUpdateWidget(BottomNavigationBar oldWidget) {
if (config.currentIndex != oldConfig.currentIndex) { if (widget.currentIndex != oldWidget.currentIndex) {
if (config.type == BottomNavigationBarType.shifting) if (widget.type == BottomNavigationBarType.shifting)
_pushCircle(config.currentIndex); _pushCircle(widget.currentIndex);
_controllers[oldConfig.currentIndex].reverse(); _controllers[oldWidget.currentIndex].reverse();
_controllers[config.currentIndex].forward(); _controllers[widget.currentIndex].forward();
} }
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Widget bottomNavigation; Widget bottomNavigation;
switch (config.type) { switch (widget.type) {
case BottomNavigationBarType.fixed: case BottomNavigationBarType.fixed:
final List<Widget> children = <Widget>[]; final List<Widget> children = <Widget>[];
final ThemeData themeData = Theme.of(context); final ThemeData themeData = Theme.of(context);
final TextTheme textTheme = themeData.textTheme; final TextTheme textTheme = themeData.textTheme;
final ColorTween colorTween = new ColorTween( final ColorTween colorTween = new ColorTween(
begin: textTheme.caption.color, begin: textTheme.caption.color,
end: config.fixedColor ?? ( end: widget.fixedColor ?? (
themeData.brightness == Brightness.light ? themeData.brightness == Brightness.light ?
themeData.primaryColor : themeData.accentColor themeData.primaryColor : themeData.accentColor
) )
); );
for (int i = 0; i < config.items.length; i += 1) { for (int i = 0; i < widget.items.length; i += 1) {
children.add( children.add(
new Expanded( new Expanded(
child: new InkResponse( child: new InkResponse(
onTap: () { onTap: () {
if (config.onTap != null) if (widget.onTap != null)
config.onTap(i); widget.onTap(i);
}, },
child: new Stack( child: new Stack(
alignment: FractionalOffset.center, alignment: FractionalOffset.center,
...@@ -337,9 +337,9 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr ...@@ -337,9 +337,9 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
child: new IconTheme( child: new IconTheme(
data: new IconThemeData( data: new IconThemeData(
color: colorTween.evaluate(_animations[i]), color: colorTween.evaluate(_animations[i]),
size: config.iconSize, size: widget.iconSize,
), ),
child: config.items[i].icon, child: widget.items[i].icon,
), ),
), ),
), ),
...@@ -361,7 +361,7 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr ...@@ -361,7 +361,7 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
).evaluate(_animations[i]), ).evaluate(_animations[i]),
)), )),
alignment: FractionalOffset.bottomCenter, alignment: FractionalOffset.bottomCenter,
child: config.items[i].title, child: widget.items[i].title,
), ),
), ),
), ),
...@@ -381,7 +381,7 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr ...@@ -381,7 +381,7 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
case BottomNavigationBarType.shifting: case BottomNavigationBarType.shifting:
final List<Widget> children = <Widget>[]; final List<Widget> children = <Widget>[];
_computeWeight(); _computeWeight();
for (int i = 0; i < config.items.length; i += 1) { for (int i = 0; i < widget.items.length; i += 1) {
children.add( children.add(
new Expanded( new Expanded(
// Since Flexible only supports integers, we're using large // Since Flexible only supports integers, we're using large
...@@ -389,8 +389,8 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr ...@@ -389,8 +389,8 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
flex: (_flex(_animations[i]) * 1000.0).round(), flex: (_flex(_animations[i]) * 1000.0).round(),
child: new InkResponse( child: new InkResponse(
onTap: () { onTap: () {
if (config.onTap != null) if (widget.onTap != null)
config.onTap(i); widget.onTap(i);
}, },
child: new Stack( child: new Stack(
alignment: FractionalOffset.center, alignment: FractionalOffset.center,
...@@ -407,9 +407,9 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr ...@@ -407,9 +407,9 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
child: new IconTheme( child: new IconTheme(
data: new IconThemeData( data: new IconThemeData(
color: Colors.white, color: Colors.white,
size: config.iconSize, size: widget.iconSize,
), ),
child: config.items[i].icon, child: widget.items[i].icon,
), ),
), ),
), ),
...@@ -425,7 +425,7 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr ...@@ -425,7 +425,7 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
fontSize: 14.0, fontSize: 14.0,
color: Colors.white color: Colors.white
), ),
child: config.items[i].title child: widget.items[i].title
), ),
), ),
), ),
...@@ -450,7 +450,7 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr ...@@ -450,7 +450,7 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
new Positioned.fill( new Positioned.fill(
child: new Material( // Casts shadow. child: new Material( // Casts shadow.
elevation: 8, elevation: 8,
color: config.type == BottomNavigationBarType.shifting ? _backgroundColor : null color: widget.type == BottomNavigationBarType.shifting ? _backgroundColor : null
) )
), ),
new SizedBox( new SizedBox(
......
...@@ -98,12 +98,12 @@ class _BottomSheetState extends State<BottomSheet> { ...@@ -98,12 +98,12 @@ class _BottomSheetState extends State<BottomSheet> {
return renderBox.size.height; return renderBox.size.height;
} }
bool get _dismissUnderway => config.animationController.status == AnimationStatus.reverse; bool get _dismissUnderway => widget.animationController.status == AnimationStatus.reverse;
void _handleDragUpdate(DragUpdateDetails details) { void _handleDragUpdate(DragUpdateDetails details) {
if (_dismissUnderway) if (_dismissUnderway)
return; return;
config.animationController.value -= details.primaryDelta / (_childHeight ?? details.primaryDelta); widget.animationController.value -= details.primaryDelta / (_childHeight ?? details.primaryDelta);
} }
void _handleDragEnd(DragEndDetails details) { void _handleDragEnd(DragEndDetails details) {
...@@ -111,16 +111,16 @@ class _BottomSheetState extends State<BottomSheet> { ...@@ -111,16 +111,16 @@ class _BottomSheetState extends State<BottomSheet> {
return; return;
if (details.velocity.pixelsPerSecond.dy > _kMinFlingVelocity) { if (details.velocity.pixelsPerSecond.dy > _kMinFlingVelocity) {
final double flingVelocity = -details.velocity.pixelsPerSecond.dy / _childHeight; final double flingVelocity = -details.velocity.pixelsPerSecond.dy / _childHeight;
if (config.animationController.value > 0.0) if (widget.animationController.value > 0.0)
config.animationController.fling(velocity: flingVelocity); widget.animationController.fling(velocity: flingVelocity);
if (flingVelocity < 0.0) if (flingVelocity < 0.0)
config.onClosing(); widget.onClosing();
} else if (config.animationController.value < _kCloseProgressThreshold) { } else if (widget.animationController.value < _kCloseProgressThreshold) {
if (config.animationController.value > 0.0) if (widget.animationController.value > 0.0)
config.animationController.fling(velocity: -1.0); widget.animationController.fling(velocity: -1.0);
config.onClosing(); widget.onClosing();
} else { } else {
config.animationController.forward(); widget.animationController.forward();
} }
} }
...@@ -131,7 +131,7 @@ class _BottomSheetState extends State<BottomSheet> { ...@@ -131,7 +131,7 @@ class _BottomSheetState extends State<BottomSheet> {
onVerticalDragEnd: _handleDragEnd, onVerticalDragEnd: _handleDragEnd,
child: new Material( child: new Material(
key: _childKey, key: _childKey,
child: config.builder(context) child: widget.builder(context)
) )
); );
} }
...@@ -185,15 +185,15 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> { ...@@ -185,15 +185,15 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> {
return new GestureDetector( return new GestureDetector(
onTap: () => Navigator.pop(context), onTap: () => Navigator.pop(context),
child: new AnimatedBuilder( child: new AnimatedBuilder(
animation: config.route.animation, animation: widget.route.animation,
builder: (BuildContext context, Widget child) { builder: (BuildContext context, Widget child) {
return new ClipRect( return new ClipRect(
child: new CustomSingleChildLayout( child: new CustomSingleChildLayout(
delegate: new _ModalBottomSheetLayout(config.route.animation.value), delegate: new _ModalBottomSheetLayout(widget.route.animation.value),
child: new BottomSheet( child: new BottomSheet(
animationController: config.route._animationController, animationController: widget.route._animationController,
onClosing: () => Navigator.pop(context), onClosing: () => Navigator.pop(context),
builder: config.route.builder builder: widget.route.builder
) )
) )
); );
......
...@@ -246,14 +246,14 @@ class _MaterialButtonState extends State<MaterialButton> { ...@@ -246,14 +246,14 @@ class _MaterialButtonState extends State<MaterialButton> {
bool _highlight = false; bool _highlight = false;
Brightness get _colorBrightness { Brightness get _colorBrightness {
return config.colorBrightness ?? Theme.of(context).brightness; return widget.colorBrightness ?? Theme.of(context).brightness;
} }
Color get _textColor { Color get _textColor {
if (config.textColor != null) if (widget.textColor != null)
return config.textColor; return widget.textColor;
if (config.enabled) { if (widget.enabled) {
switch (config.textTheme ?? ButtonTheme.of(context).textTheme) { switch (widget.textTheme ?? ButtonTheme.of(context).textTheme) {
case ButtonTextTheme.accent: case ButtonTextTheme.accent:
return Theme.of(context).accentColor; return Theme.of(context).accentColor;
case ButtonTextTheme.normal: case ButtonTextTheme.normal:
...@@ -289,9 +289,9 @@ class _MaterialButtonState extends State<MaterialButton> { ...@@ -289,9 +289,9 @@ class _MaterialButtonState extends State<MaterialButton> {
final Color textColor = _textColor; final Color textColor = _textColor;
final TextStyle style = theme.textTheme.button.copyWith(color: textColor); final TextStyle style = theme.textTheme.button.copyWith(color: textColor);
final ButtonTheme buttonTheme = ButtonTheme.of(context); final ButtonTheme buttonTheme = ButtonTheme.of(context);
final double height = config.height ?? buttonTheme.height; final double height = widget.height ?? buttonTheme.height;
final int elevation = (_highlight ? config.highlightElevation : config.elevation) ?? 0; final int elevation = (_highlight ? widget.highlightElevation : widget.elevation) ?? 0;
final bool hasColorOrElevation = (config.color != null || elevation > 0); final bool hasColorOrElevation = (widget.color != null || elevation > 0);
Widget contents = new IconTheme.merge( Widget contents = new IconTheme.merge(
context: context, context: context,
data: new IconThemeData( data: new IconThemeData(
...@@ -299,15 +299,15 @@ class _MaterialButtonState extends State<MaterialButton> { ...@@ -299,15 +299,15 @@ class _MaterialButtonState extends State<MaterialButton> {
), ),
child: new InkWell( child: new InkWell(
borderRadius: hasColorOrElevation ? null : kMaterialEdges[MaterialType.button], borderRadius: hasColorOrElevation ? null : kMaterialEdges[MaterialType.button],
highlightColor: config.highlightColor ?? theme.highlightColor, highlightColor: widget.highlightColor ?? theme.highlightColor,
splashColor: config.splashColor ?? theme.splashColor, splashColor: widget.splashColor ?? theme.splashColor,
onTap: config.onPressed, onTap: widget.onPressed,
onHighlightChanged: _handleHighlightChanged, onHighlightChanged: _handleHighlightChanged,
child: new Container( child: new Container(
padding: config.padding ?? ButtonTheme.of(context).padding, padding: widget.padding ?? ButtonTheme.of(context).padding,
child: new Center( child: new Center(
widthFactor: 1.0, widthFactor: 1.0,
child: config.child child: widget.child
) )
) )
) )
...@@ -315,7 +315,7 @@ class _MaterialButtonState extends State<MaterialButton> { ...@@ -315,7 +315,7 @@ class _MaterialButtonState extends State<MaterialButton> {
if (hasColorOrElevation) { if (hasColorOrElevation) {
contents = new Material( contents = new Material(
type: MaterialType.button, type: MaterialType.button,
color: config.color, color: widget.color,
elevation: elevation, elevation: elevation,
textStyle: style, textStyle: style,
child: contents child: contents
...@@ -329,7 +329,7 @@ class _MaterialButtonState extends State<MaterialButton> { ...@@ -329,7 +329,7 @@ class _MaterialButtonState extends State<MaterialButton> {
} }
return new ConstrainedBox( return new ConstrainedBox(
constraints: new BoxConstraints( constraints: new BoxConstraints(
minWidth: config.minWidth ?? buttonTheme.minWidth, minWidth: widget.minWidth ?? buttonTheme.minWidth,
minHeight: height, minHeight: height,
maxHeight: height maxHeight: height
), ),
......
...@@ -93,10 +93,10 @@ class _CheckboxState extends State<Checkbox> with TickerProviderStateMixin { ...@@ -93,10 +93,10 @@ class _CheckboxState extends State<Checkbox> with TickerProviderStateMixin {
assert(debugCheckHasMaterial(context)); assert(debugCheckHasMaterial(context));
final ThemeData themeData = Theme.of(context); final ThemeData themeData = Theme.of(context);
return new _CheckboxRenderObjectWidget( return new _CheckboxRenderObjectWidget(
value: config.value, value: widget.value,
activeColor: config.activeColor ?? themeData.accentColor, activeColor: widget.activeColor ?? themeData.accentColor,
inactiveColor: config.onChanged != null ? themeData.unselectedWidgetColor : themeData.disabledColor, inactiveColor: widget.onChanged != null ? themeData.unselectedWidgetColor : themeData.disabledColor,
onChanged: config.onChanged, onChanged: widget.onChanged,
vsync: this, vsync: this,
); );
} }
......
...@@ -160,7 +160,7 @@ class DataCell { ...@@ -160,7 +160,7 @@ class DataCell {
/// If the cell has no data, then a [Text] widget with placeholder /// If the cell has no data, then a [Text] widget with placeholder
/// text should be provided instead, and then the [placeholder] /// text should be provided instead, and then the [placeholder]
/// argument should be set to true. /// argument should be set to true.
const DataCell(this.widget, { const DataCell(this.child, {
this.placeholder: false, this.placeholder: false,
this.showEditIcon: false, this.showEditIcon: false,
this.onTap this.onTap
...@@ -176,9 +176,9 @@ class DataCell { ...@@ -176,9 +176,9 @@ class DataCell {
/// If the cell has no data, then a [Text] widget with placeholder /// If the cell has no data, then a [Text] widget with placeholder
/// text should be provided instead, and [placeholder] should be set /// text should be provided instead, and [placeholder] should be set
/// to true. /// to true.
final Widget widget; final Widget child;
/// Whether the [widget] is actually a placeholder. /// Whether the [child] is actually a placeholder.
/// ///
/// If this is true, the default text style for the cell is changed /// If this is true, the default text style for the cell is changed
/// to be appropriate for placeholder text. /// to be appropriate for placeholder text.
...@@ -571,7 +571,7 @@ class DataTable extends StatelessWidget { ...@@ -571,7 +571,7 @@ class DataTable extends StatelessWidget {
tableRows[rowIndex].children[displayColumnIndex] = _buildDataCell( tableRows[rowIndex].children[displayColumnIndex] = _buildDataCell(
context: context, context: context,
padding: padding, padding: padding,
label: cell.widget, label: cell.child,
numeric: column.numeric, numeric: column.numeric,
placeholder: cell.placeholder, placeholder: cell.placeholder,
showEditIcon: cell.showEditIcon, showEditIcon: cell.showEditIcon,
...@@ -692,27 +692,27 @@ class _SortArrowState extends State<_SortArrow> with TickerProviderStateMixin { ...@@ -692,27 +692,27 @@ class _SortArrowState extends State<_SortArrow> with TickerProviderStateMixin {
super.initState(); super.initState();
_opacityAnimation = new CurvedAnimation( _opacityAnimation = new CurvedAnimation(
parent: _opacityController = new AnimationController( parent: _opacityController = new AnimationController(
duration: config.duration, duration: widget.duration,
vsync: this, vsync: this,
), ),
curve: Curves.fastOutSlowIn curve: Curves.fastOutSlowIn
) )
..addListener(_rebuild); ..addListener(_rebuild);
_opacityController.value = config.visible ? 1.0 : 0.0; _opacityController.value = widget.visible ? 1.0 : 0.0;
_orientationAnimation = new Tween<double>( _orientationAnimation = new Tween<double>(
begin: 0.0, begin: 0.0,
end: math.PI end: math.PI
).animate(new CurvedAnimation( ).animate(new CurvedAnimation(
parent: _orientationController = new AnimationController( parent: _orientationController = new AnimationController(
duration: config.duration, duration: widget.duration,
vsync: this, vsync: this,
), ),
curve: Curves.easeIn curve: Curves.easeIn
)) ))
..addListener(_rebuild) ..addListener(_rebuild)
..addStatusListener(_resetOrientationAnimation); ..addStatusListener(_resetOrientationAnimation);
if (config.visible) if (widget.visible)
_orientationOffset = config.down ? 0.0 : math.PI; _orientationOffset = widget.down ? 0.0 : math.PI;
} }
void _rebuild() { void _rebuild() {
...@@ -730,18 +730,18 @@ class _SortArrowState extends State<_SortArrow> with TickerProviderStateMixin { ...@@ -730,18 +730,18 @@ class _SortArrowState extends State<_SortArrow> with TickerProviderStateMixin {
} }
@override @override
void didUpdateConfig(_SortArrow oldConfig) { void didUpdateWidget(_SortArrow oldWidget) {
super.didUpdateConfig(oldConfig); super.didUpdateWidget(oldWidget);
bool skipArrow = false; bool skipArrow = false;
final bool newDown = config.down != null ? config.down : _down; final bool newDown = widget.down != null ? widget.down : _down;
if (oldConfig.visible != config.visible) { if (oldWidget.visible != widget.visible) {
if (config.visible && (_opacityController.status == AnimationStatus.dismissed)) { if (widget.visible && (_opacityController.status == AnimationStatus.dismissed)) {
_orientationController.stop(); _orientationController.stop();
_orientationController.value = 0.0; _orientationController.value = 0.0;
_orientationOffset = newDown ? 0.0 : math.PI; _orientationOffset = newDown ? 0.0 : math.PI;
skipArrow = true; skipArrow = true;
} }
if (config.visible) { if (widget.visible) {
_opacityController.forward(); _opacityController.forward();
} else { } else {
_opacityController.reverse(); _opacityController.reverse();
......
...@@ -365,17 +365,17 @@ class _MonthPickerState extends State<MonthPicker> { ...@@ -365,17 +365,17 @@ class _MonthPickerState extends State<MonthPicker> {
void initState() { void initState() {
super.initState(); super.initState();
// Initially display the pre-selected date. // Initially display the pre-selected date.
_dayPickerController = new PageController(initialPage: _monthDelta(config.firstDate, config.selectedDate)); _dayPickerController = new PageController(initialPage: _monthDelta(widget.firstDate, widget.selectedDate));
_currentDisplayedMonthDate = new DateTime(config.selectedDate.year, config.selectedDate.month); _currentDisplayedMonthDate = new DateTime(widget.selectedDate.year, widget.selectedDate.month);
_updateCurrentDate(); _updateCurrentDate();
} }
@override @override
void didUpdateConfig(MonthPicker oldConfig) { void didUpdateWidget(MonthPicker oldWidget) {
if (config.selectedDate != oldConfig.selectedDate) { if (widget.selectedDate != oldWidget.selectedDate) {
_dayPickerController = new PageController(initialPage: _monthDelta(config.firstDate, config.selectedDate)); _dayPickerController = new PageController(initialPage: _monthDelta(widget.firstDate, widget.selectedDate));
_currentDisplayedMonthDate = _currentDisplayedMonthDate =
new DateTime(config.selectedDate.year, config.selectedDate.month); new DateTime(widget.selectedDate.year, widget.selectedDate.month);
} }
} }
...@@ -407,16 +407,16 @@ class _MonthPickerState extends State<MonthPicker> { ...@@ -407,16 +407,16 @@ class _MonthPickerState extends State<MonthPicker> {
} }
Widget _buildItems(BuildContext context, int index) { Widget _buildItems(BuildContext context, int index) {
final DateTime month = _addMonthsToMonthDate(config.firstDate, index); final DateTime month = _addMonthsToMonthDate(widget.firstDate, index);
return new DayPicker( return new DayPicker(
key: new ValueKey<DateTime>(month), key: new ValueKey<DateTime>(month),
selectedDate: config.selectedDate, selectedDate: widget.selectedDate,
currentDate: _todayDate, currentDate: _todayDate,
onChanged: config.onChanged, onChanged: widget.onChanged,
firstDate: config.firstDate, firstDate: widget.firstDate,
lastDate: config.lastDate, lastDate: widget.lastDate,
displayedMonth: month, displayedMonth: month,
selectableDayPredicate: config.selectableDayPredicate, selectableDayPredicate: widget.selectableDayPredicate,
); );
} }
...@@ -433,18 +433,18 @@ class _MonthPickerState extends State<MonthPicker> { ...@@ -433,18 +433,18 @@ class _MonthPickerState extends State<MonthPicker> {
/// True if the earliest allowable month is displayed. /// True if the earliest allowable month is displayed.
bool get _isDisplayingFirstMonth { bool get _isDisplayingFirstMonth {
return !_currentDisplayedMonthDate.isAfter( return !_currentDisplayedMonthDate.isAfter(
new DateTime(config.firstDate.year, config.firstDate.month)); new DateTime(widget.firstDate.year, widget.firstDate.month));
} }
/// True if the latest allowable month is displayed. /// True if the latest allowable month is displayed.
bool get _isDisplayingLastMonth { bool get _isDisplayingLastMonth {
return !_currentDisplayedMonthDate.isBefore( return !_currentDisplayedMonthDate.isBefore(
new DateTime(config.lastDate.year, config.lastDate.month)); new DateTime(widget.lastDate.year, widget.lastDate.month));
} }
void _handleMonthPageChanged(int monthPage) { void _handleMonthPageChanged(int monthPage) {
setState(() { setState(() {
_currentDisplayedMonthDate = _addMonthsToMonthDate(config.firstDate, monthPage); _currentDisplayedMonthDate = _addMonthsToMonthDate(widget.firstDate, monthPage);
}); });
} }
...@@ -456,10 +456,10 @@ class _MonthPickerState extends State<MonthPicker> { ...@@ -456,10 +456,10 @@ class _MonthPickerState extends State<MonthPicker> {
child: new Stack( child: new Stack(
children: <Widget>[ children: <Widget>[
new PageView.builder( new PageView.builder(
key: new ValueKey<DateTime>(config.selectedDate), key: new ValueKey<DateTime>(widget.selectedDate),
controller: _dayPickerController, controller: _dayPickerController,
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
itemCount: _monthDelta(config.firstDate, config.lastDate) + 1, itemCount: _monthDelta(widget.firstDate, widget.lastDate) + 1,
itemBuilder: _buildItems, itemBuilder: _buildItems,
onPageChanged: _handleMonthPageChanged, onPageChanged: _handleMonthPageChanged,
), ),
...@@ -552,15 +552,15 @@ class _YearPickerState extends State<YearPicker> { ...@@ -552,15 +552,15 @@ class _YearPickerState extends State<YearPicker> {
final TextStyle style = themeData.textTheme.body1; final TextStyle style = themeData.textTheme.body1;
return new ListView.builder( return new ListView.builder(
itemExtent: _itemExtent, itemExtent: _itemExtent,
itemCount: config.lastDate.year - config.firstDate.year + 1, itemCount: widget.lastDate.year - widget.firstDate.year + 1,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
final int year = config.firstDate.year + index; final int year = widget.firstDate.year + index;
final TextStyle itemStyle = year == config.selectedDate.year ? final TextStyle itemStyle = year == widget.selectedDate.year ?
themeData.textTheme.headline.copyWith(color: themeData.accentColor) : style; themeData.textTheme.headline.copyWith(color: themeData.accentColor) : style;
return new InkWell( return new InkWell(
key: new ValueKey<int>(year), key: new ValueKey<int>(year),
onTap: () { onTap: () {
config.onChanged(new DateTime(year, config.selectedDate.month, config.selectedDate.day)); widget.onChanged(new DateTime(year, widget.selectedDate.month, widget.selectedDate.day));
}, },
child: new Center( child: new Center(
child: new Text(year.toString(), style: itemStyle), child: new Text(year.toString(), style: itemStyle),
...@@ -593,7 +593,7 @@ class _DatePickerDialogState extends State<_DatePickerDialog> { ...@@ -593,7 +593,7 @@ class _DatePickerDialogState extends State<_DatePickerDialog> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_selectedDate = config.initialDate; _selectedDate = widget.initialDate;
} }
DateTime _selectedDate; DateTime _selectedDate;
...@@ -649,17 +649,17 @@ class _DatePickerDialogState extends State<_DatePickerDialog> { ...@@ -649,17 +649,17 @@ class _DatePickerDialogState extends State<_DatePickerDialog> {
key: _pickerKey, key: _pickerKey,
selectedDate: _selectedDate, selectedDate: _selectedDate,
onChanged: _handleDayChanged, onChanged: _handleDayChanged,
firstDate: config.firstDate, firstDate: widget.firstDate,
lastDate: config.lastDate, lastDate: widget.lastDate,
selectableDayPredicate: config.selectableDayPredicate, selectableDayPredicate: widget.selectableDayPredicate,
); );
case _DatePickerMode.year: case _DatePickerMode.year:
return new YearPicker( return new YearPicker(
key: _pickerKey, key: _pickerKey,
selectedDate: _selectedDate, selectedDate: _selectedDate,
onChanged: _handleYearChanged, onChanged: _handleYearChanged,
firstDate: config.firstDate, firstDate: widget.firstDate,
lastDate: config.lastDate, lastDate: widget.lastDate,
); );
} }
return null; return null;
......
...@@ -290,7 +290,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro ...@@ -290,7 +290,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
child: new FocusScope( child: new FocusScope(
key: _drawerKey, key: _drawerKey,
node: _focusScopeNode, node: _focusScopeNode,
child: config.child child: widget.child
), ),
), ),
), ),
......
...@@ -113,12 +113,12 @@ class _DropdownMenuState<T> extends State<_DropdownMenu<T>> { ...@@ -113,12 +113,12 @@ class _DropdownMenuState<T> extends State<_DropdownMenu<T>> {
// the CurvedAnimation objects in build, we'd lose // the CurvedAnimation objects in build, we'd lose
// CurvedAnimation._curveDirection. // CurvedAnimation._curveDirection.
_fadeOpacity = new CurvedAnimation( _fadeOpacity = new CurvedAnimation(
parent: config.route.animation, parent: widget.route.animation,
curve: const Interval(0.0, 0.25), curve: const Interval(0.0, 0.25),
reverseCurve: const Interval(0.75, 1.0), reverseCurve: const Interval(0.75, 1.0),
); );
_resize = new CurvedAnimation( _resize = new CurvedAnimation(
parent: config.route.animation, parent: widget.route.animation,
curve: const Interval(0.25, 0.5), curve: const Interval(0.25, 0.5),
reverseCurve: const Threshold(0.0), reverseCurve: const Threshold(0.0),
); );
...@@ -134,7 +134,7 @@ class _DropdownMenuState<T> extends State<_DropdownMenu<T>> { ...@@ -134,7 +134,7 @@ class _DropdownMenuState<T> extends State<_DropdownMenu<T>> {
// //
// When the menu is dismissed we just fade the entire thing out // When the menu is dismissed we just fade the entire thing out
// in the first 0.25s. // in the first 0.25s.
final _DropdownRoute<T> route = config.route; final _DropdownRoute<T> route = widget.route;
final double unit = 0.5 / (route.items.length + 1.5); final double unit = 0.5 / (route.items.length + 1.5);
final List<Widget> children = <Widget>[]; final List<Widget> children = <Widget>[];
for (int itemIndex = 0; itemIndex < route.items.length; ++itemIndex) { for (int itemIndex = 0; itemIndex < route.items.length; ++itemIndex) {
...@@ -177,7 +177,7 @@ class _DropdownMenuState<T> extends State<_DropdownMenu<T>> { ...@@ -177,7 +177,7 @@ class _DropdownMenuState<T> extends State<_DropdownMenu<T>> {
behavior: const _DropdownScrollBehavior(), behavior: const _DropdownScrollBehavior(),
child: new Scrollbar( child: new Scrollbar(
child: new ListView( child: new ListView(
controller: config.route.scrollController, controller: widget.route.scrollController,
padding: kMaterialListPadding, padding: kMaterialListPadding,
itemExtent: _kMenuItemHeight, itemExtent: _kMenuItemHeight,
shrinkWrap: true, shrinkWrap: true,
...@@ -479,39 +479,39 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> { ...@@ -479,39 +479,39 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> {
} }
@override @override
void didUpdateConfig(DropdownButton<T> oldConfig) { void didUpdateWidget(DropdownButton<T> oldWidget) {
_updateSelectedIndex(); _updateSelectedIndex();
} }
void _updateSelectedIndex() { void _updateSelectedIndex() {
assert(config.value == null || assert(widget.value == null ||
config.items.where((DropdownMenuItem<T> item) => item.value == config.value).length == 1); widget.items.where((DropdownMenuItem<T> item) => item.value == widget.value).length == 1);
_selectedIndex = null; _selectedIndex = null;
for (int itemIndex = 0; itemIndex < config.items.length; itemIndex++) { for (int itemIndex = 0; itemIndex < widget.items.length; itemIndex++) {
if (config.items[itemIndex].value == config.value) { if (widget.items[itemIndex].value == widget.value) {
_selectedIndex = itemIndex; _selectedIndex = itemIndex;
return; return;
} }
} }
} }
TextStyle get _textStyle => config.style ?? Theme.of(context).textTheme.subhead; TextStyle get _textStyle => widget.style ?? Theme.of(context).textTheme.subhead;
void _handleTap() { void _handleTap() {
final RenderBox itemBox = context.findRenderObject(); final RenderBox itemBox = context.findRenderObject();
final Rect itemRect = itemBox.localToGlobal(Point.origin) & itemBox.size; final Rect itemRect = itemBox.localToGlobal(Point.origin) & itemBox.size;
Navigator.push(context, new _DropdownRoute<T>( Navigator.push(context, new _DropdownRoute<T>(
items: config.items, items: widget.items,
buttonRect: _kMenuHorizontalPadding.inflateRect(itemRect), buttonRect: _kMenuHorizontalPadding.inflateRect(itemRect),
selectedIndex: _selectedIndex ?? 0, selectedIndex: _selectedIndex ?? 0,
elevation: config.elevation, elevation: widget.elevation,
theme: Theme.of(context, shadowThemeOnly: true), theme: Theme.of(context, shadowThemeOnly: true),
style: _textStyle, style: _textStyle,
)).then<Null>((_DropdownRouteResult<T> newValue) { )).then<Null>((_DropdownRouteResult<T> newValue) {
if (!mounted || newValue == null) if (!mounted || newValue == null)
return null; return null;
if (config.onChanged != null) if (widget.onChanged != null)
config.onChanged(newValue.result); widget.onChanged(newValue.result);
}); });
} }
...@@ -520,7 +520,7 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> { ...@@ -520,7 +520,7 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> {
// Similarly, we don't reduce the height of the button so much that its icon // Similarly, we don't reduce the height of the button so much that its icon
// would be clipped. // would be clipped.
double get _denseButtonHeight { double get _denseButtonHeight {
return math.max(_textStyle.fontSize, math.max(config.iconSize, _kDenseButtonHeight)); return math.max(_textStyle.fontSize, math.max(widget.iconSize, _kDenseButtonHeight));
} }
@override @override
...@@ -529,14 +529,14 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> { ...@@ -529,14 +529,14 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> {
// The width of the button and the menu are defined by the widest // The width of the button and the menu are defined by the widest
// item and the width of the hint. // item and the width of the hint.
final List<Widget> items = new List<Widget>.from(config.items); final List<Widget> items = new List<Widget>.from(widget.items);
int hintIndex; int hintIndex;
if (config.hint != null) { if (widget.hint != null) {
hintIndex = items.length; hintIndex = items.length;
items.add(new DefaultTextStyle( items.add(new DefaultTextStyle(
style: _textStyle.copyWith(color: Theme.of(context).hintColor), style: _textStyle.copyWith(color: Theme.of(context).hintColor),
child: new IgnorePointer( child: new IgnorePointer(
child: config.hint, child: widget.hint,
), ),
)); ));
} }
...@@ -544,7 +544,7 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> { ...@@ -544,7 +544,7 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> {
Widget result = new DefaultTextStyle( Widget result = new DefaultTextStyle(
style: _textStyle, style: _textStyle,
child: new SizedBox( child: new SizedBox(
height: config.isDense ? _denseButtonHeight : null, height: widget.isDense ? _denseButtonHeight : null,
child: new Row( child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
...@@ -557,7 +557,7 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> { ...@@ -557,7 +557,7 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> {
children: items, children: items,
), ),
new Icon(Icons.arrow_drop_down, new Icon(Icons.arrow_drop_down,
size: config.iconSize, size: widget.iconSize,
// These colors are not defined in the Material Design spec. // These colors are not defined in the Material Design spec.
color: Theme.of(context).brightness == Brightness.light ? Colors.grey.shade700 : Colors.white70 color: Theme.of(context).brightness == Brightness.light ? Colors.grey.shade700 : Colors.white70
), ),
...@@ -567,7 +567,7 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> { ...@@ -567,7 +567,7 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> {
); );
if (!DropdownButtonHideUnderline.at(context)) { if (!DropdownButtonHideUnderline.at(context)) {
final double bottom = config.isDense ? 0.0 : 8.0; final double bottom = widget.isDense ? 0.0 : 8.0;
result = new Stack( result = new Stack(
children: <Widget>[ children: <Widget>[
result, result,
......
...@@ -83,9 +83,9 @@ class _ExpandIconState extends State<ExpandIcon> with SingleTickerProviderStateM ...@@ -83,9 +83,9 @@ class _ExpandIconState extends State<ExpandIcon> with SingleTickerProviderStateM
} }
@override @override
void didUpdateConfig(ExpandIcon oldConfig) { void didUpdateWidget(ExpandIcon oldWidget) {
if (config.isExpanded != oldConfig.isExpanded) { if (widget.isExpanded != oldWidget.isExpanded) {
if (config.isExpanded) { if (widget.isExpanded) {
_controller.forward(); _controller.forward();
} else { } else {
_controller.reverse(); _controller.reverse();
...@@ -94,17 +94,17 @@ class _ExpandIconState extends State<ExpandIcon> with SingleTickerProviderStateM ...@@ -94,17 +94,17 @@ class _ExpandIconState extends State<ExpandIcon> with SingleTickerProviderStateM
} }
void _handlePressed() { void _handlePressed() {
if (config.onPressed != null) if (widget.onPressed != null)
config.onPressed(config.isExpanded); widget.onPressed(widget.isExpanded);
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
assert(debugCheckHasMaterial(context)); assert(debugCheckHasMaterial(context));
return new IconButton( return new IconButton(
padding: config.padding, padding: widget.padding,
color: Colors.black38, color: Colors.black38,
onPressed: config.onPressed == null ? null : _handlePressed, onPressed: widget.onPressed == null ? null : _handlePressed,
icon: new RotationTransition( icon: new RotationTransition(
turns: _iconTurns, turns: _iconTurns,
child: const Icon(Icons.expand_more) child: const Icon(Icons.expand_more)
......
...@@ -79,8 +79,8 @@ class FlexibleSpaceBar extends StatefulWidget { ...@@ -79,8 +79,8 @@ class FlexibleSpaceBar extends StatefulWidget {
class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> { class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
bool _getEffectiveCenterTitle(ThemeData theme) { bool _getEffectiveCenterTitle(ThemeData theme) {
if (config.centerTitle != null) if (widget.centerTitle != null)
return config.centerTitle; return widget.centerTitle;
assert(theme.platform != null); assert(theme.platform != null);
switch (theme.platform) { switch (theme.platform) {
case TargetPlatform.android: case TargetPlatform.android:
...@@ -106,7 +106,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> { ...@@ -106,7 +106,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
final double t = (1.0 - (settings.currentExtent - settings.minExtent) / (deltaExtent)).clamp(0.0, 1.0); final double t = (1.0 - (settings.currentExtent - settings.minExtent) / (deltaExtent)).clamp(0.0, 1.0);
// background image // background image
if (config.background != null) { if (widget.background != null) {
final double fadeStart = math.max(0.0, 1.0 - kToolbarHeight / deltaExtent); final double fadeStart = math.max(0.0, 1.0 - kToolbarHeight / deltaExtent);
final double fadeEnd = 1.0; final double fadeEnd = 1.0;
assert(fadeStart <= fadeEnd); assert(fadeStart <= fadeEnd);
...@@ -120,13 +120,13 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> { ...@@ -120,13 +120,13 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
height: settings.maxExtent, height: settings.maxExtent,
child: new Opacity( child: new Opacity(
opacity: opacity, opacity: opacity,
child: config.background child: widget.background
) )
)); ));
} }
} }
if (config.title != null) { if (widget.title != null) {
final ThemeData theme = Theme.of(context); final ThemeData theme = Theme.of(context);
final double opacity = settings.toolbarOpacity; final double opacity = settings.toolbarOpacity;
if (opacity > 0.0) { if (opacity > 0.0) {
...@@ -149,7 +149,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> { ...@@ -149,7 +149,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
transform: scaleTransform, transform: scaleTransform,
child: new Align( child: new Align(
alignment: titleAlignment, alignment: titleAlignment,
child: new DefaultTextStyle(style: titleStyle, child: config.title) child: new DefaultTextStyle(style: titleStyle, child: widget.title)
) )
) )
)); ));
......
...@@ -116,7 +116,7 @@ class _FloatingActionButtonState extends State<FloatingActionButton> { ...@@ -116,7 +116,7 @@ class _FloatingActionButtonState extends State<FloatingActionButton> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Color iconColor = Colors.white; Color iconColor = Colors.white;
Color materialColor = config.backgroundColor; Color materialColor = widget.backgroundColor;
if (materialColor == null) { if (materialColor == null) {
final ThemeData themeData = Theme.of(context); final ThemeData themeData = Theme.of(context);
materialColor = themeData.accentColor; materialColor = themeData.accentColor;
...@@ -127,28 +127,28 @@ class _FloatingActionButtonState extends State<FloatingActionButton> { ...@@ -127,28 +127,28 @@ class _FloatingActionButtonState extends State<FloatingActionButton> {
child: new IconTheme.merge( child: new IconTheme.merge(
context: context, context: context,
data: new IconThemeData(color: iconColor), data: new IconThemeData(color: iconColor),
child: config.child child: widget.child
) )
); );
if (config.tooltip != null) { if (widget.tooltip != null) {
result = new Tooltip( result = new Tooltip(
message: config.tooltip, message: widget.tooltip,
child: result child: result
); );
} }
return new Hero( return new Hero(
tag: config.heroTag ?? _kDefaultHeroTag, tag: widget.heroTag ?? _kDefaultHeroTag,
child: new Material( child: new Material(
color: materialColor, color: materialColor,
type: MaterialType.circle, type: MaterialType.circle,
elevation: _highlight ? config.highlightElevation : config.elevation, elevation: _highlight ? widget.highlightElevation : widget.elevation,
child: new Container( child: new Container(
width: config.mini ? _kSizeMini : _kSize, width: widget.mini ? _kSizeMini : _kSize,
height: config.mini ? _kSizeMini : _kSize, height: widget.mini ? _kSizeMini : _kSize,
child: new InkWell( child: new InkWell(
onTap: config.onPressed, onTap: widget.onPressed,
onHighlightChanged: _handleHighlightChanged, onHighlightChanged: _handleHighlightChanged,
child: result child: result
) )
......
...@@ -130,10 +130,10 @@ class _InkResponseState<T extends InkResponse> extends State<T> { ...@@ -130,10 +130,10 @@ class _InkResponseState<T extends InkResponse> extends State<T> {
_lastHighlight = new InkHighlight( _lastHighlight = new InkHighlight(
controller: Material.of(context), controller: Material.of(context),
referenceBox: referenceBox, referenceBox: referenceBox,
color: config.highlightColor ?? Theme.of(context).highlightColor, color: widget.highlightColor ?? Theme.of(context).highlightColor,
shape: config.highlightShape, shape: widget.highlightShape,
borderRadius: config.borderRadius, borderRadius: widget.borderRadius,
rectCallback: config.getRectCallback(referenceBox), rectCallback: widget.getRectCallback(referenceBox),
onRemoved: () { onRemoved: () {
assert(_lastHighlight != null); assert(_lastHighlight != null);
_lastHighlight = null; _lastHighlight = null;
...@@ -146,23 +146,23 @@ class _InkResponseState<T extends InkResponse> extends State<T> { ...@@ -146,23 +146,23 @@ class _InkResponseState<T extends InkResponse> extends State<T> {
_lastHighlight.deactivate(); _lastHighlight.deactivate();
} }
assert(value == (_lastHighlight != null && _lastHighlight.active)); assert(value == (_lastHighlight != null && _lastHighlight.active));
if (config.onHighlightChanged != null) if (widget.onHighlightChanged != null)
config.onHighlightChanged(value); widget.onHighlightChanged(value);
} }
void _handleTapDown(TapDownDetails details) { void _handleTapDown(TapDownDetails details) {
final RenderBox referenceBox = context.findRenderObject(); final RenderBox referenceBox = context.findRenderObject();
final RectCallback rectCallback = config.getRectCallback(referenceBox); final RectCallback rectCallback = widget.getRectCallback(referenceBox);
InkSplash splash; InkSplash splash;
splash = new InkSplash( splash = new InkSplash(
controller: Material.of(context), controller: Material.of(context),
referenceBox: referenceBox, referenceBox: referenceBox,
position: referenceBox.globalToLocal(details.globalPosition), position: referenceBox.globalToLocal(details.globalPosition),
color: config.splashColor ?? Theme.of(context).splashColor, color: widget.splashColor ?? Theme.of(context).splashColor,
containedInkWell: config.containedInkWell, containedInkWell: widget.containedInkWell,
rectCallback: config.containedInkWell ? rectCallback : null, rectCallback: widget.containedInkWell ? rectCallback : null,
radius: config.radius, radius: widget.radius,
borderRadius: config.borderRadius ?? BorderRadius.zero, borderRadius: widget.borderRadius ?? BorderRadius.zero,
onRemoved: () { onRemoved: () {
if (_splashes != null) { if (_splashes != null) {
assert(_splashes.contains(splash)); assert(_splashes.contains(splash));
...@@ -182,8 +182,8 @@ class _InkResponseState<T extends InkResponse> extends State<T> { ...@@ -182,8 +182,8 @@ class _InkResponseState<T extends InkResponse> extends State<T> {
_currentSplash?.confirm(); _currentSplash?.confirm();
_currentSplash = null; _currentSplash = null;
updateHighlight(false); updateHighlight(false);
if (config.onTap != null) if (widget.onTap != null)
config.onTap(); widget.onTap();
} }
void _handleTapCancel() { void _handleTapCancel() {
...@@ -195,15 +195,15 @@ class _InkResponseState<T extends InkResponse> extends State<T> { ...@@ -195,15 +195,15 @@ class _InkResponseState<T extends InkResponse> extends State<T> {
void _handleDoubleTap() { void _handleDoubleTap() {
_currentSplash?.confirm(); _currentSplash?.confirm();
_currentSplash = null; _currentSplash = null;
if (config.onDoubleTap != null) if (widget.onDoubleTap != null)
config.onDoubleTap(); widget.onDoubleTap();
} }
void _handleLongPress() { void _handleLongPress() {
_currentSplash?.confirm(); _currentSplash?.confirm();
_currentSplash = null; _currentSplash = null;
if (config.onLongPress != null) if (widget.onLongPress != null)
config.onLongPress(); widget.onLongPress();
} }
@override @override
...@@ -223,19 +223,19 @@ class _InkResponseState<T extends InkResponse> extends State<T> { ...@@ -223,19 +223,19 @@ class _InkResponseState<T extends InkResponse> extends State<T> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
assert(config.debugCheckContext(context)); assert(widget.debugCheckContext(context));
final ThemeData themeData = Theme.of(context); final ThemeData themeData = Theme.of(context);
_lastHighlight?.color = config.highlightColor ?? themeData.highlightColor; _lastHighlight?.color = widget.highlightColor ?? themeData.highlightColor;
_currentSplash?.color = config.splashColor ?? themeData.splashColor; _currentSplash?.color = widget.splashColor ?? themeData.splashColor;
final bool enabled = config.onTap != null || config.onDoubleTap != null || config.onLongPress != null; final bool enabled = widget.onTap != null || widget.onDoubleTap != null || widget.onLongPress != null;
return new GestureDetector( return new GestureDetector(
onTapDown: enabled ? _handleTapDown : null, onTapDown: enabled ? _handleTapDown : null,
onTap: enabled ? _handleTap : null, onTap: enabled ? _handleTap : null,
onTapCancel: enabled ? _handleTapCancel : null, onTapCancel: enabled ? _handleTapCancel : null,
onDoubleTap: config.onDoubleTap != null ? _handleDoubleTap : null, onDoubleTap: widget.onDoubleTap != null ? _handleDoubleTap : null,
onLongPress: config.onLongPress != null ? _handleLongPress : null, onLongPress: widget.onLongPress != null ? _handleLongPress : null,
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
child: config.child child: widget.child
); );
} }
......
...@@ -491,25 +491,25 @@ class _AnimatedLabelState extends AnimatedWidgetBaseState<_AnimatedLabel> { ...@@ -491,25 +491,25 @@ class _AnimatedLabelState extends AnimatedWidgetBaseState<_AnimatedLabel> {
@override @override
void forEachTween(TweenVisitor<dynamic> visitor) { void forEachTween(TweenVisitor<dynamic> visitor) {
_style = visitor(_style, config.style, (dynamic value) => new TextStyleTween(begin: value)); _style = visitor(_style, widget.style, (dynamic value) => new TextStyleTween(begin: value));
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
TextStyle style = _style.evaluate(animation); TextStyle style = _style.evaluate(animation);
double scale = 1.0; double scale = 1.0;
if (style.fontSize != config.style.fontSize) { if (style.fontSize != widget.style.fontSize) {
// While the fontSize is transitioning, use a scaled Transform as a // While the fontSize is transitioning, use a scaled Transform as a
// fraction of the original fontSize. That way we get a smooth scaling // fraction of the original fontSize. That way we get a smooth scaling
// effect with no snapping between discrete font sizes. // effect with no snapping between discrete font sizes.
scale = style.fontSize / config.style.fontSize; scale = style.fontSize / widget.style.fontSize;
style = style.copyWith(fontSize: config.style.fontSize); style = style.copyWith(fontSize: widget.style.fontSize);
} }
return new Transform( return new Transform(
transform: new Matrix4.identity()..scale(scale), transform: new Matrix4.identity()..scale(scale),
child: new Text( child: new Text(
config.text, widget.text,
style: style, style: style,
), ),
); );
......
...@@ -199,9 +199,9 @@ class _MaterialState extends State<Material> with TickerProviderStateMixin { ...@@ -199,9 +199,9 @@ class _MaterialState extends State<Material> with TickerProviderStateMixin {
final GlobalKey _inkFeatureRenderer = new GlobalKey(debugLabel: 'ink renderer'); final GlobalKey _inkFeatureRenderer = new GlobalKey(debugLabel: 'ink renderer');
Color _getBackgroundColor(BuildContext context) { Color _getBackgroundColor(BuildContext context) {
if (config.color != null) if (widget.color != null)
return config.color; return widget.color;
switch (config.type) { switch (widget.type) {
case MaterialType.canvas: case MaterialType.canvas:
return Theme.of(context).canvasColor; return Theme.of(context).canvasColor;
case MaterialType.card: case MaterialType.card:
...@@ -214,12 +214,12 @@ class _MaterialState extends State<Material> with TickerProviderStateMixin { ...@@ -214,12 +214,12 @@ class _MaterialState extends State<Material> with TickerProviderStateMixin {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final Color backgroundColor = _getBackgroundColor(context); final Color backgroundColor = _getBackgroundColor(context);
assert(backgroundColor != null || config.type == MaterialType.transparency); assert(backgroundColor != null || widget.type == MaterialType.transparency);
Widget contents = config.child; Widget contents = widget.child;
final BorderRadius radius = config.borderRadius ?? kMaterialEdges[config.type]; final BorderRadius radius = widget.borderRadius ?? kMaterialEdges[widget.type];
if (contents != null) { if (contents != null) {
contents = new AnimatedDefaultTextStyle( contents = new AnimatedDefaultTextStyle(
style: config.textStyle ?? Theme.of(context).textTheme.body1, style: widget.textStyle ?? Theme.of(context).textTheme.body1,
duration: kThemeChangeDuration, duration: kThemeChangeDuration,
child: contents child: contents
); );
...@@ -239,14 +239,14 @@ class _MaterialState extends State<Material> with TickerProviderStateMixin { ...@@ -239,14 +239,14 @@ class _MaterialState extends State<Material> with TickerProviderStateMixin {
); );
if (Material.debugEnablePhysicalModel) { if (Material.debugEnablePhysicalModel) {
if (config.type == MaterialType.circle) { if (widget.type == MaterialType.circle) {
contents = new PhysicalModel( contents = new PhysicalModel(
shape: BoxShape.circle, shape: BoxShape.circle,
elevation: config.elevation, elevation: widget.elevation,
color: backgroundColor, color: backgroundColor,
child: contents, child: contents,
); );
} else if (config.type == MaterialType.transparency) { } else if (widget.type == MaterialType.transparency) {
if (radius == null) { if (radius == null) {
contents = new ClipRect(child: contents); contents = new ClipRect(child: contents);
} else { } else {
...@@ -259,15 +259,15 @@ class _MaterialState extends State<Material> with TickerProviderStateMixin { ...@@ -259,15 +259,15 @@ class _MaterialState extends State<Material> with TickerProviderStateMixin {
contents = new PhysicalModel( contents = new PhysicalModel(
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
borderRadius: radius ?? BorderRadius.zero, borderRadius: radius ?? BorderRadius.zero,
elevation: config.elevation, elevation: widget.elevation,
color: backgroundColor, color: backgroundColor,
child: contents, child: contents,
); );
} }
} else { } else {
if (config.type == MaterialType.circle) { if (widget.type == MaterialType.circle) {
contents = new ClipOval(child: contents); contents = new ClipOval(child: contents);
} else if (kMaterialEdges[config.type] != null) { } else if (kMaterialEdges[widget.type] != null) {
contents = new ClipRRect( contents = new ClipRRect(
borderRadius: radius, borderRadius: radius,
child: contents child: contents
...@@ -275,21 +275,21 @@ class _MaterialState extends State<Material> with TickerProviderStateMixin { ...@@ -275,21 +275,21 @@ class _MaterialState extends State<Material> with TickerProviderStateMixin {
} }
} }
if (config.type != MaterialType.transparency) { if (widget.type != MaterialType.transparency) {
contents = new AnimatedContainer( contents = new AnimatedContainer(
curve: Curves.fastOutSlowIn, curve: Curves.fastOutSlowIn,
duration: kThemeChangeDuration, duration: kThemeChangeDuration,
decoration: new BoxDecoration( decoration: new BoxDecoration(
borderRadius: radius, borderRadius: radius,
boxShadow: config.elevation == 0 || Material.debugEnablePhysicalModel ? boxShadow: widget.elevation == 0 || Material.debugEnablePhysicalModel ?
null : kElevationToShadow[config.elevation], null : kElevationToShadow[widget.elevation],
shape: config.type == MaterialType.circle ? BoxShape.circle : BoxShape.rectangle shape: widget.type == MaterialType.circle ? BoxShape.circle : BoxShape.rectangle
), ),
child: new Container( child: new Container(
decoration: new BoxDecoration( decoration: new BoxDecoration(
borderRadius: radius, borderRadius: radius,
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
shape: config.type == MaterialType.circle ? BoxShape.circle : BoxShape.rectangle shape: widget.type == MaterialType.circle ? BoxShape.circle : BoxShape.rectangle
), ),
child: contents child: contents
) )
......
...@@ -153,7 +153,7 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid ...@@ -153,7 +153,7 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_children = new List<MergeableMaterialItem>.from(config.children); _children = new List<MergeableMaterialItem>.from(widget.children);
for (int i = 0; i < _children.length; i += 1) { for (int i = 0; i < _children.length; i += 1) {
if (_children[i] is MaterialGap) { if (_children[i] is MaterialGap) {
...@@ -209,9 +209,9 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid ...@@ -209,9 +209,9 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid
} }
bool _debugHasConsecutiveGaps(List<MergeableMaterialItem> children) { bool _debugHasConsecutiveGaps(List<MergeableMaterialItem> children) {
for (int i = 0; i < config.children.length - 1; i += 1) { for (int i = 0; i < widget.children.length - 1; i += 1) {
if (config.children[i] is MaterialGap && if (widget.children[i] is MaterialGap &&
config.children[i + 1] is MaterialGap) widget.children[i + 1] is MaterialGap)
return true; return true;
} }
return false; return false;
...@@ -270,19 +270,19 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid ...@@ -270,19 +270,19 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid
} }
@override @override
void didUpdateConfig(MergeableMaterial oldConfig) { void didUpdateWidget(MergeableMaterial oldWidget) {
super.didUpdateConfig(oldConfig); super.didUpdateWidget(oldWidget);
final Set<LocalKey> oldKeys = oldConfig.children.map( final Set<LocalKey> oldKeys = oldWidget.children.map(
(MergeableMaterialItem child) => child.key (MergeableMaterialItem child) => child.key
).toSet(); ).toSet();
final Set<LocalKey> newKeys = config.children.map( final Set<LocalKey> newKeys = widget.children.map(
(MergeableMaterialItem child) => child.key (MergeableMaterialItem child) => child.key
).toSet(); ).toSet();
final Set<LocalKey> newOnly = newKeys.difference(oldKeys); final Set<LocalKey> newOnly = newKeys.difference(oldKeys);
final Set<LocalKey> oldOnly = oldKeys.difference(newKeys); final Set<LocalKey> oldOnly = oldKeys.difference(newKeys);
final List<MergeableMaterialItem> newChildren = config.children; final List<MergeableMaterialItem> newChildren = widget.children;
int i = 0; int i = 0;
int j = 0; int j = 0;
...@@ -473,7 +473,7 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid ...@@ -473,7 +473,7 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid
); );
} }
if (config.mainAxis == Axis.vertical) { if (widget.mainAxis == Axis.vertical) {
return new BorderRadius.vertical( return new BorderRadius.vertical(
top: start ? cardRadius : startRadius, top: start ? cardRadius : startRadius,
bottom: end ? cardRadius : endRadius bottom: end ? cardRadius : endRadius
...@@ -523,7 +523,7 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid ...@@ -523,7 +523,7 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid
shape: BoxShape.rectangle shape: BoxShape.rectangle
), ),
child: new ListBody( child: new ListBody(
mainAxis: config.mainAxis, mainAxis: widget.mainAxis,
children: slices children: slices
) )
) )
...@@ -532,15 +532,15 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid ...@@ -532,15 +532,15 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid
widgets.add( widgets.add(
new SizedBox( new SizedBox(
width: config.mainAxis == Axis.horizontal ? _getGapSize(i) : null, width: widget.mainAxis == Axis.horizontal ? _getGapSize(i) : null,
height: config.mainAxis == Axis.vertical ? _getGapSize(i) : null height: widget.mainAxis == Axis.vertical ? _getGapSize(i) : null
) )
); );
} else { } else {
final MaterialSlice slice = _children[i]; final MaterialSlice slice = _children[i];
Widget child = slice.child; Widget child = slice.child;
if (config.hasDividers) { if (widget.hasDividers) {
final bool hasTopDivider = _willNeedDivider(i - 1); final bool hasTopDivider = _willNeedDivider(i - 1);
final bool hasBottomDivider = _willNeedDivider(i + 1); final bool hasBottomDivider = _willNeedDivider(i + 1);
...@@ -594,7 +594,7 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid ...@@ -594,7 +594,7 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid
shape: BoxShape.rectangle shape: BoxShape.rectangle
), ),
child: new ListBody( child: new ListBody(
mainAxis: config.mainAxis, mainAxis: widget.mainAxis,
children: slices children: slices
) )
) )
...@@ -603,8 +603,8 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid ...@@ -603,8 +603,8 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid
} }
return new _MergeableMaterialListBody( return new _MergeableMaterialListBody(
mainAxis: config.mainAxis, mainAxis: widget.mainAxis,
boxShadows: kElevationToShadow[config.elevation], boxShadows: kElevationToShadow[widget.elevation],
items: _children, items: _children,
children: widgets children: widgets
); );
......
...@@ -189,32 +189,32 @@ class PaginatedDataTableState extends State<PaginatedDataTable> { ...@@ -189,32 +189,32 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_firstRowIndex = PageStorage.of(context)?.readState(context) ?? config.initialFirstRowIndex ?? 0; _firstRowIndex = PageStorage.of(context)?.readState(context) ?? widget.initialFirstRowIndex ?? 0;
config.source.addListener(_handleDataSourceChanged); widget.source.addListener(_handleDataSourceChanged);
_handleDataSourceChanged(); _handleDataSourceChanged();
} }
@override @override
void didUpdateConfig(PaginatedDataTable oldConfig) { void didUpdateWidget(PaginatedDataTable oldWidget) {
super.didUpdateConfig(oldConfig); super.didUpdateWidget(oldWidget);
if (oldConfig.source != config.source) { if (oldWidget.source != widget.source) {
oldConfig.source.removeListener(_handleDataSourceChanged); oldWidget.source.removeListener(_handleDataSourceChanged);
config.source.addListener(_handleDataSourceChanged); widget.source.addListener(_handleDataSourceChanged);
_handleDataSourceChanged(); _handleDataSourceChanged();
} }
} }
@override @override
void dispose() { void dispose() {
config.source.removeListener(_handleDataSourceChanged); widget.source.removeListener(_handleDataSourceChanged);
super.dispose(); super.dispose();
} }
void _handleDataSourceChanged() { void _handleDataSourceChanged() {
setState(() { setState(() {
_rowCount = config.source.rowCount; _rowCount = widget.source.rowCount;
_rowCountApproximate = config.source.isRowCountApproximate; _rowCountApproximate = widget.source.isRowCountApproximate;
_selectedRowCount = config.source.selectedRowCount; _selectedRowCount = widget.source.selectedRowCount;
_rows.clear(); _rows.clear();
}); });
} }
...@@ -223,24 +223,24 @@ class PaginatedDataTableState extends State<PaginatedDataTable> { ...@@ -223,24 +223,24 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
void pageTo(int rowIndex) { void pageTo(int rowIndex) {
final int oldFirstRowIndex = _firstRowIndex; final int oldFirstRowIndex = _firstRowIndex;
setState(() { setState(() {
final int rowsPerPage = config.rowsPerPage; final int rowsPerPage = widget.rowsPerPage;
_firstRowIndex = (rowIndex ~/ rowsPerPage) * rowsPerPage; _firstRowIndex = (rowIndex ~/ rowsPerPage) * rowsPerPage;
}); });
if ((config.onPageChanged != null) && if ((widget.onPageChanged != null) &&
(oldFirstRowIndex != _firstRowIndex)) (oldFirstRowIndex != _firstRowIndex))
config.onPageChanged(_firstRowIndex); widget.onPageChanged(_firstRowIndex);
} }
DataRow _getBlankRowFor(int index) { DataRow _getBlankRowFor(int index) {
return new DataRow.byIndex( return new DataRow.byIndex(
index: index, index: index,
cells: config.columns.map<DataCell>((DataColumn column) => DataCell.empty).toList() cells: widget.columns.map<DataCell>((DataColumn column) => DataCell.empty).toList()
); );
} }
DataRow _getProgressIndicatorRowFor(int index) { DataRow _getProgressIndicatorRowFor(int index) {
bool haveProgressIndicator = false; bool haveProgressIndicator = false;
final List<DataCell> cells = config.columns.map<DataCell>((DataColumn column) { final List<DataCell> cells = widget.columns.map<DataCell>((DataColumn column) {
if (!column.numeric) { if (!column.numeric) {
haveProgressIndicator = true; haveProgressIndicator = true;
return new DataCell(new CircularProgressIndicator()); return new DataCell(new CircularProgressIndicator());
...@@ -264,7 +264,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> { ...@@ -264,7 +264,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
for (int index = firstRowIndex; index < nextPageFirstRowIndex; index += 1) { for (int index = firstRowIndex; index < nextPageFirstRowIndex; index += 1) {
DataRow row; DataRow row;
if (index < _rowCount || _rowCountApproximate) { if (index < _rowCount || _rowCountApproximate) {
row = _rows.putIfAbsent(index, () => config.source.getRow(index)); row = _rows.putIfAbsent(index, () => widget.source.getRow(index));
if (row == null && !haveProgressIndicator) { if (row == null && !haveProgressIndicator) {
row ??= _getProgressIndicatorRowFor(index); row ??= _getProgressIndicatorRowFor(index);
haveProgressIndicator = true; haveProgressIndicator = true;
...@@ -286,8 +286,8 @@ class PaginatedDataTableState extends State<PaginatedDataTable> { ...@@ -286,8 +286,8 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
final List<Widget> headerWidgets = <Widget>[]; final List<Widget> headerWidgets = <Widget>[];
double leftPadding = 24.0; double leftPadding = 24.0;
if (_selectedRowCount == 0) { if (_selectedRowCount == 0) {
headerWidgets.add(new Expanded(child: config.header)); headerWidgets.add(new Expanded(child: widget.header));
if (config.header is ButtonBar) { if (widget.header is ButtonBar) {
// We adjust the padding when a button bar is present, because the // We adjust the padding when a button bar is present, because the
// ButtonBar introduces 2 pixels of outside padding, plus 2 pixels // ButtonBar introduces 2 pixels of outside padding, plus 2 pixels
// around each button on each side, and the button itself will have 8 // around each button on each side, and the button itself will have 8
...@@ -302,13 +302,13 @@ class PaginatedDataTableState extends State<PaginatedDataTable> { ...@@ -302,13 +302,13 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
} else { } else {
headerWidgets.add(new Expanded(child: new Text('$_selectedRowCount items selected'))); headerWidgets.add(new Expanded(child: new Text('$_selectedRowCount items selected')));
} }
if (config.actions != null) { if (widget.actions != null) {
headerWidgets.addAll( headerWidgets.addAll(
config.actions.map<Widget>((Widget widget) { widget.actions.map<Widget>((Widget action) {
return new Padding( return new Padding(
// 8.0 is the default padding of an icon button // 8.0 is the default padding of an icon button
padding: const EdgeInsets.only(left: 24.0 - 8.0 * 2.0), padding: const EdgeInsets.only(left: 24.0 - 8.0 * 2.0),
child: widget child: action,
); );
}).toList() }).toList()
); );
...@@ -317,8 +317,8 @@ class PaginatedDataTableState extends State<PaginatedDataTable> { ...@@ -317,8 +317,8 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
// FOOTER // FOOTER
final TextStyle footerTextStyle = themeData.textTheme.caption; final TextStyle footerTextStyle = themeData.textTheme.caption;
final List<Widget> footerWidgets = <Widget>[]; final List<Widget> footerWidgets = <Widget>[];
if (config.onRowsPerPageChanged != null) { if (widget.onRowsPerPageChanged != null) {
final List<Widget> availableRowsPerPage = config.availableRowsPerPage final List<Widget> availableRowsPerPage = widget.availableRowsPerPage
.where((int value) => value <= _rowCount) .where((int value) => value <= _rowCount)
.map<DropdownMenuItem<int>>((int value) { .map<DropdownMenuItem<int>>((int value) {
return new DropdownMenuItem<int>( return new DropdownMenuItem<int>(
...@@ -332,8 +332,8 @@ class PaginatedDataTableState extends State<PaginatedDataTable> { ...@@ -332,8 +332,8 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
new DropdownButtonHideUnderline( new DropdownButtonHideUnderline(
child: new DropdownButton<int>( child: new DropdownButton<int>(
items: availableRowsPerPage, items: availableRowsPerPage,
value: config.rowsPerPage, value: widget.rowsPerPage,
onChanged: config.onRowsPerPageChanged, onChanged: widget.onRowsPerPageChanged,
style: footerTextStyle, style: footerTextStyle,
iconSize: 24.0 iconSize: 24.0
) )
...@@ -343,7 +343,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> { ...@@ -343,7 +343,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
footerWidgets.addAll(<Widget>[ footerWidgets.addAll(<Widget>[
new Container(width: 32.0), new Container(width: 32.0),
new Text( new Text(
'${_firstRowIndex + 1}\u2013${_firstRowIndex + config.rowsPerPage} ${ _rowCountApproximate ? "of about" : "of" } $_rowCount' '${_firstRowIndex + 1}\u2013${_firstRowIndex + widget.rowsPerPage} ${ _rowCountApproximate ? "of about" : "of" } $_rowCount'
), ),
new Container(width: 32.0), new Container(width: 32.0),
new IconButton( new IconButton(
...@@ -351,7 +351,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> { ...@@ -351,7 +351,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
tooltip: 'Previous page', tooltip: 'Previous page',
onPressed: _firstRowIndex <= 0 ? null : () { onPressed: _firstRowIndex <= 0 ? null : () {
pageTo(math.max(_firstRowIndex - config.rowsPerPage, 0)); pageTo(math.max(_firstRowIndex - widget.rowsPerPage, 0));
} }
), ),
new Container(width: 24.0), new Container(width: 24.0),
...@@ -359,8 +359,8 @@ class PaginatedDataTableState extends State<PaginatedDataTable> { ...@@ -359,8 +359,8 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
icon: const Icon(Icons.chevron_right), icon: const Icon(Icons.chevron_right),
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
tooltip: 'Next page', tooltip: 'Next page',
onPressed: (!_rowCountApproximate && (_firstRowIndex + config.rowsPerPage >= _rowCount)) ? null : () { onPressed: (!_rowCountApproximate && (_firstRowIndex + widget.rowsPerPage >= _rowCount)) ? null : () {
pageTo(_firstRowIndex + config.rowsPerPage); pageTo(_firstRowIndex + widget.rowsPerPage);
} }
), ),
new Container(width: 14.0), new Container(width: 14.0),
...@@ -404,11 +404,11 @@ class PaginatedDataTableState extends State<PaginatedDataTable> { ...@@ -404,11 +404,11 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
child: new DataTable( child: new DataTable(
key: _tableKey, key: _tableKey,
columns: config.columns, columns: widget.columns,
sortColumnIndex: config.sortColumnIndex, sortColumnIndex: widget.sortColumnIndex,
sortAscending: config.sortAscending, sortAscending: widget.sortAscending,
onSelectAll: config.onSelectAll, onSelectAll: widget.onSelectAll,
rows: _getRows(_firstRowIndex, config.rowsPerPage) rows: _getRows(_firstRowIndex, widget.rowsPerPage)
) )
), ),
new DefaultTextStyle( new DefaultTextStyle(
......
...@@ -90,7 +90,7 @@ class PopupMenuDivider extends PopupMenuEntry<dynamic> { ...@@ -90,7 +90,7 @@ class PopupMenuDivider extends PopupMenuEntry<dynamic> {
class _PopupMenuDividerState extends State<PopupMenuDivider> { class _PopupMenuDividerState extends State<PopupMenuDivider> {
@override @override
Widget build(BuildContext context) => new Divider(height: config.height); Widget build(BuildContext context) => new Divider(height: widget.height);
} }
/// An item in a material design popup menu. /// An item in a material design popup menu.
...@@ -136,29 +136,29 @@ class PopupMenuItem<T> extends PopupMenuEntry<T> { ...@@ -136,29 +136,29 @@ class PopupMenuItem<T> extends PopupMenuEntry<T> {
class _PopupMenuItemState<T extends PopupMenuItem<dynamic>> extends State<T> { class _PopupMenuItemState<T extends PopupMenuItem<dynamic>> extends State<T> {
// Override this to put something else in the menu entry. // Override this to put something else in the menu entry.
Widget buildChild() => config.child; Widget buildChild() => widget.child;
void onTap() { void onTap() {
Navigator.pop(context, config.value); Navigator.pop(context, widget.value);
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context); final ThemeData theme = Theme.of(context);
TextStyle style = theme.textTheme.subhead; TextStyle style = theme.textTheme.subhead;
if (!config.enabled) if (!widget.enabled)
style = style.copyWith(color: theme.disabledColor); style = style.copyWith(color: theme.disabledColor);
Widget item = new AnimatedDefaultTextStyle( Widget item = new AnimatedDefaultTextStyle(
style: style, style: style,
duration: kThemeChangeDuration, duration: kThemeChangeDuration,
child: new Baseline( child: new Baseline(
baseline: config.height - _kBaselineOffsetFromBottom, baseline: widget.height - _kBaselineOffsetFromBottom,
baselineType: TextBaseline.alphabetic, baselineType: TextBaseline.alphabetic,
child: buildChild() child: buildChild()
) )
); );
if (!config.enabled) { if (!widget.enabled) {
final bool isDark = theme.brightness == Brightness.dark; final bool isDark = theme.brightness == Brightness.dark;
item = new IconTheme.merge( item = new IconTheme.merge(
context: context, context: context,
...@@ -168,10 +168,10 @@ class _PopupMenuItemState<T extends PopupMenuItem<dynamic>> extends State<T> { ...@@ -168,10 +168,10 @@ class _PopupMenuItemState<T extends PopupMenuItem<dynamic>> extends State<T> {
} }
return new InkWell( return new InkWell(
onTap: config.enabled ? onTap : null, onTap: widget.enabled ? onTap : null,
child: new MergeSemantics( child: new MergeSemantics(
child: new Container( child: new Container(
height: config.height, height: widget.height,
padding: const EdgeInsets.symmetric(horizontal: _kMenuHorizontalPadding), padding: const EdgeInsets.symmetric(horizontal: _kMenuHorizontalPadding),
child: item child: item
) )
...@@ -225,14 +225,14 @@ class _CheckedPopupMenuItemState<T> extends _PopupMenuItemState<CheckedPopupMenu ...@@ -225,14 +225,14 @@ class _CheckedPopupMenuItemState<T> extends _PopupMenuItemState<CheckedPopupMenu
void initState() { void initState() {
super.initState(); super.initState();
_controller = new AnimationController(duration: _kFadeDuration, vsync: this) _controller = new AnimationController(duration: _kFadeDuration, vsync: this)
..value = config.checked ? 1.0 : 0.0 ..value = widget.checked ? 1.0 : 0.0
..addListener(() => setState(() { /* animation changed */ })); ..addListener(() => setState(() { /* animation changed */ }));
} }
@override @override
void onTap() { void onTap() {
// This fades the checkmark in or out when tapped. // This fades the checkmark in or out when tapped.
if (config.checked) if (widget.checked)
_controller.reverse(); _controller.reverse();
else else
_controller.forward(); _controller.forward();
...@@ -242,12 +242,12 @@ class _CheckedPopupMenuItemState<T> extends _PopupMenuItemState<CheckedPopupMenu ...@@ -242,12 +242,12 @@ class _CheckedPopupMenuItemState<T> extends _PopupMenuItemState<CheckedPopupMenu
@override @override
Widget buildChild() { Widget buildChild() {
return new ListTile( return new ListTile(
enabled: config.enabled, enabled: widget.enabled,
leading: new FadeTransition( leading: new FadeTransition(
opacity: _opacity, opacity: _opacity,
child: new Icon(_controller.isDismissed ? null : Icons.done) child: new Icon(_controller.isDismissed ? null : Icons.done)
), ),
title: config.child title: widget.child
); );
} }
} }
...@@ -527,35 +527,35 @@ class _PopupMenuButtonState<T> extends State<PopupMenuButton<T>> { ...@@ -527,35 +527,35 @@ class _PopupMenuButtonState<T> extends State<PopupMenuButton<T>> {
final Point topLeft = renderBox.localToGlobal(Point.origin); final Point topLeft = renderBox.localToGlobal(Point.origin);
showMenu<T>( showMenu<T>(
context: context, context: context,
elevation: config.elevation, elevation: widget.elevation,
items: config.itemBuilder(context), items: widget.itemBuilder(context),
initialValue: config.initialValue, initialValue: widget.initialValue,
position: new RelativeRect.fromLTRB( position: new RelativeRect.fromLTRB(
topLeft.x, topLeft.y + (config.initialValue != null ? renderBox.size.height / 2.0 : 0.0), topLeft.x, topLeft.y + (widget.initialValue != null ? renderBox.size.height / 2.0 : 0.0),
0.0, 0.0 0.0, 0.0
) )
) )
.then<Null>((T newValue) { .then<Null>((T newValue) {
if (!mounted || newValue == null) if (!mounted || newValue == null)
return null; return null;
if (config.onSelected != null) if (widget.onSelected != null)
config.onSelected(newValue); widget.onSelected(newValue);
}); });
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (config.child == null) { if (widget.child == null) {
return new IconButton( return new IconButton(
icon: const Icon(Icons.more_vert), icon: const Icon(Icons.more_vert),
padding: config.padding, padding: widget.padding,
tooltip: config.tooltip, tooltip: widget.tooltip,
onPressed: showButtonMenu, onPressed: showButtonMenu,
); );
} }
return new InkWell( return new InkWell(
onTap: showButtonMenu, onTap: showButtonMenu,
child: config.child, child: widget.child,
); );
} }
} }
...@@ -174,10 +174,10 @@ class _LinearProgressIndicatorState extends State<LinearProgressIndicator> with ...@@ -174,10 +174,10 @@ class _LinearProgressIndicatorState extends State<LinearProgressIndicator> with
), ),
child: new CustomPaint( child: new CustomPaint(
painter: new _LinearProgressIndicatorPainter( painter: new _LinearProgressIndicatorPainter(
backgroundColor: config._getBackgroundColor(context), backgroundColor: widget._getBackgroundColor(context),
valueColor: config._getValueColor(context), valueColor: widget._getValueColor(context),
value: config.value, // may be null value: widget.value, // may be null
animationValue: animationValue // ignored if config.value is not null animationValue: animationValue // ignored if widget.value is not null
) )
) )
); );
...@@ -185,7 +185,7 @@ class _LinearProgressIndicatorState extends State<LinearProgressIndicator> with ...@@ -185,7 +185,7 @@ class _LinearProgressIndicatorState extends State<LinearProgressIndicator> with
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (config.value != null) if (widget.value != null)
return _buildIndicator(context, _animation.value); return _buildIndicator(context, _animation.value);
return new AnimatedBuilder( return new AnimatedBuilder(
...@@ -332,9 +332,9 @@ class _CircularProgressIndicatorState extends State<CircularProgressIndicator> w ...@@ -332,9 +332,9 @@ class _CircularProgressIndicatorState extends State<CircularProgressIndicator> w
), ),
child: new CustomPaint( child: new CustomPaint(
painter: new _CircularProgressIndicatorPainter( painter: new _CircularProgressIndicatorPainter(
valueColor: config._getValueColor(context), valueColor: widget._getValueColor(context),
value: config.value, // may be null value: widget.value, // may be null
headValue: headValue, // remaining arguments are ignored if config.value is not null headValue: headValue, // remaining arguments are ignored if widget.value is not null
tailValue: tailValue, tailValue: tailValue,
stepValue: stepValue, stepValue: stepValue,
rotationValue: rotationValue, rotationValue: rotationValue,
...@@ -361,7 +361,7 @@ class _CircularProgressIndicatorState extends State<CircularProgressIndicator> w ...@@ -361,7 +361,7 @@ class _CircularProgressIndicatorState extends State<CircularProgressIndicator> w
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (config.value != null) if (widget.value != null)
return _buildIndicator(context, 0.0, 0.0, 0, 0.0); return _buildIndicator(context, 0.0, 0.0, 0, 0.0);
return _buildAnimation(); return _buildAnimation();
} }
...@@ -463,8 +463,8 @@ class _RefreshProgressIndicatorState extends _CircularProgressIndicatorState { ...@@ -463,8 +463,8 @@ class _RefreshProgressIndicatorState extends _CircularProgressIndicatorState {
// starting from wherever we left it. // starting from wherever we left it.
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (config.value != null) if (widget.value != null)
_controller.value = config.value / 10.0; _controller.value = widget.value / 10.0;
else else
_controller.forward(); _controller.forward();
return _buildAnimation(); return _buildAnimation();
...@@ -472,20 +472,20 @@ class _RefreshProgressIndicatorState extends _CircularProgressIndicatorState { ...@@ -472,20 +472,20 @@ class _RefreshProgressIndicatorState extends _CircularProgressIndicatorState {
@override @override
Widget _buildIndicator(BuildContext context, double headValue, double tailValue, int stepValue, double rotationValue) { Widget _buildIndicator(BuildContext context, double headValue, double tailValue, int stepValue, double rotationValue) {
final double arrowheadScale = config.value == null ? 0.0 : (config.value * 2.0).clamp(0.0, 1.0); final double arrowheadScale = widget.value == null ? 0.0 : (widget.value * 2.0).clamp(0.0, 1.0);
return new Container( return new Container(
width: _kIndicatorSize, width: _kIndicatorSize,
height: _kIndicatorSize, height: _kIndicatorSize,
margin: const EdgeInsets.all(4.0), // acommodate the shadow margin: const EdgeInsets.all(4.0), // acommodate the shadow
child: new Material( child: new Material(
type: MaterialType.circle, type: MaterialType.circle,
color: config.backgroundColor ?? Theme.of(context).canvasColor, color: widget.backgroundColor ?? Theme.of(context).canvasColor,
elevation: 2, elevation: 2,
child: new Padding( child: new Padding(
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
child: new CustomPaint( child: new CustomPaint(
painter: new _RefreshProgressIndicatorPainter( painter: new _RefreshProgressIndicatorPainter(
valueColor: config._getValueColor(context), valueColor: widget._getValueColor(context),
value: null, // Draw the indeterminate progress indicator. value: null, // Draw the indeterminate progress indicator.
headValue: headValue, headValue: headValue,
tailValue: tailValue, tailValue: tailValue,
......
...@@ -98,7 +98,7 @@ class Radio<T> extends StatefulWidget { ...@@ -98,7 +98,7 @@ class Radio<T> extends StatefulWidget {
} }
class _RadioState<T> extends State<Radio<T>> with TickerProviderStateMixin { class _RadioState<T> extends State<Radio<T>> with TickerProviderStateMixin {
bool get _enabled => config.onChanged != null; bool get _enabled => widget.onChanged != null;
Color _getInactiveColor(ThemeData themeData) { Color _getInactiveColor(ThemeData themeData) {
return _enabled ? themeData.unselectedWidgetColor : themeData.disabledColor; return _enabled ? themeData.unselectedWidgetColor : themeData.disabledColor;
...@@ -106,7 +106,7 @@ class _RadioState<T> extends State<Radio<T>> with TickerProviderStateMixin { ...@@ -106,7 +106,7 @@ class _RadioState<T> extends State<Radio<T>> with TickerProviderStateMixin {
void _handleChanged(bool selected) { void _handleChanged(bool selected) {
if (selected) if (selected)
config.onChanged(config.value); widget.onChanged(widget.value);
} }
@override @override
...@@ -114,10 +114,10 @@ class _RadioState<T> extends State<Radio<T>> with TickerProviderStateMixin { ...@@ -114,10 +114,10 @@ class _RadioState<T> extends State<Radio<T>> with TickerProviderStateMixin {
assert(debugCheckHasMaterial(context)); assert(debugCheckHasMaterial(context));
final ThemeData themeData = Theme.of(context); final ThemeData themeData = Theme.of(context);
return new Semantics( return new Semantics(
checked: config.value == config.groupValue, checked: widget.value == widget.groupValue,
child: new _RadioRenderObjectWidget( child: new _RadioRenderObjectWidget(
selected: config.value == config.groupValue, selected: widget.value == widget.groupValue,
activeColor: config.activeColor ?? themeData.accentColor, activeColor: widget.activeColor ?? themeData.accentColor,
inactiveColor: _getInactiveColor(themeData), inactiveColor: _getInactiveColor(themeData),
onChanged: _enabled ? _handleChanged : null, onChanged: _enabled ? _handleChanged : null,
vsync: this, vsync: this,
......
...@@ -158,8 +158,8 @@ class RefreshIndicatorState extends State<RefreshIndicator> with TickerProviderS ...@@ -158,8 +158,8 @@ class RefreshIndicatorState extends State<RefreshIndicator> with TickerProviderS
void didChangeDependencies() { void didChangeDependencies() {
final ThemeData theme = Theme.of(context); final ThemeData theme = Theme.of(context);
_valueColor = new ColorTween( _valueColor = new ColorTween(
begin: (config.color ?? theme.accentColor).withOpacity(0.0), begin: (widget.color ?? theme.accentColor).withOpacity(0.0),
end: (config.color ?? theme.accentColor).withOpacity(1.0) end: (widget.color ?? theme.accentColor).withOpacity(1.0)
).animate(new CurvedAnimation( ).animate(new CurvedAnimation(
parent: _positionController, parent: _positionController,
curve: const Interval(0.0, 1.0 / _kDragSizeFactorLimit) curve: const Interval(0.0, 1.0 / _kDragSizeFactorLimit)
...@@ -311,13 +311,13 @@ class RefreshIndicatorState extends State<RefreshIndicator> with TickerProviderS ...@@ -311,13 +311,13 @@ class RefreshIndicatorState extends State<RefreshIndicator> with TickerProviderS
.animateTo(1.0 / _kDragSizeFactorLimit, duration: _kIndicatorSnapDuration) .animateTo(1.0 / _kDragSizeFactorLimit, duration: _kIndicatorSnapDuration)
.whenComplete(() { .whenComplete(() {
if (mounted && _mode == _RefreshIndicatorMode.snap) { if (mounted && _mode == _RefreshIndicatorMode.snap) {
assert(config.onRefresh != null); assert(widget.onRefresh != null);
setState(() { setState(() {
// Show the indeterminate progress indicator. // Show the indeterminate progress indicator.
_mode = _RefreshIndicatorMode.refresh; _mode = _RefreshIndicatorMode.refresh;
}); });
config.onRefresh().whenComplete(() { widget.onRefresh().whenComplete(() {
if (mounted && _mode == _RefreshIndicatorMode.refresh) { if (mounted && _mode == _RefreshIndicatorMode.refresh) {
completer.complete(); completer.complete();
_dismiss(_RefreshIndicatorMode.done); _dismiss(_RefreshIndicatorMode.done);
...@@ -362,7 +362,7 @@ class RefreshIndicatorState extends State<RefreshIndicator> with TickerProviderS ...@@ -362,7 +362,7 @@ class RefreshIndicatorState extends State<RefreshIndicator> with TickerProviderS
onNotification: _handleScrollNotification, onNotification: _handleScrollNotification,
child: new NotificationListener<OverscrollIndicatorNotification>( child: new NotificationListener<OverscrollIndicatorNotification>(
onNotification: _handleGlowNotification, onNotification: _handleGlowNotification,
child: config.child, child: widget.child,
), ),
); );
if (_mode == null) { if (_mode == null) {
...@@ -389,8 +389,8 @@ class RefreshIndicatorState extends State<RefreshIndicator> with TickerProviderS ...@@ -389,8 +389,8 @@ class RefreshIndicatorState extends State<RefreshIndicator> with TickerProviderS
sizeFactor: _positionFactor, // this is what brings it down sizeFactor: _positionFactor, // this is what brings it down
child: new Container( child: new Container(
padding: _isIndicatorAtTop padding: _isIndicatorAtTop
? new EdgeInsets.only(top: config.displacement) ? new EdgeInsets.only(top: widget.displacement)
: new EdgeInsets.only(bottom: config.displacement), : new EdgeInsets.only(bottom: widget.displacement),
alignment: _isIndicatorAtTop alignment: _isIndicatorAtTop
? FractionalOffset.topCenter ? FractionalOffset.topCenter
: FractionalOffset.bottomCenter, : FractionalOffset.bottomCenter,
...@@ -402,7 +402,7 @@ class RefreshIndicatorState extends State<RefreshIndicator> with TickerProviderS ...@@ -402,7 +402,7 @@ class RefreshIndicatorState extends State<RefreshIndicator> with TickerProviderS
return new RefreshProgressIndicator( return new RefreshProgressIndicator(
value: showIndeterminateIndicator ? null : _value.value, value: showIndeterminateIndicator ? null : _value.value,
valueColor: _valueColor, valueColor: _valueColor,
backgroundColor: config.backgroundColor, backgroundColor: widget.backgroundColor,
); );
}, },
), ),
......
...@@ -183,7 +183,7 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr ...@@ -183,7 +183,7 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr
// If we start out with a child, have the child appear fully visible instead // If we start out with a child, have the child appear fully visible instead
// of animating in. // of animating in.
if (config.child != null) if (widget.child != null)
_currentController.value = 1.0; _currentController.value = 1.0;
} }
...@@ -195,24 +195,24 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr ...@@ -195,24 +195,24 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr
} }
@override @override
void didUpdateConfig(_FloatingActionButtonTransition oldConfig) { void didUpdateWidget(_FloatingActionButtonTransition oldWidget) {
final bool oldChildIsNull = oldConfig.child == null; final bool oldChildIsNull = oldWidget.child == null;
final bool newChildIsNull = config.child == null; final bool newChildIsNull = widget.child == null;
if (oldChildIsNull == newChildIsNull && oldConfig.child?.key == config.child?.key) if (oldChildIsNull == newChildIsNull && oldWidget.child?.key == widget.child?.key)
return; return;
if (_previousController.status == AnimationStatus.dismissed) { if (_previousController.status == AnimationStatus.dismissed) {
final double currentValue = _currentController.value; final double currentValue = _currentController.value;
if (currentValue == 0.0 || oldConfig.child == null) { if (currentValue == 0.0 || oldWidget.child == null) {
// The current child hasn't started its entrance animation yet. We can // The current child hasn't started its entrance animation yet. We can
// just skip directly to the new child's entrance. // just skip directly to the new child's entrance.
_previousChild = null; _previousChild = null;
if (config.child != null) if (widget.child != null)
_currentController.forward(); _currentController.forward();
} else { } else {
// Otherwise, we need to copy the state from the current controller to // Otherwise, we need to copy the state from the current controller to
// the previous controller and run an exit animation for the previous // the previous controller and run an exit animation for the previous
// widget before running the entrance animation for the new child. // widget before running the entrance animation for the new child.
_previousChild = oldConfig.child; _previousChild = oldWidget.child;
_previousController _previousController
..value = currentValue ..value = currentValue
..reverse(); ..reverse();
...@@ -225,7 +225,7 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr ...@@ -225,7 +225,7 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr
setState(() { setState(() {
if (status == AnimationStatus.dismissed) { if (status == AnimationStatus.dismissed) {
assert(_currentController.status == AnimationStatus.dismissed); assert(_currentController.status == AnimationStatus.dismissed);
if (config.child != null) if (widget.child != null)
_currentController.forward(); _currentController.forward();
} }
}); });
...@@ -245,7 +245,7 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr ...@@ -245,7 +245,7 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr
scale: _currentAnimation, scale: _currentAnimation,
child: new RotationTransition( child: new RotationTransition(
turns: _kFloatingActionButtonTurnTween.animate(_currentAnimation), turns: _kFloatingActionButtonTurnTween.animate(_currentAnimation),
child: config.child, child: widget.child,
) )
)); ));
} }
...@@ -492,7 +492,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin { ...@@ -492,7 +492,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
final GlobalKey<DrawerControllerState> _drawerKey = new GlobalKey<DrawerControllerState>(); final GlobalKey<DrawerControllerState> _drawerKey = new GlobalKey<DrawerControllerState>();
/// Whether this scaffold has a non-null [Scaffold.drawer]. /// Whether this scaffold has a non-null [Scaffold.drawer].
bool get hasDrawer => config.drawer != null; bool get hasDrawer => widget.drawer != null;
/// Opens the [Drawer] (if any). /// Opens the [Drawer] (if any).
/// ///
...@@ -759,7 +759,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin { ...@@ -759,7 +759,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
Widget build(BuildContext context) { Widget build(BuildContext context) {
EdgeInsets padding = MediaQuery.of(context).padding; EdgeInsets padding = MediaQuery.of(context).padding;
final ThemeData themeData = Theme.of(context); final ThemeData themeData = Theme.of(context);
if (!config.resizeToAvoidBottomPadding) if (!widget.resizeToAvoidBottomPadding)
padding = new EdgeInsets.fromLTRB(padding.left, padding.top, padding.right, 0.0); padding = new EdgeInsets.fromLTRB(padding.left, padding.top, padding.right, 0.0);
if (_snackBars.isNotEmpty) { if (_snackBars.isNotEmpty) {
...@@ -779,14 +779,14 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin { ...@@ -779,14 +779,14 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
final List<LayoutId> children = <LayoutId>[]; final List<LayoutId> children = <LayoutId>[];
_addIfNonNull(children, config.body, _ScaffoldSlot.body); _addIfNonNull(children, widget.body, _ScaffoldSlot.body);
if (config.appBar != null) { if (widget.appBar != null) {
assert(config.appBar.primary || padding.top == 0.0, 'A non-primary AppBar was passed to a Scaffold but the MediaQuery in scope has top padding.'); assert(widget.appBar.primary || padding.top == 0.0, 'A non-primary AppBar was passed to a Scaffold but the MediaQuery in scope has top padding.');
final double topPadding = config.appBar.primary ? padding.top : 0.0; final double topPadding = widget.appBar.primary ? padding.top : 0.0;
Widget appBar = config.appBar; Widget appBar = widget.appBar;
final double extent = config.appBar.minExtent + topPadding; final double extent = widget.appBar.minExtent + topPadding;
if (config.appBar.flexibleSpace != null) { if (widget.appBar.flexibleSpace != null) {
appBar = FlexibleSpaceBar.createSettings( appBar = FlexibleSpaceBar.createSettings(
currentExtent: extent, currentExtent: extent,
child: appBar, child: appBar,
...@@ -805,7 +805,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin { ...@@ -805,7 +805,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
if (_snackBars.isNotEmpty) if (_snackBars.isNotEmpty)
_addIfNonNull(children, _snackBars.first._widget, _ScaffoldSlot.snackBar); _addIfNonNull(children, _snackBars.first._widget, _ScaffoldSlot.snackBar);
if (config.persistentFooterButtons != null) { if (widget.persistentFooterButtons != null) {
children.add(new LayoutId( children.add(new LayoutId(
id: _ScaffoldSlot.persistentFooter, id: _ScaffoldSlot.persistentFooter,
child: new Container( child: new Container(
...@@ -818,17 +818,17 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin { ...@@ -818,17 +818,17 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
), ),
child: new ButtonTheme.bar( child: new ButtonTheme.bar(
child: new ButtonBar( child: new ButtonBar(
children: config.persistentFooterButtons children: widget.persistentFooterButtons
), ),
), ),
), ),
)); ));
} }
if (config.bottomNavigationBar != null) { if (widget.bottomNavigationBar != null) {
children.add(new LayoutId( children.add(new LayoutId(
id: _ScaffoldSlot.bottomNavigationBar, id: _ScaffoldSlot.bottomNavigationBar,
child: config.bottomNavigationBar, child: widget.bottomNavigationBar,
)); ));
} }
...@@ -848,7 +848,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin { ...@@ -848,7 +848,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
children.add(new LayoutId( children.add(new LayoutId(
id: _ScaffoldSlot.floatingActionButton, id: _ScaffoldSlot.floatingActionButton,
child: new _FloatingActionButtonTransition( child: new _FloatingActionButtonTransition(
child: config.floatingActionButton, child: widget.floatingActionButton,
) )
)); ));
...@@ -862,13 +862,13 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin { ...@@ -862,13 +862,13 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
)); ));
} }
if (config.drawer != null) { if (widget.drawer != null) {
assert(hasDrawer); assert(hasDrawer);
children.add(new LayoutId( children.add(new LayoutId(
id: _ScaffoldSlot.drawer, id: _ScaffoldSlot.drawer,
child: new DrawerController( child: new DrawerController(
key: _drawerKey, key: _drawerKey,
child: config.drawer, child: widget.drawer,
) )
)); ));
} else if (_shouldHandleBackGesture()) { } else if (_shouldHandleBackGesture()) {
...@@ -897,7 +897,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin { ...@@ -897,7 +897,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
child: new PrimaryScrollController( child: new PrimaryScrollController(
controller: _primaryScrollController, controller: _primaryScrollController,
child: new Material( child: new Material(
color: config.backgroundColor ?? themeData.scaffoldBackgroundColor, color: widget.backgroundColor ?? themeData.scaffoldBackgroundColor,
child: new CustomMultiChildLayout( child: new CustomMultiChildLayout(
children: children, children: children,
delegate: new _ScaffoldLayout( delegate: new _ScaffoldLayout(
...@@ -955,48 +955,48 @@ class _PersistentBottomSheetState extends State<_PersistentBottomSheet> { ...@@ -955,48 +955,48 @@ class _PersistentBottomSheetState extends State<_PersistentBottomSheet> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
assert(config.animationController.status == AnimationStatus.forward); assert(widget.animationController.status == AnimationStatus.forward);
config.animationController.addStatusListener(_handleStatusChange); widget.animationController.addStatusListener(_handleStatusChange);
} }
@override @override
void didUpdateConfig(_PersistentBottomSheet oldConfig) { void didUpdateWidget(_PersistentBottomSheet oldWidget) {
super.didUpdateConfig(oldConfig); super.didUpdateWidget(oldWidget);
assert(config.animationController == oldConfig.animationController); assert(widget.animationController == oldWidget.animationController);
} }
@override @override
void dispose() { void dispose() {
config.animationController.stop(); widget.animationController.stop();
super.dispose(); super.dispose();
} }
void close() { void close() {
config.animationController.reverse(); widget.animationController.reverse();
} }
void _handleStatusChange(AnimationStatus status) { void _handleStatusChange(AnimationStatus status) {
if (status == AnimationStatus.dismissed && config.onDismissed != null) if (status == AnimationStatus.dismissed && widget.onDismissed != null)
config.onDismissed(); widget.onDismissed();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new AnimatedBuilder( return new AnimatedBuilder(
animation: config.animationController, animation: widget.animationController,
builder: (BuildContext context, Widget child) { builder: (BuildContext context, Widget child) {
return new Align( return new Align(
alignment: FractionalOffset.topLeft, alignment: FractionalOffset.topLeft,
heightFactor: config.animationController.value, heightFactor: widget.animationController.value,
child: child child: child
); );
}, },
child: new Semantics( child: new Semantics(
container: true, container: true,
child: new BottomSheet( child: new BottomSheet(
animationController: config.animationController, animationController: widget.animationController,
onClosing: config.onClosing, onClosing: widget.onClosing,
builder: config.builder builder: widget.builder
) )
) )
); );
......
...@@ -75,7 +75,7 @@ class _ScrollbarState extends State<Scrollbar> with TickerProviderStateMixin { ...@@ -75,7 +75,7 @@ class _ScrollbarState extends State<Scrollbar> with TickerProviderStateMixin {
child: new CustomPaint( child: new CustomPaint(
foregroundPainter: new _ScrollbarPainter(_controller), foregroundPainter: new _ScrollbarPainter(_controller),
child: new RepaintBoundary( child: new RepaintBoundary(
child: config.child, child: widget.child,
), ),
), ),
), ),
......
...@@ -155,8 +155,8 @@ class Slider extends StatefulWidget { ...@@ -155,8 +155,8 @@ class Slider extends StatefulWidget {
class _SliderState extends State<Slider> with TickerProviderStateMixin { class _SliderState extends State<Slider> with TickerProviderStateMixin {
void _handleChanged(double value) { void _handleChanged(double value) {
assert(config.onChanged != null); assert(widget.onChanged != null);
config.onChanged(value * (config.max - config.min) + config.min); widget.onChanged(value * (widget.max - widget.min) + widget.min);
} }
@override @override
...@@ -164,13 +164,13 @@ class _SliderState extends State<Slider> with TickerProviderStateMixin { ...@@ -164,13 +164,13 @@ class _SliderState extends State<Slider> with TickerProviderStateMixin {
assert(debugCheckHasMaterial(context)); assert(debugCheckHasMaterial(context));
final ThemeData theme = Theme.of(context); final ThemeData theme = Theme.of(context);
return new _SliderRenderObjectWidget( return new _SliderRenderObjectWidget(
value: (config.value - config.min) / (config.max - config.min), value: (widget.value - widget.min) / (widget.max - widget.min),
divisions: config.divisions, divisions: widget.divisions,
label: config.label, label: widget.label,
activeColor: config.activeColor ?? theme.accentColor, activeColor: widget.activeColor ?? theme.accentColor,
thumbOpenAtMin: config.thumbOpenAtMin, thumbOpenAtMin: widget.thumbOpenAtMin,
textTheme: theme.accentTextTheme, textTheme: theme.accentTextTheme,
onChanged: config.onChanged != null ? _handleChanged : null, onChanged: widget.onChanged != null ? _handleChanged : null,
vsync: this, vsync: this,
); );
} }
......
...@@ -110,7 +110,7 @@ class _SnackBarActionState extends State<SnackBarAction> { ...@@ -110,7 +110,7 @@ class _SnackBarActionState extends State<SnackBarAction> {
setState(() { setState(() {
_haveTriggeredAction = true; _haveTriggeredAction = true;
}); });
config.onPressed(); widget.onPressed();
Scaffold.of(context).hideCurrentSnackBar(reason: SnackBarClosedReason.action); Scaffold.of(context).hideCurrentSnackBar(reason: SnackBarClosedReason.action);
} }
...@@ -118,7 +118,7 @@ class _SnackBarActionState extends State<SnackBarAction> { ...@@ -118,7 +118,7 @@ class _SnackBarActionState extends State<SnackBarAction> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new FlatButton( return new FlatButton(
onPressed: _haveTriggeredAction ? null : _handlePressed, onPressed: _haveTriggeredAction ? null : _handlePressed,
child: new Text(config.label) child: new Text(widget.label)
); );
} }
} }
......
...@@ -108,12 +108,12 @@ class _SwitchState extends State<Switch> with TickerProviderStateMixin { ...@@ -108,12 +108,12 @@ class _SwitchState extends State<Switch> with TickerProviderStateMixin {
final ThemeData themeData = Theme.of(context); final ThemeData themeData = Theme.of(context);
final bool isDark = themeData.brightness == Brightness.dark; final bool isDark = themeData.brightness == Brightness.dark;
final Color activeThumbColor = config.activeColor ?? themeData.accentColor; final Color activeThumbColor = widget.activeColor ?? themeData.accentColor;
final Color activeTrackColor = activeThumbColor.withAlpha(0x80); final Color activeTrackColor = activeThumbColor.withAlpha(0x80);
Color inactiveThumbColor; Color inactiveThumbColor;
Color inactiveTrackColor; Color inactiveTrackColor;
if (config.onChanged != null) { if (widget.onChanged != null) {
inactiveThumbColor = isDark ? Colors.grey.shade400 : Colors.grey.shade50; inactiveThumbColor = isDark ? Colors.grey.shade400 : Colors.grey.shade50;
inactiveTrackColor = isDark ? Colors.white30 : Colors.black26; inactiveTrackColor = isDark ? Colors.white30 : Colors.black26;
} else { } else {
...@@ -122,15 +122,15 @@ class _SwitchState extends State<Switch> with TickerProviderStateMixin { ...@@ -122,15 +122,15 @@ class _SwitchState extends State<Switch> with TickerProviderStateMixin {
} }
return new _SwitchRenderObjectWidget( return new _SwitchRenderObjectWidget(
value: config.value, value: widget.value,
activeColor: activeThumbColor, activeColor: activeThumbColor,
inactiveColor: inactiveThumbColor, inactiveColor: inactiveThumbColor,
activeThumbImage: config.activeThumbImage, activeThumbImage: widget.activeThumbImage,
inactiveThumbImage: config.inactiveThumbImage, inactiveThumbImage: widget.inactiveThumbImage,
activeTrackColor: activeTrackColor, activeTrackColor: activeTrackColor,
inactiveTrackColor: inactiveTrackColor, inactiveTrackColor: inactiveTrackColor,
configuration: createLocalImageConfiguration(context), configuration: createLocalImageConfiguration(context),
onChanged: config.onChanged, onChanged: widget.onChanged,
vsync: this, vsync: this,
); );
} }
......
...@@ -265,8 +265,8 @@ class _DefaultTabControllerState extends State<DefaultTabController> with Single ...@@ -265,8 +265,8 @@ class _DefaultTabControllerState extends State<DefaultTabController> with Single
super.initState(); super.initState();
_controller = new TabController( _controller = new TabController(
vsync: this, vsync: this,
length: config.length, length: widget.length,
initialIndex: config.initialIndex, initialIndex: widget.initialIndex,
); );
} }
...@@ -281,7 +281,7 @@ class _DefaultTabControllerState extends State<DefaultTabController> with Single ...@@ -281,7 +281,7 @@ class _DefaultTabControllerState extends State<DefaultTabController> with Single
return new _TabControllerScope( return new _TabControllerScope(
controller: _controller, controller: _controller,
enabled: TickerMode.of(context), enabled: TickerMode.of(context),
child: config.child, child: widget.child,
); );
} }
} }
...@@ -423,9 +423,9 @@ class TabBar extends StatefulWidget implements AppBarBottomWidget { ...@@ -423,9 +423,9 @@ class TabBar extends StatefulWidget implements AppBarBottomWidget {
@override @override
double get bottomHeight { double get bottomHeight {
for (Widget widget in tabs) { for (Widget item in tabs) {
if (widget is Tab) { if (item is Tab) {
final Tab tab = widget; final Tab tab = item;
if (tab.text != null && tab.icon != null) if (tab.text != null && tab.icon != null)
return _kTextAndIconTabHeight + _kTabIndicatorHeight; return _kTextAndIconTabHeight + _kTabIndicatorHeight;
} }
...@@ -445,14 +445,14 @@ class _TabBarState extends State<TabBar> { ...@@ -445,14 +445,14 @@ class _TabBarState extends State<TabBar> {
int _currentIndex; int _currentIndex;
void _updateTabController() { void _updateTabController() {
final TabController newController = config.controller ?? DefaultTabController.of(context); final TabController newController = widget.controller ?? DefaultTabController.of(context);
assert(() { assert(() {
if (newController == null) { if (newController == null) {
throw new FlutterError( throw new FlutterError(
'No TabController for ${config.runtimeType}.\n' 'No TabController for ${widget.runtimeType}.\n'
'When creating a ${config.runtimeType}, you must either provide an explicit ' 'When creating a ${widget.runtimeType}, you must either provide an explicit '
'TabController using the "controller" property, or you must ensure that there ' 'TabController using the "controller" property, or you must ensure that there '
'is a DefaultTabController above the ${config.runtimeType}.\n' 'is a DefaultTabController above the ${widget.runtimeType}.\n'
'In this case, there was neither an explicit controller nor a default controller.' 'In this case, there was neither an explicit controller nor a default controller.'
); );
} }
...@@ -482,9 +482,9 @@ class _TabBarState extends State<TabBar> { ...@@ -482,9 +482,9 @@ class _TabBarState extends State<TabBar> {
} }
@override @override
void didUpdateConfig(TabBar oldConfig) { void didUpdateWidget(TabBar oldWidget) {
super.didUpdateConfig(oldConfig); super.didUpdateWidget(oldWidget);
if (config.controller != oldConfig.controller) if (widget.controller != oldWidget.controller)
_updateTabController(); _updateTabController();
} }
...@@ -541,7 +541,7 @@ class _TabBarState extends State<TabBar> { ...@@ -541,7 +541,7 @@ class _TabBarState extends State<TabBar> {
void _handleTabControllerAnimationTick() { void _handleTabControllerAnimationTick() {
assert(mounted); assert(mounted);
if (!_controller.indexIsChanging && config.isScrollable) { if (!_controller.indexIsChanging && widget.isScrollable) {
// Sync the TabBar's scroll position with the TabBarView's PageView. // Sync the TabBar's scroll position with the TabBarView's PageView.
_currentIndex = _controller.index; _currentIndex = _controller.index;
_scrollToControllerValue(); _scrollToControllerValue();
...@@ -560,7 +560,7 @@ class _TabBarState extends State<TabBar> { ...@@ -560,7 +560,7 @@ class _TabBarState extends State<TabBar> {
} }
void _handleTap(int index) { void _handleTap(int index) {
assert(index >= 0 && index < config.tabs.length); assert(index >= 0 && index < widget.tabs.length);
_controller.animateTo(index); _controller.animateTo(index);
} }
...@@ -568,23 +568,23 @@ class _TabBarState extends State<TabBar> { ...@@ -568,23 +568,23 @@ class _TabBarState extends State<TabBar> {
return new _TabStyle( return new _TabStyle(
animation: animation, animation: animation,
selected: selected, selected: selected,
labelColor: config.labelColor, labelColor: widget.labelColor,
unselectedLabelColor: config.unselectedLabelColor, unselectedLabelColor: widget.unselectedLabelColor,
labelStyle: config.labelStyle, labelStyle: widget.labelStyle,
unselectedLabelStyle: config.unselectedLabelStyle, unselectedLabelStyle: widget.unselectedLabelStyle,
child: child, child: child,
); );
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final List<Widget> wrappedTabs = new List<Widget>.from(config.tabs, growable: false); final List<Widget> wrappedTabs = new List<Widget>.from(widget.tabs, growable: false);
// If the controller was provided by DefaultTabController and we're part // If the controller was provided by DefaultTabController and we're part
// of a Hero (typically the AppBar), then we will not be able to find the // of a Hero (typically the AppBar), then we will not be able to find the
// controller during a Hero transition. See https://github.com/flutter/flutter/issues/213. // controller during a Hero transition. See https://github.com/flutter/flutter/issues/213.
if (_controller != null) { if (_controller != null) {
_indicatorPainter.color = config.indicatorColor ?? Theme.of(context).indicatorColor; _indicatorPainter.color = widget.indicatorColor ?? Theme.of(context).indicatorColor;
if (_indicatorPainter.color == Material.of(context).color) { if (_indicatorPainter.color == Material.of(context).color) {
// ThemeData tries to avoid this by having indicatorColor avoid being the // ThemeData tries to avoid this by having indicatorColor avoid being the
// primaryColor. However, it's possible that the tab bar is on a // primaryColor. However, it's possible that the tab bar is on a
...@@ -598,7 +598,7 @@ class _TabBarState extends State<TabBar> { ...@@ -598,7 +598,7 @@ class _TabBarState extends State<TabBar> {
if (_controller.index != _currentIndex) { if (_controller.index != _currentIndex) {
_currentIndex = _controller.index; _currentIndex = _controller.index;
if (config.isScrollable) if (widget.isScrollable)
_scrollToCurrentIndex(); _scrollToCurrentIndex();
} }
...@@ -620,7 +620,7 @@ class _TabBarState extends State<TabBar> { ...@@ -620,7 +620,7 @@ class _TabBarState extends State<TabBar> {
final Animation<double> leftAnimation = new _DragAnimation(_controller, tabIndex); final Animation<double> leftAnimation = new _DragAnimation(_controller, tabIndex);
wrappedTabs[tabIndex] = _buildStyledTab(wrappedTabs[tabIndex], true, leftAnimation); wrappedTabs[tabIndex] = _buildStyledTab(wrappedTabs[tabIndex], true, leftAnimation);
} }
if (_currentIndex < config.tabs.length - 1) { if (_currentIndex < widget.tabs.length - 1) {
final int tabIndex = _currentIndex + 1; final int tabIndex = _currentIndex + 1;
final Animation<double> rightAnimation = new _DragAnimation(_controller, tabIndex); final Animation<double> rightAnimation = new _DragAnimation(_controller, tabIndex);
wrappedTabs[tabIndex] = _buildStyledTab(wrappedTabs[tabIndex], true, rightAnimation); wrappedTabs[tabIndex] = _buildStyledTab(wrappedTabs[tabIndex], true, rightAnimation);
...@@ -631,12 +631,12 @@ class _TabBarState extends State<TabBar> { ...@@ -631,12 +631,12 @@ class _TabBarState extends State<TabBar> {
// Add the tap handler to each tab. If the tab bar is scrollable // Add the tap handler to each tab. If the tab bar is scrollable
// then give all of the tabs equal flexibility so that their widths // then give all of the tabs equal flexibility so that their widths
// reflect the intrinsic width of their labels. // reflect the intrinsic width of their labels.
for (int index = 0; index < config.tabs.length; index++) { for (int index = 0; index < widget.tabs.length; index++) {
wrappedTabs[index] = new InkWell( wrappedTabs[index] = new InkWell(
onTap: () { _handleTap(index); }, onTap: () { _handleTap(index); },
child: wrappedTabs[index], child: wrappedTabs[index],
); );
if (!config.isScrollable) if (!widget.isScrollable)
wrappedTabs[index] = new Expanded(child: wrappedTabs[index]); wrappedTabs[index] = new Expanded(child: wrappedTabs[index]);
} }
...@@ -647,10 +647,10 @@ class _TabBarState extends State<TabBar> { ...@@ -647,10 +647,10 @@ class _TabBarState extends State<TabBar> {
child: new _TabStyle( child: new _TabStyle(
animation: kAlwaysDismissedAnimation, animation: kAlwaysDismissedAnimation,
selected: false, selected: false,
labelColor: config.labelColor, labelColor: widget.labelColor,
unselectedLabelColor: config.unselectedLabelColor, unselectedLabelColor: widget.unselectedLabelColor,
labelStyle: config.labelStyle, labelStyle: widget.labelStyle,
unselectedLabelStyle: config.unselectedLabelStyle, unselectedLabelStyle: widget.unselectedLabelStyle,
child: new _TabLabelBar( child: new _TabLabelBar(
onPerformLayout: _saveTabOffsets, onPerformLayout: _saveTabOffsets,
children: wrappedTabs, children: wrappedTabs,
...@@ -659,7 +659,7 @@ class _TabBarState extends State<TabBar> { ...@@ -659,7 +659,7 @@ class _TabBarState extends State<TabBar> {
), ),
); );
if (config.isScrollable) { if (widget.isScrollable) {
tabBar = new SingleChildScrollView( tabBar = new SingleChildScrollView(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
controller: _scrollController, controller: _scrollController,
...@@ -711,14 +711,14 @@ class _TabBarViewState extends State<TabBarView> { ...@@ -711,14 +711,14 @@ class _TabBarViewState extends State<TabBarView> {
int _warpUnderwayCount = 0; int _warpUnderwayCount = 0;
void _updateTabController() { void _updateTabController() {
final TabController newController = config.controller ?? DefaultTabController.of(context); final TabController newController = widget.controller ?? DefaultTabController.of(context);
assert(() { assert(() {
if (newController == null) { if (newController == null) {
throw new FlutterError( throw new FlutterError(
'No TabController for ${config.runtimeType}.\n' 'No TabController for ${widget.runtimeType}.\n'
'When creating a ${config.runtimeType}, you must either provide an explicit ' 'When creating a ${widget.runtimeType}, you must either provide an explicit '
'TabController using the "controller" property, or you must ensure that there ' 'TabController using the "controller" property, or you must ensure that there '
'is a DefaultTabController above the ${config.runtimeType}.\n' 'is a DefaultTabController above the ${widget.runtimeType}.\n'
'In this case, there was neither an explicit controller nor a default controller.' 'In this case, there was neither an explicit controller nor a default controller.'
); );
} }
...@@ -737,7 +737,7 @@ class _TabBarViewState extends State<TabBarView> { ...@@ -737,7 +737,7 @@ class _TabBarViewState extends State<TabBarView> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_children = config.children; _children = widget.children;
} }
@override @override
...@@ -749,12 +749,12 @@ class _TabBarViewState extends State<TabBarView> { ...@@ -749,12 +749,12 @@ class _TabBarViewState extends State<TabBarView> {
} }
@override @override
void didUpdateConfig(TabBarView oldConfig) { void didUpdateWidget(TabBarView oldWidget) {
super.didUpdateConfig(oldConfig); super.didUpdateWidget(oldWidget);
if (config.controller != oldConfig.controller) if (widget.controller != oldWidget.controller)
_updateTabController(); _updateTabController();
if (config.children != oldConfig.children && _warpUnderwayCount == 0) if (widget.children != oldWidget.children && _warpUnderwayCount == 0)
_children = config.children; _children = widget.children;
} }
@override @override
...@@ -790,7 +790,7 @@ class _TabBarViewState extends State<TabBarView> { ...@@ -790,7 +790,7 @@ class _TabBarViewState extends State<TabBarView> {
int initialPage; int initialPage;
setState(() { setState(() {
_warpUnderwayCount += 1; _warpUnderwayCount += 1;
_children = new List<Widget>.from(config.children, growable: false); _children = new List<Widget>.from(widget.children, growable: false);
if (_currentIndex > previousIndex) { if (_currentIndex > previousIndex) {
_children[_currentIndex - 1] = _children[previousIndex]; _children[_currentIndex - 1] = _children[previousIndex];
initialPage = _currentIndex - 1; initialPage = _currentIndex - 1;
...@@ -808,7 +808,7 @@ class _TabBarViewState extends State<TabBarView> { ...@@ -808,7 +808,7 @@ class _TabBarViewState extends State<TabBarView> {
setState(() { setState(() {
_warpUnderwayCount -= 1; _warpUnderwayCount -= 1;
_children = config.children; _children = widget.children;
}); });
} }
......
...@@ -169,23 +169,23 @@ class _TextFieldState extends State<TextField> { ...@@ -169,23 +169,23 @@ class _TextFieldState extends State<TextField> {
final GlobalKey<EditableTextState> _editableTextKey = new GlobalKey<EditableTextState>(); final GlobalKey<EditableTextState> _editableTextKey = new GlobalKey<EditableTextState>();
TextEditingController _controller; TextEditingController _controller;
TextEditingController get _effectiveController => config.controller ?? _controller; TextEditingController get _effectiveController => widget.controller ?? _controller;
FocusNode _focusNode; FocusNode _focusNode;
FocusNode get _effectiveFocusNode => config.focusNode ?? (_focusNode ??= new FocusNode()); FocusNode get _effectiveFocusNode => widget.focusNode ?? (_focusNode ??= new FocusNode());
@override @override
void initState() { void initState() {
super.initState(); super.initState();
if (config.controller == null) if (widget.controller == null)
_controller = new TextEditingController(); _controller = new TextEditingController();
} }
@override @override
void didUpdateConfig(TextField oldConfig) { void didUpdateWidget(TextField oldWidget) {
if (config.controller == null && oldConfig.controller != null) if (widget.controller == null && oldWidget.controller != null)
_controller == new TextEditingController.fromValue(oldConfig.controller.value); _controller == new TextEditingController.fromValue(oldWidget.controller.value);
else if (config.controller != null && oldConfig.controller == null) else if (widget.controller != null && oldWidget.controller == null)
_controller = null; _controller = null;
} }
...@@ -202,7 +202,7 @@ class _TextFieldState extends State<TextField> { ...@@ -202,7 +202,7 @@ class _TextFieldState extends State<TextField> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final ThemeData themeData = Theme.of(context); final ThemeData themeData = Theme.of(context);
final TextStyle style = config.style ?? themeData.textTheme.subhead; final TextStyle style = widget.style ?? themeData.textTheme.subhead;
final TextEditingController controller = _effectiveController; final TextEditingController controller = _effectiveController;
final FocusNode focusNode = _effectiveFocusNode; final FocusNode focusNode = _effectiveFocusNode;
...@@ -211,28 +211,28 @@ class _TextFieldState extends State<TextField> { ...@@ -211,28 +211,28 @@ class _TextFieldState extends State<TextField> {
key: _editableTextKey, key: _editableTextKey,
controller: controller, controller: controller,
focusNode: focusNode, focusNode: focusNode,
keyboardType: config.keyboardType, keyboardType: widget.keyboardType,
style: style, style: style,
textAlign: config.textAlign, textAlign: widget.textAlign,
autofocus: config.autofocus, autofocus: widget.autofocus,
obscureText: config.obscureText, obscureText: widget.obscureText,
maxLines: config.maxLines, maxLines: widget.maxLines,
cursorColor: themeData.textSelectionColor, cursorColor: themeData.textSelectionColor,
selectionColor: themeData.textSelectionColor, selectionColor: themeData.textSelectionColor,
selectionControls: materialTextSelectionControls, selectionControls: materialTextSelectionControls,
onChanged: config.onChanged, onChanged: widget.onChanged,
onSubmitted: config.onSubmitted, onSubmitted: widget.onSubmitted,
), ),
); );
if (config.decoration != null) { if (widget.decoration != null) {
child = new AnimatedBuilder( child = new AnimatedBuilder(
animation: new Listenable.merge(<Listenable>[ focusNode, controller ]), animation: new Listenable.merge(<Listenable>[ focusNode, controller ]),
builder: (BuildContext context, Widget child) { builder: (BuildContext context, Widget child) {
return new InputDecorator( return new InputDecorator(
decoration: config.decoration, decoration: widget.decoration,
baseStyle: config.style, baseStyle: widget.style,
textAlign: config.textAlign, textAlign: widget.textAlign,
isFocused: focusNode.hasFocus, isFocused: focusNode.hasFocus,
isEmpty: controller.value.text.isEmpty, isEmpty: controller.value.text.isEmpty,
child: child, child: child,
......
...@@ -185,15 +185,15 @@ class _AnimatedThemeState extends AnimatedWidgetBaseState<AnimatedTheme> { ...@@ -185,15 +185,15 @@ class _AnimatedThemeState extends AnimatedWidgetBaseState<AnimatedTheme> {
@override @override
void forEachTween(TweenVisitor<dynamic> visitor) { void forEachTween(TweenVisitor<dynamic> visitor) {
// TODO(ianh): Use constructor tear-offs when it becomes possible // TODO(ianh): Use constructor tear-offs when it becomes possible
_data = visitor(_data, config.data, (dynamic value) => new ThemeDataTween(begin: value)); _data = visitor(_data, widget.data, (dynamic value) => new ThemeDataTween(begin: value));
assert(_data != null); assert(_data != null);
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Theme( return new Theme(
isMaterialAppTheme: config.isMaterialAppTheme, isMaterialAppTheme: widget.isMaterialAppTheme,
child: config.child, child: widget.child,
data: _data.evaluate(animation) data: _data.evaluate(animation)
); );
} }
......
...@@ -470,7 +470,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin { ...@@ -470,7 +470,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin {
duration: _kDialAnimateDuration, duration: _kDialAnimateDuration,
vsync: this, vsync: this,
); );
_thetaTween = new Tween<double>(begin: _getThetaForTime(config.selectedTime)); _thetaTween = new Tween<double>(begin: _getThetaForTime(widget.selectedTime));
_theta = _thetaTween.animate(new CurvedAnimation( _theta = _thetaTween.animate(new CurvedAnimation(
parent: _thetaController, parent: _thetaController,
curve: Curves.fastOutSlowIn curve: Curves.fastOutSlowIn
...@@ -478,9 +478,9 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin { ...@@ -478,9 +478,9 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin {
} }
@override @override
void didUpdateConfig(_Dial oldConfig) { void didUpdateWidget(_Dial oldWidget) {
if (config.mode != oldConfig.mode && !_dragging) if (widget.mode != oldWidget.mode && !_dragging)
_animateTo(_getThetaForTime(config.selectedTime)); _animateTo(_getThetaForTime(widget.selectedTime));
} }
@override @override
...@@ -511,7 +511,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin { ...@@ -511,7 +511,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin {
} }
double _getThetaForTime(TimeOfDay time) { double _getThetaForTime(TimeOfDay time) {
final double fraction = (config.mode == _TimePickerMode.hour) ? final double fraction = (widget.mode == _TimePickerMode.hour) ?
(time.hour / _kHoursPerPeriod) % _kHoursPerPeriod : (time.hour / _kHoursPerPeriod) % _kHoursPerPeriod :
(time.minute / _kMinutesPerHour) % _kMinutesPerHour; (time.minute / _kMinutesPerHour) % _kMinutesPerHour;
return (math.PI / 2.0 - fraction * _kTwoPi) % _kTwoPi; return (math.PI / 2.0 - fraction * _kTwoPi) % _kTwoPi;
...@@ -519,24 +519,24 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin { ...@@ -519,24 +519,24 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin {
TimeOfDay _getTimeForTheta(double theta) { TimeOfDay _getTimeForTheta(double theta) {
final double fraction = (0.25 - (theta % _kTwoPi) / _kTwoPi) % 1.0; final double fraction = (0.25 - (theta % _kTwoPi) / _kTwoPi) % 1.0;
if (config.mode == _TimePickerMode.hour) { if (widget.mode == _TimePickerMode.hour) {
final int hourOfPeriod = (fraction * _kHoursPerPeriod).round() % _kHoursPerPeriod; final int hourOfPeriod = (fraction * _kHoursPerPeriod).round() % _kHoursPerPeriod;
return config.selectedTime.replacing( return widget.selectedTime.replacing(
hour: hourOfPeriod + config.selectedTime.periodOffset hour: hourOfPeriod + widget.selectedTime.periodOffset
); );
} else { } else {
return config.selectedTime.replacing( return widget.selectedTime.replacing(
minute: (fraction * _kMinutesPerHour).round() % _kMinutesPerHour minute: (fraction * _kMinutesPerHour).round() % _kMinutesPerHour
); );
} }
} }
void _notifyOnChangedIfNeeded() { void _notifyOnChangedIfNeeded() {
if (config.onChanged == null) if (widget.onChanged == null)
return; return;
final TimeOfDay current = _getTimeForTheta(_theta.value); final TimeOfDay current = _getTimeForTheta(_theta.value);
if (current != config.selectedTime) if (current != widget.selectedTime)
config.onChanged(current); widget.onChanged(current);
} }
void _updateThetaForPan() { void _updateThetaForPan() {
...@@ -573,7 +573,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin { ...@@ -573,7 +573,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin {
_dragging = false; _dragging = false;
_position = null; _position = null;
_center = null; _center = null;
_animateTo(_getThetaForTime(config.selectedTime)); _animateTo(_getThetaForTime(widget.selectedTime));
} }
@override @override
...@@ -593,7 +593,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin { ...@@ -593,7 +593,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin {
final ThemeData theme = Theme.of(context); final ThemeData theme = Theme.of(context);
List<TextPainter> primaryLabels; List<TextPainter> primaryLabels;
List<TextPainter> secondaryLabels; List<TextPainter> secondaryLabels;
switch (config.mode) { switch (widget.mode) {
case _TimePickerMode.hour: case _TimePickerMode.hour:
primaryLabels = _initHours(theme.textTheme); primaryLabels = _initHours(theme.textTheme);
secondaryLabels = _initHours(theme.accentTextTheme); secondaryLabels = _initHours(theme.accentTextTheme);
...@@ -640,7 +640,7 @@ class _TimePickerDialogState extends State<_TimePickerDialog> { ...@@ -640,7 +640,7 @@ class _TimePickerDialogState extends State<_TimePickerDialog> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_selectedTime = config.initialTime; _selectedTime = widget.initialTime;
} }
_TimePickerMode _mode = _TimePickerMode.hour; _TimePickerMode _mode = _TimePickerMode.hour;
......
...@@ -124,19 +124,19 @@ class _TooltipState extends State<Tooltip> with SingleTickerProviderStateMixin { ...@@ -124,19 +124,19 @@ class _TooltipState extends State<Tooltip> with SingleTickerProviderStateMixin {
// updated values from happening to leak into the overlay when the overlay // updated values from happening to leak into the overlay when the overlay
// rebuilds. // rebuilds.
final Widget overlay = new _TooltipOverlay( final Widget overlay = new _TooltipOverlay(
message: config.message, message: widget.message,
height: config.height, height: widget.height,
padding: config.padding, padding: widget.padding,
animation: new CurvedAnimation( animation: new CurvedAnimation(
parent: _controller, parent: _controller,
curve: Curves.fastOutSlowIn curve: Curves.fastOutSlowIn
), ),
target: target, target: target,
verticalOffset: config.verticalOffset, verticalOffset: widget.verticalOffset,
preferBelow: config.preferBelow preferBelow: widget.preferBelow
); );
_entry = new OverlayEntry(builder: (BuildContext context) => overlay); _entry = new OverlayEntry(builder: (BuildContext context) => overlay);
Overlay.of(context, debugRequiredFor: config).insert(_entry); Overlay.of(context, debugRequiredFor: widget).insert(_entry);
GestureBinding.instance.pointerRouter.addGlobalRoute(_handlePointerEvent); GestureBinding.instance.pointerRouter.addGlobalRoute(_handlePointerEvent);
_controller.forward(); _controller.forward();
} }
...@@ -175,14 +175,14 @@ class _TooltipState extends State<Tooltip> with SingleTickerProviderStateMixin { ...@@ -175,14 +175,14 @@ class _TooltipState extends State<Tooltip> with SingleTickerProviderStateMixin {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
assert(Overlay.of(context, debugRequiredFor: config) != null); assert(Overlay.of(context, debugRequiredFor: widget) != null);
return new GestureDetector( return new GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onLongPress: ensureTooltipVisible, onLongPress: ensureTooltipVisible,
excludeFromSemantics: true, excludeFromSemantics: true,
child: new Semantics( child: new Semantics(
label: config.message, label: widget.message,
child: config.child, child: widget.child,
) )
); );
} }
......
...@@ -186,8 +186,8 @@ class _TwoLevelSublistState extends State<TwoLevelSublist> with SingleTickerProv ...@@ -186,8 +186,8 @@ class _TwoLevelSublistState extends State<TwoLevelSublist> with SingleTickerProv
_controller.reverse(); _controller.reverse();
PageStorage.of(context)?.writeState(context, _isExpanded); PageStorage.of(context)?.writeState(context, _isExpanded);
}); });
if (config.onOpenChanged != null) if (widget.onOpenChanged != null)
config.onOpenChanged(_isExpanded); widget.onOpenChanged(_isExpanded);
} }
Widget buildList(BuildContext context, Widget child) { Widget buildList(BuildContext context, Widget child) {
...@@ -206,10 +206,10 @@ class _TwoLevelSublistState extends State<TwoLevelSublist> with SingleTickerProv ...@@ -206,10 +206,10 @@ class _TwoLevelSublistState extends State<TwoLevelSublist> with SingleTickerProv
data: new IconThemeData(color: _iconColor.evaluate(_easeInAnimation)), data: new IconThemeData(color: _iconColor.evaluate(_easeInAnimation)),
child: new TwoLevelListItem( child: new TwoLevelListItem(
onTap: _handleOnTap, onTap: _handleOnTap,
leading: config.leading, leading: widget.leading,
title: new DefaultTextStyle( title: new DefaultTextStyle(
style: Theme.of(context).textTheme.subhead.copyWith(color: _headerColor.evaluate(_easeInAnimation)), style: Theme.of(context).textTheme.subhead.copyWith(color: _headerColor.evaluate(_easeInAnimation)),
child: config.title child: widget.title
), ),
trailing: new RotationTransition( trailing: new RotationTransition(
turns: _iconTurns, turns: _iconTurns,
...@@ -220,7 +220,7 @@ class _TwoLevelSublistState extends State<TwoLevelSublist> with SingleTickerProv ...@@ -220,7 +220,7 @@ class _TwoLevelSublistState extends State<TwoLevelSublist> with SingleTickerProv
new ClipRect( new ClipRect(
child: new Align( child: new Align(
heightFactor: _easeInAnimation.value, heightFactor: _easeInAnimation.value,
child: new Column(children: config.children) child: new Column(children: widget.children)
) )
) )
] ]
...@@ -240,7 +240,7 @@ class _TwoLevelSublistState extends State<TwoLevelSublist> with SingleTickerProv ...@@ -240,7 +240,7 @@ class _TwoLevelSublistState extends State<TwoLevelSublist> with SingleTickerProv
..end = theme.accentColor; ..end = theme.accentColor;
_backgroundColor _backgroundColor
..begin = Colors.transparent ..begin = Colors.transparent
..end = config.backgroundColor ?? Colors.transparent; ..end = widget.backgroundColor ?? Colors.transparent;
return new AnimatedBuilder( return new AnimatedBuilder(
animation: _controller.view, animation: _controller.view,
......
...@@ -182,28 +182,28 @@ class _UserAccountsDrawerHeaderState extends State<UserAccountsDrawerHeader> { ...@@ -182,28 +182,28 @@ class _UserAccountsDrawerHeaderState extends State<UserAccountsDrawerHeader> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
assert(debugCheckHasMaterial(context)); assert(debugCheckHasMaterial(context));
return new DrawerHeader( return new DrawerHeader(
decoration: config.decoration ?? new BoxDecoration( decoration: widget.decoration ?? new BoxDecoration(
backgroundColor: Theme.of(context).primaryColor, backgroundColor: Theme.of(context).primaryColor,
), ),
margin: config.margin, margin: widget.margin,
child: new Column( child: new Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[ children: <Widget>[
new Expanded( new Expanded(
child: new _AccountPictures( child: new _AccountPictures(
currentAccountPicture: config.currentAccountPicture, currentAccountPicture: widget.currentAccountPicture,
otherAccountsPictures: config.otherAccountsPictures, otherAccountsPictures: widget.otherAccountsPictures,
) )
), ),
new _AccountDetails( new _AccountDetails(
accountName: config.accountName, accountName: widget.accountName,
accountEmail: config.accountEmail, accountEmail: widget.accountEmail,
isOpen: _isOpen, isOpen: _isOpen,
onTap: config.onDetailsPressed == null ? null : () { onTap: widget.onDetailsPressed == null ? null : () {
setState(() { setState(() {
_isOpen = !_isOpen; _isOpen = !_isOpen;
}); });
config.onDetailsPressed(); widget.onDetailsPressed();
}, },
), ),
], ],
......
...@@ -93,11 +93,11 @@ class _AnimatedCrossFadeState extends State<AnimatedCrossFade> with TickerProvid ...@@ -93,11 +93,11 @@ class _AnimatedCrossFadeState extends State<AnimatedCrossFade> with TickerProvid
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_controller = new AnimationController(duration: config.duration, vsync: this); _controller = new AnimationController(duration: widget.duration, vsync: this);
if (config.crossFadeState == CrossFadeState.showSecond) if (widget.crossFadeState == CrossFadeState.showSecond)
_controller.value = 1.0; _controller.value = 1.0;
_firstAnimation = _initAnimation(config.firstCurve, true); _firstAnimation = _initAnimation(widget.firstCurve, true);
_secondAnimation = _initAnimation(config.secondCurve, false); _secondAnimation = _initAnimation(widget.secondCurve, false);
} }
Animation<double> _initAnimation(Curve curve, bool inverted) { Animation<double> _initAnimation(Curve curve, bool inverted) {
...@@ -119,16 +119,16 @@ class _AnimatedCrossFadeState extends State<AnimatedCrossFade> with TickerProvid ...@@ -119,16 +119,16 @@ class _AnimatedCrossFadeState extends State<AnimatedCrossFade> with TickerProvid
} }
@override @override
void didUpdateConfig(AnimatedCrossFade oldConfig) { void didUpdateWidget(AnimatedCrossFade oldWidget) {
super.didUpdateConfig(oldConfig); super.didUpdateWidget(oldWidget);
if (config.duration != oldConfig.duration) if (widget.duration != oldWidget.duration)
_controller.duration = config.duration; _controller.duration = widget.duration;
if (config.firstCurve != oldConfig.firstCurve) if (widget.firstCurve != oldWidget.firstCurve)
_firstAnimation = _initAnimation(config.firstCurve, true); _firstAnimation = _initAnimation(widget.firstCurve, true);
if (config.secondCurve != oldConfig.secondCurve) if (widget.secondCurve != oldWidget.secondCurve)
_secondAnimation = _initAnimation(config.secondCurve, false); _secondAnimation = _initAnimation(widget.secondCurve, false);
if (config.crossFadeState != oldConfig.crossFadeState) { if (widget.crossFadeState != oldWidget.crossFadeState) {
switch (config.crossFadeState) { switch (widget.crossFadeState) {
case CrossFadeState.showFirst: case CrossFadeState.showFirst:
_controller.reverse(); _controller.reverse();
break; break;
...@@ -148,7 +148,7 @@ class _AnimatedCrossFadeState extends State<AnimatedCrossFade> with TickerProvid ...@@ -148,7 +148,7 @@ class _AnimatedCrossFadeState extends State<AnimatedCrossFade> with TickerProvid
children = <Widget>[ children = <Widget>[
new FadeTransition( new FadeTransition(
opacity: _secondAnimation, opacity: _secondAnimation,
child: config.secondChild child: widget.secondChild
), ),
new Positioned( new Positioned(
// TODO(dragostis): Add a way to crop from top right for // TODO(dragostis): Add a way to crop from top right for
...@@ -158,7 +158,7 @@ class _AnimatedCrossFadeState extends State<AnimatedCrossFade> with TickerProvid ...@@ -158,7 +158,7 @@ class _AnimatedCrossFadeState extends State<AnimatedCrossFade> with TickerProvid
right: 0.0, right: 0.0,
child: new FadeTransition( child: new FadeTransition(
opacity: _firstAnimation, opacity: _firstAnimation,
child: config.firstChild child: widget.firstChild
) )
) )
]; ];
...@@ -166,7 +166,7 @@ class _AnimatedCrossFadeState extends State<AnimatedCrossFade> with TickerProvid ...@@ -166,7 +166,7 @@ class _AnimatedCrossFadeState extends State<AnimatedCrossFade> with TickerProvid
children = <Widget>[ children = <Widget>[
new FadeTransition( new FadeTransition(
opacity: _firstAnimation, opacity: _firstAnimation,
child: config.firstChild child: widget.firstChild
), ),
new Positioned( new Positioned(
// TODO(dragostis): Add a way to crop from top right for // TODO(dragostis): Add a way to crop from top right for
...@@ -176,7 +176,7 @@ class _AnimatedCrossFadeState extends State<AnimatedCrossFade> with TickerProvid ...@@ -176,7 +176,7 @@ class _AnimatedCrossFadeState extends State<AnimatedCrossFade> with TickerProvid
right: 0.0, right: 0.0,
child: new FadeTransition( child: new FadeTransition(
opacity: _secondAnimation, opacity: _secondAnimation,
child: config.secondChild child: widget.secondChild
) )
) )
]; ];
...@@ -184,10 +184,10 @@ class _AnimatedCrossFadeState extends State<AnimatedCrossFade> with TickerProvid ...@@ -184,10 +184,10 @@ class _AnimatedCrossFadeState extends State<AnimatedCrossFade> with TickerProvid
return new ClipRect( return new ClipRect(
child: new AnimatedSize( child: new AnimatedSize(
key: new ValueKey<Key>(config.key), key: new ValueKey<Key>(widget.key),
alignment: FractionalOffset.topCenter, alignment: FractionalOffset.topCenter,
duration: config.duration, duration: widget.duration,
curve: config.sizeCurve, curve: widget.sizeCurve,
vsync: this, vsync: this,
child: new Stack( child: new Stack(
overflow: Overflow.visible, overflow: Overflow.visible,
......
...@@ -168,8 +168,8 @@ class _WidgetsAppState extends State<WidgetsApp> implements WidgetsBindingObserv ...@@ -168,8 +168,8 @@ class _WidgetsAppState extends State<WidgetsApp> implements WidgetsBindingObserv
@override @override
void didChangeLocale(Locale locale) { void didChangeLocale(Locale locale) {
if (config.onLocaleChanged != null) { if (widget.onLocaleChanged != null) {
config.onLocaleChanged(locale).then<Null>((LocaleQueryData data) { widget.onLocaleChanged(locale).then<Null>((LocaleQueryData data) {
if (mounted) if (mounted)
setState(() { _localeData = data; }); setState(() { _localeData = data; });
}); });
...@@ -184,7 +184,7 @@ class _WidgetsAppState extends State<WidgetsApp> implements WidgetsBindingObserv ...@@ -184,7 +184,7 @@ class _WidgetsAppState extends State<WidgetsApp> implements WidgetsBindingObserv
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (config.onLocaleChanged != null && _localeData == null) { if (widget.onLocaleChanged != null && _localeData == null) {
// If the app expects a locale but we don't yet know the locale, then // If the app expects a locale but we don't yet know the locale, then
// don't build the widgets now. // don't build the widgets now.
// TODO(ianh): Make this unnecessary. See https://github.com/flutter/flutter/issues/1865 // TODO(ianh): Make this unnecessary. See https://github.com/flutter/flutter/issues/1865
...@@ -198,20 +198,20 @@ class _WidgetsAppState extends State<WidgetsApp> implements WidgetsBindingObserv ...@@ -198,20 +198,20 @@ class _WidgetsAppState extends State<WidgetsApp> implements WidgetsBindingObserv
child: new LocaleQuery( child: new LocaleQuery(
data: _localeData, data: _localeData,
child: new Title( child: new Title(
title: config.title, title: widget.title,
color: config.color, color: widget.color,
child: new Navigator( child: new Navigator(
key: _navigator, key: _navigator,
initialRoute: config.initialRoute ?? ui.window.defaultRouteName, initialRoute: widget.initialRoute ?? ui.window.defaultRouteName,
onGenerateRoute: config.onGenerateRoute, onGenerateRoute: widget.onGenerateRoute,
observers: config.navigatorObservers observers: widget.navigatorObservers
) )
) )
) )
); );
if (config.textStyle != null) { if (widget.textStyle != null) {
result = new DefaultTextStyle( result = new DefaultTextStyle(
style: config.textStyle, style: widget.textStyle,
child: result child: result
); );
} }
...@@ -219,10 +219,10 @@ class _WidgetsAppState extends State<WidgetsApp> implements WidgetsBindingObserv ...@@ -219,10 +219,10 @@ class _WidgetsAppState extends State<WidgetsApp> implements WidgetsBindingObserv
PerformanceOverlay performanceOverlay; PerformanceOverlay performanceOverlay;
// We need to push a performance overlay if any of the display or checkerboarding // We need to push a performance overlay if any of the display or checkerboarding
// options are set. // options are set.
if (config.showPerformanceOverlay || WidgetsApp.showPerformanceOverlayOverride) { if (widget.showPerformanceOverlay || WidgetsApp.showPerformanceOverlayOverride) {
performanceOverlay = new PerformanceOverlay.allEnabled( performanceOverlay = new PerformanceOverlay.allEnabled(
checkerboardRasterCacheImages: config.checkerboardRasterCacheImages); checkerboardRasterCacheImages: widget.checkerboardRasterCacheImages);
} else if (config.checkerboardRasterCacheImages) { } else if (widget.checkerboardRasterCacheImages) {
performanceOverlay = new PerformanceOverlay(checkerboardRasterCacheImages: true); performanceOverlay = new PerformanceOverlay(checkerboardRasterCacheImages: true);
} }
...@@ -234,13 +234,13 @@ class _WidgetsAppState extends State<WidgetsApp> implements WidgetsBindingObserv ...@@ -234,13 +234,13 @@ class _WidgetsAppState extends State<WidgetsApp> implements WidgetsBindingObserv
] ]
); );
} }
if (config.showSemanticsDebugger) { if (widget.showSemanticsDebugger) {
result = new SemanticsDebugger( result = new SemanticsDebugger(
child: result child: result
); );
} }
assert(() { assert(() {
if (config.debugShowCheckedModeBanner && WidgetsApp.debugAllowBannerOverride) { if (widget.debugShowCheckedModeBanner && WidgetsApp.debugAllowBannerOverride) {
result = new CheckedModeBanner( result = new CheckedModeBanner(
child: result child: result
); );
......
...@@ -101,23 +101,23 @@ class _StreamBuilderBaseState<T, S> extends State<StreamBuilderBase<T, S>> { ...@@ -101,23 +101,23 @@ class _StreamBuilderBaseState<T, S> extends State<StreamBuilderBase<T, S>> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_summary = config.initial(); _summary = widget.initial();
_subscribe(); _subscribe();
} }
@override @override
void didUpdateConfig(StreamBuilderBase<T, S> oldConfig) { void didUpdateWidget(StreamBuilderBase<T, S> oldWidget) {
if (oldConfig.stream != config.stream) { if (oldWidget.stream != widget.stream) {
if (_subscription != null) { if (_subscription != null) {
_unsubscribe(); _unsubscribe();
_summary = config.afterDisconnected(_summary); _summary = widget.afterDisconnected(_summary);
} }
_subscribe(); _subscribe();
} }
} }
@override @override
Widget build(BuildContext context) => config.build(context, _summary); Widget build(BuildContext context) => widget.build(context, _summary);
@override @override
void dispose() { void dispose() {
...@@ -126,21 +126,21 @@ class _StreamBuilderBaseState<T, S> extends State<StreamBuilderBase<T, S>> { ...@@ -126,21 +126,21 @@ class _StreamBuilderBaseState<T, S> extends State<StreamBuilderBase<T, S>> {
} }
void _subscribe() { void _subscribe() {
if (config.stream != null) { if (widget.stream != null) {
_subscription = config.stream.listen((T data) { _subscription = widget.stream.listen((T data) {
setState(() { setState(() {
_summary = config.afterData(_summary, data); _summary = widget.afterData(_summary, data);
}); });
}, onError: (Object error) { }, onError: (Object error) {
setState(() { setState(() {
_summary = config.afterError(_summary, error); _summary = widget.afterError(_summary, error);
}); });
}, onDone: () { }, onDone: () {
setState(() { setState(() {
_summary = config.afterDone(_summary); _summary = widget.afterDone(_summary);
}); });
}); });
_summary = config.afterConnected(_summary); _summary = widget.afterConnected(_summary);
} }
} }
...@@ -418,8 +418,8 @@ class _FutureBuilderState<T> extends State<FutureBuilder<T>> { ...@@ -418,8 +418,8 @@ class _FutureBuilderState<T> extends State<FutureBuilder<T>> {
} }
@override @override
void didUpdateConfig(FutureBuilder<T> oldConfig) { void didUpdateWidget(FutureBuilder<T> oldWidget) {
if (oldConfig.future != config.future) { if (oldWidget.future != widget.future) {
if (_activeCallbackIdentity != null) { if (_activeCallbackIdentity != null) {
_unsubscribe(); _unsubscribe();
_snapshot = _snapshot.inState(ConnectionState.none); _snapshot = _snapshot.inState(ConnectionState.none);
...@@ -429,7 +429,7 @@ class _FutureBuilderState<T> extends State<FutureBuilder<T>> { ...@@ -429,7 +429,7 @@ class _FutureBuilderState<T> extends State<FutureBuilder<T>> {
} }
@override @override
Widget build(BuildContext context) => config.builder(context, _snapshot); Widget build(BuildContext context) => widget.builder(context, _snapshot);
@override @override
void dispose() { void dispose() {
...@@ -438,10 +438,10 @@ class _FutureBuilderState<T> extends State<FutureBuilder<T>> { ...@@ -438,10 +438,10 @@ class _FutureBuilderState<T> extends State<FutureBuilder<T>> {
} }
void _subscribe() { void _subscribe() {
if (config.future != null) { if (widget.future != null) {
final Object callbackIdentity = new Object(); final Object callbackIdentity = new Object();
_activeCallbackIdentity = callbackIdentity; _activeCallbackIdentity = callbackIdentity;
config.future.then<Null>((T data) { widget.future.then<Null>((T data) {
if (_activeCallbackIdentity == callbackIdentity) { if (_activeCallbackIdentity == callbackIdentity) {
setState(() { setState(() {
_snapshot = new AsyncSnapshot<T>.withData(ConnectionState.done, data); _snapshot = new AsyncSnapshot<T>.withData(ConnectionState.done, data);
......
...@@ -3241,5 +3241,5 @@ class StatefulBuilder extends StatefulWidget { ...@@ -3241,5 +3241,5 @@ class StatefulBuilder extends StatefulWidget {
class _StatefulBuilderState extends State<StatefulBuilder> { class _StatefulBuilderState extends State<StatefulBuilder> {
@override @override
Widget build(BuildContext context) => config.builder(context, setState); Widget build(BuildContext context) => widget.builder(context, setState);
} }
...@@ -193,9 +193,9 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin ...@@ -193,9 +193,9 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin
} }
bool get _directionIsXAxis { bool get _directionIsXAxis {
return config.direction == DismissDirection.horizontal return widget.direction == DismissDirection.horizontal
|| config.direction == DismissDirection.endToStart || widget.direction == DismissDirection.endToStart
|| config.direction == DismissDirection.startToEnd; || widget.direction == DismissDirection.startToEnd;
} }
DismissDirection get _dismissDirection { DismissDirection get _dismissDirection {
...@@ -205,7 +205,7 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin ...@@ -205,7 +205,7 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin
} }
double get _dismissThreshold { double get _dismissThreshold {
return config.dismissThresholds[_dismissDirection] ?? _kDismissThreshold; return widget.dismissThresholds[_dismissDirection] ?? _kDismissThreshold;
} }
bool get _isActive { bool get _isActive {
...@@ -237,7 +237,7 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin ...@@ -237,7 +237,7 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin
final double delta = details.primaryDelta; final double delta = details.primaryDelta;
final double oldDragExtent = _dragExtent; final double oldDragExtent = _dragExtent;
switch (config.direction) { switch (widget.direction) {
case DismissDirection.horizontal: case DismissDirection.horizontal:
case DismissDirection.vertical: case DismissDirection.vertical:
_dragExtent += delta; _dragExtent += delta;
...@@ -283,7 +283,7 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin ...@@ -283,7 +283,7 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin
if (_directionIsXAxis) { if (_directionIsXAxis) {
if (vx.abs() - vy.abs() < _kMinFlingVelocityDelta) if (vx.abs() - vy.abs() < _kMinFlingVelocityDelta)
return false; return false;
switch(config.direction) { switch(widget.direction) {
case DismissDirection.horizontal: case DismissDirection.horizontal:
return vx.abs() > _kMinFlingVelocity; return vx.abs() > _kMinFlingVelocity;
case DismissDirection.endToStart: case DismissDirection.endToStart:
...@@ -294,7 +294,7 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin ...@@ -294,7 +294,7 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin
} else { } else {
if (vy.abs() - vx.abs() < _kMinFlingVelocityDelta) if (vy.abs() - vx.abs() < _kMinFlingVelocityDelta)
return false; return false;
switch(config.direction) { switch(widget.direction) {
case DismissDirection.vertical: case DismissDirection.vertical:
return vy.abs() > _kMinFlingVelocity; return vy.abs() > _kMinFlingVelocity;
case DismissDirection.up: case DismissDirection.up:
...@@ -332,11 +332,11 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin ...@@ -332,11 +332,11 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin
assert(_moveController.isCompleted); assert(_moveController.isCompleted);
assert(_resizeController == null); assert(_resizeController == null);
assert(_sizePriorToCollapse == null); assert(_sizePriorToCollapse == null);
if (config.resizeDuration == null) { if (widget.resizeDuration == null) {
if (config.onDismissed != null) if (widget.onDismissed != null)
config.onDismissed(_dismissDirection); widget.onDismissed(_dismissDirection);
} else { } else {
_resizeController = new AnimationController(duration: config.resizeDuration, vsync: this) _resizeController = new AnimationController(duration: widget.resizeDuration, vsync: this)
..addListener(_handleResizeProgressChanged); ..addListener(_handleResizeProgressChanged);
_resizeController.forward(); _resizeController.forward();
setState(() { setState(() {
...@@ -354,21 +354,21 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin ...@@ -354,21 +354,21 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin
void _handleResizeProgressChanged() { void _handleResizeProgressChanged() {
if (_resizeController.isCompleted) { if (_resizeController.isCompleted) {
if (config.onDismissed != null) if (widget.onDismissed != null)
config.onDismissed(_dismissDirection); widget.onDismissed(_dismissDirection);
} else { } else {
if (config.onResize != null) if (widget.onResize != null)
config.onResize(); widget.onResize();
} }
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Widget background = config.background; Widget background = widget.background;
if (config.secondaryBackground != null) { if (widget.secondaryBackground != null) {
final DismissDirection direction = _dismissDirection; final DismissDirection direction = _dismissDirection;
if (direction == DismissDirection.endToStart || direction == DismissDirection.up) if (direction == DismissDirection.endToStart || direction == DismissDirection.up)
background = config.secondaryBackground; background = widget.secondaryBackground;
} }
if (_resizeAnimation != null) { if (_resizeAnimation != null) {
...@@ -398,7 +398,7 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin ...@@ -398,7 +398,7 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin
Widget content = new SlideTransition( Widget content = new SlideTransition(
position: _moveAnimation, position: _moveAnimation,
child: config.child child: widget.child
); );
if (background != null) { if (background != null) {
...@@ -420,7 +420,7 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin ...@@ -420,7 +420,7 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin
content = new Stack(children: children); content = new Stack(children: children);
} }
// We are not resizing but we may be being dragging in config.direction. // We are not resizing but we may be being dragging in widget.direction.
return new GestureDetector( return new GestureDetector(
onHorizontalDragStart: _directionIsXAxis ? _handleDragStart : null, onHorizontalDragStart: _directionIsXAxis ? _handleDragStart : null,
onHorizontalDragUpdate: _directionIsXAxis ? _handleDragUpdate : null, onHorizontalDragUpdate: _directionIsXAxis ? _handleDragUpdate : null,
......
...@@ -247,7 +247,7 @@ class _DraggableState<T> extends State<Draggable<T>> { ...@@ -247,7 +247,7 @@ class _DraggableState<T> extends State<Draggable<T>> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_recognizer = config.createRecognizer(_startDrag); _recognizer = widget.createRecognizer(_startDrag);
} }
@override @override
...@@ -276,16 +276,16 @@ class _DraggableState<T> extends State<Draggable<T>> { ...@@ -276,16 +276,16 @@ class _DraggableState<T> extends State<Draggable<T>> {
} }
void _routePointer(PointerEvent event) { void _routePointer(PointerEvent event) {
if (config.maxSimultaneousDrags != null && _activeCount >= config.maxSimultaneousDrags) if (widget.maxSimultaneousDrags != null && _activeCount >= widget.maxSimultaneousDrags)
return; return;
_recognizer.addPointer(event); _recognizer.addPointer(event);
} }
_DragAvatar<T> _startDrag(Point position) { _DragAvatar<T> _startDrag(Point position) {
if (config.maxSimultaneousDrags != null && _activeCount >= config.maxSimultaneousDrags) if (widget.maxSimultaneousDrags != null && _activeCount >= widget.maxSimultaneousDrags)
return null; return null;
Point dragStartPoint; Point dragStartPoint;
switch (config.dragAnchor) { switch (widget.dragAnchor) {
case DragAnchor.child: case DragAnchor.child:
final RenderBox renderObject = context.findRenderObject(); final RenderBox renderObject = context.findRenderObject();
dragStartPoint = renderObject.globalToLocal(position); dragStartPoint = renderObject.globalToLocal(position);
...@@ -298,12 +298,12 @@ class _DraggableState<T> extends State<Draggable<T>> { ...@@ -298,12 +298,12 @@ class _DraggableState<T> extends State<Draggable<T>> {
_activeCount += 1; _activeCount += 1;
}); });
final _DragAvatar<T> avatar = new _DragAvatar<T>( final _DragAvatar<T> avatar = new _DragAvatar<T>(
overlayState: Overlay.of(context, debugRequiredFor: config), overlayState: Overlay.of(context, debugRequiredFor: widget),
data: config.data, data: widget.data,
initialPosition: position, initialPosition: position,
dragStartPoint: dragStartPoint, dragStartPoint: dragStartPoint,
feedback: config.feedback, feedback: widget.feedback,
feedbackOffset: config.feedbackOffset, feedbackOffset: widget.feedbackOffset,
onDragEnd: (Velocity velocity, Offset offset, bool wasAccepted) { onDragEnd: (Velocity velocity, Offset offset, bool wasAccepted) {
if (mounted) { if (mounted) {
setState(() { setState(() {
...@@ -313,24 +313,24 @@ class _DraggableState<T> extends State<Draggable<T>> { ...@@ -313,24 +313,24 @@ class _DraggableState<T> extends State<Draggable<T>> {
_activeCount -= 1; _activeCount -= 1;
_disposeRecognizerIfInactive(); _disposeRecognizerIfInactive();
} }
if (!wasAccepted && config.onDraggableCanceled != null) if (!wasAccepted && widget.onDraggableCanceled != null)
config.onDraggableCanceled(velocity, offset); widget.onDraggableCanceled(velocity, offset);
} }
); );
if (config.onDragStarted != null) if (widget.onDragStarted != null)
config.onDragStarted(); widget.onDragStarted();
return avatar; return avatar;
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
assert(Overlay.of(context, debugRequiredFor: config) != null); assert(Overlay.of(context, debugRequiredFor: widget) != null);
final bool canDrag = config.maxSimultaneousDrags == null || final bool canDrag = widget.maxSimultaneousDrags == null ||
_activeCount < config.maxSimultaneousDrags; _activeCount < widget.maxSimultaneousDrags;
final bool showChild = _activeCount == 0 || config.childWhenDragging == null; final bool showChild = _activeCount == 0 || widget.childWhenDragging == null;
return new Listener( return new Listener(
onPointerDown: canDrag ? _routePointer : null, onPointerDown: canDrag ? _routePointer : null,
child: showChild ? config.child : config.childWhenDragging child: showChild ? widget.child : widget.childWhenDragging
); );
} }
} }
...@@ -386,7 +386,7 @@ class _DragTargetState<T> extends State<DragTarget<T>> { ...@@ -386,7 +386,7 @@ class _DragTargetState<T> extends State<DragTarget<T>> {
bool didEnter(_DragAvatar<dynamic> avatar) { bool didEnter(_DragAvatar<dynamic> avatar) {
assert(!_candidateAvatars.contains(avatar)); assert(!_candidateAvatars.contains(avatar));
assert(!_rejectedAvatars.contains(avatar)); assert(!_rejectedAvatars.contains(avatar));
if (avatar.data is T && (config.onWillAccept == null || config.onWillAccept(avatar.data))) { if (avatar.data is T && (widget.onWillAccept == null || widget.onWillAccept(avatar.data))) {
setState(() { setState(() {
_candidateAvatars.add(avatar); _candidateAvatars.add(avatar);
}); });
...@@ -413,17 +413,17 @@ class _DragTargetState<T> extends State<DragTarget<T>> { ...@@ -413,17 +413,17 @@ class _DragTargetState<T> extends State<DragTarget<T>> {
setState(() { setState(() {
_candidateAvatars.remove(avatar); _candidateAvatars.remove(avatar);
}); });
if (config.onAccept != null) if (widget.onAccept != null)
config.onAccept(avatar.data); widget.onAccept(avatar.data);
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
assert(config.builder != null); assert(widget.builder != null);
return new MetaData( return new MetaData(
metaData: this, metaData: this,
behavior: HitTestBehavior.translucent, behavior: HitTestBehavior.translucent,
child: config.builder(context, _mapAvatarsToData<T>(_candidateAvatars), _mapAvatarsToData<dynamic>(_rejectedAvatars)) child: widget.builder(context, _mapAvatarsToData<T>(_candidateAvatars), _mapAvatarsToData<dynamic>(_rejectedAvatars))
); );
} }
} }
......
...@@ -220,43 +220,43 @@ class EditableTextState extends State<EditableText> implements TextInputClient { ...@@ -220,43 +220,43 @@ class EditableTextState extends State<EditableText> implements TextInputClient {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
config.controller.addListener(_didChangeTextEditingValue); widget.controller.addListener(_didChangeTextEditingValue);
config.focusNode.addListener(_handleFocusChanged); widget.focusNode.addListener(_handleFocusChanged);
} }
@override @override
void didChangeDependencies() { void didChangeDependencies() {
super.didChangeDependencies(); super.didChangeDependencies();
if (!_didAutoFocus && config.autofocus) { if (!_didAutoFocus && widget.autofocus) {
_didRequestKeyboard = true; _didRequestKeyboard = true;
FocusScope.of(context).autofocus(config.focusNode); FocusScope.of(context).autofocus(widget.focusNode);
_didAutoFocus = true; _didAutoFocus = true;
} }
} }
@override @override
void didUpdateConfig(EditableText oldConfig) { void didUpdateWidget(EditableText oldWidget) {
if (config.controller != oldConfig.controller) { if (widget.controller != oldWidget.controller) {
oldConfig.controller.removeListener(_didChangeTextEditingValue); oldWidget.controller.removeListener(_didChangeTextEditingValue);
config.controller.addListener(_didChangeTextEditingValue); widget.controller.addListener(_didChangeTextEditingValue);
_updateRemoteEditingValueIfNeeded(); _updateRemoteEditingValueIfNeeded();
} }
if (config.focusNode != oldConfig.focusNode) { if (widget.focusNode != oldWidget.focusNode) {
oldConfig.focusNode.removeListener(_handleFocusChanged); oldWidget.focusNode.removeListener(_handleFocusChanged);
config.focusNode.addListener(_handleFocusChanged); widget.focusNode.addListener(_handleFocusChanged);
} }
} }
@override @override
void dispose() { void dispose() {
config.controller.removeListener(_didChangeTextEditingValue); widget.controller.removeListener(_didChangeTextEditingValue);
_closeInputConnectionIfNeeded(); _closeInputConnectionIfNeeded();
assert(!_hasInputConnection); assert(!_hasInputConnection);
_stopCursorTimer(); _stopCursorTimer();
assert(_cursorTimer == null); assert(_cursorTimer == null);
_selectionOverlay?.dispose(); _selectionOverlay?.dispose();
_selectionOverlay = null; _selectionOverlay = null;
config.focusNode.removeListener(_handleFocusChanged); widget.focusNode.removeListener(_handleFocusChanged);
super.dispose(); super.dispose();
} }
...@@ -270,16 +270,16 @@ class EditableTextState extends State<EditableText> implements TextInputClient { ...@@ -270,16 +270,16 @@ class EditableTextState extends State<EditableText> implements TextInputClient {
_hideSelectionOverlayIfNeeded(); _hideSelectionOverlayIfNeeded();
_lastKnownRemoteTextEditingValue = value; _lastKnownRemoteTextEditingValue = value;
_value = value; _value = value;
if (config.onChanged != null) if (widget.onChanged != null)
config.onChanged(value.text); widget.onChanged(value.text);
} }
@override @override
void performAction(TextInputAction action) { void performAction(TextInputAction action) {
config.controller.clearComposing(); widget.controller.clearComposing();
config.focusNode.unfocus(); widget.focusNode.unfocus();
if (config.onSubmitted != null) if (widget.onSubmitted != null)
config.onSubmitted(_value.text); widget.onSubmitted(_value.text);
} }
void _updateRemoteEditingValueIfNeeded() { void _updateRemoteEditingValueIfNeeded() {
...@@ -292,13 +292,13 @@ class EditableTextState extends State<EditableText> implements TextInputClient { ...@@ -292,13 +292,13 @@ class EditableTextState extends State<EditableText> implements TextInputClient {
_textInputConnection.setEditingState(localValue); _textInputConnection.setEditingState(localValue);
} }
TextEditingValue get _value => config.controller.value; TextEditingValue get _value => widget.controller.value;
set _value(TextEditingValue value) { set _value(TextEditingValue value) {
config.controller.value = value; widget.controller.value = value;
} }
bool get _hasFocus => config.focusNode.hasFocus; bool get _hasFocus => widget.focusNode.hasFocus;
bool get _isMultiline => config.maxLines > 1; bool get _isMultiline => widget.maxLines > 1;
// Calculate the new scroll offset so the cursor remains visible. // Calculate the new scroll offset so the cursor remains visible.
double _getScrollOffsetForCaret(Rect caretRect) { double _getScrollOffsetForCaret(Rect caretRect) {
...@@ -320,7 +320,7 @@ class EditableTextState extends State<EditableText> implements TextInputClient { ...@@ -320,7 +320,7 @@ class EditableTextState extends State<EditableText> implements TextInputClient {
if (!_hasInputConnection) { if (!_hasInputConnection) {
final TextEditingValue localValue = _value; final TextEditingValue localValue = _value;
_lastKnownRemoteTextEditingValue = localValue; _lastKnownRemoteTextEditingValue = localValue;
_textInputConnection = TextInput.attach(this, new TextInputConfiguration(inputType: config.keyboardType)) _textInputConnection = TextInput.attach(this, new TextInputConfiguration(inputType: widget.keyboardType))
..setEditingState(localValue) ..setEditingState(localValue)
..show(); ..show();
} }
...@@ -339,7 +339,7 @@ class EditableTextState extends State<EditableText> implements TextInputClient { ...@@ -339,7 +339,7 @@ class EditableTextState extends State<EditableText> implements TextInputClient {
_openInputConnectionIfNeeded(); _openInputConnectionIfNeeded();
} else if (!_hasFocus) { } else if (!_hasFocus) {
_closeInputConnectionIfNeeded(); _closeInputConnectionIfNeeded();
config.controller.clearComposing(); widget.controller.clearComposing();
} }
_didRequestKeyboard = false; _didRequestKeyboard = false;
} }
...@@ -359,7 +359,7 @@ class EditableTextState extends State<EditableText> implements TextInputClient { ...@@ -359,7 +359,7 @@ class EditableTextState extends State<EditableText> implements TextInputClient {
_openInputConnectionIfNeeded(); _openInputConnectionIfNeeded();
} else { } else {
_didRequestKeyboard = true; _didRequestKeyboard = true;
FocusScope.of(context).requestFocus(config.focusNode); FocusScope.of(context).requestFocus(widget.focusNode);
} }
} }
} }
...@@ -381,7 +381,7 @@ class EditableTextState extends State<EditableText> implements TextInputClient { ...@@ -381,7 +381,7 @@ class EditableTextState extends State<EditableText> implements TextInputClient {
} }
void _handleSelectionChanged(TextSelection selection, RenderEditable renderObject, bool longPress) { void _handleSelectionChanged(TextSelection selection, RenderEditable renderObject, bool longPress) {
config.controller.selection = selection; widget.controller.selection = selection;
// Note that this will show the keyboard for all selection changes on the // Note that this will show the keyboard for all selection changes on the
// EditableWidget, not just changes triggered by user gestures. // EditableWidget, not just changes triggered by user gestures.
...@@ -389,14 +389,14 @@ class EditableTextState extends State<EditableText> implements TextInputClient { ...@@ -389,14 +389,14 @@ class EditableTextState extends State<EditableText> implements TextInputClient {
_hideSelectionOverlayIfNeeded(); _hideSelectionOverlayIfNeeded();
if (config.selectionControls != null) { if (widget.selectionControls != null) {
_selectionOverlay = new TextSelectionOverlay( _selectionOverlay = new TextSelectionOverlay(
context: context, context: context,
value: _value, value: _value,
debugRequiredFor: config, debugRequiredFor: widget,
renderObject: renderObject, renderObject: renderObject,
onSelectionOverlayChanged: _handleSelectionOverlayChanged, onSelectionOverlayChanged: _handleSelectionOverlayChanged,
selectionControls: config.selectionControls, selectionControls: widget.selectionControls,
); );
if (_value.text.isNotEmpty || longPress) if (_value.text.isNotEmpty || longPress)
_selectionOverlay.showHandles(); _selectionOverlay.showHandles();
...@@ -450,7 +450,7 @@ class EditableTextState extends State<EditableText> implements TextInputClient { ...@@ -450,7 +450,7 @@ class EditableTextState extends State<EditableText> implements TextInputClient {
_updateOrDisposeSelectionOverlayIfNeeded(); _updateOrDisposeSelectionOverlayIfNeeded();
// TODO(abarth): Teach RenderEditable about ValueNotifier<TextEditingValue> // TODO(abarth): Teach RenderEditable about ValueNotifier<TextEditingValue>
// to avoid this setState(). // to avoid this setState().
setState(() { /* We use config.controller.value in build(). */ }); setState(() { /* We use widget.controller.value in build(). */ });
} }
void _handleFocusChanged() { void _handleFocusChanged() {
...@@ -461,7 +461,7 @@ class EditableTextState extends State<EditableText> implements TextInputClient { ...@@ -461,7 +461,7 @@ class EditableTextState extends State<EditableText> implements TextInputClient {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
FocusScope.of(context).reparentIfNeeded(config.focusNode); FocusScope.of(context).reparentIfNeeded(widget.focusNode);
return new Scrollable( return new Scrollable(
axisDirection: _isMultiline ? AxisDirection.down : AxisDirection.right, axisDirection: _isMultiline ? AxisDirection.down : AxisDirection.right,
controller: _scrollController, controller: _scrollController,
...@@ -469,14 +469,14 @@ class EditableTextState extends State<EditableText> implements TextInputClient { ...@@ -469,14 +469,14 @@ class EditableTextState extends State<EditableText> implements TextInputClient {
viewportBuilder: (BuildContext context, ViewportOffset offset) { viewportBuilder: (BuildContext context, ViewportOffset offset) {
return new _Editable( return new _Editable(
value: _value, value: _value,
style: config.style, style: widget.style,
cursorColor: config.cursorColor, cursorColor: widget.cursorColor,
showCursor: _showCursor, showCursor: _showCursor,
maxLines: config.maxLines, maxLines: widget.maxLines,
selectionColor: config.selectionColor, selectionColor: widget.selectionColor,
textScaleFactor: config.textScaleFactor ?? MediaQuery.of(context).textScaleFactor, textScaleFactor: widget.textScaleFactor ?? MediaQuery.of(context).textScaleFactor,
textAlign: config.textAlign, textAlign: widget.textAlign,
obscureText: config.obscureText, obscureText: widget.obscureText,
offset: offset, offset: offset,
onSelectionChanged: _handleSelectionChanged, onSelectionChanged: _handleSelectionChanged,
); );
......
...@@ -90,26 +90,26 @@ class _FocusScopeState extends State<FocusScope> { ...@@ -90,26 +90,26 @@ class _FocusScopeState extends State<FocusScope> {
@override @override
void didChangeDependencies() { void didChangeDependencies() {
super.didChangeDependencies(); super.didChangeDependencies();
if (!_didAutofocus && config.autofocus) { if (!_didAutofocus && widget.autofocus) {
FocusScope.of(context).setFirstFocus(config.node); FocusScope.of(context).setFirstFocus(widget.node);
_didAutofocus = true; _didAutofocus = true;
} }
} }
@override @override
void dispose() { void dispose() {
config.node.detach(); widget.node.detach();
super.dispose(); super.dispose();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
FocusScope.of(context).reparentScopeIfNeeded(config.node); FocusScope.of(context).reparentScopeIfNeeded(widget.node);
return new Semantics( return new Semantics(
container: true, container: true,
child: new _FocusScopeMarker( child: new _FocusScopeMarker(
node: config.node, node: widget.node,
child: config.child, child: widget.child,
), ),
); );
} }
......
...@@ -90,14 +90,14 @@ class FormState extends State<Form> { ...@@ -90,14 +90,14 @@ class FormState extends State<Form> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (config.autovalidate) if (widget.autovalidate)
_validate(); _validate();
return new WillPopScope( return new WillPopScope(
onWillPop: config.onWillPop, onWillPop: widget.onWillPop,
child: new _FormScope( child: new _FormScope(
formState: this, formState: this,
generation: _generation, generation: _generation,
child: config.child, child: widget.child,
), ),
); );
} }
...@@ -148,7 +148,7 @@ class _FormScope extends InheritedWidget { ...@@ -148,7 +148,7 @@ class _FormScope extends InheritedWidget {
final int _generation; final int _generation;
/// The [Form] associated with this widget. /// The [Form] associated with this widget.
Form get form => _formState.config; Form get form => _formState.widget;
@override @override
bool updateShouldNotify(_FormScope old) => _generation != old._generation; bool updateShouldNotify(_FormScope old) => _generation != old._generation;
...@@ -250,14 +250,14 @@ class FormFieldState<T> extends State<FormField<T>> { ...@@ -250,14 +250,14 @@ class FormFieldState<T> extends State<FormField<T>> {
/// Calls the [FormField]'s onSaved method with the current value. /// Calls the [FormField]'s onSaved method with the current value.
void save() { void save() {
if (config.onSaved != null) if (widget.onSaved != null)
config.onSaved(value); widget.onSaved(value);
} }
/// Resets the field to its initial value. /// Resets the field to its initial value.
void reset() { void reset() {
setState(() { setState(() {
_value = config.initialValue; _value = widget.initialValue;
_errorText = null; _errorText = null;
}); });
} }
...@@ -272,8 +272,8 @@ class FormFieldState<T> extends State<FormField<T>> { ...@@ -272,8 +272,8 @@ class FormFieldState<T> extends State<FormField<T>> {
} }
bool _validate() { bool _validate() {
if (config.validator != null) if (widget.validator != null)
_errorText = config.validator(_value); _errorText = widget.validator(_value);
return !hasError; return !hasError;
} }
...@@ -289,7 +289,7 @@ class FormFieldState<T> extends State<FormField<T>> { ...@@ -289,7 +289,7 @@ class FormFieldState<T> extends State<FormField<T>> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_value = config.initialValue; _value = widget.initialValue;
} }
@override @override
...@@ -300,9 +300,9 @@ class FormFieldState<T> extends State<FormField<T>> { ...@@ -300,9 +300,9 @@ class FormFieldState<T> extends State<FormField<T>> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (config.autovalidate) if (widget.autovalidate)
_validate(); _validate();
Form.of(context)?._register(this); Form.of(context)?._register(this);
return config.builder(this); return widget.builder(this);
} }
} }
...@@ -363,12 +363,12 @@ class RawGestureDetectorState extends State<RawGestureDetector> { ...@@ -363,12 +363,12 @@ class RawGestureDetectorState extends State<RawGestureDetector> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_syncAll(config.gestures); _syncAll(widget.gestures);
} }
@override @override
void didUpdateConfig(RawGestureDetector oldConfig) { void didUpdateWidget(RawGestureDetector oldWidget) {
_syncAll(config.gestures); _syncAll(widget.gestures);
} }
/// This method can be called after the build phase, during the /// This method can be called after the build phase, during the
...@@ -394,7 +394,7 @@ class RawGestureDetectorState extends State<RawGestureDetector> { ...@@ -394,7 +394,7 @@ class RawGestureDetectorState extends State<RawGestureDetector> {
return true; return true;
}); });
_syncAll(gestures); _syncAll(gestures);
if (!config.excludeFromSemantics) { if (!widget.excludeFromSemantics) {
final RenderSemanticsGestureHandler semanticsGestureHandler = context.findRenderObject(); final RenderSemanticsGestureHandler semanticsGestureHandler = context.findRenderObject();
context.visitChildElements((Element element) { context.visitChildElements((Element element) {
final _GestureSemantics widget = element.widget; final _GestureSemantics widget = element.widget;
...@@ -433,17 +433,17 @@ class RawGestureDetectorState extends State<RawGestureDetector> { ...@@ -433,17 +433,17 @@ class RawGestureDetectorState extends State<RawGestureDetector> {
} }
HitTestBehavior get _defaultBehavior { HitTestBehavior get _defaultBehavior {
return config.child == null ? HitTestBehavior.translucent : HitTestBehavior.deferToChild; return widget.child == null ? HitTestBehavior.translucent : HitTestBehavior.deferToChild;
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Widget result = new Listener( Widget result = new Listener(
onPointerDown: _handlePointerDown, onPointerDown: _handlePointerDown,
behavior: config.behavior ?? _defaultBehavior, behavior: widget.behavior ?? _defaultBehavior,
child: config.child child: widget.child
); );
if (!config.excludeFromSemantics) if (!widget.excludeFromSemantics)
result = new _GestureSemantics(owner: this, child: result); result = new _GestureSemantics(owner: this, child: result);
return result; return result;
} }
...@@ -459,7 +459,7 @@ class RawGestureDetectorState extends State<RawGestureDetector> { ...@@ -459,7 +459,7 @@ class RawGestureDetectorState extends State<RawGestureDetector> {
gestures.add('<none>'); gestures.add('<none>');
description.add('gestures: ${gestures.join(", ")}'); description.add('gestures: ${gestures.join(", ")}');
} }
switch (config.behavior) { switch (widget.behavior) {
case HitTestBehavior.translucent: case HitTestBehavior.translucent:
description.add('behavior: translucent'); description.add('behavior: translucent');
break; break;
......
...@@ -165,7 +165,7 @@ class _HeroState extends State<Hero> { ...@@ -165,7 +165,7 @@ class _HeroState extends State<Hero> {
} }
return new KeyedSubtree( return new KeyedSubtree(
key: _key, key: _key,
child: config.child, child: widget.child,
); );
} }
} }
...@@ -182,7 +182,7 @@ class _HeroFlightManifest { ...@@ -182,7 +182,7 @@ class _HeroFlightManifest {
@required this.toHero, @required this.toHero,
@required this.createRectTween, @required this.createRectTween,
}) { }) {
assert(fromHero.config.tag == toHero.config.tag); assert(fromHero.widget.tag == toHero.widget.tag);
} }
final _HeroFlightType type; final _HeroFlightType type;
...@@ -194,7 +194,7 @@ class _HeroFlightManifest { ...@@ -194,7 +194,7 @@ class _HeroFlightManifest {
final _HeroState toHero; final _HeroState toHero;
final CreateRectTween createRectTween; final CreateRectTween createRectTween;
Object get tag => fromHero.config.tag; Object get tag => fromHero.widget.tag;
Animation<double> get animation { Animation<double> get animation {
return new CurvedAnimation( return new CurvedAnimation(
...@@ -235,7 +235,7 @@ class _HeroFlight { ...@@ -235,7 +235,7 @@ class _HeroFlight {
assert(manifest != null); assert(manifest != null);
return new AnimatedBuilder( return new AnimatedBuilder(
animation: _proxyAnimation, animation: _proxyAnimation,
child: manifest.toHero.config, child: manifest.toHero.widget,
builder: (BuildContext context, Widget child) { builder: (BuildContext context, Widget child) {
final RenderBox toHeroBox = manifest.toHero.context?.findRenderObject(); final RenderBox toHeroBox = manifest.toHero.context?.findRenderObject();
if (_aborted || toHeroBox == null || !toHeroBox.attached) { if (_aborted || toHeroBox == null || !toHeroBox.attached) {
......
...@@ -243,8 +243,8 @@ class _ImageState extends State<Image> { ...@@ -243,8 +243,8 @@ class _ImageState extends State<Image> {
} }
@override @override
void didUpdateConfig(Image oldConfig) { void didUpdateWidget(Image oldWidget) {
if (config.image != oldConfig.image) if (widget.image != oldWidget.image)
_resolveImage(); _resolveImage();
} }
...@@ -256,14 +256,14 @@ class _ImageState extends State<Image> { ...@@ -256,14 +256,14 @@ class _ImageState extends State<Image> {
void _resolveImage() { void _resolveImage() {
final ImageStream oldImageStream = _imageStream; final ImageStream oldImageStream = _imageStream;
_imageStream = config.image.resolve(createLocalImageConfiguration( _imageStream = widget.image.resolve(createLocalImageConfiguration(
context, context,
size: config.width != null && config.height != null ? new Size(config.width, config.height) : null size: widget.width != null && widget.height != null ? new Size(widget.width, widget.height) : null
)); ));
assert(_imageStream != null); assert(_imageStream != null);
if (_imageStream.key != oldImageStream?.key) { if (_imageStream.key != oldImageStream?.key) {
oldImageStream?.removeListener(_handleImageChanged); oldImageStream?.removeListener(_handleImageChanged);
if (!config.gaplessPlayback) if (!widget.gaplessPlayback)
setState(() { _imageInfo = null; }); setState(() { _imageInfo = null; });
_imageStream.addListener(_handleImageChanged); _imageStream.addListener(_handleImageChanged);
} }
...@@ -286,14 +286,14 @@ class _ImageState extends State<Image> { ...@@ -286,14 +286,14 @@ class _ImageState extends State<Image> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new RawImage( return new RawImage(
image: _imageInfo?.image, image: _imageInfo?.image,
width: config.width, width: widget.width,
height: config.height, height: widget.height,
scale: _imageInfo?.scale ?? 1.0, scale: _imageInfo?.scale ?? 1.0,
color: config.color, color: widget.color,
fit: config.fit, fit: widget.fit,
alignment: config.alignment, alignment: widget.alignment,
repeat: config.repeat, repeat: widget.repeat,
centerSlice: config.centerSlice centerSlice: widget.centerSlice
); );
} }
......
...@@ -138,8 +138,8 @@ abstract class AnimatedWidgetBaseState<T extends ImplicitlyAnimatedWidget> exten ...@@ -138,8 +138,8 @@ abstract class AnimatedWidgetBaseState<T extends ImplicitlyAnimatedWidget> exten
void initState() { void initState() {
super.initState(); super.initState();
_controller = new AnimationController( _controller = new AnimationController(
duration: config.duration, duration: widget.duration,
debugLabel: '${config.toStringShort()}', debugLabel: '${widget.toStringShort()}',
vsync: this, vsync: this,
)..addListener(_handleAnimationChanged); )..addListener(_handleAnimationChanged);
_updateCurve(); _updateCurve();
...@@ -147,10 +147,10 @@ abstract class AnimatedWidgetBaseState<T extends ImplicitlyAnimatedWidget> exten ...@@ -147,10 +147,10 @@ abstract class AnimatedWidgetBaseState<T extends ImplicitlyAnimatedWidget> exten
} }
@override @override
void didUpdateConfig(T oldConfig) { void didUpdateWidget(T oldWidget) {
if (config.curve != oldConfig.curve) if (widget.curve != oldWidget.curve)
_updateCurve(); _updateCurve();
_controller.duration = config.duration; _controller.duration = widget.duration;
if (_constructTweens()) { if (_constructTweens()) {
forEachTween((Tween<dynamic> tween, dynamic targetValue, TweenConstructor<dynamic> constructor) { forEachTween((Tween<dynamic> tween, dynamic targetValue, TweenConstructor<dynamic> constructor) {
_updateTween(tween, targetValue); _updateTween(tween, targetValue);
...@@ -163,8 +163,8 @@ abstract class AnimatedWidgetBaseState<T extends ImplicitlyAnimatedWidget> exten ...@@ -163,8 +163,8 @@ abstract class AnimatedWidgetBaseState<T extends ImplicitlyAnimatedWidget> exten
} }
void _updateCurve() { void _updateCurve() {
if (config.curve != null) if (widget.curve != null)
_animation = new CurvedAnimation(parent: _controller, curve: config.curve); _animation = new CurvedAnimation(parent: _controller, curve: widget.curve);
else else
_animation = _controller; _animation = _controller;
} }
...@@ -212,7 +212,7 @@ abstract class AnimatedWidgetBaseState<T extends ImplicitlyAnimatedWidget> exten ...@@ -212,7 +212,7 @@ abstract class AnimatedWidgetBaseState<T extends ImplicitlyAnimatedWidget> exten
/// 1. Call the visitor callback with three arguments, the first argument /// 1. Call the visitor callback with three arguments, the first argument
/// being the current value of the Tween<T> object that represents the /// being the current value of the Tween<T> object that represents the
/// tween (initially null), the second argument, of type T, being the value /// tween (initially null), the second argument, of type T, being the value
/// on the Widget (config) that represents the current target value of the /// on the Widget that represents the current target value of the
/// tween, and the third being a callback that takes a value T (which will /// tween, and the third being a callback that takes a value T (which will
/// be the second argument to the visitor callback), and that returns an /// be the second argument to the visitor callback), and that returns an
/// Tween<T> object for the tween, configured with the given value /// Tween<T> object for the tween, configured with the given value
...@@ -324,20 +324,20 @@ class _AnimatedContainerState extends AnimatedWidgetBaseState<AnimatedContainer> ...@@ -324,20 +324,20 @@ class _AnimatedContainerState extends AnimatedWidgetBaseState<AnimatedContainer>
@override @override
void forEachTween(TweenVisitor<dynamic> visitor) { void forEachTween(TweenVisitor<dynamic> visitor) {
// TODO(ianh): Use constructor tear-offs when it becomes possible // TODO(ianh): Use constructor tear-offs when it becomes possible
_constraints = visitor(_constraints, config.constraints, (dynamic value) => new BoxConstraintsTween(begin: value)); _constraints = visitor(_constraints, widget.constraints, (dynamic value) => new BoxConstraintsTween(begin: value));
_decoration = visitor(_decoration, config.decoration, (dynamic value) => new DecorationTween(begin: value)); _decoration = visitor(_decoration, widget.decoration, (dynamic value) => new DecorationTween(begin: value));
_foregroundDecoration = visitor(_foregroundDecoration, config.foregroundDecoration, (dynamic value) => new DecorationTween(begin: value)); _foregroundDecoration = visitor(_foregroundDecoration, widget.foregroundDecoration, (dynamic value) => new DecorationTween(begin: value));
_margin = visitor(_margin, config.margin, (dynamic value) => new EdgeInsetsTween(begin: value)); _margin = visitor(_margin, widget.margin, (dynamic value) => new EdgeInsetsTween(begin: value));
_padding = visitor(_padding, config.padding, (dynamic value) => new EdgeInsetsTween(begin: value)); _padding = visitor(_padding, widget.padding, (dynamic value) => new EdgeInsetsTween(begin: value));
_transform = visitor(_transform, config.transform, (dynamic value) => new Matrix4Tween(begin: value)); _transform = visitor(_transform, widget.transform, (dynamic value) => new Matrix4Tween(begin: value));
_width = visitor(_width, config.width, (dynamic value) => new Tween<double>(begin: value)); _width = visitor(_width, widget.width, (dynamic value) => new Tween<double>(begin: value));
_height = visitor(_height, config.height, (dynamic value) => new Tween<double>(begin: value)); _height = visitor(_height, widget.height, (dynamic value) => new Tween<double>(begin: value));
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Container( return new Container(
child: config.child, child: widget.child,
constraints: _constraints?.evaluate(animation), constraints: _constraints?.evaluate(animation),
decoration: _decoration?.evaluate(animation), decoration: _decoration?.evaluate(animation),
foregroundDecoration: _foregroundDecoration?.evaluate(animation), foregroundDecoration: _foregroundDecoration?.evaluate(animation),
...@@ -476,18 +476,18 @@ class _AnimatedPositionedState extends AnimatedWidgetBaseState<AnimatedPositione ...@@ -476,18 +476,18 @@ class _AnimatedPositionedState extends AnimatedWidgetBaseState<AnimatedPositione
@override @override
void forEachTween(TweenVisitor<dynamic> visitor) { void forEachTween(TweenVisitor<dynamic> visitor) {
// TODO(ianh): Use constructor tear-offs when it becomes possible // TODO(ianh): Use constructor tear-offs when it becomes possible
_left = visitor(_left, config.left, (dynamic value) => new Tween<double>(begin: value)); _left = visitor(_left, widget.left, (dynamic value) => new Tween<double>(begin: value));
_top = visitor(_top, config.top, (dynamic value) => new Tween<double>(begin: value)); _top = visitor(_top, widget.top, (dynamic value) => new Tween<double>(begin: value));
_right = visitor(_right, config.right, (dynamic value) => new Tween<double>(begin: value)); _right = visitor(_right, widget.right, (dynamic value) => new Tween<double>(begin: value));
_bottom = visitor(_bottom, config.bottom, (dynamic value) => new Tween<double>(begin: value)); _bottom = visitor(_bottom, widget.bottom, (dynamic value) => new Tween<double>(begin: value));
_width = visitor(_width, config.width, (dynamic value) => new Tween<double>(begin: value)); _width = visitor(_width, widget.width, (dynamic value) => new Tween<double>(begin: value));
_height = visitor(_height, config.height, (dynamic value) => new Tween<double>(begin: value)); _height = visitor(_height, widget.height, (dynamic value) => new Tween<double>(begin: value));
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Positioned( return new Positioned(
child: config.child, child: widget.child,
left: _left?.evaluate(animation), left: _left?.evaluate(animation),
top: _top?.evaluate(animation), top: _top?.evaluate(animation),
right: _right?.evaluate(animation), right: _right?.evaluate(animation),
...@@ -561,14 +561,14 @@ class _AnimatedOpacityState extends AnimatedWidgetBaseState<AnimatedOpacity> { ...@@ -561,14 +561,14 @@ class _AnimatedOpacityState extends AnimatedWidgetBaseState<AnimatedOpacity> {
@override @override
void forEachTween(TweenVisitor<dynamic> visitor) { void forEachTween(TweenVisitor<dynamic> visitor) {
// TODO(ianh): Use constructor tear-offs when it becomes possible // TODO(ianh): Use constructor tear-offs when it becomes possible
_opacity = visitor(_opacity, config.opacity, (dynamic value) => new Tween<double>(begin: value)); _opacity = visitor(_opacity, widget.opacity, (dynamic value) => new Tween<double>(begin: value));
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Opacity( return new Opacity(
opacity: _opacity.evaluate(animation), opacity: _opacity.evaluate(animation),
child: config.child child: widget.child
); );
} }
} }
...@@ -616,14 +616,14 @@ class _AnimatedDefaultTextStyleState extends AnimatedWidgetBaseState<AnimatedDef ...@@ -616,14 +616,14 @@ class _AnimatedDefaultTextStyleState extends AnimatedWidgetBaseState<AnimatedDef
@override @override
void forEachTween(TweenVisitor<dynamic> visitor) { void forEachTween(TweenVisitor<dynamic> visitor) {
// TODO(ianh): Use constructor tear-offs when it becomes possible // TODO(ianh): Use constructor tear-offs when it becomes possible
_style = visitor(_style, config.style, (dynamic value) => new TextStyleTween(begin: value)); _style = visitor(_style, widget.style, (dynamic value) => new TextStyleTween(begin: value));
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new DefaultTextStyle( return new DefaultTextStyle(
style: _style.evaluate(animation), style: _style.evaluate(animation),
child: config.child child: widget.child
); );
} }
} }
...@@ -704,22 +704,22 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin { ...@@ -704,22 +704,22 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
for (NavigatorObserver observer in config.observers) { for (NavigatorObserver observer in widget.observers) {
assert(observer.navigator == null); assert(observer.navigator == null);
observer._navigator = this; observer._navigator = this;
} }
push(config.onGenerateRoute(new RouteSettings( push(widget.onGenerateRoute(new RouteSettings(
name: config.initialRoute ?? Navigator.defaultRouteName, name: widget.initialRoute ?? Navigator.defaultRouteName,
isInitialRoute: true isInitialRoute: true
))); )));
} }
@override @override
void didUpdateConfig(Navigator oldConfig) { void didUpdateWidget(Navigator oldWidget) {
if (oldConfig.observers != config.observers) { if (oldWidget.observers != widget.observers) {
for (NavigatorObserver observer in oldConfig.observers) for (NavigatorObserver observer in oldWidget.observers)
observer._navigator = null; observer._navigator = null;
for (NavigatorObserver observer in config.observers) { for (NavigatorObserver observer in widget.observers) {
assert(observer.navigator == null); assert(observer.navigator == null);
observer._navigator = this; observer._navigator = this;
} }
...@@ -730,7 +730,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin { ...@@ -730,7 +730,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
void dispose() { void dispose() {
assert(!_debugLocked); assert(!_debugLocked);
assert(() { _debugLocked = true; return true; }); assert(() { _debugLocked = true; return true; });
for (NavigatorObserver observer in config.observers) for (NavigatorObserver observer in widget.observers)
observer._navigator = null; observer._navigator = null;
final List<Route<dynamic>> doomed = _poppedRoutes.toList()..addAll(_history); final List<Route<dynamic>> doomed = _poppedRoutes.toList()..addAll(_history);
for (Route<dynamic> route in doomed) for (Route<dynamic> route in doomed)
...@@ -759,10 +759,10 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin { ...@@ -759,10 +759,10 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
assert(!_debugLocked); assert(!_debugLocked);
assert(name != null); assert(name != null);
final RouteSettings settings = new RouteSettings(name: name); final RouteSettings settings = new RouteSettings(name: name);
Route<dynamic> route = config.onGenerateRoute(settings); Route<dynamic> route = widget.onGenerateRoute(settings);
if (route == null) { if (route == null) {
assert(config.onUnknownRoute != null); assert(widget.onUnknownRoute != null);
route = config.onUnknownRoute(settings); route = widget.onUnknownRoute(settings);
assert(route != null); assert(route != null);
} }
return route; return route;
...@@ -811,7 +811,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin { ...@@ -811,7 +811,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
route.didChangeNext(null); route.didChangeNext(null);
if (oldRoute != null) if (oldRoute != null)
oldRoute.didChangeNext(route); oldRoute.didChangeNext(route);
for (NavigatorObserver observer in config.observers) for (NavigatorObserver observer in widget.observers)
observer.didPush(route, oldRoute); observer.didPush(route, oldRoute);
}); });
assert(() { _debugLocked = false; return true; }); assert(() { _debugLocked = false; return true; });
...@@ -896,7 +896,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin { ...@@ -896,7 +896,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
newRoute.didChangeNext(null); newRoute.didChangeNext(null);
if (index > 0) if (index > 0)
_history[index - 1].didChangeNext(newRoute); _history[index - 1].didChangeNext(newRoute);
for (NavigatorObserver observer in config.observers) for (NavigatorObserver observer in widget.observers)
observer.didPush(newRoute, oldRoute); observer.didPush(newRoute, oldRoute);
}); });
assert(() { _debugLocked = false; return true; }); assert(() { _debugLocked = false; return true; });
...@@ -1015,7 +1015,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin { ...@@ -1015,7 +1015,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
if (route._navigator != null) if (route._navigator != null)
_poppedRoutes.add(route); _poppedRoutes.add(route);
_history.last.didPopNext(route); _history.last.didPopNext(route);
for (NavigatorObserver observer in config.observers) for (NavigatorObserver observer in widget.observers)
observer.didPop(route, _history.last); observer.didPop(route, _history.last);
}); });
} else { } else {
...@@ -1085,14 +1085,14 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin { ...@@ -1085,14 +1085,14 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
/// Used for the iOS back gesture. /// Used for the iOS back gesture.
void didStartUserGesture() { void didStartUserGesture() {
_userGestureInProgress = true; _userGestureInProgress = true;
for (NavigatorObserver observer in config.observers) for (NavigatorObserver observer in widget.observers)
observer.didStartUserGesture(); observer.didStartUserGesture();
} }
/// A user gesture is no longer controlling the navigator. /// A user gesture is no longer controlling the navigator.
void didStopUserGesture() { void didStopUserGesture() {
_userGestureInProgress = false; _userGestureInProgress = false;
for (NavigatorObserver observer in config.observers) for (NavigatorObserver observer in widget.observers)
observer.didStopUserGesture(); observer.didStopUserGesture();
} }
......
...@@ -167,7 +167,7 @@ class _OverlayEntry extends StatefulWidget { ...@@ -167,7 +167,7 @@ class _OverlayEntry extends StatefulWidget {
class _OverlayEntryState extends State<_OverlayEntry> { class _OverlayEntryState extends State<_OverlayEntry> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return config.entry.builder(context); return widget.entry.builder(context);
} }
void _markNeedsBuild() { void _markNeedsBuild() {
...@@ -271,7 +271,7 @@ class OverlayState extends State<Overlay> with TickerProviderStateMixin { ...@@ -271,7 +271,7 @@ class OverlayState extends State<Overlay> with TickerProviderStateMixin {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
insertAll(config.initialEntries); insertAll(widget.initialEntries);
} }
/// Insert the given entry into the overlay. /// Insert the given entry into the overlay.
......
...@@ -116,17 +116,17 @@ class _GlowingOverscrollIndicatorState extends State<GlowingOverscrollIndicator> ...@@ -116,17 +116,17 @@ class _GlowingOverscrollIndicatorState extends State<GlowingOverscrollIndicator>
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_leadingController = new _GlowController(vsync: this, color: config.color, axis: config.axis); _leadingController = new _GlowController(vsync: this, color: widget.color, axis: widget.axis);
_trailingController = new _GlowController(vsync: this, color: config.color, axis: config.axis); _trailingController = new _GlowController(vsync: this, color: widget.color, axis: widget.axis);
} }
@override @override
void didUpdateConfig(GlowingOverscrollIndicator oldConfig) { void didUpdateWidget(GlowingOverscrollIndicator oldWidget) {
if (oldConfig.color != config.color || oldConfig.axis != config.axis) { if (oldWidget.color != widget.color || oldWidget.axis != widget.axis) {
_leadingController.color = config.color; _leadingController.color = widget.color;
_leadingController.axis = config.axis; _leadingController.axis = widget.axis;
_trailingController.color = config.color; _trailingController.color = widget.color;
_trailingController.axis = config.axis; _trailingController.axis = widget.axis;
} }
} }
...@@ -152,7 +152,7 @@ class _GlowingOverscrollIndicatorState extends State<GlowingOverscrollIndicator> ...@@ -152,7 +152,7 @@ class _GlowingOverscrollIndicatorState extends State<GlowingOverscrollIndicator>
_accepted[isLeading] = confirmationNotification._accepted; _accepted[isLeading] = confirmationNotification._accepted;
} }
assert(controller != null); assert(controller != null);
assert(notification.axis == config.axis); assert(notification.axis == widget.axis);
if (_accepted[isLeading]) { if (_accepted[isLeading]) {
if (notification.velocity != 0.0) { if (notification.velocity != 0.0) {
assert(notification.dragDetails == null); assert(notification.dragDetails == null);
...@@ -201,12 +201,12 @@ class _GlowingOverscrollIndicatorState extends State<GlowingOverscrollIndicator> ...@@ -201,12 +201,12 @@ class _GlowingOverscrollIndicatorState extends State<GlowingOverscrollIndicator>
child: new RepaintBoundary( child: new RepaintBoundary(
child: new CustomPaint( child: new CustomPaint(
foregroundPainter: new _GlowingOverscrollIndicatorPainter( foregroundPainter: new _GlowingOverscrollIndicatorPainter(
leadingController: config.showLeading ? _leadingController : null, leadingController: widget.showLeading ? _leadingController : null,
trailingController: config.showTrailing ? _trailingController : null, trailingController: widget.showTrailing ? _trailingController : null,
axisDirection: config.axisDirection, axisDirection: widget.axisDirection,
), ),
child: new RepaintBoundary( child: new RepaintBoundary(
child: config.child, child: widget.child,
), ),
), ),
), ),
......
...@@ -388,16 +388,16 @@ class _PageViewState extends State<PageView> { ...@@ -388,16 +388,16 @@ class _PageViewState extends State<PageView> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_lastReportedPage = config.controller.initialPage; _lastReportedPage = widget.controller.initialPage;
} }
AxisDirection _getDirection(BuildContext context) { AxisDirection _getDirection(BuildContext context) {
// TODO(abarth): Consider reading direction. // TODO(abarth): Consider reading direction.
switch (config.scrollDirection) { switch (widget.scrollDirection) {
case Axis.horizontal: case Axis.horizontal:
return config.reverse ? AxisDirection.left : AxisDirection.right; return widget.reverse ? AxisDirection.left : AxisDirection.right;
case Axis.vertical: case Axis.vertical:
return config.reverse ? AxisDirection.up : AxisDirection.down; return widget.reverse ? AxisDirection.up : AxisDirection.down;
} }
return null; return null;
} }
...@@ -407,28 +407,28 @@ class _PageViewState extends State<PageView> { ...@@ -407,28 +407,28 @@ class _PageViewState extends State<PageView> {
final AxisDirection axisDirection = _getDirection(context); final AxisDirection axisDirection = _getDirection(context);
return new NotificationListener<ScrollNotification>( return new NotificationListener<ScrollNotification>(
onNotification: (ScrollNotification notification) { onNotification: (ScrollNotification notification) {
if (notification.depth == 0 && config.onPageChanged != null && notification is ScrollUpdateNotification) { if (notification.depth == 0 && widget.onPageChanged != null && notification is ScrollUpdateNotification) {
final PageMetrics metrics = notification.metrics; final PageMetrics metrics = notification.metrics;
final int currentPage = metrics.page.round(); final int currentPage = metrics.page.round();
if (currentPage != _lastReportedPage) { if (currentPage != _lastReportedPage) {
_lastReportedPage = currentPage; _lastReportedPage = currentPage;
config.onPageChanged(currentPage); widget.onPageChanged(currentPage);
} }
} }
return false; return false;
}, },
child: new Scrollable( child: new Scrollable(
axisDirection: axisDirection, axisDirection: axisDirection,
controller: config.controller, controller: widget.controller,
physics: config.physics == null ? _kPagePhysics : _kPagePhysics.applyTo(config.physics), physics: widget.physics == null ? _kPagePhysics : _kPagePhysics.applyTo(widget.physics),
viewportBuilder: (BuildContext context, ViewportOffset offset) { viewportBuilder: (BuildContext context, ViewportOffset offset) {
return new Viewport( return new Viewport(
axisDirection: axisDirection, axisDirection: axisDirection,
offset: offset, offset: offset,
slivers: <Widget>[ slivers: <Widget>[
new SliverFillViewport( new SliverFillViewport(
viewportFraction: config.controller.viewportFraction, viewportFraction: widget.controller.viewportFraction,
delegate: config.childrenDelegate delegate: widget.childrenDelegate
), ),
], ],
); );
...@@ -440,10 +440,10 @@ class _PageViewState extends State<PageView> { ...@@ -440,10 +440,10 @@ class _PageViewState extends State<PageView> {
@override @override
void debugFillDescription(List<String> description) { void debugFillDescription(List<String> description) {
super.debugFillDescription(description); super.debugFillDescription(description);
description.add('${config.scrollDirection}'); description.add('${widget.scrollDirection}');
if (config.reverse) if (widget.reverse)
description.add('reversed'); description.add('reversed');
description.add('${config.controller}'); description.add('${widget.controller}');
description.add('${config.physics}'); description.add('${widget.physics}');
} }
} }
...@@ -95,7 +95,7 @@ abstract class ScrollNotification extends LayoutChangedNotification with Viewpor ...@@ -95,7 +95,7 @@ abstract class ScrollNotification extends LayoutChangedNotification with Viewpor
/// Creates a notification about scrolling. /// Creates a notification about scrolling.
ScrollNotification({ ScrollNotification({
@required ScrollableState scrollable, @required ScrollableState scrollable,
}) : axisDirection = scrollable.config.axisDirection, }) : axisDirection = scrollable.widget.axisDirection,
metrics = scrollable.position.getMetrics(), metrics = scrollable.position.getMetrics(),
context = scrollable.context; context = scrollable.context;
......
...@@ -142,7 +142,7 @@ class _SemanticsDebuggerState extends State<SemanticsDebugger> { ...@@ -142,7 +142,7 @@ class _SemanticsDebuggerState extends State<SemanticsDebugger> {
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
child: new IgnorePointer( child: new IgnorePointer(
ignoringSemantics: false, ignoringSemantics: false,
child: config.child child: widget.child
) )
) )
) )
......
...@@ -19,8 +19,8 @@ class StateMarkerState extends State<StateMarker> { ...@@ -19,8 +19,8 @@ class StateMarkerState extends State<StateMarker> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (config.child != null) if (widget.child != null)
return config.child; return widget.child;
return new Container(); return new Container();
} }
} }
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment