1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-11 23:39:14 +00:00

Update web/ samples to work with Flutter SDK (#134)

* add package:http dependency in dad_jokes

* add package:http dependency in filipino_cuisine

* don't build package:http demos until flutter/flutter#34858 is resolved

* update gallery

* update github_dataviz

* update particle_background

* don't build github_dataviz (uses package:http)

* update slide_puzzle

* update spinning_square

* update timeflow

* update vision_challenge

* update charts

* update dad_jokes

* update filipino cuisine

* ignore build output

* update timeflow and vision_challenge

* update slide_puzzle

* don't commit build/ directory

* move preview.png images to assets

* fix path url join

* update readme

* update web/readme.md
This commit is contained in:
John Ryan
2019-09-10 09:49:58 -07:00
committed by GitHub
parent 16fa475ff8
commit 317d459a58
746 changed files with 14607 additions and 61610 deletions

View File

@@ -1,8 +1,8 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// 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_web/material.dart';
import 'package:flutter/material.dart';
class TextStyleItem extends StatelessWidget {
const TextStyleItem({
@@ -10,10 +10,10 @@ class TextStyleItem extends StatelessWidget {
@required this.name,
@required this.style,
@required this.text,
}) : assert(name != null),
assert(style != null),
assert(text != null),
super(key: key);
}) : assert(name != null),
assert(style != null),
assert(text != null),
super(key: key);
final String name;
final TextStyle style;
@@ -22,16 +22,22 @@ class TextStyleItem extends StatelessWidget {
@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
final TextStyle nameStyle =
theme.textTheme.caption.copyWith(color: theme.textTheme.caption.color);
final TextStyle nameStyle = theme.textTheme.caption.copyWith(color: theme.textTheme.caption.color);
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 16.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(width: 72.0, child: Text(name, style: nameStyle)),
Expanded(child: Text(text, style: style.copyWith(height: 1.0)))
]));
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 16.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(
width: 72.0,
child: Text(name, style: nameStyle),
),
Expanded(
child: Text(text, style: style.copyWith(height: 1.0)),
),
],
),
);
}
}
@@ -42,36 +48,24 @@ class TypographyDemo extends StatelessWidget {
Widget build(BuildContext context) {
final TextTheme textTheme = Theme.of(context).textTheme;
final List<Widget> styleItems = <Widget>[
TextStyleItem(
name: 'Display 3', style: textTheme.display3, text: 'Regular 56sp'),
TextStyleItem(
name: 'Display 2', style: textTheme.display2, text: 'Regular 45sp'),
TextStyleItem(
name: 'Display 1', style: textTheme.display1, text: 'Regular 34sp'),
TextStyleItem(
name: 'Headline', style: textTheme.headline, text: 'Regular 24sp'),
TextStyleItem(name: 'Display 3', style: textTheme.display3, text: 'Regular 56sp'),
TextStyleItem(name: 'Display 2', style: textTheme.display2, text: 'Regular 45sp'),
TextStyleItem(name: 'Display 1', style: textTheme.display1, text: 'Regular 34sp'),
TextStyleItem(name: 'Headline', style: textTheme.headline, text: 'Regular 24sp'),
TextStyleItem(name: 'Title', style: textTheme.title, text: 'Medium 20sp'),
TextStyleItem(
name: 'Subheading', style: textTheme.subhead, text: 'Regular 16sp'),
TextStyleItem(
name: 'Body 2', style: textTheme.body2, text: 'Medium 14sp'),
TextStyleItem(
name: 'Body 1', style: textTheme.body1, text: 'Regular 14sp'),
TextStyleItem(
name: 'Caption', style: textTheme.caption, text: 'Regular 12sp'),
TextStyleItem(
name: 'Button',
style: textTheme.button,
text: 'MEDIUM (ALL CAPS) 14sp'),
TextStyleItem(name: 'Subheading', style: textTheme.subhead, text: 'Regular 16sp'),
TextStyleItem(name: 'Body 2', style: textTheme.body2, text: 'Medium 14sp'),
TextStyleItem(name: 'Body 1', style: textTheme.body1, text: 'Regular 14sp'),
TextStyleItem(name: 'Caption', style: textTheme.caption, text: 'Regular 12sp'),
TextStyleItem(name: 'Button', style: textTheme.button, text: 'MEDIUM (ALL CAPS) 14sp'),
];
if (MediaQuery.of(context).size.width > 500.0) {
styleItems.insert(
0,
TextStyleItem(
name: 'Display 4',
style: textTheme.display4,
text: 'Light 112sp'));
styleItems.insert(0, TextStyleItem(
name: 'Display 4',
style: textTheme.display4,
text: 'Light 112sp',
));
}
return Scaffold(
@@ -79,7 +73,7 @@ class TypographyDemo extends StatelessWidget {
body: SafeArea(
top: false,
bottom: false,
child: ListView(children: styleItems),
child: Scrollbar(child: ListView(children: styleItems)),
),
);
}