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,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flutter code sample for [AbsorbPointer].
import 'package:flutter/material.dart';
/// Flutter code sample for [AbsorbPointer].
void main() => runApp(const AbsorbPointerApp());
class AbsorbPointerApp extends StatelessWidget {

View File

@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flutter code sample for [AspectRatio].
import 'package:flutter/material.dart';
/// Flutter code sample for [AspectRatio].
void main() => runApp(const AspectRatioApp());
class AspectRatioApp extends StatelessWidget {

View File

@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flutter code sample for [AspectRatio].
import 'package:flutter/material.dart';
/// Flutter code sample for [AspectRatio].
void main() => runApp(const AspectRatioApp());
class AspectRatioApp extends StatelessWidget {

View File

@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flutter code sample for [AspectRatio].
import 'package:flutter/material.dart';
/// Flutter code sample for [AspectRatio].
void main() => runApp(const AspectRatioApp());
class AspectRatioApp extends StatelessWidget {

View File

@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flutter code sample for [ClipRRect].
import 'package:flutter/material.dart';
/// Flutter code sample for [ClipRRect].
void main() => runApp(const ClipRRectApp());
class ClipRRectApp extends StatelessWidget {

View File

@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flutter code sample for [ClipRRect].
import 'package:flutter/material.dart';
/// Flutter code sample for [ClipRRect].
void main() => runApp(const ClipRRectApp());
class ClipRRectApp extends StatelessWidget {

View File

@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flutter code sample for [CustomMultiChildLayout].
import 'package:flutter/material.dart';
/// Flutter code sample for [CustomMultiChildLayout].
void main() => runApp(const ExampleApp());
class ExampleApp extends StatelessWidget {
@@ -78,8 +78,7 @@ class _CascadeLayoutDelegate extends MultiChildLayoutDelegate {
// automatically cause a relayout, like any other widget.
@override
bool shouldRelayout(_CascadeLayoutDelegate oldDelegate) {
return oldDelegate.textDirection != textDirection
|| oldDelegate.overlap != overlap;
return oldDelegate.textDirection != textDirection || oldDelegate.overlap != overlap;
}
}

View File

@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flutter code sample for [Expanded].
import 'package:flutter/material.dart';
/// Flutter code sample for [Expanded].
void main() => runApp(const ExpandedApp());
class ExpandedApp extends StatelessWidget {
@@ -19,7 +19,7 @@ class ExpandedApp extends StatelessWidget {
title: const Text('Expanded Column Sample'),
),
body: const ExpandedExample(),
)
),
);
}
}

View File

@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flutter code sample for [Expanded].
import 'package:flutter/material.dart';
/// Flutter code sample for [Expanded].
void main() => runApp(const ExpandedApp());
class ExpandedApp extends StatelessWidget {

View File

@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flutter code sample for [Flow].
import 'package:flutter/material.dart';
/// Flutter code sample for [Flow].
void main() => runApp(const FlowApp());
class FlowApp extends StatelessWidget {
@@ -31,8 +31,7 @@ class FlowMenu extends StatefulWidget {
State<FlowMenu> createState() => _FlowMenuState();
}
class _FlowMenuState extends State<FlowMenu>
with SingleTickerProviderStateMixin {
class _FlowMenuState extends State<FlowMenu> with SingleTickerProviderStateMixin {
late AnimationController menuAnimation;
IconData lastTapped = Icons.notifications;
final List<IconData> menuItems = <IconData>[
@@ -59,8 +58,7 @@ class _FlowMenuState extends State<FlowMenu>
}
Widget flowMenuItem(IconData icon) {
final double buttonDiameter =
MediaQuery.of(context).size.width / menuItems.length;
final double buttonDiameter = MediaQuery.of(context).size.width / menuItems.length;
return Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: RawMaterialButton(
@@ -70,9 +68,7 @@ class _FlowMenuState extends State<FlowMenu>
constraints: BoxConstraints.tight(Size(buttonDiameter, buttonDiameter)),
onPressed: () {
_updateMenu(icon);
menuAnimation.status == AnimationStatus.completed
? menuAnimation.reverse()
: menuAnimation.forward();
menuAnimation.status == AnimationStatus.completed ? menuAnimation.reverse() : menuAnimation.forward();
},
child: Icon(
icon,
@@ -87,15 +83,13 @@ class _FlowMenuState extends State<FlowMenu>
Widget build(BuildContext context) {
return Flow(
delegate: FlowMenuDelegate(menuAnimation: menuAnimation),
children:
menuItems.map<Widget>((IconData icon) => flowMenuItem(icon)).toList(),
children: menuItems.map<Widget>((IconData icon) => flowMenuItem(icon)).toList(),
);
}
}
class FlowMenuDelegate extends FlowDelegate {
FlowMenuDelegate({required this.menuAnimation})
: super(repaint: menuAnimation);
FlowMenuDelegate({required this.menuAnimation}) : super(repaint: menuAnimation);
final Animation<double> menuAnimation;

View File

@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flutter code sample for [FractionallySizedBox].
import 'package:flutter/material.dart';
/// Flutter code sample for [FractionallySizedBox].
void main() => runApp(const FractionallySizedBoxApp());
class FractionallySizedBoxApp extends StatelessWidget {

View File

@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flutter code sample for [IgnorePointer].
import 'package:flutter/material.dart';
/// Flutter code sample for [IgnorePointer].
void main() => runApp(const IgnorePointerApp());
class IgnorePointerApp extends StatelessWidget {
@@ -13,7 +13,7 @@ class IgnorePointerApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
return MaterialApp(
home: Scaffold(
appBar: AppBar(
centerTitle: true,

View File

@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flutter code sample for [IndexedStack].
import 'package:flutter/material.dart';
/// Flutter code sample for [IndexedStack].
void main() => runApp(const IndexedStackApp());
class IndexedStackApp extends StatelessWidget {
@@ -76,9 +76,7 @@ class _IndexedStackExampleState extends State<IndexedStackExample> {
children: <Widget>[
IndexedStack(
index: index,
children: <Widget>[
for (String name in names) PersonTracker(name: name)
],
children: <Widget>[for (String name in names) PersonTracker(name: name)],
)
],
),

View File

@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flutter code sample for [Listener].
import 'package:flutter/material.dart';
/// Flutter code sample for [Listener].
void main() => runApp(const ListenerApp());
class ListenerApp extends StatelessWidget {
@@ -71,8 +71,7 @@ class _ListenerExampleState extends State<ListenerExample> {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'You have pressed or released in this area this many times:'),
const Text('You have pressed or released in this area this many times:'),
Text(
'$_downCounter presses\n$_upCounter releases',
style: Theme.of(context).textTheme.headlineMedium,

View File

@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flutter code sample for [MouseRegion].
import 'package:flutter/material.dart';
/// Flutter code sample for [MouseRegion].
void main() => runApp(const MouseRegionApp());
class MouseRegionApp extends StatelessWidget {
@@ -69,8 +69,7 @@ class _MouseRegionExampleState extends State<MouseRegionExample> {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'You have entered or exited this box this many times:'),
const Text('You have entered or exited this box this many times:'),
Text(
'$_enterCounter Entries\n$_exitCounter Exits',
style: Theme.of(context).textTheme.headlineMedium,

View File

@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flutter code sample for [MouseRegion.onExit].
import 'package:flutter/material.dart';
/// Flutter code sample for [MouseRegion.onExit].
void main() => runApp(const MouseRegionApp());
class MouseRegionApp extends StatelessWidget {

View File

@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flutter code sample for [MouseRegion.onExit].
import 'package:flutter/material.dart';
/// Flutter code sample for [MouseRegion.onExit].
void main() => runApp(const MouseRegionApp());
class MouseRegionApp extends StatelessWidget {
@@ -26,8 +26,7 @@ class MouseRegionApp extends StatelessWidget {
// A region that hides its content one second after being hovered.
class MyTimedButton extends StatefulWidget {
const MyTimedButton(
{super.key, required this.onEnterButton, required this.onExitButton});
const MyTimedButton({super.key, required this.onEnterButton, required this.onExitButton});
final VoidCallback onEnterButton;
final VoidCallback onExitButton;
@@ -62,23 +61,23 @@ class _MyTimedButton extends State<MyTimedButton> {
height: 100,
child: MouseRegion(
child: regionIsHidden
? null
: MouseRegion(
onEnter: (_) {
widget.onEnterButton();
setState(() {
hovered = true;
});
startCountdown();
},
onExit: (_) {
setState(() {
hovered = false;
});
widget.onExitButton();
},
child: Container(color: Colors.red),
),
? null
: MouseRegion(
onEnter: (_) {
widget.onEnterButton();
setState(() {
hovered = true;
});
startCountdown();
},
onExit: (_) {
setState(() {
hovered = false;
});
widget.onExitButton();
},
child: Container(color: Colors.red),
),
),
);
}

View File

@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flutter code sample for [Offstage].
import 'package:flutter/material.dart';
/// Flutter code sample for [Offstage].
void main() => runApp(const OffstageApp());
class OffstageApp extends StatelessWidget {
@@ -36,8 +36,7 @@ class _OffstageExampleState extends State<OffstageExample> {
bool _offstage = true;
Size _getFlutterLogoSize() {
final RenderBox renderLogo =
_key.currentContext!.findRenderObject()! as RenderBox;
final RenderBox renderLogo = _key.currentContext!.findRenderObject()! as RenderBox;
return renderLogo.size;
}
@@ -68,8 +67,7 @@ class _OffstageExampleState extends State<OffstageExample> {
onPressed: () {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content:
Text('Flutter Logo size is ${_getFlutterLogoSize()}'),
content: Text('Flutter Logo size is ${_getFlutterLogoSize()}'),
),
);
}),

View File

@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flutter code sample for [OverflowBox].
import 'package:flutter/material.dart';
/// Flutter code sample for [OverflowBox].
void main() => runApp(const OverflowBoxApp());
class OverflowBoxApp extends StatelessWidget {

View File

@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flutter code sample for [PhysicalShape].
import 'package:flutter/material.dart';
/// Flutter code sample for [PhysicalShape].
void main() => runApp(const PhysicalShapeApp());
class PhysicalShapeApp extends StatelessWidget {