Rename Sample classes (#124080)

Rename Sample classes
This commit is contained in:
Greg Spencer
2023-04-04 13:34:29 -07:00
committed by GitHub
parent c8a3dbaf06
commit e3bc8efd39
480 changed files with 3125 additions and 3816 deletions

View File

@@ -2,28 +2,25 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flutter code sample for [NestedScrollView].
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// Flutter code sample for [NestedScrollView].
class MyApp extends StatelessWidget {
const MyApp({super.key});
void main() => runApp(const NestedScrollViewExampleApp());
static const String _title = 'Flutter Code Sample';
class NestedScrollViewExampleApp extends StatelessWidget {
const NestedScrollViewExampleApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
title: _title,
home: MyStatelessWidget(),
home: NestedScrollViewExample(),
);
}
}
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({super.key});
class NestedScrollViewExample extends StatelessWidget {
const NestedScrollViewExample({super.key});
@override
Widget build(BuildContext context) {
@@ -43,11 +40,9 @@ class MyStatelessWidget extends StatelessWidget {
// scroll view thinks it has not been scrolled.
// This is not necessary if the "headerSliverBuilder" only builds
// widgets that do not overlap the next sliver.
handle:
NestedScrollView.sliverOverlapAbsorberHandleFor(context),
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
sliver: SliverAppBar(
title:
const Text('Books'), // This is the title in the app bar.
title: const Text('Books'), // This is the title in the app bar.
pinned: true,
expandedHeight: 150.0,
// The "forceElevated" property causes the SliverAppBar to show
@@ -93,9 +88,7 @@ class MyStatelessWidget extends StatelessWidget {
SliverOverlapInjector(
// This is the flip side of the SliverOverlapAbsorber
// above.
handle:
NestedScrollView.sliverOverlapAbsorberHandleFor(
context),
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
),
SliverPadding(
padding: const EdgeInsets.all(8.0),

View File

@@ -2,28 +2,25 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flutter code sample for [NestedScrollView].
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// Flutter code sample for [NestedScrollView].
class MyApp extends StatelessWidget {
const MyApp({super.key});
void main() => runApp(const NestedScrollViewExampleApp());
static const String _title = 'Flutter Code Sample';
class NestedScrollViewExampleApp extends StatelessWidget {
const NestedScrollViewExampleApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
title: _title,
home: MyStatelessWidget(),
home: NestedScrollViewExample(),
);
}
}
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({super.key});
class NestedScrollViewExample extends StatelessWidget {
const NestedScrollViewExample({super.key});
@override
Widget build(BuildContext context) {
@@ -32,8 +29,7 @@ class MyStatelessWidget extends StatelessWidget {
// Setting floatHeaderSlivers to true is required in order to float
// the outer slivers over the inner scrollable.
floatHeaderSlivers: true,
headerSliverBuilder:
(BuildContext context, bool innerBoxIsScrolled) {
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
SliverAppBar(
title: const Text('Floating Nested SliverAppBar'),

View File

@@ -2,34 +2,30 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flutter code sample for [NestedScrollView].
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// Flutter code sample for [NestedScrollView].
class MyApp extends StatelessWidget {
const MyApp({super.key});
void main() => runApp(const NestedScrollViewExampleApp());
static const String _title = 'Flutter Code Sample';
class NestedScrollViewExampleApp extends StatelessWidget {
const NestedScrollViewExampleApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
title: _title,
home: MyStatelessWidget(),
home: NestedScrollViewExample(),
);
}
}
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({super.key});
class NestedScrollViewExample extends StatelessWidget {
const NestedScrollViewExample({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: NestedScrollView(headerSliverBuilder:
(BuildContext context, bool innerBoxIsScrolled) {
body: NestedScrollView(headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
SliverOverlapAbsorber(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
@@ -49,13 +45,11 @@ class MyStatelessWidget extends StatelessWidget {
// If the "controller" property is set, then this scroll view will not
// be associated with the NestedScrollView.
slivers: <Widget>[
SliverOverlapInjector(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context)),
SliverOverlapInjector(handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context)),
SliverFixedExtentList(
itemExtent: 48.0,
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) =>
ListTile(title: Text('Item $index')),
(BuildContext context, int index) => ListTile(title: Text('Item $index')),
childCount: 30,
),
),

View File

@@ -2,30 +2,27 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flutter code sample for [NestedScrollViewState].
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// Flutter code sample for [NestedScrollViewState].
class MyApp extends StatelessWidget {
const MyApp({super.key});
void main() => runApp(const NestedScrollViewStateExampleApp());
static const String _title = 'Flutter Code Sample';
class NestedScrollViewStateExampleApp extends StatelessWidget {
const NestedScrollViewStateExampleApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
title: _title,
home: MyStatelessWidget(),
home: NestedScrollViewStateExample(),
);
}
}
final GlobalKey<NestedScrollViewState> globalKey = GlobalKey();
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({super.key});
class NestedScrollViewStateExample extends StatelessWidget {
const NestedScrollViewStateExample({super.key});
@override
@override