1
0
mirror of https://github.com/flutter/samples.git synced 2026-05-13 10:27:09 +00:00

web/chart: fix sample (#909)

This commit is contained in:
Brett Morgan
2021-10-07 08:10:34 +11:00
committed by GitHub
parent 0fe216a1cf
commit 2d9ba2f9eb
118 changed files with 3655 additions and 3511 deletions

View File

@@ -15,7 +15,7 @@
import 'package:flutter/material.dart';
typedef Widget GalleryWidgetBuilder();
typedef GalleryWidgetBuilder = Widget Function();
/// Helper to build gallery.
class GalleryScaffold extends StatefulWidget {
@@ -25,20 +25,25 @@ class GalleryScaffold extends StatefulWidget {
final String subtitle;
final GalleryWidgetBuilder childBuilder;
GalleryScaffold(
{this.listTileIcon, this.title, this.subtitle, this.childBuilder});
const GalleryScaffold(
{this.listTileIcon,
this.title,
this.subtitle,
this.childBuilder,
Key key})
: super(key: key);
/// Gets the gallery
Widget buildGalleryListTile(BuildContext context) => new ListTile(
Widget buildGalleryListTile(BuildContext context) => ListTile(
leading: listTileIcon,
title: new Text(title),
subtitle: new Text(subtitle),
title: Text(title),
subtitle: Text(subtitle),
onTap: () {
Navigator.push(context, new MaterialPageRoute(builder: (_) => this));
Navigator.push(context, MaterialPageRoute(builder: (_) => this));
});
@override
_GalleryScaffoldState createState() => new _GalleryScaffoldState();
_GalleryScaffoldState createState() => _GalleryScaffoldState();
}
class _GalleryScaffoldState extends State<GalleryScaffold> {
@@ -48,15 +53,15 @@ class _GalleryScaffoldState extends State<GalleryScaffold> {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(title: new Text(widget.title)),
body: new Padding(
return Scaffold(
appBar: AppBar(title: Text(widget.title)),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: new Column(children: <Widget>[
new SizedBox(height: 250.0, child: widget.childBuilder()),
child: Column(children: <Widget>[
SizedBox(height: 250.0, child: widget.childBuilder()),
])),
floatingActionButton: new FloatingActionButton(
child: new Icon(Icons.refresh), onPressed: _handleButtonPress),
floatingActionButton: FloatingActionButton(
child: const Icon(Icons.refresh), onPressed: _handleButtonPress),
);
}
}