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:
@@ -1,18 +1,18 @@
|
||||
// Copyright 2018 The Chromium Authors. All rights reserved.
|
||||
// Copyright 2015 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 '../../gallery/demo.dart';
|
||||
|
||||
// Each TabBarView contains a _Page and for each _Page there is a list
|
||||
// of _CardData objects. Each _CardData object is displayed by a _CardItem.
|
||||
|
||||
import 'package:flutter_web/material.dart';
|
||||
|
||||
import '../../gallery/demo.dart';
|
||||
|
||||
const String _kGalleryAssetsPackage = 'flutter_gallery_assets';
|
||||
|
||||
class _Page {
|
||||
_Page({this.label});
|
||||
_Page({ this.label });
|
||||
final String label;
|
||||
String get id => label[0];
|
||||
@override
|
||||
@@ -20,7 +20,7 @@ class _Page {
|
||||
}
|
||||
|
||||
class _CardData {
|
||||
const _CardData({this.title, this.imageAsset, this.imageAssetPackage});
|
||||
const _CardData({ this.title, this.imageAsset, this.imageAssetPackage });
|
||||
final String title;
|
||||
final String imageAsset;
|
||||
final String imageAssetPackage;
|
||||
@@ -94,7 +94,7 @@ final Map<_Page, List<_CardData>> _allPages = <_Page, List<_CardData>>{
|
||||
};
|
||||
|
||||
class _CardDataItem extends StatelessWidget {
|
||||
const _CardDataItem({this.page, this.data});
|
||||
const _CardDataItem({ this.page, this.data });
|
||||
|
||||
static const double height = 272.0;
|
||||
final _Page page;
|
||||
@@ -110,17 +110,20 @@ class _CardDataItem extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Align(
|
||||
alignment:
|
||||
page.id == 'H' ? Alignment.centerLeft : Alignment.centerRight,
|
||||
alignment: page.id == 'H'
|
||||
? Alignment.centerLeft
|
||||
: Alignment.centerRight,
|
||||
child: CircleAvatar(child: Text('${page.id}')),
|
||||
),
|
||||
SizedBox(width: 144.0, height: 144.0, child: new Text('image')
|
||||
// Image.asset(
|
||||
// data.imageAsset,
|
||||
// package: data.imageAssetPackage,
|
||||
// fit: BoxFit.contain,
|
||||
// ),
|
||||
),
|
||||
SizedBox(
|
||||
width: 144.0,
|
||||
height: 144.0,
|
||||
child: Image.asset(
|
||||
data.imageAsset,
|
||||
package: data.imageAssetPackage,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
Center(
|
||||
child: Text(
|
||||
data.title,
|
||||
@@ -145,18 +148,19 @@ class TabsDemo extends StatelessWidget {
|
||||
body: NestedScrollView(
|
||||
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
||||
return <Widget>[
|
||||
SliverAppBar(
|
||||
title: const Text('Tabs and scrolling'),
|
||||
actions: <Widget>[MaterialDemoDocumentationButton(routeName)],
|
||||
pinned: true,
|
||||
expandedHeight: 150.0,
|
||||
forceElevated: innerBoxIsScrolled,
|
||||
bottom: TabBar(
|
||||
tabs: _allPages.keys
|
||||
.map<Widget>(
|
||||
(_Page page) => Tab(text: page.label),
|
||||
)
|
||||
.toList(),
|
||||
SliverOverlapAbsorber(
|
||||
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||
child: SliverAppBar(
|
||||
title: const Text('Tabs and scrolling'),
|
||||
actions: <Widget>[MaterialDemoDocumentationButton(routeName)],
|
||||
pinned: true,
|
||||
expandedHeight: 150.0,
|
||||
forceElevated: innerBoxIsScrolled,
|
||||
bottom: TabBar(
|
||||
tabs: _allPages.keys.map<Widget>(
|
||||
(_Page page) => Tab(text: page.label),
|
||||
).toList(),
|
||||
),
|
||||
),
|
||||
),
|
||||
];
|
||||
@@ -171,6 +175,9 @@ class TabsDemo extends StatelessWidget {
|
||||
return CustomScrollView(
|
||||
key: PageStorageKey<_Page>(page),
|
||||
slivers: <Widget>[
|
||||
SliverOverlapInjector(
|
||||
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||
),
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 8.0,
|
||||
|
||||
Reference in New Issue
Block a user