mirror of
https://github.com/flutter/samples.git
synced 2025-11-10 14:58:34 +00:00
Update flutter web samples (#161)
* update gallery and web samples compatable with SDK version 2a576b774c: Flutter 1.12.3-pre.38 • channel master • git@github.com:flutter/flutter.git Framework • revision 2a576b774c (2 hours ago) • 2019-11-15 13:15:05 -0800 Engine • revision b2640d97e7 Tools • Dart 2.7.0 * add preview image
This commit is contained in:
@@ -41,59 +41,53 @@ class _CupertinoRefreshControlDemoState extends State<CupertinoRefreshControlDem
|
||||
return DefaultTextStyle(
|
||||
style: CupertinoTheme.of(context).textTheme.textStyle,
|
||||
child: CupertinoPageScaffold(
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: CupertinoTheme.of(context).brightness == Brightness.light
|
||||
? CupertinoColors.extraLightBackgroundGray
|
||||
: CupertinoColors.darkBackgroundGray,
|
||||
),
|
||||
child: CustomScrollView(
|
||||
// If left unspecified, the [CustomScrollView] appends an
|
||||
// [AlwaysScrollableScrollPhysics]. Behind the scene, the ScrollableState
|
||||
// will attach that [AlwaysScrollableScrollPhysics] to the output of
|
||||
// [ScrollConfiguration.of] which will be a [ClampingScrollPhysics]
|
||||
// on Android.
|
||||
// To demonstrate the iOS behavior in this demo and to ensure that the list
|
||||
// always scrolls, we specifically use a [BouncingScrollPhysics] combined
|
||||
// with a [AlwaysScrollableScrollPhysics]
|
||||
physics: const BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics()),
|
||||
slivers: <Widget>[
|
||||
CupertinoSliverNavigationBar(
|
||||
largeTitle: const Text('Refresh'),
|
||||
// We're specifying a back label here because the previous page
|
||||
// is a Material page. CupertinoPageRoutes could auto-populate
|
||||
// these back labels.
|
||||
previousPageTitle: 'Cupertino',
|
||||
trailing: CupertinoDemoDocumentationButton(CupertinoRefreshControlDemo.routeName),
|
||||
),
|
||||
CupertinoSliverRefreshControl(
|
||||
onRefresh: () {
|
||||
return Future<void>.delayed(const Duration(seconds: 2))
|
||||
..then<void>((_) {
|
||||
if (mounted) {
|
||||
setState(() => repopulateList());
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
SliverSafeArea(
|
||||
top: false, // Top safe area is consumed by the navigation bar.
|
||||
sliver: SliverList(
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(BuildContext context, int index) {
|
||||
return _ListItem(
|
||||
name: randomizedContacts[index][0],
|
||||
place: randomizedContacts[index][1],
|
||||
date: randomizedContacts[index][2],
|
||||
called: randomizedContacts[index][3] == 'true',
|
||||
);
|
||||
},
|
||||
childCount: 20,
|
||||
),
|
||||
backgroundColor: CupertinoColors.systemGroupedBackground,
|
||||
child: CustomScrollView(
|
||||
// If left unspecified, the [CustomScrollView] appends an
|
||||
// [AlwaysScrollableScrollPhysics]. Behind the scene, the ScrollableState
|
||||
// will attach that [AlwaysScrollableScrollPhysics] to the output of
|
||||
// [ScrollConfiguration.of] which will be a [ClampingScrollPhysics]
|
||||
// on Android.
|
||||
// To demonstrate the iOS behavior in this demo and to ensure that the list
|
||||
// always scrolls, we specifically use a [BouncingScrollPhysics] combined
|
||||
// with a [AlwaysScrollableScrollPhysics]
|
||||
physics: const BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics()),
|
||||
slivers: <Widget>[
|
||||
CupertinoSliverNavigationBar(
|
||||
largeTitle: const Text('Refresh'),
|
||||
// We're specifying a back label here because the previous page
|
||||
// is a Material page. CupertinoPageRoutes could auto-populate
|
||||
// these back labels.
|
||||
previousPageTitle: 'Cupertino',
|
||||
trailing: CupertinoDemoDocumentationButton(CupertinoRefreshControlDemo.routeName),
|
||||
),
|
||||
CupertinoSliverRefreshControl(
|
||||
onRefresh: () {
|
||||
return Future<void>.delayed(const Duration(seconds: 2))
|
||||
..then<void>((_) {
|
||||
if (mounted) {
|
||||
setState(() => repopulateList());
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
SliverSafeArea(
|
||||
top: false, // Top safe area is consumed by the navigation bar.
|
||||
sliver: SliverList(
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(BuildContext context, int index) {
|
||||
return _ListItem(
|
||||
name: randomizedContacts[index][0],
|
||||
place: randomizedContacts[index][1],
|
||||
date: randomizedContacts[index][2],
|
||||
called: randomizedContacts[index][3] == 'true',
|
||||
);
|
||||
},
|
||||
childCount: 20,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -163,7 +157,7 @@ class _ListItem extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: CupertinoTheme.of(context).scaffoldBackgroundColor,
|
||||
color: CupertinoDynamicColor.resolve(CupertinoColors.systemBackground, context),
|
||||
height: 60.0,
|
||||
padding: const EdgeInsets.only(top: 9.0),
|
||||
child: Row(
|
||||
@@ -171,11 +165,11 @@ class _ListItem extends StatelessWidget {
|
||||
Container(
|
||||
width: 38.0,
|
||||
child: called
|
||||
? const Align(
|
||||
? Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: Icon(
|
||||
CupertinoIcons.phone_solid,
|
||||
color: CupertinoColors.inactiveGray,
|
||||
color: CupertinoColors.inactiveGray.resolveFrom(context),
|
||||
size: 18.0,
|
||||
),
|
||||
)
|
||||
@@ -209,10 +203,10 @@ class _ListItem extends StatelessWidget {
|
||||
place,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 15.0,
|
||||
letterSpacing: -0.24,
|
||||
color: CupertinoColors.inactiveGray,
|
||||
color: CupertinoColors.inactiveGray.resolveFrom(context),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -220,8 +214,8 @@ class _ListItem extends StatelessWidget {
|
||||
),
|
||||
Text(
|
||||
date,
|
||||
style: const TextStyle(
|
||||
color: CupertinoColors.inactiveGray,
|
||||
style: TextStyle(
|
||||
color: CupertinoColors.inactiveGray.resolveFrom(context),
|
||||
fontSize: 15.0,
|
||||
letterSpacing: -0.41,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user