Unverified Commit 04bd8779 authored by Anthony's avatar Anthony Committed by GitHub

[Material] Update slider gallery demo, including range slider (#34597)

Update the flutter_gallery Slider demo by aligning the text field in the first slider, adding range slider examples (including custom range thumbs), and separating single slider and range slider examples with tabs.
parent a276ab3d
......@@ -46,11 +46,15 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
this.title,
this.demos,
this.actions,
this.isScrollable = true,
this.showExampleCodeAction = true,
});
final List<ComponentDemoTabData> demos;
final String title;
final List<Widget> actions;
final bool isScrollable;
final bool showExampleCodeAction;
void _showExampleCode(BuildContext context) {
final String tag = demos[DefaultTabController.of(context).index].exampleCodeTag;
......@@ -93,29 +97,28 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
child: Scaffold(
appBar: AppBar(
title: Text(title),
actions: (actions ?? <Widget>[])..addAll(
<Widget>[
Builder(
builder: (BuildContext context) {
return IconButton(
icon: const Icon(Icons.library_books, semanticLabel: 'Show documentation'),
onPressed: () => _showApiDocumentation(context),
);
},
),
Builder(
builder: (BuildContext context) {
return IconButton(
icon: const Icon(Icons.code),
tooltip: 'Show example code',
onPressed: () => _showExampleCode(context),
);
},
),
],
),
actions: (actions ?? <Widget>[])..add(
Builder(
builder: (BuildContext context) {
return IconButton(
icon: const Icon(Icons.library_books, semanticLabel: 'Show documentation'),
onPressed: () => _showApiDocumentation(context),
);
},
),
)..addAll(showExampleCodeAction ? <Widget>[
Builder(
builder: (BuildContext context) {
return IconButton(
icon: const Icon(Icons.code),
tooltip: 'Show example code',
onPressed: () => _showExampleCode(context),
);
},
),
] : <Widget>[]),
bottom: TabBar(
isScrollable: true,
isScrollable: isScrollable,
tabs: demos.map<Widget>((ComponentDemoTabData data) => Tab(text: data.tabName)).toList(),
),
),
......
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