Commit 67254ef6 authored by Todd Volkert's avatar Todd Volkert Committed by GitHub

Run `dartfmt` on a few of the gallery example files (#6260)

parent 3161d1a5
...@@ -15,7 +15,7 @@ class NavigationIconView { ...@@ -15,7 +15,7 @@ class NavigationIconView {
destinationLabel = new DestinationLabel( destinationLabel = new DestinationLabel(
icon: icon, icon: icon,
title: title, title: title,
backgroundColor: color backgroundColor: color,
), ),
controller = new AnimationController( controller = new AnimationController(
duration: kThemeAnimationDuration, duration: kThemeAnimationDuration,
...@@ -23,7 +23,7 @@ class NavigationIconView { ...@@ -23,7 +23,7 @@ class NavigationIconView {
) { ) {
_animation = new CurvedAnimation( _animation = new CurvedAnimation(
parent: controller, parent: controller,
curve: new Interval(0.5, 1.0, curve: Curves.fastOutSlowIn) curve: new Interval(0.5, 1.0, curve: Curves.fastOutSlowIn),
); );
} }
...@@ -39,8 +39,9 @@ class NavigationIconView { ...@@ -39,8 +39,9 @@ class NavigationIconView {
iconColor = _color; iconColor = _color;
} else { } else {
final ThemeData themeData = Theme.of(context); final ThemeData themeData = Theme.of(context);
iconColor = themeData.brightness == Brightness.light ? iconColor = themeData.brightness == Brightness.light
themeData.primaryColor : themeData.accentColor; ? themeData.primaryColor
: themeData.accentColor;
} }
return new FadeTransition( return new FadeTransition(
...@@ -48,10 +49,10 @@ class NavigationIconView { ...@@ -48,10 +49,10 @@ class NavigationIconView {
child: new SlideTransition( child: new SlideTransition(
position: new Tween<FractionalOffset>( position: new Tween<FractionalOffset>(
begin: const FractionalOffset(0.0, 0.02), // Small offset from the top. begin: const FractionalOffset(0.0, 0.02), // Small offset from the top.
end: FractionalOffset.topLeft end: FractionalOffset.topLeft,
).animate(_animation), ).animate(_animation),
child: new Icon(_icon.icon, color: iconColor, size: 120.0) child: new Icon(_icon.icon, color: iconColor, size: 120.0),
) ),
); );
} }
} }
...@@ -63,7 +64,8 @@ class BottomNavigationDemo extends StatefulWidget { ...@@ -63,7 +64,8 @@ class BottomNavigationDemo extends StatefulWidget {
_BottomNavigationDemoState createState() => new _BottomNavigationDemoState(); _BottomNavigationDemoState createState() => new _BottomNavigationDemoState();
} }
class _BottomNavigationDemoState extends State<BottomNavigationDemo> with TickerProviderStateMixin { class _BottomNavigationDemoState extends State<BottomNavigationDemo>
with TickerProviderStateMixin {
int _currentIndex = 0; int _currentIndex = 0;
BottomNavigationBarType _type = BottomNavigationBarType.shifting; BottomNavigationBarType _type = BottomNavigationBarType.shifting;
List<NavigationIconView> _navigationViews; List<NavigationIconView> _navigationViews;
...@@ -136,9 +138,9 @@ class _BottomNavigationDemoState extends State<BottomNavigationDemo> with Ticker ...@@ -136,9 +138,9 @@ class _BottomNavigationDemoState extends State<BottomNavigationDemo> with Ticker
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final BottomNavigationBar botNavBar = new BottomNavigationBar( final BottomNavigationBar botNavBar = new BottomNavigationBar(
labels: _navigationViews.map( labels: _navigationViews
(NavigationIconView navigationView) => navigationView.destinationLabel .map((NavigationIconView navigationView) => navigationView.destinationLabel)
).toList(), .toList(),
currentIndex: _currentIndex, currentIndex: _currentIndex,
type: _type, type: _type,
onTap: (int index) { onTap: (int index) {
...@@ -147,7 +149,7 @@ class _BottomNavigationDemoState extends State<BottomNavigationDemo> with Ticker ...@@ -147,7 +149,7 @@ class _BottomNavigationDemoState extends State<BottomNavigationDemo> with Ticker
_currentIndex = index; _currentIndex = index;
_navigationViews[_currentIndex].controller.forward(); _navigationViews[_currentIndex].controller.forward();
}); });
} },
); );
return new Scaffold( return new Scaffold(
...@@ -169,9 +171,9 @@ class _BottomNavigationDemoState extends State<BottomNavigationDemo> with Ticker ...@@ -169,9 +171,9 @@ class _BottomNavigationDemoState extends State<BottomNavigationDemo> with Ticker
value: BottomNavigationBarType.shifting, value: BottomNavigationBarType.shifting,
child: new Text('Shifting'), child: new Text('Shifting'),
) )
] ],
) )
] ],
), ),
body: _buildBody(), body: _buildBody(),
bottomNavigationBar: botNavBar, bottomNavigationBar: botNavBar,
......
...@@ -7,36 +7,35 @@ import 'package:flutter/material.dart'; ...@@ -7,36 +7,35 @@ import 'package:flutter/material.dart';
import '../gallery/demo.dart'; import '../gallery/demo.dart';
const String _raisedText = const String _raisedText =
"Raised buttons add dimension to mostly flat layouts. They emphasize " "Raised buttons add dimension to mostly flat layouts. They emphasize "
"functions on busy or wide spaces."; "functions on busy or wide spaces.";
const String _raisedCode = 'buttons_raised'; const String _raisedCode = 'buttons_raised';
const String _flatText = const String _flatText = "A flat button displays an ink splash on press "
"A flat button displays an ink splash on press " "but does not lift. Use flat buttons on toolbars, in dialogs and "
"but does not lift. Use flat buttons on toolbars, in dialogs and " "inline with padding";
"inline with padding";
const String _flatCode = 'buttons_flat'; const String _flatCode = 'buttons_flat';
const String _dropdownText = const String _dropdownText =
"A dropdown button displays a menu that's used to select a value from a " "A dropdown button displays a menu that's used to select a value from a "
"small set of values. The button displays the current value and a down " "small set of values. The button displays the current value and a down "
"arrow."; "arrow.";
const String _dropdownCode = 'buttons_dropdown'; const String _dropdownCode = 'buttons_dropdown';
const String _iconText = const String _iconText =
"IconButtons are appropriate for toggle buttons that allow a single choice to be " "IconButtons are appropriate for toggle buttons that allow a single choice "
"selected or deselected, such as adding or removing an item's star."; "to be selected or deselected, such as adding or removing an item's star.";
const String _iconCode = 'buttons_icon'; const String _iconCode = 'buttons_icon';
const String _actionText = const String _actionText =
"Floating action buttons are used for a promoted action. They are " "Floating action buttons are used for a promoted action. They are "
"distinguished by a circled icon floating above the UI and can have motion " "distinguished by a circled icon floating above the UI and can have motion "
"behaviors that include morphing, launching, and a transferring anchor " "behaviors that include morphing, launching, and a transferring anchor "
"point."; "point.";
const String _actionCode = 'buttons_action'; const String _actionCode = 'buttons_action';
...@@ -55,37 +54,37 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -55,37 +54,37 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
tabName: 'RAISED', tabName: 'RAISED',
description: _raisedText, description: _raisedText,
widget: buildRaisedButton(), widget: buildRaisedButton(),
exampleCodeTag: _raisedCode exampleCodeTag: _raisedCode,
), ),
new ComponentDemoTabData( new ComponentDemoTabData(
tabName: 'FLAT', tabName: 'FLAT',
description: _flatText, description: _flatText,
widget: buildFlatButton(), widget: buildFlatButton(),
exampleCodeTag: _flatCode exampleCodeTag: _flatCode,
), ),
new ComponentDemoTabData( new ComponentDemoTabData(
tabName: 'DROPDOWN', tabName: 'DROPDOWN',
description: _dropdownText, description: _dropdownText,
widget: buildDropdownButton(), widget: buildDropdownButton(),
exampleCodeTag: _dropdownCode exampleCodeTag: _dropdownCode,
), ),
new ComponentDemoTabData( new ComponentDemoTabData(
tabName: 'ICON', tabName: 'ICON',
description: _iconText, description: _iconText,
widget: buildIconButton(), widget: buildIconButton(),
exampleCodeTag: _iconCode exampleCodeTag: _iconCode,
), ),
new ComponentDemoTabData( new ComponentDemoTabData(
tabName: 'ACTION', tabName: 'ACTION',
description: _actionText, description: _actionText,
widget: buildActionButton(), widget: buildActionButton(),
exampleCodeTag: _actionCode exampleCodeTag: _actionCode,
), ),
]; ];
return new TabbedComponentDemoScaffold( return new TabbedComponentDemoScaffold(
title: 'Buttons', title: 'Buttons',
demos: demos demos: demos,
); );
} }
...@@ -99,14 +98,14 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -99,14 +98,14 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
child: new Text('RAISED BUTTON'), child: new Text('RAISED BUTTON'),
onPressed: () { onPressed: () {
// Perform some action // Perform some action
} },
), ),
new RaisedButton( new RaisedButton(
child: new Text('DISABLED'), child: new Text('DISABLED'),
onPressed: null onPressed: null,
) )
] ],
) ),
); );
} }
...@@ -120,14 +119,14 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -120,14 +119,14 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
child: new Text('FLAT BUTTON'), child: new Text('FLAT BUTTON'),
onPressed: () { onPressed: () {
// Perform some action // Perform some action
} },
), ),
new FlatButton( new FlatButton(
child: new Text('DISABLED'), child: new Text('DISABLED'),
onPressed: null onPressed: null,
) )
] ],
) ),
); );
} }
...@@ -158,13 +157,14 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -158,13 +157,14 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
.map((String value) { .map((String value) {
return new DropdownMenuItem<String>( return new DropdownMenuItem<String>(
value: value, value: value,
child: new Text(value)); child: new Text(value),
);
}) })
.toList() .toList(),
) ),
), ),
new SizedBox( new SizedBox(
height: 24.0 height: 24.0,
), ),
new ListItem( new ListItem(
title: new Text('Simple dropdown:'), title: new Text('Simple dropdown:'),
...@@ -176,17 +176,16 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -176,17 +176,16 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
dropdown2Value = newValue; dropdown2Value = newValue;
}); });
}, },
items: <String>['One', 'Two', 'Free', 'Four'] items: <String>['One', 'Two', 'Free', 'Four'].map((String value) {
.map((String value) { return new DropdownMenuItem<String>(
return new DropdownMenuItem<String>( value: value,
value: value, child: new Text(value),
child: new Text(value)); );
}) }).toList(),
.toList() ),
)
) )
] ],
) ),
); );
} }
...@@ -203,16 +202,16 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -203,16 +202,16 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
onPressed: () { onPressed: () {
setState(() => iconButtonToggle = !iconButtonToggle); setState(() => iconButtonToggle = !iconButtonToggle);
}, },
color: iconButtonToggle ? Theme.of(context).primaryColor : null color: iconButtonToggle ? Theme.of(context).primaryColor : null,
), ),
new IconButton( new IconButton(
icon: new Icon(Icons.thumb_up), icon: new Icon(Icons.thumb_up),
onPressed: null onPressed: null,
) )
] ]
.map((Widget button) => new SizedBox(width: 64.0, height: 64.0, child: button)) .map((Widget button) => new SizedBox(width: 64.0, height: 64.0, child: button))
.toList() .toList(),
) ),
); );
} }
...@@ -223,8 +222,8 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -223,8 +222,8 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
child: new Icon(Icons.add), child: new Icon(Icons.add),
onPressed: () { onPressed: () {
// Perform some action // Perform some action
} },
) ),
); );
} }
} }
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