Update gallery demo list (again) (#4339)
This commit is contained in:
parent
f2ea70d93e
commit
1d516f0e94
@ -26,6 +26,11 @@ assets:
|
||||
- packages/flutter_gallery_assets/landscape_10.jpg
|
||||
- packages/flutter_gallery_assets/landscape_11.jpg
|
||||
- lib/gallery/example_code.dart
|
||||
- packages/flutter_gallery_assets/shrine/vendors/16c477b.jpg
|
||||
- packages/flutter_gallery_assets/shrine/vendors/ali-connors.png
|
||||
- packages/flutter_gallery_assets/shrine/vendors/peter-carlsson.png
|
||||
- packages/flutter_gallery_assets/shrine/vendors/sandra-adams.jpg
|
||||
- packages/flutter_gallery_assets/shrine/vendors/zach.jpg
|
||||
fonts:
|
||||
- family: AbrilFatface
|
||||
fonts:
|
||||
|
@ -3,6 +3,7 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
export 'buttons_demo.dart';
|
||||
export 'contacts_demo.dart';
|
||||
export 'cards_demo.dart';
|
||||
export 'calculator_demo.dart';
|
||||
export 'chip_demo.dart';
|
||||
@ -11,7 +12,6 @@ export 'data_table_demo.dart';
|
||||
export 'date_picker_demo.dart';
|
||||
export 'dialog_demo.dart';
|
||||
export 'drop_down_demo.dart';
|
||||
export 'flexible_space_demo.dart';
|
||||
export 'grid_list_demo.dart';
|
||||
export 'icons_demo.dart';
|
||||
export 'leave_behind_demo.dart';
|
||||
|
@ -70,14 +70,14 @@ class _ContactItem extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class FlexibleSpaceDemo extends StatefulWidget {
|
||||
static const String routeName = '/flexible-space';
|
||||
class ContactsDemo extends StatefulWidget {
|
||||
static const String routeName = '/contacts';
|
||||
|
||||
@override
|
||||
FlexibleSpaceDemoState createState() => new FlexibleSpaceDemoState();
|
||||
ContactsDemoState createState() => new ContactsDemoState();
|
||||
}
|
||||
|
||||
class FlexibleSpaceDemoState extends State<FlexibleSpaceDemo> {
|
||||
class ContactsDemoState extends State<ContactsDemo> {
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
|
||||
final double _appBarHeight = 256.0;
|
||||
AppBarBehavior _appBarBehavior = AppBarBehavior.scroll;
|
@ -1,159 +0,0 @@
|
||||
// Copyright 2016 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'flexible_space_demo.dart';
|
||||
|
||||
class _BarGraphic extends StatelessWidget {
|
||||
_BarGraphic({ Key key, this.height, this.color, this.leftText, this.rightText: '' })
|
||||
: super(key: key) {
|
||||
assert(height != null);
|
||||
assert(color != null);
|
||||
assert(leftText != null);
|
||||
}
|
||||
|
||||
final double height;
|
||||
final Color color;
|
||||
final String leftText;
|
||||
final String rightText;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Container(
|
||||
height: height,
|
||||
width: 200.0,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
decoration: new BoxDecoration(backgroundColor: color),
|
||||
child: new DefaultTextStyle(
|
||||
style: Theme.of(context).textTheme.body1.copyWith(color: Colors.white),
|
||||
child: new Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
new Text(leftText),
|
||||
new Text(rightText)
|
||||
]
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _StatusBarGraphic extends _BarGraphic {
|
||||
_StatusBarGraphic() : super(
|
||||
height: 24.0,
|
||||
color: Colors.green[400],
|
||||
leftText: 'Status Bar',
|
||||
rightText: '24dp'
|
||||
);
|
||||
}
|
||||
|
||||
class _AppBarGraphic extends _BarGraphic {
|
||||
_AppBarGraphic() : super(
|
||||
height: 48.0,
|
||||
color: Colors.blue[400],
|
||||
leftText: 'Tool Bar',
|
||||
rightText: '48dp'
|
||||
);
|
||||
}
|
||||
|
||||
class _TabBarGraphic extends _BarGraphic {
|
||||
_TabBarGraphic() : super(
|
||||
height: 48.0,
|
||||
color: Colors.purple[400],
|
||||
leftText: 'Tab Bar',
|
||||
rightText: '56dp'
|
||||
);
|
||||
}
|
||||
|
||||
class _FlexibleSpaceGraphic extends _BarGraphic {
|
||||
_FlexibleSpaceGraphic() : super(
|
||||
height: 128.0,
|
||||
color: Colors.pink[400],
|
||||
leftText: 'Flexible Space'
|
||||
);
|
||||
}
|
||||
|
||||
class _TechniqueItem extends StatelessWidget {
|
||||
_TechniqueItem({ this.titleText, this.barGraphics, this.builder });
|
||||
|
||||
final String titleText;
|
||||
final List<Widget> barGraphics;
|
||||
final WidgetBuilder builder;
|
||||
|
||||
void showDemo(BuildContext context) {
|
||||
Navigator.push(context, new MaterialPageRoute<Null>(builder: builder));
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Card(
|
||||
child: new InkWell(
|
||||
onTap: () { showDemo(context); },
|
||||
child: new Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: new Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children :<Widget>[
|
||||
new Text(titleText),
|
||||
new Column(children: barGraphics)
|
||||
]
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const String _introText =
|
||||
"An AppBar is a combination of a ToolBar and a TabBar or a flexible space "
|
||||
"Widget that is managed by the Scaffold. The Scaffold pads the ToolBar so that "
|
||||
"it appears behind the device's status bar. When a flexible space Widget is "
|
||||
"specified it is stacked on top of the ToolBar.";
|
||||
|
||||
class ScrollingTechniquesDemo extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Scaffold(
|
||||
appBar: new AppBar(title: new Text('Scrolling techniques')),
|
||||
body: new Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: new Block(
|
||||
children: <Widget>[
|
||||
new Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 32.0),
|
||||
child: new Text(_introText, style: Theme.of(context).textTheme.caption)
|
||||
),
|
||||
new _TechniqueItem(
|
||||
builder: (BuildContext context) => new FlexibleSpaceDemo(),
|
||||
titleText: 'Standard',
|
||||
barGraphics: <Widget>[
|
||||
new _StatusBarGraphic(),
|
||||
new _AppBarGraphic()
|
||||
]
|
||||
),
|
||||
new _TechniqueItem(
|
||||
titleText: 'Tabs',
|
||||
builder: (BuildContext context) => new FlexibleSpaceDemo(),
|
||||
barGraphics: <Widget>[
|
||||
new _StatusBarGraphic(),
|
||||
new _AppBarGraphic(),
|
||||
new _TabBarGraphic()
|
||||
]
|
||||
),
|
||||
new _TechniqueItem(
|
||||
titleText: 'Flexible',
|
||||
builder: (BuildContext context) => new FlexibleSpaceDemo(),
|
||||
barGraphics: <Widget>[
|
||||
new _StatusBarGraphic(),
|
||||
new _AppBarGraphic(),
|
||||
new _FlexibleSpaceGraphic()
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@ import 'shrine_types.dart';
|
||||
|
||||
const Vendor _ali = const Vendor(
|
||||
name: 'Ali’s shop',
|
||||
avatarUrl: 'https://www.gstatic.com/angular/material-adaptive/shrine/ali-connors.png',
|
||||
avatarAsset: 'packages/flutter_gallery_assets/shrine/vendors/ali-connors.png',
|
||||
description:
|
||||
'Ali Connor’s makes custom goods for folks of all shapes and sizes '
|
||||
'made by hand and sometimes by machine, but always with love and care. '
|
||||
@ -15,7 +15,7 @@ const Vendor _ali = const Vendor(
|
||||
|
||||
const Vendor _sandra = const Vendor(
|
||||
name: 'Sandra’s shop',
|
||||
avatarUrl: 'https://www.gstatic.com/angular/material-adaptive/shrine/sandra-adams.jpg',
|
||||
avatarAsset: 'packages/flutter_gallery_assets/shrine/vendors/sandra-adams.jpg',
|
||||
description:
|
||||
'Sandra specializes in furniture, beauty and travel products with a classic vibe. '
|
||||
'Custom orders are available if you’re looking for a certain color or material.'
|
||||
@ -23,7 +23,7 @@ const Vendor _sandra = const Vendor(
|
||||
|
||||
const Vendor _trevor = const Vendor(
|
||||
name: 'Trevor’s shop',
|
||||
avatarUrl: 'https://www.gstatic.com/angular/material-adaptive/shrine/zach.jpg',
|
||||
avatarAsset: 'packages/flutter_gallery_assets/shrine/vendors/zach.jpg',
|
||||
description:
|
||||
'Trevor makes great stuff for awesome people like you. Super cool and extra '
|
||||
'awesome all of his shop’s goods are handmade with love. Custom orders are '
|
||||
@ -32,7 +32,7 @@ const Vendor _trevor = const Vendor(
|
||||
|
||||
const Vendor _peter = const Vendor(
|
||||
name: 'Peter’s shop',
|
||||
avatarUrl: 'https://www.gstatic.com/angular/material-adaptive/shrine/peter-carlsson.png',
|
||||
avatarAsset: 'packages/flutter_gallery_assets/shrine/vendors/peter-carlsson.png',
|
||||
description:
|
||||
'Peter makes great stuff for awesome people like you. Super cool and extra '
|
||||
'awesome all of his shop’s goods are handmade with love. Custom orders are '
|
||||
@ -41,7 +41,7 @@ const Vendor _peter = const Vendor(
|
||||
|
||||
const Vendor _stella = const Vendor(
|
||||
name: 'Stella’s shop',
|
||||
avatarUrl: 'https://www.gstatic.com/angular/material-adaptive/shrine/16c477b.jpg',
|
||||
avatarAsset: 'packages/flutter_gallery_assets/shrine/vendors/16c477b.jpg',
|
||||
description:
|
||||
'Stella sells awesome stuff at lovely prices. made by hand and sometimes by '
|
||||
'machine, but always with love and care. Custom orders are available upon request '
|
||||
|
@ -36,9 +36,9 @@ class VendorItem extends StatelessWidget {
|
||||
child: new ClipRRect(
|
||||
xRadius: 12.0,
|
||||
yRadius: 12.0,
|
||||
child: new NetworkImage(
|
||||
child: new AssetImage(
|
||||
fit: ImageFit.cover,
|
||||
src: vendor.avatarUrl
|
||||
name: vendor.avatarAsset
|
||||
)
|
||||
)
|
||||
),
|
||||
|
@ -10,17 +10,17 @@ class Vendor {
|
||||
const Vendor({
|
||||
this.name,
|
||||
this.description,
|
||||
this.avatarUrl
|
||||
this.avatarAsset
|
||||
});
|
||||
|
||||
final String name;
|
||||
final String description;
|
||||
final String avatarUrl;
|
||||
final String avatarAsset;
|
||||
|
||||
bool isValid() {
|
||||
return name != null &&
|
||||
description != null &&
|
||||
avatarUrl != null;
|
||||
avatarAsset != null;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -8,11 +8,11 @@ import 'package:flutter/scheduler.dart' show timeDilation;
|
||||
import '../demo/all.dart';
|
||||
import 'home.dart';
|
||||
|
||||
// Warning: this list must be in the same order that the demos appear in GalleryHome.
|
||||
final Map<String, WidgetBuilder> kRoutes = <String, WidgetBuilder>{
|
||||
ShrineDemo.routeName: (BuildContext context) => new ShrineDemo(),
|
||||
Calculator.routeName: (BuildContext context) => new Calculator(),
|
||||
FlexibleSpaceDemo.routeName: (BuildContext context) => new FlexibleSpaceDemo(),
|
||||
TabsFabDemo.routeName: (BuildContext context) => new TabsFabDemo(),
|
||||
ContactsDemo.routeName: (BuildContext context) => new ContactsDemo(),
|
||||
ButtonsDemo.routeName: (BuildContext context) => new ButtonsDemo(),
|
||||
CardsDemo.routeName: (BuildContext context) => new CardsDemo(),
|
||||
ChipDemo.routeName: (BuildContext context) => new ChipDemo(),
|
||||
@ -21,6 +21,7 @@ final Map<String, WidgetBuilder> kRoutes = <String, WidgetBuilder>{
|
||||
DialogDemo.routeName: (BuildContext context) => new DialogDemo(),
|
||||
DropDownDemo.routeName: (BuildContext context) => new DropDownDemo(),
|
||||
TwoLevelListDemo.routeName: (BuildContext context) => new TwoLevelListDemo(),
|
||||
TabsFabDemo.routeName: (BuildContext context) => new TabsFabDemo(),
|
||||
GridListDemo.routeName: (BuildContext context) => new GridListDemo(),
|
||||
IconsDemo.routeName: (BuildContext context) => new IconsDemo(),
|
||||
LeaveBehindDemo.routeName: (BuildContext context) => new LeaveBehindDemo(),
|
||||
|
@ -73,8 +73,7 @@ class GalleryHomeState extends State<GalleryHome> {
|
||||
children: <Widget>[
|
||||
new GalleryItem(title: 'Shrine', routeName: ShrineDemo.routeName),
|
||||
new GalleryItem(title: 'Calculator', routeName: Calculator.routeName),
|
||||
new GalleryItem(title: 'Flexible space toolbar', routeName: FlexibleSpaceDemo.routeName),
|
||||
new GalleryItem(title: 'Floating action button', routeName: TabsFabDemo.routeName),
|
||||
new GalleryItem(title: 'Contacts', routeName: ContactsDemo.routeName)
|
||||
]
|
||||
),
|
||||
new TwoLevelSublist(
|
||||
@ -89,6 +88,7 @@ class GalleryHomeState extends State<GalleryHome> {
|
||||
new GalleryItem(title: 'Dialog', routeName: DialogDemo.routeName),
|
||||
new GalleryItem(title: 'Drop-down button', routeName: DropDownDemo.routeName),
|
||||
new GalleryItem(title: 'Expand/collapse list control', routeName: TwoLevelListDemo.routeName),
|
||||
new GalleryItem(title: 'Floating action button', routeName: TabsFabDemo.routeName),
|
||||
new GalleryItem(title: 'Grid', routeName: GridListDemo.routeName),
|
||||
new GalleryItem(title: 'Icons', routeName: IconsDemo.routeName),
|
||||
new GalleryItem(title: 'Leave-behind list items', routeName: LeaveBehindDemo.routeName),
|
||||
|
@ -42,7 +42,7 @@ void main() {
|
||||
await tester.pump(const Duration(seconds: 1)); // end animation
|
||||
|
||||
// Open Flexible space toolbar
|
||||
await tester.tap(find.text('Flexible space toolbar'));
|
||||
await tester.tap(find.text('Contacts'));
|
||||
await tester.pump(); // start animation
|
||||
await tester.pump(const Duration(seconds: 1)); // end animation
|
||||
|
||||
|
@ -15,8 +15,8 @@ import 'package:test/test.dart';
|
||||
const List<String> demoCategories = const <String>['Demos', 'Components', 'Style'];
|
||||
|
||||
const List<String> demoNames = const <String>[
|
||||
'Flexible space toolbar',
|
||||
'Floating action button',
|
||||
'Shrine',
|
||||
'Contacts',
|
||||
'Buttons',
|
||||
'Cards',
|
||||
'Chips',
|
||||
@ -25,6 +25,7 @@ const List<String> demoNames = const <String>[
|
||||
'Dialog',
|
||||
'Drop-down button',
|
||||
'Expand/collapse list control',
|
||||
'Floating action button',
|
||||
'Grid',
|
||||
'Icons',
|
||||
'Leave-behind list items',
|
||||
|
Loading…
x
Reference in New Issue
Block a user