Unverified Commit 75b24070 authored by xster's avatar xster Committed by GitHub

Add API docs link to each gallery demo (#22379)

parent c60560fb
...@@ -3,18 +3,21 @@ ...@@ -3,18 +3,21 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class CupertinoProgressIndicatorDemo extends StatelessWidget { class CupertinoProgressIndicatorDemo extends StatelessWidget {
static const String routeName = '/cupertino/progress_indicator'; static const String routeName = '/cupertino/progress_indicator';
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return CupertinoPageScaffold(
appBar: AppBar( navigationBar: CupertinoNavigationBar(
title: const Text('Cupertino Activity Indicator'), previousPageTitle: 'Cupertino',
middle: const Text('Cupertino Activity Indicator'),
trailing: CupertinoDemoDocumentationButton(routeName),
), ),
body: const Center( child: const Center(
child: CupertinoActivityIndicator(), child: CupertinoActivityIndicator(),
), ),
); );
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class CupertinoAlertDemo extends StatefulWidget { class CupertinoAlertDemo extends StatefulWidget {
static const String routeName = '/cupertino/alert'; static const String routeName = '/cupertino/alert';
...@@ -53,6 +55,7 @@ class _CupertinoAlertDemoState extends State<CupertinoAlertDemo> { ...@@ -53,6 +55,7 @@ class _CupertinoAlertDemoState extends State<CupertinoAlertDemo> {
key: _scaffoldKey, key: _scaffoldKey,
appBar: AppBar( appBar: AppBar(
title: const Text('Cupertino Alerts'), title: const Text('Cupertino Alerts'),
actions: <Widget>[MaterialDemoDocumentationButton(CupertinoAlertDemo.routeName)],
), ),
body: ListView( body: ListView(
padding: const EdgeInsets.symmetric(vertical: 24.0, horizontal: 72.0), padding: const EdgeInsets.symmetric(vertical: 24.0, horizontal: 72.0),
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class CupertinoButtonsDemo extends StatefulWidget { class CupertinoButtonsDemo extends StatefulWidget {
static const String routeName = '/cupertino/buttons'; static const String routeName = '/cupertino/buttons';
...@@ -20,6 +22,7 @@ class _CupertinoButtonDemoState extends State<CupertinoButtonsDemo> { ...@@ -20,6 +22,7 @@ class _CupertinoButtonDemoState extends State<CupertinoButtonsDemo> {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: const Text('Cupertino Buttons'), title: const Text('Cupertino Buttons'),
actions: <Widget>[MaterialDemoDocumentationButton(CupertinoButtonsDemo.routeName)],
), ),
body: Column( body: Column(
children: <Widget> [ children: <Widget> [
......
...@@ -8,6 +8,8 @@ import 'dart:math' as math; ...@@ -8,6 +8,8 @@ import 'dart:math' as math;
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
const String _kGalleryAssetsPackage = 'flutter_gallery_assets'; const String _kGalleryAssetsPackage = 'flutter_gallery_assets';
const List<Color> coolColors = <Color>[ const List<Color> coolColors = <Color>[
...@@ -125,6 +127,15 @@ class ExitButton extends StatelessWidget { ...@@ -125,6 +127,15 @@ class ExitButton extends StatelessWidget {
} }
} }
final Widget trailingButtons = Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
CupertinoDemoDocumentationButton(CupertinoNavigationDemo.routeName),
const Padding(padding: EdgeInsets.only(left: 8.0)),
const ExitButton(),
],
);
class CupertinoDemoTab1 extends StatelessWidget { class CupertinoDemoTab1 extends StatelessWidget {
const CupertinoDemoTab1({this.colorItems, this.colorNameItems}); const CupertinoDemoTab1({this.colorItems, this.colorNameItems});
...@@ -136,8 +147,8 @@ class CupertinoDemoTab1 extends StatelessWidget { ...@@ -136,8 +147,8 @@ class CupertinoDemoTab1 extends StatelessWidget {
return CupertinoPageScaffold( return CupertinoPageScaffold(
child: CustomScrollView( child: CustomScrollView(
slivers: <Widget>[ slivers: <Widget>[
const CupertinoSliverNavigationBar( CupertinoSliverNavigationBar(
trailing: ExitButton(), trailing: trailingButtons,
), ),
SliverPadding( SliverPadding(
// Top media padding consumed by CupertinoSliverNavigationBar. // Top media padding consumed by CupertinoSliverNavigationBar.
...@@ -421,8 +432,8 @@ class CupertinoDemoTab2 extends StatelessWidget { ...@@ -421,8 +432,8 @@ class CupertinoDemoTab2 extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return CupertinoPageScaffold( return CupertinoPageScaffold(
navigationBar: const CupertinoNavigationBar( navigationBar: CupertinoNavigationBar(
trailing: ExitButton(), trailing: trailingButtons,
), ),
child: ListView( child: ListView(
children: <Widget>[ children: <Widget>[
...@@ -704,8 +715,8 @@ class CupertinoDemoTab3 extends StatelessWidget { ...@@ -704,8 +715,8 @@ class CupertinoDemoTab3 extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return CupertinoPageScaffold( return CupertinoPageScaffold(
navigationBar: const CupertinoNavigationBar( navigationBar: CupertinoNavigationBar(
trailing: ExitButton(), trailing: trailingButtons,
), ),
child: DecoratedBox( child: DecoratedBox(
decoration: const BoxDecoration(color: Color(0xFFEFEFF4)), decoration: const BoxDecoration(color: Color(0xFFEFEFF4)),
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
import 'cupertino_navigation_demo.dart' show coolColorNames; import 'cupertino_navigation_demo.dart' show coolColorNames;
const double _kPickerSheetHeight = 216.0; const double _kPickerSheetHeight = 216.0;
...@@ -132,6 +133,7 @@ class _CupertinoPickerDemoState extends State<CupertinoPickerDemo> { ...@@ -132,6 +133,7 @@ class _CupertinoPickerDemoState extends State<CupertinoPickerDemo> {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: const Text('Cupertino Picker'), title: const Text('Cupertino Picker'),
actions: <Widget>[MaterialDemoDocumentationButton(CupertinoPickerDemo.routeName)],
), ),
body: DefaultTextStyle( body: DefaultTextStyle(
style: const TextStyle( style: const TextStyle(
......
...@@ -6,6 +6,8 @@ import 'dart:math' show Random; ...@@ -6,6 +6,8 @@ import 'dart:math' show Random;
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import '../../gallery/demo.dart';
class CupertinoRefreshControlDemo extends StatefulWidget { class CupertinoRefreshControlDemo extends StatefulWidget {
static const String routeName = '/cupertino/refresh'; static const String routeName = '/cupertino/refresh';
...@@ -48,9 +50,10 @@ class _CupertinoRefreshControlDemoState extends State<CupertinoRefreshControlDem ...@@ -48,9 +50,10 @@ class _CupertinoRefreshControlDemoState extends State<CupertinoRefreshControlDem
decoration: const BoxDecoration(color: Color(0xFFEFEFF4)), decoration: const BoxDecoration(color: Color(0xFFEFEFF4)),
child: CustomScrollView( child: CustomScrollView(
slivers: <Widget>[ slivers: <Widget>[
const CupertinoSliverNavigationBar( CupertinoSliverNavigationBar(
largeTitle: Text('Cupertino Refresh'), largeTitle: const Text('Cupertino Refresh'),
previousPageTitle: 'Cupertino', previousPageTitle: 'Cupertino',
trailing: CupertinoDemoDocumentationButton(CupertinoRefreshControlDemo.routeName),
), ),
CupertinoSliverRefreshControl( CupertinoSliverRefreshControl(
onRefresh: () { onRefresh: () {
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
const Color _kKeyUmbraOpacity = Color(0x33000000); // alpha = 0.2 const Color _kKeyUmbraOpacity = Color(0x33000000); // alpha = 0.2
const Color _kKeyPenumbraOpacity = Color(0x24000000); // alpha = 0.14 const Color _kKeyPenumbraOpacity = Color(0x24000000); // alpha = 0.14
const Color _kAmbientShadowOpacity = Color(0x1F000000); // alpha = 0.12 const Color _kAmbientShadowOpacity = Color(0x1F000000); // alpha = 0.12
...@@ -51,6 +53,7 @@ class _CupertinoSegmentedControlDemoState extends State<CupertinoSegmentedContro ...@@ -51,6 +53,7 @@ class _CupertinoSegmentedControlDemoState extends State<CupertinoSegmentedContro
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: const Text('Segmented Control'), title: const Text('Segmented Control'),
actions: <Widget>[MaterialDemoDocumentationButton(CupertinoSegmentedControlDemo.routeName)],
), ),
body: Column( body: Column(
children: <Widget>[ children: <Widget>[
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class CupertinoSliderDemo extends StatefulWidget { class CupertinoSliderDemo extends StatefulWidget {
static const String routeName = '/cupertino/slider'; static const String routeName = '/cupertino/slider';
...@@ -21,6 +23,7 @@ class _CupertinoSliderDemoState extends State<CupertinoSliderDemo> { ...@@ -21,6 +23,7 @@ class _CupertinoSliderDemoState extends State<CupertinoSliderDemo> {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: const Text('Cupertino Sliders'), title: const Text('Cupertino Sliders'),
actions: <Widget>[MaterialDemoDocumentationButton(CupertinoSliderDemo.routeName)],
), ),
body: Center( body: Center(
child: Column( child: Column(
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class CupertinoSwitchDemo extends StatefulWidget { class CupertinoSwitchDemo extends StatefulWidget {
static const String routeName = '/cupertino/switch'; static const String routeName = '/cupertino/switch';
...@@ -21,6 +23,7 @@ class _CupertinoSwitchDemoState extends State<CupertinoSwitchDemo> { ...@@ -21,6 +23,7 @@ class _CupertinoSwitchDemoState extends State<CupertinoSwitchDemo> {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: const Text('Cupertino Switch'), title: const Text('Cupertino Switch'),
actions: <Widget>[MaterialDemoDocumentationButton(CupertinoSwitchDemo.routeName)],
), ),
body: Center( body: Center(
child: Column( child: Column(
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class BottomAppBarDemo extends StatefulWidget { class BottomAppBarDemo extends StatefulWidget {
static const String routeName = '/material/bottom_app_bar'; static const String routeName = '/material/bottom_app_bar';
...@@ -143,6 +145,7 @@ class _BottomAppBarDemoState extends State<BottomAppBarDemo> { ...@@ -143,6 +145,7 @@ class _BottomAppBarDemoState extends State<BottomAppBarDemo> {
title: const Text('Bottom app bar'), title: const Text('Bottom app bar'),
elevation: 0.0, elevation: 0.0,
actions: <Widget>[ actions: <Widget>[
MaterialDemoDocumentationButton(BottomAppBarDemo.routeName),
IconButton( IconButton(
icon: const Icon(Icons.sentiment_very_satisfied), icon: const Icon(Icons.sentiment_very_satisfied),
onPressed: () { onPressed: () {
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class NavigationIconView { class NavigationIconView {
NavigationIconView({ NavigationIconView({
Widget icon, Widget icon,
...@@ -209,6 +211,7 @@ class _BottomNavigationDemoState extends State<BottomNavigationDemo> ...@@ -209,6 +211,7 @@ class _BottomNavigationDemoState extends State<BottomNavigationDemo>
appBar: AppBar( appBar: AppBar(
title: const Text('Bottom navigation'), title: const Text('Bottom navigation'),
actions: <Widget>[ actions: <Widget>[
MaterialDemoDocumentationButton(BottomNavigationDemo.routeName),
PopupMenuButton<BottomNavigationBarType>( PopupMenuButton<BottomNavigationBarType>(
onSelected: (BottomNavigationBarType value) { onSelected: (BottomNavigationBarType value) {
setState(() { setState(() {
......
...@@ -70,6 +70,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -70,6 +70,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
child: buildRaisedButton(), child: buildRaisedButton(),
), ),
exampleCodeTag: _raisedCode, exampleCodeTag: _raisedCode,
documentationUrl: 'https://docs.flutter.io/flutter/material/RaisedButton-class.html',
), ),
ComponentDemoTabData( ComponentDemoTabData(
tabName: 'FLAT', tabName: 'FLAT',
...@@ -79,6 +80,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -79,6 +80,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
child: buildFlatButton(), child: buildFlatButton(),
), ),
exampleCodeTag: _flatCode, exampleCodeTag: _flatCode,
documentationUrl: 'https://docs.flutter.io/flutter/material/FlatButton-class.html',
), ),
ComponentDemoTabData( ComponentDemoTabData(
tabName: 'OUTLINE', tabName: 'OUTLINE',
...@@ -88,24 +90,28 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -88,24 +90,28 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
child: buildOutlineButton(), child: buildOutlineButton(),
), ),
exampleCodeTag: _outlineCode, exampleCodeTag: _outlineCode,
documentationUrl: 'https://docs.flutter.io/flutter/material/OutlineButton-class.html',
), ),
ComponentDemoTabData( ComponentDemoTabData(
tabName: 'DROPDOWN', tabName: 'DROPDOWN',
description: _dropdownText, description: _dropdownText,
demoWidget: buildDropdownButton(), demoWidget: buildDropdownButton(),
exampleCodeTag: _dropdownCode, exampleCodeTag: _dropdownCode,
documentationUrl: 'https://docs.flutter.io/flutter/material/DropdownButton-class.html',
), ),
ComponentDemoTabData( ComponentDemoTabData(
tabName: 'ICON', tabName: 'ICON',
description: _iconText, description: _iconText,
demoWidget: buildIconButton(), demoWidget: buildIconButton(),
exampleCodeTag: _iconCode, exampleCodeTag: _iconCode,
documentationUrl: 'https://docs.flutter.io/flutter/material/IconButton-class.html',
), ),
ComponentDemoTabData( ComponentDemoTabData(
tabName: 'ACTION', tabName: 'ACTION',
description: _actionText, description: _actionText,
demoWidget: buildActionButton(), demoWidget: buildActionButton(),
exampleCodeTag: _actionCode, exampleCodeTag: _actionCode,
documentationUrl: 'https://docs.flutter.io/flutter/material/FloatingActionButton-class.html',
), ),
]; ];
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
const String _kGalleryAssetsPackage = 'flutter_gallery_assets'; const String _kGalleryAssetsPackage = 'flutter_gallery_assets';
class TravelDestination { class TravelDestination {
...@@ -168,6 +170,7 @@ class _CardsDemoState extends State<CardsDemo> { ...@@ -168,6 +170,7 @@ class _CardsDemoState extends State<CardsDemo> {
appBar: AppBar( appBar: AppBar(
title: const Text('Travel stream'), title: const Text('Travel stream'),
actions: <Widget>[ actions: <Widget>[
MaterialDemoDocumentationButton(CardsDemo.routeName),
IconButton( IconButton(
icon: const Icon(Icons.sentiment_very_satisfied), icon: const Icon(Icons.sentiment_very_satisfied),
onPressed: () { onPressed: () {
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
const List<String> _defaultMaterials = <String>[ const List<String> _defaultMaterials = <String>[
'poker', 'poker',
'tortilla', 'tortilla',
...@@ -303,6 +305,7 @@ class _ChipDemoState extends State<ChipDemo> { ...@@ -303,6 +305,7 @@ class _ChipDemoState extends State<ChipDemo> {
appBar: AppBar( appBar: AppBar(
title: const Text('Chips'), title: const Text('Chips'),
actions: <Widget>[ actions: <Widget>[
MaterialDemoDocumentationButton(ChipDemo.routeName),
IconButton( IconButton(
onPressed: () { onPressed: () {
setState(() { setState(() {
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import '../../gallery/demo.dart';
class Dessert { class Dessert {
Dessert(this.name, this.calories, this.fat, this.carbs, this.protein, this.sodium, this.calcium, this.iron); Dessert(this.name, this.calories, this.fat, this.carbs, this.protein, this.sodium, this.calcium, this.iron);
final String name; final String name;
...@@ -164,7 +166,12 @@ class _DataTableDemoState extends State<DataTableDemo> { ...@@ -164,7 +166,12 @@ class _DataTableDemoState extends State<DataTableDemo> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar(title: const Text('Data tables')), appBar: AppBar(
title: const Text('Data tables'),
actions: <Widget>[
MaterialDemoDocumentationButton(DataTableDemo.routeName),
],
),
body: ListView( body: ListView(
padding: const EdgeInsets.all(20.0), padding: const EdgeInsets.all(20.0),
children: <Widget>[ children: <Widget>[
......
...@@ -7,6 +7,8 @@ import 'dart:async'; ...@@ -7,6 +7,8 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import '../../gallery/demo.dart';
class _InputDropdown extends StatelessWidget { class _InputDropdown extends StatelessWidget {
const _InputDropdown({ const _InputDropdown({
Key key, Key key,
...@@ -129,7 +131,10 @@ class _DateAndTimePickerDemoState extends State<DateAndTimePickerDemo> { ...@@ -129,7 +131,10 @@ class _DateAndTimePickerDemoState extends State<DateAndTimePickerDemo> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar(title: const Text('Date and time pickers')), appBar: AppBar(
title: const Text('Date and time pickers'),
actions: <Widget>[MaterialDemoDocumentationButton(DateAndTimePickerDemo.routeName)],
),
body: DropdownButtonHideUnderline( body: DropdownButtonHideUnderline(
child: SafeArea( child: SafeArea(
top: false, top: false,
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
import 'full_screen_dialog_demo.dart'; import 'full_screen_dialog_demo.dart';
enum DialogDemoAction { enum DialogDemoAction {
...@@ -87,7 +88,8 @@ class DialogDemoState extends State<DialogDemo> { ...@@ -87,7 +88,8 @@ class DialogDemoState extends State<DialogDemo> {
return Scaffold( return Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
appBar: AppBar( appBar: AppBar(
title: const Text('Dialogs') title: const Text('Dialogs'),
actions: <Widget>[MaterialDemoDocumentationButton(DialogDemo.routeName)],
), ),
body: ListView( body: ListView(
padding: const EdgeInsets.symmetric(vertical: 24.0, horizontal: 72.0), padding: const EdgeInsets.symmetric(vertical: 24.0, horizontal: 72.0),
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
const String _kAsset0 = 'people/square/trevor.png'; const String _kAsset0 = 'people/square/trevor.png';
const String _kAsset1 = 'people/square/stella.png'; const String _kAsset1 = 'people/square/stella.png';
const String _kAsset2 = 'people/square/sandra.png'; const String _kAsset2 = 'people/square/sandra.png';
...@@ -88,6 +90,7 @@ class _DrawerDemoState extends State<DrawerDemo> with TickerProviderStateMixin { ...@@ -88,6 +90,7 @@ class _DrawerDemoState extends State<DrawerDemo> with TickerProviderStateMixin {
}, },
), ),
title: const Text('Navigation drawer'), title: const Text('Navigation drawer'),
actions: <Widget>[MaterialDemoDocumentationButton(DrawerDemo.routeName)],
), ),
drawer: Drawer( drawer: Drawer(
child: Column( child: Column(
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class ElevationDemo extends StatefulWidget { class ElevationDemo extends StatefulWidget {
static const String routeName = '/material/elevation'; static const String routeName = '/material/elevation';
...@@ -46,6 +48,7 @@ class _ElevationDemoState extends State<ElevationDemo> { ...@@ -46,6 +48,7 @@ class _ElevationDemoState extends State<ElevationDemo> {
appBar: AppBar( appBar: AppBar(
title: const Text('Elevation'), title: const Text('Elevation'),
actions: <Widget>[ actions: <Widget>[
MaterialDemoDocumentationButton(ElevationDemo.routeName),
IconButton( IconButton(
icon: const Icon(Icons.sentiment_very_satisfied), icon: const Icon(Icons.sentiment_very_satisfied),
onPressed: () { onPressed: () {
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
enum _Location { enum _Location {
Barbados, Barbados,
Bahamas, Bahamas,
...@@ -336,7 +338,12 @@ class _ExpansionPanelsDemoState extends State<ExpansionPanelsDemo> { ...@@ -336,7 +338,12 @@ class _ExpansionPanelsDemoState extends State<ExpansionPanelsDemo> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar(title: const Text('Expansion panels')), appBar: AppBar(
title: const Text('Expansion panels'),
actions: <Widget>[
MaterialDemoDocumentationButton(ExpansionPanelsDemo.routeName),
],
),
body: SingleChildScrollView( body: SingleChildScrollView(
child: SafeArea( child: SafeArea(
top: false, top: false,
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
enum GridDemoTileStyle { enum GridDemoTileStyle {
imageOnly, imageOnly,
oneLine, oneLine,
...@@ -340,6 +342,7 @@ class GridListDemoState extends State<GridListDemo> { ...@@ -340,6 +342,7 @@ class GridListDemoState extends State<GridListDemo> {
appBar: AppBar( appBar: AppBar(
title: const Text('Grid list'), title: const Text('Grid list'),
actions: <Widget>[ actions: <Widget>[
MaterialDemoDocumentationButton(GridListDemo.routeName),
PopupMenuButton<GridDemoTileStyle>( PopupMenuButton<GridDemoTileStyle>(
onSelected: changeTileStyle, onSelected: changeTileStyle,
itemBuilder: (BuildContext context) => <PopupMenuItem<GridDemoTileStyle>>[ itemBuilder: (BuildContext context) => <PopupMenuItem<GridDemoTileStyle>>[
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class IconsDemo extends StatefulWidget { class IconsDemo extends StatefulWidget {
static const String routeName = '/material/icons'; static const String routeName = '/material/icons';
...@@ -48,7 +50,8 @@ class IconsDemoState extends State<IconsDemo> { ...@@ -48,7 +50,8 @@ class IconsDemoState extends State<IconsDemo> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: const Text('Icons') title: const Text('Icons'),
actions: <Widget>[MaterialDemoDocumentationButton(IconsDemo.routeName)],
), ),
body: IconTheme( body: IconTheme(
data: IconThemeData(color: iconColor), data: IconThemeData(color: iconColor),
......
...@@ -7,6 +7,8 @@ import 'package:collection/collection.dart' show lowerBound; ...@@ -7,6 +7,8 @@ import 'package:collection/collection.dart' show lowerBound;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/semantics.dart'; import 'package:flutter/semantics.dart';
import '../../gallery/demo.dart';
enum LeaveBehindDemoAction { enum LeaveBehindDemoAction {
reset, reset,
horizontalSwipe, horizontalSwipe,
...@@ -140,6 +142,7 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> { ...@@ -140,6 +142,7 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
appBar: AppBar( appBar: AppBar(
title: const Text('Swipe to dismiss'), title: const Text('Swipe to dismiss'),
actions: <Widget>[ actions: <Widget>[
MaterialDemoDocumentationButton(LeaveBehindDemo.routeName),
PopupMenuButton<LeaveBehindDemoAction>( PopupMenuButton<LeaveBehindDemoAction>(
onSelected: handleDemoAction, onSelected: handleDemoAction,
itemBuilder: (BuildContext context) => <PopupMenuEntry<LeaveBehindDemoAction>>[ itemBuilder: (BuildContext context) => <PopupMenuEntry<LeaveBehindDemoAction>>[
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
enum _MaterialListType { enum _MaterialListType {
/// A list tile that contains a single line of text. /// A list tile that contains a single line of text.
oneLine, oneLine,
...@@ -216,6 +218,7 @@ class _ListDemoState extends State<ListDemo> { ...@@ -216,6 +218,7 @@ class _ListDemoState extends State<ListDemo> {
appBar: AppBar( appBar: AppBar(
title: Text('Scrolling list\n$itemTypeText$layoutText'), title: Text('Scrolling list\n$itemTypeText$layoutText'),
actions: <Widget>[ actions: <Widget>[
MaterialDemoDocumentationButton(ListDemo.routeName),
IconButton( IconButton(
icon: const Icon(Icons.sort_by_alpha), icon: const Icon(Icons.sort_by_alpha),
tooltip: 'Sort', tooltip: 'Sort',
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class MenuDemo extends StatefulWidget { class MenuDemo extends StatefulWidget {
const MenuDemo({ Key key }) : super(key: key); const MenuDemo({ Key key }) : super(key: key);
...@@ -64,6 +66,7 @@ class MenuDemoState extends State<MenuDemo> { ...@@ -64,6 +66,7 @@ class MenuDemoState extends State<MenuDemo> {
appBar: AppBar( appBar: AppBar(
title: const Text('Menus'), title: const Text('Menus'),
actions: <Widget>[ actions: <Widget>[
MaterialDemoDocumentationButton(MenuDemo.routeName),
PopupMenuButton<String>( PopupMenuButton<String>(
onSelected: showMenuSelection, onSelected: showMenuSelection,
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[ itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
......
...@@ -4,13 +4,18 @@ ...@@ -4,13 +4,18 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class ModalBottomSheetDemo extends StatelessWidget { class ModalBottomSheetDemo extends StatelessWidget {
static const String routeName = '/material/modal-bottom-sheet'; static const String routeName = '/material/modal-bottom-sheet';
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar(title: const Text('Modal bottom sheet')), appBar: AppBar(
title: const Text('Modal bottom sheet'),
actions: <Widget>[MaterialDemoDocumentationButton(routeName)],
),
body: Center( body: Center(
child: RaisedButton( child: RaisedButton(
child: const Text('SHOW BOTTOM SHEET'), child: const Text('SHOW BOTTOM SHEET'),
......
...@@ -6,6 +6,8 @@ import 'dart:async'; ...@@ -6,6 +6,8 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
enum IndicatorType { overscroll, refresh } enum IndicatorType { overscroll, refresh }
class OverscrollDemo extends StatefulWidget { class OverscrollDemo extends StatefulWidget {
...@@ -47,6 +49,7 @@ class OverscrollDemoState extends State<OverscrollDemo> { ...@@ -47,6 +49,7 @@ class OverscrollDemoState extends State<OverscrollDemo> {
appBar: AppBar( appBar: AppBar(
title: const Text('Pull to refresh'), title: const Text('Pull to refresh'),
actions: <Widget>[ actions: <Widget>[
MaterialDemoDocumentationButton(OverscrollDemo.routeName),
IconButton( IconButton(
icon: const Icon(Icons.refresh), icon: const Icon(Icons.refresh),
tooltip: 'Refresh', tooltip: 'Refresh',
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class _PageSelector extends StatelessWidget { class _PageSelector extends StatelessWidget {
const _PageSelector({ this.icons }); const _PageSelector({ this.icons });
...@@ -85,7 +87,10 @@ class PageSelectorDemo extends StatelessWidget { ...@@ -85,7 +87,10 @@ class PageSelectorDemo extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar(title: const Text('Page selector')), appBar: AppBar(
title: const Text('Page selector'),
actions: <Widget>[MaterialDemoDocumentationButton(routeName)],
),
body: DefaultTabController( body: DefaultTabController(
length: icons.length, length: icons.length,
child: _PageSelector(icons: icons), child: _PageSelector(icons: icons),
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class PersistentBottomSheetDemo extends StatefulWidget { class PersistentBottomSheetDemo extends StatefulWidget {
static const String routeName = '/material/persistent-bottom-sheet'; static const String routeName = '/material/persistent-bottom-sheet';
...@@ -76,7 +78,12 @@ class _PersistentBottomSheetDemoState extends State<PersistentBottomSheetDemo> { ...@@ -76,7 +78,12 @@ class _PersistentBottomSheetDemoState extends State<PersistentBottomSheetDemo> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
appBar: AppBar(title: const Text('Persistent bottom sheet')), appBar: AppBar(
title: const Text('Persistent bottom sheet'),
actions: <Widget>[
MaterialDemoDocumentationButton(PersistentBottomSheetDemo.routeName),
],
),
floatingActionButton: FloatingActionButton( floatingActionButton: FloatingActionButton(
onPressed: _showMessage, onPressed: _showMessage,
backgroundColor: Colors.redAccent, backgroundColor: Colors.redAccent,
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class ProgressIndicatorDemo extends StatefulWidget { class ProgressIndicatorDemo extends StatefulWidget {
static const String routeName = '/material/progress-indicator'; static const String routeName = '/material/progress-indicator';
...@@ -100,7 +102,10 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> with Sing ...@@ -100,7 +102,10 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> with Sing
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar(title: const Text('Progress indicators')), appBar: AppBar(
title: const Text('Progress indicators'),
actions: <Widget>[MaterialDemoDocumentationButton(ProgressIndicatorDemo.routeName)],
),
body: Center( body: Center(
child: SingleChildScrollView( child: SingleChildScrollView(
child: DefaultTextStyle( child: DefaultTextStyle(
......
...@@ -6,6 +6,8 @@ import 'package:flutter/foundation.dart'; ...@@ -6,6 +6,8 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import '../../gallery/demo.dart';
enum _ReorderableListType { enum _ReorderableListType {
/// A list tile that contains a [CircleAvatar]. /// A list tile that contains a [CircleAvatar].
horizontalAvatar, horizontalAvatar,
...@@ -157,6 +159,7 @@ class _ListDemoState extends State<ReorderableListDemo> { ...@@ -157,6 +159,7 @@ class _ListDemoState extends State<ReorderableListDemo> {
appBar: AppBar( appBar: AppBar(
title: const Text('Reorderable list'), title: const Text('Reorderable list'),
actions: <Widget>[ actions: <Widget>[
MaterialDemoDocumentationButton(ReorderableListDemo.routeName),
IconButton( IconButton(
icon: const Icon(Icons.sort_by_alpha), icon: const Icon(Icons.sort_by_alpha),
tooltip: 'Sort', tooltip: 'Sort',
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
enum TabsDemoStyle { enum TabsDemoStyle {
iconsAndText, iconsAndText,
iconsOnly, iconsOnly,
...@@ -125,6 +127,7 @@ class ScrollableTabsDemoState extends State<ScrollableTabsDemo> with SingleTicke ...@@ -125,6 +127,7 @@ class ScrollableTabsDemoState extends State<ScrollableTabsDemo> with SingleTicke
appBar: AppBar( appBar: AppBar(
title: const Text('Scrollable tabs'), title: const Text('Scrollable tabs'),
actions: <Widget>[ actions: <Widget>[
MaterialDemoDocumentationButton(ScrollableTabsDemo.routeName),
IconButton( IconButton(
icon: const Icon(Icons.sentiment_very_satisfied), icon: const Icon(Icons.sentiment_very_satisfied),
onPressed: () { onPressed: () {
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class SearchDemo extends StatefulWidget { class SearchDemo extends StatefulWidget {
static const String routeName = '/material/search'; static const String routeName = '/material/search';
...@@ -50,6 +52,7 @@ class _SearchDemoState extends State<SearchDemo> { ...@@ -50,6 +52,7 @@ class _SearchDemoState extends State<SearchDemo> {
} }
}, },
), ),
MaterialDemoDocumentationButton(SearchDemo.routeName),
IconButton( IconButton(
tooltip: 'More (not implemented)', tooltip: 'More (not implemented)',
icon: Icon( icon: Icon(
......
...@@ -42,19 +42,22 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> { ...@@ -42,19 +42,22 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> {
tabName: 'CHECKBOX', tabName: 'CHECKBOX',
description: _checkboxText, description: _checkboxText,
demoWidget: buildCheckbox(), demoWidget: buildCheckbox(),
exampleCodeTag: _checkboxCode exampleCodeTag: _checkboxCode,
documentationUrl: 'https://docs.flutter.io/flutter/material/Checkbox-class.html',
), ),
ComponentDemoTabData( ComponentDemoTabData(
tabName: 'RADIO', tabName: 'RADIO',
description: _radioText, description: _radioText,
demoWidget: buildRadio(), demoWidget: buildRadio(),
exampleCodeTag: _radioCode exampleCodeTag: _radioCode,
documentationUrl: 'https://docs.flutter.io/flutter/material/Radio-class.html',
), ),
ComponentDemoTabData( ComponentDemoTabData(
tabName: 'SWITCH', tabName: 'SWITCH',
description: _switchText, description: _switchText,
demoWidget: buildSwitch(), demoWidget: buildSwitch(),
exampleCodeTag: _switchCode exampleCodeTag: _switchCode,
documentationUrl: 'https://docs.flutter.io/flutter/material/Switch-class.html',
) )
]; ];
......
...@@ -6,6 +6,8 @@ import 'dart:math' as math; ...@@ -6,6 +6,8 @@ import 'dart:math' as math;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class SliderDemo extends StatefulWidget { class SliderDemo extends StatefulWidget {
static const String routeName = '/material/slider'; static const String routeName = '/material/slider';
...@@ -132,7 +134,10 @@ class _SliderDemoState extends State<SliderDemo> { ...@@ -132,7 +134,10 @@ class _SliderDemoState extends State<SliderDemo> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context); final ThemeData theme = Theme.of(context);
return Scaffold( return Scaffold(
appBar: AppBar(title: const Text('Sliders')), appBar: AppBar(
title: const Text('Sliders'),
actions: <Widget>[MaterialDemoDocumentationButton(SliderDemo.routeName)],
),
body: Padding( body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 40.0), padding: const EdgeInsets.symmetric(horizontal: 40.0),
child: Column( child: Column(
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
const String _text1 = const String _text1 =
'Snackbars provide lightweight feedback about an operation by ' 'Snackbars provide lightweight feedback about an operation by '
'showing a brief message at the bottom of the screen. Snackbars ' 'showing a brief message at the bottom of the screen. Snackbars '
...@@ -73,7 +75,8 @@ class _SnackBarDemoState extends State<SnackBarDemo> { ...@@ -73,7 +75,8 @@ class _SnackBarDemoState extends State<SnackBarDemo> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: const Text('Snackbar') title: const Text('Snackbar'),
actions: <Widget>[MaterialDemoDocumentationButton(SnackBarDemo.routeName)],
), ),
body: Builder( body: Builder(
// Create an inner BuildContext so that the snackBar onPressed methods // Create an inner BuildContext so that the snackBar onPressed methods
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
// Each TabBarView contains a _Page and for each _Page there is a list // Each TabBarView contains a _Page and for each _Page there is a list
// of _CardData objects. Each _CardData object is displayed by a _CardItem. // of _CardData objects. Each _CardData object is displayed by a _CardItem.
...@@ -150,6 +152,7 @@ class TabsDemo extends StatelessWidget { ...@@ -150,6 +152,7 @@ class TabsDemo extends StatelessWidget {
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
child: SliverAppBar( child: SliverAppBar(
title: const Text('Tabs and scrolling'), title: const Text('Tabs and scrolling'),
actions: <Widget>[MaterialDemoDocumentationButton(routeName)],
pinned: true, pinned: true,
expandedHeight: 150.0, expandedHeight: 150.0,
forceElevated: innerBoxIsScrolled, forceElevated: innerBoxIsScrolled,
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
const String _explanatoryText = const String _explanatoryText =
"When the Scaffold's floating action button changes, the new button fades and " "When the Scaffold's floating action button changes, the new button fades and "
'turns into view. In this demo, changing tabs can cause the app to be rebuilt ' 'turns into view. In this demo, changing tabs can cause the app to be rebuilt '
...@@ -137,6 +139,7 @@ class _TabsFabDemoState extends State<TabsFabDemo> with SingleTickerProviderStat ...@@ -137,6 +139,7 @@ class _TabsFabDemoState extends State<TabsFabDemo> with SingleTickerProviderStat
tabs: _allPages.map((_Page page) => Tab(text: page.label.toUpperCase())).toList(), tabs: _allPages.map((_Page page) => Tab(text: page.label.toUpperCase())).toList(),
), ),
actions: <Widget>[ actions: <Widget>[
MaterialDemoDocumentationButton(TabsFabDemo.routeName),
IconButton( IconButton(
icon: const Icon(Icons.sentiment_very_satisfied), icon: const Icon(Icons.sentiment_very_satisfied),
onPressed: () { onPressed: () {
......
...@@ -7,6 +7,8 @@ import 'dart:async'; ...@@ -7,6 +7,8 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import '../../gallery/demo.dart';
class TextFormFieldDemo extends StatefulWidget { class TextFormFieldDemo extends StatefulWidget {
const TextFormFieldDemo({ Key key }) : super(key: key); const TextFormFieldDemo({ Key key }) : super(key: key);
...@@ -165,6 +167,7 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> { ...@@ -165,6 +167,7 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> {
key: _scaffoldKey, key: _scaffoldKey,
appBar: AppBar( appBar: AppBar(
title: const Text('Text fields'), title: const Text('Text fields'),
actions: <Widget>[MaterialDemoDocumentationButton(TextFormFieldDemo.routeName)],
), ),
body: SafeArea( body: SafeArea(
top: false, top: false,
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
const String _introText = const String _introText =
'Tooltips are short identifying messages that briefly appear in response to ' 'Tooltips are short identifying messages that briefly appear in response to '
'a long press. Tooltip messages are also used by services that make Flutter ' 'a long press. Tooltip messages are also used by services that make Flutter '
...@@ -18,7 +20,8 @@ class TooltipDemo extends StatelessWidget { ...@@ -18,7 +20,8 @@ class TooltipDemo extends StatelessWidget {
final ThemeData theme = Theme.of(context); final ThemeData theme = Theme.of(context);
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: const Text('Tooltips') title: const Text('Tooltips'),
actions: <Widget>[MaterialDemoDocumentationButton(routeName)],
), ),
body: Builder( body: Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
......
...@@ -4,13 +4,18 @@ ...@@ -4,13 +4,18 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class TwoLevelListDemo extends StatelessWidget { class TwoLevelListDemo extends StatelessWidget {
static const String routeName = '/material/two-level-list'; static const String routeName = '/material/two-level-list';
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar(title: const Text('Expand/collapse list control')), appBar: AppBar(
title: const Text('Expand/collapse list control'),
actions: <Widget>[MaterialDemoDocumentationButton(routeName)],
),
body: ListView( body: ListView(
children: <Widget>[ children: <Widget>[
const ListTile(title: Text('Top')), const ListTile(title: Text('Top')),
......
...@@ -2,8 +2,11 @@ ...@@ -2,8 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import 'demos.dart';
import 'example_code_parser.dart'; import 'example_code_parser.dart';
import 'syntax_highlighter.dart'; import 'syntax_highlighter.dart';
...@@ -12,24 +15,28 @@ class ComponentDemoTabData { ...@@ -12,24 +15,28 @@ class ComponentDemoTabData {
this.demoWidget, this.demoWidget,
this.exampleCodeTag, this.exampleCodeTag,
this.description, this.description,
this.tabName this.tabName,
this.documentationUrl,
}); });
final Widget demoWidget; final Widget demoWidget;
final String exampleCodeTag; final String exampleCodeTag;
final String description; final String description;
final String tabName; final String tabName;
final String documentationUrl;
@override @override
bool operator==(Object other) { bool operator==(Object other) {
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
final ComponentDemoTabData typedOther = other; final ComponentDemoTabData typedOther = other;
return typedOther.tabName == tabName && typedOther.description == description; return typedOther.tabName == tabName
&& typedOther.description == description
&& typedOther.documentationUrl == documentationUrl;
} }
@override @override
int get hashCode => hashValues(tabName.hashCode, description.hashCode); int get hashCode => hashValues(tabName, description, documentationUrl);
} }
class TabbedComponentDemoScaffold extends StatelessWidget { class TabbedComponentDemoScaffold extends StatelessWidget {
...@@ -52,6 +59,13 @@ class TabbedComponentDemoScaffold extends StatelessWidget { ...@@ -52,6 +59,13 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
} }
} }
void _showApiDocumentation(BuildContext context) {
final String url = demos[DefaultTabController.of(context).index].documentationUrl;
if (url != null) {
launch(url, forceWebView: true);
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return DefaultTabController( return DefaultTabController(
...@@ -61,14 +75,20 @@ class TabbedComponentDemoScaffold extends StatelessWidget { ...@@ -61,14 +75,20 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
title: Text(title), title: Text(title),
actions: (actions ?? <Widget>[])..addAll( actions: (actions ?? <Widget>[])..addAll(
<Widget>[ <Widget>[
Builder(
builder: (BuildContext context) {
return IconButton(
icon: const Icon(Icons.library_books),
onPressed: () => _showApiDocumentation(context),
);
},
),
Builder( Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
return IconButton( return IconButton(
icon: const Icon(Icons.code), icon: const Icon(Icons.code),
tooltip: 'Show example code', tooltip: 'Show example code',
onPressed: () { onPressed: () => _showExampleCode(context),
_showExampleCode(context);
},
); );
}, },
) )
...@@ -170,3 +190,44 @@ class FullScreenCodeDialogState extends State<FullScreenCodeDialog> { ...@@ -170,3 +190,44 @@ class FullScreenCodeDialogState extends State<FullScreenCodeDialog> {
); );
} }
} }
class MaterialDemoDocumentationButton extends StatelessWidget {
MaterialDemoDocumentationButton(String routeName, { Key key })
: documentationUrl = kDemoDocumentationUrl[routeName],
assert(
kDemoDocumentationUrl[routeName] != null,
'A documentation URL was not specified for demo route $routeName in kAllGalleryDemos',
),
super(key: key);
final String documentationUrl;
@override
Widget build(BuildContext context) {
return IconButton(
icon: const Icon(Icons.library_books),
onPressed: () => launch(documentationUrl, forceWebView: true)
);
}
}
class CupertinoDemoDocumentationButton extends StatelessWidget {
CupertinoDemoDocumentationButton(String routeName, { Key key })
: documentationUrl = kDemoDocumentationUrl[routeName],
assert(
kDemoDocumentationUrl[routeName] != null,
'A documentation URL was not specified for demo route $routeName in kAllGalleryDemos',
),
super(key: key);
final String documentationUrl;
@override
Widget build(BuildContext context) {
return CupertinoButton(
padding: EdgeInsets.zero,
child: const Icon(CupertinoIcons.book),
onPressed: () => launch(documentationUrl, forceWebView: true)
);
}
}
...@@ -63,6 +63,7 @@ class GalleryDemo { ...@@ -63,6 +63,7 @@ class GalleryDemo {
this.subtitle, this.subtitle,
@required this.category, @required this.category,
@required this.routeName, @required this.routeName,
this.documentationUrl,
@required this.buildRoute, @required this.buildRoute,
}) : assert(title != null), }) : assert(title != null),
assert(category != null), assert(category != null),
...@@ -75,6 +76,7 @@ class GalleryDemo { ...@@ -75,6 +76,7 @@ class GalleryDemo {
final GalleryDemoCategory category; final GalleryDemoCategory category;
final String routeName; final String routeName;
final WidgetBuilder buildRoute; final WidgetBuilder buildRoute;
final String documentationUrl;
@override @override
String toString() { String toString() {
...@@ -143,6 +145,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -143,6 +145,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.bottom_app_bar, icon: GalleryIcons.bottom_app_bar,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: BottomAppBarDemo.routeName, routeName: BottomAppBarDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/material/BottomAppBar-class.html',
buildRoute: (BuildContext context) => BottomAppBarDemo(), buildRoute: (BuildContext context) => BottomAppBarDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -151,6 +154,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -151,6 +154,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.bottom_navigation, icon: GalleryIcons.bottom_navigation,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: BottomNavigationDemo.routeName, routeName: BottomNavigationDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/material/BottomNavigationBar-class.html',
buildRoute: (BuildContext context) => BottomNavigationDemo(), buildRoute: (BuildContext context) => BottomNavigationDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -159,6 +163,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -159,6 +163,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.bottom_sheets, icon: GalleryIcons.bottom_sheets,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: ModalBottomSheetDemo.routeName, routeName: ModalBottomSheetDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/material/showModalBottomSheet.html',
buildRoute: (BuildContext context) => ModalBottomSheetDemo(), buildRoute: (BuildContext context) => ModalBottomSheetDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -167,6 +172,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -167,6 +172,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.bottom_sheet_persistent, icon: GalleryIcons.bottom_sheet_persistent,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: PersistentBottomSheetDemo.routeName, routeName: PersistentBottomSheetDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/material/ScaffoldState/showBottomSheet.html',
buildRoute: (BuildContext context) => PersistentBottomSheetDemo(), buildRoute: (BuildContext context) => PersistentBottomSheetDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -183,6 +189,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -183,6 +189,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.buttons, icon: GalleryIcons.buttons,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: TabsFabDemo.routeName, routeName: TabsFabDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/material/FloatingActionButton-class.html',
buildRoute: (BuildContext context) => TabsFabDemo(), buildRoute: (BuildContext context) => TabsFabDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -191,6 +198,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -191,6 +198,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.cards, icon: GalleryIcons.cards,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: CardsDemo.routeName, routeName: CardsDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/material/Card-class.html',
buildRoute: (BuildContext context) => CardsDemo(), buildRoute: (BuildContext context) => CardsDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -199,6 +207,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -199,6 +207,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.chips, icon: GalleryIcons.chips,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: ChipDemo.routeName, routeName: ChipDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/material/Chip-class.html',
buildRoute: (BuildContext context) => ChipDemo(), buildRoute: (BuildContext context) => ChipDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -207,6 +216,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -207,6 +216,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.data_table, icon: GalleryIcons.data_table,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: DataTableDemo.routeName, routeName: DataTableDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/material/PaginatedDataTable-class.html',
buildRoute: (BuildContext context) => DataTableDemo(), buildRoute: (BuildContext context) => DataTableDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -215,6 +225,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -215,6 +225,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.dialogs, icon: GalleryIcons.dialogs,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: DialogDemo.routeName, routeName: DialogDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/material/showDialog.html',
buildRoute: (BuildContext context) => DialogDemo(), buildRoute: (BuildContext context) => DialogDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -224,6 +235,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -224,6 +235,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.cupertino_progress, icon: GalleryIcons.cupertino_progress,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: ElevationDemo.routeName, routeName: ElevationDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/material/Material/elevation.html',
buildRoute: (BuildContext context) => ElevationDemo(), buildRoute: (BuildContext context) => ElevationDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -232,6 +244,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -232,6 +244,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.expand_all, icon: GalleryIcons.expand_all,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: TwoLevelListDemo.routeName, routeName: TwoLevelListDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/material/ExpansionTile-class.html',
buildRoute: (BuildContext context) => TwoLevelListDemo(), buildRoute: (BuildContext context) => TwoLevelListDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -240,6 +253,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -240,6 +253,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.expand_all, icon: GalleryIcons.expand_all,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: ExpansionPanelsDemo.routeName, routeName: ExpansionPanelsDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/material/ExpansionPanel-class.html',
buildRoute: (BuildContext context) => ExpansionPanelsDemo(), buildRoute: (BuildContext context) => ExpansionPanelsDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -248,6 +262,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -248,6 +262,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.grid_on, icon: GalleryIcons.grid_on,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: GridListDemo.routeName, routeName: GridListDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/widgets/GridView-class.html',
buildRoute: (BuildContext context) => const GridListDemo(), buildRoute: (BuildContext context) => const GridListDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -256,6 +271,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -256,6 +271,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.sentiment_very_satisfied, icon: GalleryIcons.sentiment_very_satisfied,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: IconsDemo.routeName, routeName: IconsDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/material/IconButton-class.html',
buildRoute: (BuildContext context) => IconsDemo(), buildRoute: (BuildContext context) => IconsDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -264,6 +280,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -264,6 +280,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.list_alt, icon: GalleryIcons.list_alt,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: ListDemo.routeName, routeName: ListDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/material/ListTile-class.html',
buildRoute: (BuildContext context) => const ListDemo(), buildRoute: (BuildContext context) => const ListDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -272,6 +289,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -272,6 +289,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.lists_leave_behind, icon: GalleryIcons.lists_leave_behind,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: LeaveBehindDemo.routeName, routeName: LeaveBehindDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/widgets/Dismissible-class.html',
buildRoute: (BuildContext context) => const LeaveBehindDemo(), buildRoute: (BuildContext context) => const LeaveBehindDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -280,6 +298,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -280,6 +298,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.list_alt, icon: GalleryIcons.list_alt,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: ReorderableListDemo.routeName, routeName: ReorderableListDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/material/ReorderableListView-class.html',
buildRoute: (BuildContext context) => const ReorderableListDemo(), buildRoute: (BuildContext context) => const ReorderableListDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -288,6 +307,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -288,6 +307,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.more_vert, icon: GalleryIcons.more_vert,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: MenuDemo.routeName, routeName: MenuDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/material/PopupMenuButton-class.html',
buildRoute: (BuildContext context) => const MenuDemo(), buildRoute: (BuildContext context) => const MenuDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -296,6 +316,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -296,6 +316,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.menu, icon: GalleryIcons.menu,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: DrawerDemo.routeName, routeName: DrawerDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/material/Drawer-class.html',
buildRoute: (BuildContext context) => DrawerDemo(), buildRoute: (BuildContext context) => DrawerDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -304,6 +325,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -304,6 +325,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.page_control, icon: GalleryIcons.page_control,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: PageSelectorDemo.routeName, routeName: PageSelectorDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/material/TabBarView-class.html',
buildRoute: (BuildContext context) => PageSelectorDemo(), buildRoute: (BuildContext context) => PageSelectorDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -312,6 +334,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -312,6 +334,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.event, icon: GalleryIcons.event,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: DateAndTimePickerDemo.routeName, routeName: DateAndTimePickerDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/material/showDatePicker.html',
buildRoute: (BuildContext context) => DateAndTimePickerDemo(), buildRoute: (BuildContext context) => DateAndTimePickerDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -320,6 +343,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -320,6 +343,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.progress_activity, icon: GalleryIcons.progress_activity,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: ProgressIndicatorDemo.routeName, routeName: ProgressIndicatorDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/material/LinearProgressIndicator-class.html',
buildRoute: (BuildContext context) => ProgressIndicatorDemo(), buildRoute: (BuildContext context) => ProgressIndicatorDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -328,6 +352,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -328,6 +352,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.refresh, icon: GalleryIcons.refresh,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: OverscrollDemo.routeName, routeName: OverscrollDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/material/RefreshIndicator-class.html',
buildRoute: (BuildContext context) => const OverscrollDemo(), buildRoute: (BuildContext context) => const OverscrollDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -336,6 +361,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -336,6 +361,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: Icons.search, icon: Icons.search,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: SearchDemo.routeName, routeName: SearchDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/material/showSearch.html',
buildRoute: (BuildContext context) => SearchDemo(), buildRoute: (BuildContext context) => SearchDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -352,6 +378,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -352,6 +378,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.sliders, icon: GalleryIcons.sliders,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: SliderDemo.routeName, routeName: SliderDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/material/Slider-class.html',
buildRoute: (BuildContext context) => SliderDemo(), buildRoute: (BuildContext context) => SliderDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -360,6 +387,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -360,6 +387,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.snackbar, icon: GalleryIcons.snackbar,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: SnackBarDemo.routeName, routeName: SnackBarDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/material/ScaffoldState/showSnackBar.html',
buildRoute: (BuildContext context) => const SnackBarDemo(), buildRoute: (BuildContext context) => const SnackBarDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -368,6 +396,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -368,6 +396,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.tabs, icon: GalleryIcons.tabs,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: TabsDemo.routeName, routeName: TabsDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/material/TabBarView-class.html',
buildRoute: (BuildContext context) => TabsDemo(), buildRoute: (BuildContext context) => TabsDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -376,6 +405,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -376,6 +405,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents, category: _kMaterialComponents,
icon: GalleryIcons.tabs, icon: GalleryIcons.tabs,
routeName: ScrollableTabsDemo.routeName, routeName: ScrollableTabsDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/material/TabBar-class.html',
buildRoute: (BuildContext context) => ScrollableTabsDemo(), buildRoute: (BuildContext context) => ScrollableTabsDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -384,6 +414,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -384,6 +414,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.text_fields_alt, icon: GalleryIcons.text_fields_alt,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: TextFormFieldDemo.routeName, routeName: TextFormFieldDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/material/TextFormField-class.html',
buildRoute: (BuildContext context) => const TextFormFieldDemo(), buildRoute: (BuildContext context) => const TextFormFieldDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -392,6 +423,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -392,6 +423,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.tooltip, icon: GalleryIcons.tooltip,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: TooltipDemo.routeName, routeName: TooltipDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/material/Tooltip-class.html',
buildRoute: (BuildContext context) => TooltipDemo(), buildRoute: (BuildContext context) => TooltipDemo(),
), ),
...@@ -401,6 +433,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -401,6 +433,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.cupertino_progress, icon: GalleryIcons.cupertino_progress,
category: _kCupertinoComponents, category: _kCupertinoComponents,
routeName: CupertinoProgressIndicatorDemo.routeName, routeName: CupertinoProgressIndicatorDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/cupertino/CupertinoActivityIndicator-class.html',
buildRoute: (BuildContext context) => CupertinoProgressIndicatorDemo(), buildRoute: (BuildContext context) => CupertinoProgressIndicatorDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -408,6 +441,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -408,6 +441,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.dialogs, icon: GalleryIcons.dialogs,
category: _kCupertinoComponents, category: _kCupertinoComponents,
routeName: CupertinoAlertDemo.routeName, routeName: CupertinoAlertDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/cupertino/showCupertinoDialog.html',
buildRoute: (BuildContext context) => CupertinoAlertDemo(), buildRoute: (BuildContext context) => CupertinoAlertDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -415,6 +449,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -415,6 +449,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.generic_buttons, icon: GalleryIcons.generic_buttons,
category: _kCupertinoComponents, category: _kCupertinoComponents,
routeName: CupertinoButtonsDemo.routeName, routeName: CupertinoButtonsDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/cupertino/CupertinoButton-class.html',
buildRoute: (BuildContext context) => CupertinoButtonsDemo(), buildRoute: (BuildContext context) => CupertinoButtonsDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -422,6 +457,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -422,6 +457,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.bottom_navigation, icon: GalleryIcons.bottom_navigation,
category: _kCupertinoComponents, category: _kCupertinoComponents,
routeName: CupertinoNavigationDemo.routeName, routeName: CupertinoNavigationDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/cupertino/CupertinoTabScaffold-class.html',
buildRoute: (BuildContext context) => CupertinoNavigationDemo(), buildRoute: (BuildContext context) => CupertinoNavigationDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -429,6 +465,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -429,6 +465,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.event, icon: GalleryIcons.event,
category: _kCupertinoComponents, category: _kCupertinoComponents,
routeName: CupertinoPickerDemo.routeName, routeName: CupertinoPickerDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/cupertino/CupertinoPicker-class.html',
buildRoute: (BuildContext context) => CupertinoPickerDemo(), buildRoute: (BuildContext context) => CupertinoPickerDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -436,6 +473,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -436,6 +473,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.cupertino_pull_to_refresh, icon: GalleryIcons.cupertino_pull_to_refresh,
category: _kCupertinoComponents, category: _kCupertinoComponents,
routeName: CupertinoRefreshControlDemo.routeName, routeName: CupertinoRefreshControlDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/cupertino/CupertinoSliverRefreshControl-class.html',
buildRoute: (BuildContext context) => CupertinoRefreshControlDemo(), buildRoute: (BuildContext context) => CupertinoRefreshControlDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -443,6 +481,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -443,6 +481,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.tabs, icon: GalleryIcons.tabs,
category: _kCupertinoComponents, category: _kCupertinoComponents,
routeName: CupertinoSegmentedControlDemo.routeName, routeName: CupertinoSegmentedControlDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/cupertino/CupertinoSegmentedControl-class.html',
buildRoute: (BuildContext context) => CupertinoSegmentedControlDemo(), buildRoute: (BuildContext context) => CupertinoSegmentedControlDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -450,6 +489,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -450,6 +489,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.sliders, icon: GalleryIcons.sliders,
category: _kCupertinoComponents, category: _kCupertinoComponents,
routeName: CupertinoSliderDemo.routeName, routeName: CupertinoSliderDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/cupertino/CupertinoSlider-class.html',
buildRoute: (BuildContext context) => CupertinoSliderDemo(), buildRoute: (BuildContext context) => CupertinoSliderDemo(),
), ),
GalleryDemo( GalleryDemo(
...@@ -457,6 +497,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -457,6 +497,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.cupertino_switch, icon: GalleryIcons.cupertino_switch,
category: _kCupertinoComponents, category: _kCupertinoComponents,
routeName: CupertinoSwitchDemo.routeName, routeName: CupertinoSwitchDemo.routeName,
documentationUrl: 'https://docs.flutter.io/flutter/cupertino/CupertinoSwitch-class.html',
buildRoute: (BuildContext context) => CupertinoSwitchDemo(), buildRoute: (BuildContext context) => CupertinoSwitchDemo(),
), ),
...@@ -510,3 +551,10 @@ final Map<GalleryDemoCategory, List<GalleryDemo>> kGalleryCategoryToDemos = ...@@ -510,3 +551,10 @@ final Map<GalleryDemoCategory, List<GalleryDemo>> kGalleryCategoryToDemos =
return kAllGalleryDemos.where((GalleryDemo demo) => demo.category == category).toList(); return kAllGalleryDemos.where((GalleryDemo demo) => demo.category == category).toList();
}, },
); );
final Map<String, String> kDemoDocumentationUrl =
Map<String, String>.fromIterable(
kAllGalleryDemos.where((GalleryDemo demo) => demo.documentationUrl != null),
key: (dynamic demo) => demo.routeName,
value: (dynamic demo) => demo.documentationUrl,
);
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