Clean up examples, remove section markers and --template args (#91133)

This does a cleanup of the examples, removing all of the "section" markers and extra comments that we don't need anymore now that the samples are no longer in the source code. It also removes the --template arguments from the {@tool dartpad} and {@tool sample} directives, since those are no longer used. It converts two examples that I discovered were still embedded into linked examples in the examples folder.

I didn't delete the templates from the snippets config folder yet, because there are still embedded samples in the dart:ui package from the engine that use them. Once dart:ui no longer uses the templates, they can be removed.

I bumped the version of the snippets package to pick up a change that allows removal of the --template argument.
This commit is contained in:
Greg Spencer 2021-10-04 12:16:17 -07:00 committed by GitHub
parent 799501cd31
commit fd9ce27748
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
350 changed files with 396 additions and 6885 deletions

View File

@ -19,7 +19,7 @@ import 'package:path/path.dart' as path;
import 'package:watcher/watcher.dart';
// If you update this version, also update it in dev/bots/docs.sh
const String _snippetsActivateVersion = '0.2.3';
const String _snippetsActivateVersion = '0.2.5';
final String _flutterRoot = path.dirname(path.dirname(path.dirname(path.fromUri(Platform.script))));
final String _defaultFlutterPackage = path.join(_flutterRoot, 'packages', 'flutter', 'lib');

View File

@ -26,7 +26,7 @@ function generate_docs() {
# assets-for-api-docs repo:
# https://github.com/flutter/assets-for-api-docs/tree/master/packages/snippets
# >>> If you update this version, also update it in dev/bots/analyze_sample_code.dart <<<
"$DART" pub global activate snippets 0.2.3
"$DART" pub global activate snippets 0.2.5
# This script generates a unified doc set, and creates
# a custom index.html, placing everything into dev/docs/doc.

View File

@ -2,27 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_material.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for Curve2D
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This example shows how to use a [Curve2D] to modify the position of a widget
// so that it can follow an arbitrary path.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -37,9 +22,6 @@ class MyApp extends StatelessWidget {
}
}
//*****************************************************************************
//* code-preamble (do not modify or remove section marker)
// This is the path that the child will follow. It's a CatmullRomSpline so
// that the coordinates can be specified that it must pass through. If the
// tension is set to 1.0, it will linearly interpolate between those points,
@ -115,17 +97,10 @@ class _FollowCurve2DState extends State<FollowCurve2D>
}
}
//* code-preamble (do not modify or remove section marker)
//*****************************************************************************
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return Container(
color: Colors.white,
@ -144,8 +119,4 @@ class MyStatelessWidget extends StatelessWidget {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,35 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_material.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for CupertinoContextMenu
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This sample shows a very simple CupertinoContextMenu for an empty red
// 100x100 Container. Simply long press on it to open.
//* description (do not modify or remove section marker)
//***************************************************************************
//****************************************************************************
//* code-imports (do not modify or remove section marker)
import 'package:flutter/cupertino.dart';
//* code-imports (do not modify or remove section marker)
//****************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -45,14 +24,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return Scaffold(
body: Center(
@ -82,8 +57,4 @@ class MyStatelessWidget extends StatelessWidget {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,28 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_cupertino.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for CupertinoNavigationBar
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This example shows a [CupertinoNavigationBar] placed in a [CupertinoPageScaffold].
// Since [backgroundColor]'s opacity is not 1.0, there is a blur effect and
// content slides underneath.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/cupertino.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -38,7 +22,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -46,11 +29,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
@override
Widget build(BuildContext context) {
return CupertinoPageScaffold(
@ -69,8 +48,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,28 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_cupertino.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for CupertinoPageScaffold
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This example shows a [CupertinoPageScaffold] with a [ListView] as a [child].
// The [CupertinoButton] is connected to a callback that increments a counter.
// The [backgroundColor] can be changed.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/cupertino.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -38,7 +22,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -46,11 +29,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
int _count = 0;
@override
@ -74,8 +53,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,28 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_cupertino.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for CupertinoSliverRefreshControl
//
//***************************************************************************
//* description (do not modify or remove section marker)
// When the user scrolls past [refreshTriggerPullDistance],
// this sample shows the default iOS pull to refresh indicator for 1 second and
// adds a new item to the top of the list view.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/cupertino.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -38,7 +22,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -46,11 +29,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
List<Color> colors = <Color>[
CupertinoColors.systemYellow,
CupertinoColors.systemOrange,
@ -98,8 +77,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,31 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_restoration_cupertino.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for showCupertinoDialog
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This sample demonstrates how to create a restorable Cupertino dialog. This is
// accomplished by enabling state restoration by specifying
// [CupertinoApp.restorationScopeId] and using [Navigator.restorablePush] to
// push [CupertinoDialogRoute] when the [CupertinoButton] is tapped.
//
// {@macro flutter.widgets.RestorationManager}
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/cupertino.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -42,14 +23,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return CupertinoPageScaffold(
navigationBar: const CupertinoNavigationBar(
@ -81,8 +58,4 @@ class MyStatelessWidget extends StatelessWidget {
},
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,31 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_restoration_cupertino.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for showCupertinoModalPopup
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This sample demonstrates how to create a restorable Cupertino modal route.
// This is accomplished by enabling state restoration by specifying
// [CupertinoApp.restorationScopeId] and using [Navigator.restorablePush] to
// push [CupertinoModalPopupRoute] when the [CupertinoButton] is tapped.
//
// {@macro flutter.widgets.RestorationManager}
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/cupertino.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -42,14 +23,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return CupertinoPageScaffold(
navigationBar: const CupertinoNavigationBar(
@ -89,8 +66,4 @@ class MyStatelessWidget extends StatelessWidget {
},
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,38 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for CupertinoScrollbar
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This sample shows a [CupertinoScrollbar] that fades in and out of view as scrolling occurs.
// The scrollbar will fade into view as the user scrolls, and fade out when scrolling stops.
// The `thickness` of the scrollbar will animate from 6 pixels to the `thicknessWhileDragging` of 10
// when it is dragged by the user. The `radius` of the scrollbar thumb corners will animate from 34
// to the `radiusWhileDragging` of 0 when the scrollbar is being dragged by the user.
//* description (do not modify or remove section marker)
//***************************************************************************
//****************************************************************************
//* code-imports (do not modify or remove section marker)
import 'package:flutter/cupertino.dart';
//* code-imports (do not modify or remove section marker)
//****************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -51,14 +27,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
@override
Widget build(BuildContext context) {
return CupertinoScrollbar(
@ -76,8 +48,4 @@ class MyStatelessWidget extends StatelessWidget {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,36 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for CupertinoScrollbar
//
//***************************************************************************
//* description (do not modify or remove section marker)
// When `isAlwaysShown` is true, the scrollbar thumb will remain visible without the
// fade animation. This requires that a [ScrollController] is provided to controller,
// or that the [PrimaryScrollController] is available.
//* description (do not modify or remove section marker)
//***************************************************************************
//****************************************************************************
//* code-imports (do not modify or remove section marker)
import 'package:flutter/cupertino.dart';
//* code-imports (do not modify or remove section marker)
//****************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -49,7 +27,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -57,11 +34,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
final ScrollController _controllerOne = ScrollController();
@override
@ -84,8 +57,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,35 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_material.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for CupertinoTextFormFieldRow
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This example shows how to move the focus to the next field when the user
// presses the SPACE key.
//* description (do not modify or remove section marker)
//***************************************************************************
//****************************************************************************
//* code-imports (do not modify or remove section marker)
import 'package:flutter/cupertino.dart';
//* code-imports (do not modify or remove section marker)
//****************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -45,7 +24,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -53,11 +31,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
@override
Widget build(BuildContext context) {
return CupertinoPageScaffold(
@ -86,8 +60,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,45 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_material.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for PointerSignalResolver
//
//***************************************************************************
//* description (do not modify or remove section marker)
// Here is an example that demonstrates the effect of not using the resolver
// versus using it.
//
// When this example is set to _not_ use the resolver, then triggering the
// mouse wheel over the outer box will cause only the outer box to change
// color, but triggering the mouse wheel over the inner box will cause _both_
// the outer and the inner boxes to change color (because they're both
// receiving the event).
//
// When this example is set to _use_ the resolver, then only the box located
// directly under the cursor will change color when the mouse wheel is
// triggered.
//* description (do not modify or remove section marker)
//***************************************************************************
//****************************************************************************
//* code-imports (do not modify or remove section marker)
import 'package:flutter/gestures.dart';
//* code-imports (do not modify or remove section marker)
//****************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -55,9 +24,6 @@ class MyApp extends StatelessWidget {
}
}
//*****************************************************************************
//* code-preamble (do not modify or remove section marker)
class ColorChanger extends StatefulWidget {
const ColorChanger({
Key? key,
@ -119,10 +85,6 @@ class _ColorChangerState extends State<ColorChanger> {
}
}
//* code-preamble (do not modify or remove section marker)
//*****************************************************************************
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -130,11 +92,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
bool useResolver = false;
@override
@ -179,8 +137,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,27 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_material.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for AboutListTile
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This sample shows two ways to open [AboutDialog]. The first one
// uses an [AboutListTile], and the second uses the [showAboutDialog] function.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -37,14 +22,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
final TextStyle textStyle = theme.textTheme.bodyText2!;
@ -102,8 +83,4 @@ class MyStatelessWidget extends StatelessWidget {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,27 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_material.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for AppBar
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This sample shows an [AppBar] with two simple actions. The first action
// opens a [SnackBar], while the second action navigates to a new page.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -37,14 +22,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
@ -89,8 +70,4 @@ class MyStatelessWidget extends StatelessWidget {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,26 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_material.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for AppBar
//
//***************************************************************************
//* description (do not modify or remove section marker)
//
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -36,14 +22,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
final ButtonStyle style =
TextButton.styleFrom(primary: Theme.of(context).colorScheme.onPrimary);
@ -64,8 +46,4 @@ class MyStatelessWidget extends StatelessWidget {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,27 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_material.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for SliverAppBar
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This sample shows a [SliverAppBar] and it's behavior when using the
// [pinned], [snap] and [floating] parameters.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -37,7 +22,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -45,11 +29,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
bool _pinned = true;
bool _snap = false;
bool _floating = false;
@ -152,8 +132,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,24 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/freeform.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for Autocomplete
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This example shows how to create a very basic Autocomplete widget using the
// default UI.
//* description (do not modify or remove section marker)
//***************************************************************************
//*************************************************************************
//* code-main (do not modify or remove section marker)
import 'package:flutter/material.dart';
@ -69,6 +52,3 @@ class AutocompleteBasicExample extends StatelessWidget {
);
}
}
//* code-main (do not modify or remove section marker)
//*************************************************************************

View File

@ -2,24 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/freeform.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for Autocomplete
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This example shows how to create an Autocomplete widget with a custom type.
// Try searching with text from the name or email field.
//* description (do not modify or remove section marker)
//***************************************************************************
//*************************************************************************
//* code-main (do not modify or remove section marker)
import 'package:flutter/material.dart';
@ -101,6 +84,3 @@ class AutocompleteBasicUserExample extends StatelessWidget {
);
}
}
//* code-main (do not modify or remove section marker)
//*************************************************************************

View File

@ -2,26 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_material.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for MaterialBanner
//
//***************************************************************************
//* description (do not modify or remove section marker)
// Banners placed directly into the widget tree are static.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -36,14 +22,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
@ -67,8 +49,4 @@ class MyStatelessWidget extends StatelessWidget {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,27 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_material.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for MaterialBanner
//
//***************************************************************************
//* description (do not modify or remove section marker)
// MaterialBanner's can also be presented through a [ScaffoldMessenger].
// Here is an example where ScaffoldMessengerState.showMaterialBanner() is used to show the MaterialBanner.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -37,14 +22,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
@ -71,8 +52,4 @@ class MyStatelessWidget extends StatelessWidget {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,34 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/freeform.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for BottomAppBar
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This example shows the [BottomAppBar], which can be configured to have a notch using the
// [BottomAppBar.shape] property. This also includes an optional [FloatingActionButton], which illustrates
// the [FloatingActionButtonLocation]s in relation to the [BottomAppBar].
//* description (do not modify or remove section marker)
//***************************************************************************
//****************************************************************************
//* code-imports (do not modify or remove section marker)
import 'package:flutter/material.dart';
//* code-imports (do not modify or remove section marker)
//****************************************************************************
//********************************************************************
//* code (do not modify or remove section marker)
void main() {
runApp(const BottomAppBarDemo());
}
@ -181,6 +157,3 @@ class _DemoBottomAppBar extends StatelessWidget {
);
}
}
//* code (do not modify or remove section marker)
//********************************************************************

View File

@ -2,31 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_material.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for BottomNavigationBar
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This example shows a [BottomNavigationBar] as it is used within a [Scaffold]
// widget. The [BottomNavigationBar] has three [BottomNavigationBarItem]
// widgets, which means it defaults to [BottomNavigationBarType.fixed], and
// the [currentIndex] is set to index 0. The selected item is
// amber. The `_onItemTapped` function changes the selected item's index
// and displays a corresponding message in the center of the [Scaffold].
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -41,7 +22,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -49,11 +29,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
int _selectedIndex = 0;
static const TextStyle optionStyle =
TextStyle(fontSize: 30, fontWeight: FontWeight.bold);
@ -108,8 +84,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,34 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_material.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for BottomNavigationBar
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This example shows a [BottomNavigationBar] as it is used within a [Scaffold]
// widget. The [BottomNavigationBar] has four [BottomNavigationBarItem]
// widgets, which means it defaults to [BottomNavigationBarType.shifting], and
// the [currentIndex] is set to index 0. The selected item is amber in color.
// With each [BottomNavigationBarItem] widget, backgroundColor property is
// also defined, which changes the background color of [BottomNavigationBar],
// when that item is selected. The `_onItemTapped` function changes the
// selected item's index and displays a corresponding message in the center of
// the [Scaffold].
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -44,7 +22,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -52,11 +29,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
int _selectedIndex = 0;
static const TextStyle optionStyle =
TextStyle(fontSize: 30, fontWeight: FontWeight.bold);
@ -123,8 +96,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,29 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for showModalBottomSheet
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This example demonstrates how to use `showModalBottomSheet` to display a
// bottom sheet that obscures the content behind it when a user taps a button.
// It also demonstrates how to close the bottom sheet using the [Navigator]
// when a user taps on a button inside the bottom sheet.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -42,14 +25,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return Center(
child: ElevatedButton(
@ -81,8 +60,4 @@ class MyStatelessWidget extends StatelessWidget {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,27 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for Card
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This sample shows creation of a [Card] widget that shows album information
// and two actions.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -40,14 +25,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return Center(
child: Card(
@ -79,8 +60,4 @@ class MyStatelessWidget extends StatelessWidget {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,28 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for Card
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This sample shows creation of a [Card] widget that can be tapped. When
// tapped this [Card]'s [InkWell] displays an "ink splash" that fills the
// entire card.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -41,14 +25,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return Center(
child: Card(
@ -66,8 +46,4 @@ class MyStatelessWidget extends StatelessWidget {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,30 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_scaffold_center.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for Checkbox
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This example shows how you can override the default theme of
// of a [Checkbox] with a [MaterialStateProperty].
// In this example, the checkbox's color will be `Colors.blue` when the [Checkbox]
// is being pressed, hovered, or focused. Otherwise, the checkbox's color will
// be `Colors.red`.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -45,7 +27,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -53,11 +34,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
bool isChecked = false;
@override
@ -85,8 +62,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
},
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,39 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_scaffold_center.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for CheckboxListTile
//
//***************************************************************************
//* description (do not modify or remove section marker)
// ![CheckboxListTile sample](https://flutter.github.io/assets-for-api-docs/assets/material/checkbox_list_tile.png)
//
// This widget shows a checkbox that, when checked, slows down all animations
// (including the animation of the checkbox itself getting checked!).
//
// This sample requires that you also import 'package:flutter/scheduler.dart',
// so that you can reference [timeDilation].
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
//****************************************************************************
//* code-imports (do not modify or remove section marker)
import 'package:flutter/scheduler.dart' show timeDilation;
//* code-imports (do not modify or remove section marker)
//****************************************************************************
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -54,7 +28,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -62,11 +35,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
@override
Widget build(BuildContext context) {
return CheckboxListTile(
@ -80,8 +49,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
secondary: const Icon(Icons.hourglass_empty),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,38 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_scaffold_center.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for CheckboxListTile
//
//***************************************************************************
//* description (do not modify or remove section marker)
// ![Checkbox list tile semantics sample](https://flutter.github.io/assets-for-api-docs/assets/material/checkbox_list_tile_semantics.png)
//
// Here is an example of a custom labeled checkbox widget, called
// LinkedLabelCheckbox, that includes an interactive [RichText] widget that
// handles tap gestures.
//* description (do not modify or remove section marker)
//***************************************************************************
//****************************************************************************
//* code-imports (do not modify or remove section marker)
import 'package:flutter/gestures.dart';
//* code-imports (do not modify or remove section marker)
//****************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -53,9 +29,6 @@ class MyApp extends StatelessWidget {
}
}
//*****************************************************************************
//* code-preamble (do not modify or remove section marker)
class LinkedLabelCheckbox extends StatelessWidget {
const LinkedLabelCheckbox({
Key? key,
@ -103,10 +76,6 @@ class LinkedLabelCheckbox extends StatelessWidget {
}
}
//* code-preamble (do not modify or remove section marker)
//*****************************************************************************
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -114,11 +83,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
bool _isSelected = false;
@override
@ -134,8 +99,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
},
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,29 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_scaffold_center.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for CheckboxListTile
//
//***************************************************************************
//* description (do not modify or remove section marker)
// ![Custom checkbox list tile sample](https://flutter.github.io/assets-for-api-docs/assets/material/checkbox_list_tile_custom.png)
//
// Here is an example of a custom LabeledCheckbox widget, but you can easily
// make your own configurable widget.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -44,9 +27,6 @@ class MyApp extends StatelessWidget {
}
}
//*****************************************************************************
//* code-preamble (do not modify or remove section marker)
class LabeledCheckbox extends StatelessWidget {
const LabeledCheckbox({
Key? key,
@ -85,10 +65,6 @@ class LabeledCheckbox extends StatelessWidget {
}
}
//* code-preamble (do not modify or remove section marker)
//*****************************************************************************
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -96,11 +72,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
bool _isSelected = false;
@override
@ -116,8 +88,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
},
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,27 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_scaffold_center.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for DeletableChipAttributes.onDeleted
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This sample shows how to use [onDeleted] to remove an entry when the
// delete button is tapped.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -42,9 +27,6 @@ class MyApp extends StatelessWidget {
}
}
//*****************************************************************************
//* code-preamble (do not modify or remove section marker)
class Actor {
const Actor(this.name, this.initials);
final String name;
@ -93,10 +75,6 @@ class CastListState extends State<CastList> {
}
}
//* code-preamble (do not modify or remove section marker)
//*****************************************************************************
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -104,17 +82,9 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
@override
Widget build(BuildContext context) {
return const CastList();
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,31 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for DataTable
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This sample shows how to display a [DataTable] with three columns: name, age, and
// role. The columns are defined by three [DataColumn] objects. The table
// contains three rows of data for three example users, the data for which
// is defined by three [DataRow] objects.
//
// ![](https://flutter.github.io/assets-for-api-docs/assets/material/data_table.png)
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -44,14 +25,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return DataTable(
columns: const <DataColumn>[
@ -99,8 +76,4 @@ class MyStatelessWidget extends StatelessWidget {
],
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,27 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for DataTable
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This sample shows how to display a [DataTable] with alternate colors per
// row, and a custom color for when the row is selected.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -40,7 +25,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -48,11 +32,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
static const int numItems = 10;
List<bool> selected = List<bool>.generate(numItems, (int index) => false);
@ -93,8 +73,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,29 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_restoration_material.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for showDatePicker
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This sample demonstrates how to create a restorable Material date picker.
// This is accomplished by enabling state restoration by specifying
// [MaterialApp.restorationScopeId] and using [Navigator.restorablePush] to
// push [DatePickerDialog] when the button is tapped.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -40,7 +23,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key, this.restorationId}) : super(key: key);
@ -50,7 +32,6 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
/// RestorationProperty objects can be used because of RestorationMixin.
class _MyStatefulWidgetState extends State<MyStatefulWidget>
with RestorationMixin {
@ -59,9 +40,6 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget>
@override
String? get restorationId => widget.restorationId;
//********************************************************************
//* code (do not modify or remove section marker)
final RestorableDateTime _selectedDate =
RestorableDateTime(DateTime(2021, 7, 25));
late final RestorableRouteFuture<DateTime?> _restorableDatePickerRouteFuture =
@ -125,8 +103,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget>
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,29 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_restoration_material.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for showDateRangePicker
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This sample demonstrates how to create a restorable Material date range picker.
// This is accomplished by enabling state restoration by specifying
// [MaterialApp.restorationScopeId] and using [Navigator.restorablePush] to
// push [DateRangePickerDialog] when the button is tapped.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -40,7 +23,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key, this.restorationId}) : super(key: key);
@ -50,7 +32,6 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
/// RestorationProperty objects can be used because of RestorationMixin.
class _MyStatefulWidgetState extends State<MyStatefulWidget>
with RestorationMixin {
@ -59,9 +40,6 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget>
@override
String? get restorationId => widget.restorationId;
//********************************************************************
//* code (do not modify or remove section marker)
final RestorableDateTimeN _startDate =
RestorableDateTimeN(DateTime(2021, 1, 1));
final RestorableDateTimeN _endDate =
@ -142,8 +120,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget>
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,28 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_scaffold_center.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for AlertDialog
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This demo shows a [TextButton] which when pressed, calls [showDialog]. When called, this method
// displays a Material dialog above the current contents of the app and returns
// a [Future] that completes when the dialog is dismissed.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -43,14 +27,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return TextButton(
onPressed: () => showDialog<String>(
@ -73,8 +53,4 @@ class MyStatelessWidget extends StatelessWidget {
child: const Text('Show Dialog'),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,31 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_restoration_material.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for showDialog
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This sample demonstrates how to create a restorable Material dialog. This is
// accomplished by enabling state restoration by specifying
// [MaterialApp.restorationScopeId] and using [Navigator.restorablePush] to
// push [DialogRoute] when the button is tapped.
//
// {@macro flutter.widgets.RestorationManager}
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -42,14 +23,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return Scaffold(
body: Center(
@ -71,8 +48,4 @@ class MyStatelessWidget extends StatelessWidget {
const AlertDialog(title: Text('Material Alert!')),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,31 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for Divider
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This sample shows how to display a Divider between an orange and blue box
// inside a column. The Divider is 20 logical pixels in height and contains a
// vertically centered black line that is 5 logical pixels thick. The black
// line is indented by 20 logical pixels.
//
// ![](https://flutter.github.io/assets-for-api-docs/assets/material/divider.png)
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -44,14 +25,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return Center(
child: Column(
@ -96,8 +73,4 @@ class MyStatelessWidget extends StatelessWidget {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,29 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for VerticalDivider
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This sample shows how to display a [VerticalDivider] between a purple and orange box
// inside a [Row]. The [VerticalDivider] is 20 logical pixels in width and contains a
// horizontally centered black line that is 1 logical pixels thick. The grey
// line is indented by 20 logical pixels.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -42,14 +25,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(10),
@ -82,8 +61,4 @@ class MyStatelessWidget extends StatelessWidget {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,30 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_scaffold_center.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for DropdownButton
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This sample shows a `DropdownButton` with a large arrow icon,
// purple text style, and bold purple underline, whose value is one of "One",
// "Two", "Free", or "Four".
//
// ![](https://flutter.github.io/assets-for-api-docs/assets/material/dropdown_button.png)
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -45,7 +27,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -53,11 +34,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
String dropdownValue = 'One';
@override
@ -86,8 +63,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
}).toList(),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,27 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for DropdownButton.selectedItemBuilder
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This sample shows a `DropdownButton` with a button with [Text] that
// corresponds to but is unique from [DropdownMenuItem].
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -40,7 +25,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -48,11 +32,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
final List<String> items = <String>['1', '2', '3'];
String selectedItem = '1';
@ -77,8 +57,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,27 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for DropdownButton.style
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This sample shows a `DropdownButton` with a dropdown button text style
// that is different than its menu items.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -40,7 +25,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -48,11 +32,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
List<String> options = <String>['One', 'Two', 'Free', 'Four'];
String dropdownValue = 'One';
@ -86,8 +66,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,26 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for ElevatedButton
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This sample produces an enabled and a disabled ElevatedButton.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -39,7 +25,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -47,11 +32,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
@override
Widget build(BuildContext context) {
final ButtonStyle style =
@ -76,8 +57,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,26 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for ExpansionPanelList
//
//***************************************************************************
//* description (do not modify or remove section marker)
// Here is a simple example of how to implement ExpansionPanelList.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -39,9 +25,6 @@ class MyApp extends StatelessWidget {
}
}
//*****************************************************************************
//* code-preamble (do not modify or remove section marker)
// stores ExpansionPanel state information
class Item {
Item({
@ -64,10 +47,6 @@ List<Item> generateItems(int numberOfItems) {
});
}
//* code-preamble (do not modify or remove section marker)
//*****************************************************************************
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -75,11 +54,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
final List<Item> _data = generateItems(8);
@override
@ -120,8 +95,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
}).toList(),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,26 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for ExpansionPanelList.ExpansionPanelList.radio
//
//***************************************************************************
//* description (do not modify or remove section marker)
// Here is a simple example of how to implement ExpansionPanelList.radio.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -39,9 +25,6 @@ class MyApp extends StatelessWidget {
}
}
//*****************************************************************************
//* code-preamble (do not modify or remove section marker)
// stores ExpansionPanel state information
class Item {
Item({
@ -65,10 +48,6 @@ List<Item> generateItems(int numberOfItems) {
});
}
//* code-preamble (do not modify or remove section marker)
//*****************************************************************************
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -76,11 +55,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
final List<Item> _data = generateItems(8);
@override
@ -117,8 +92,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
}).toList(),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,26 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for ExpansionTile
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This example demonstrates different configurations of ExpansionTile.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -39,7 +25,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -47,11 +32,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
bool _customTileExpanded = false;
@override
@ -91,8 +72,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
],
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,37 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/freeform.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for FlexibleSpaceBar
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This sample application demonstrates the different features of the
// [FlexibleSpaceBar] when used in a [SliverAppBar]. This app bar is configured
// to stretch into the overscroll space, and uses the
// [FlexibleSpaceBar.stretchModes] to apply `fadeTitle`, `blurBackground` and
// `zoomBackground`. The app bar also makes use of [CollapseMode.parallax] by
// default.
//* description (do not modify or remove section marker)
//***************************************************************************
//****************************************************************************
//* code-imports (do not modify or remove section marker)
import 'package:flutter/material.dart';
//* code-imports (do not modify or remove section marker)
//****************************************************************************
//********************************************************************
//* code (do not modify or remove section marker)
void main() => runApp(const MaterialApp(home: MyApp()));
class MyApp extends StatelessWidget {
@ -105,6 +78,3 @@ class MyApp extends StatelessWidget {
);
}
}
//* code (do not modify or remove section marker)
//********************************************************************

View File

@ -2,29 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_material.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for FloatingActionButton
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This example shows how to display a [FloatingActionButton] in a
// [Scaffold], with a pink [backgroundColor] and a thumbs up [Icon].
//
// ![](https://flutter.github.io/assets-for-api-docs/assets/material/floating_action_button.png)
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -39,14 +22,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
@ -62,8 +41,4 @@ class MyStatelessWidget extends StatelessWidget {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,30 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_material.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for FloatingActionButton
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This example shows how to make an extended [FloatingActionButton] in a
// [Scaffold], with a pink [backgroundColor], a thumbs up [Icon] and a
// [Text] label that reads "Approve".
//
// ![](https://flutter.github.io/assets-for-api-docs/assets/material/floating_action_button_label.png)
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -40,14 +22,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
@ -66,8 +44,4 @@ class MyStatelessWidget extends StatelessWidget {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,36 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_material.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for StandardFabLocation
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This is an example of a user-defined [FloatingActionButtonLocation].
//
// The example shows a [Scaffold] with an [AppBar], a [BottomAppBar], and a
// [FloatingActionButton] using a custom [FloatingActionButtonLocation].
//
// The new [FloatingActionButtonLocation] is defined
// by extending [StandardFabLocation] with two mixins,
// [FabEndOffsetX] and [FabFloatOffsetY], and overriding the
// [getOffsetX] method to adjust the FAB's x-coordinate, creating a
// [FloatingActionButtonLocation] slightly different from
// [FloatingActionButtonLocation.endFloat].
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -46,9 +22,6 @@ class MyApp extends StatelessWidget {
}
}
//*****************************************************************************
//* code-preamble (do not modify or remove section marker)
class AlmostEndFloatFabLocation extends StandardFabLocation
with FabEndOffsetX, FabFloatOffsetY {
@override
@ -61,17 +34,10 @@ class AlmostEndFloatFabLocation extends StandardFabLocation
}
}
//* code-preamble (do not modify or remove section marker)
//*****************************************************************************
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
@ -87,8 +53,4 @@ class MyStatelessWidget extends StatelessWidget {
floatingActionButtonLocation: AlmostEndFloatFabLocation(),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,29 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_scaffold_center.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for IconButton
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This sample shows an `IconButton` that uses the Material icon "volume_up" to
// increase the volume.
//
// ![](https://flutter.github.io/assets-for-api-docs/assets/material/icon_button.png)
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -44,15 +27,8 @@ class MyApp extends StatelessWidget {
}
}
//*****************************************************************************
//* code-preamble (do not modify or remove section marker)
double _volume = 0.0;
//* code-preamble (do not modify or remove section marker)
//*****************************************************************************
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -60,11 +36,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
@override
Widget build(BuildContext context) {
return Column(
@ -83,8 +55,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
],
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,31 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for IconButton
//
//***************************************************************************
//* description (do not modify or remove section marker)
// In this sample the icon button's background color is defined with an [Ink]
// widget whose child is an [IconButton]. The icon button's filled background
// is a light shade of blue, it's a filled circle, and it's as big as the
// button is.
//
// ![](https://flutter.github.io/assets-for-api-docs/assets/material/icon_button_background.png)
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -44,14 +25,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
@override
Widget build(BuildContext context) {
return Material(
@ -71,8 +48,4 @@ class MyStatelessWidget extends StatelessWidget {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,27 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_scaffold_center.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for InkWell
//
//***************************************************************************
//* description (do not modify or remove section marker)
// Tap the container to cause it to grow. Then, tap it again and hold before
// the widget reaches its maximum size to observe the clipped ink splash.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -42,7 +27,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -50,11 +34,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
double sideLength = 50;
@override
@ -76,8 +56,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,32 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for InputDecoration
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This sample shows how to style a `TextField` using an `InputDecorator`. The
// TextField displays a "send message" icon to the left of the input area,
// which is surrounded by a border an all sides. It displays the `hintText`
// inside the input area to help the user understand what input is required. It
// displays the `helperText` and `counterText` below the input area.
//
// ![](https://flutter.github.io/assets-for-api-docs/assets/material/input_decoration.png)
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -45,14 +25,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return const TextField(
decoration: InputDecoration(
@ -64,8 +40,4 @@ class MyStatelessWidget extends StatelessWidget {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,30 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for InputDecoration
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This sample shows how to style a "collapsed" `TextField` using an
// `InputDecorator`. The collapsed `TextField` surrounds the hint text and
// input area with a border, but does not add padding around them.
//
// ![](https://flutter.github.io/assets-for-api-docs/assets/material/input_decoration_collapsed.png)
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -43,14 +25,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return const TextField(
decoration: InputDecoration.collapsed(
@ -59,8 +37,4 @@ class MyStatelessWidget extends StatelessWidget {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,30 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for InputDecoration
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This sample shows how to create a `TextField` with hint text, a red border
// on all sides, and an error message. To display a red border and error
// message, provide `errorText` to the `InputDecoration` constructor.
//
// ![](https://flutter.github.io/assets-for-api-docs/assets/material/input_decoration_error.png)
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -43,14 +25,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return const TextField(
decoration: InputDecoration(
@ -60,8 +38,4 @@ class MyStatelessWidget extends StatelessWidget {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,30 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for InputDecoration
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This sample shows how to style a `TextField` with a round border and
// additional text before and after the input area. It displays "Prefix" before
// the input area, and "Suffix" after the input area.
//
// ![](https://flutter.github.io/assets-for-api-docs/assets/material/input_decoration_prefix_suffix.png)
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -43,14 +25,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return TextFormField(
initialValue: 'abc',
@ -61,8 +39,4 @@ class MyStatelessWidget extends StatelessWidget {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,27 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for InputDecoration.label
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This example shows a `TextField` with a [Text.rich] widget as the [label].
// The widget contains multiple [Text] widgets with different [TextStyle]'s.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -40,14 +25,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return const Center(
child: TextField(
@ -73,8 +54,4 @@ class MyStatelessWidget extends StatelessWidget {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,33 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for InputDecoration.prefixIconConstraints
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This example shows the differences between two `TextField` widgets when
// [prefixIconConstraints] is set to the default value and when one is not.
//
// Note that [isDense] must be set to true to be able to
// set the constraints smaller than 48px.
//
// If null, [BoxConstraints] with a minimum width and height of 48px is
// used.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -46,14 +25,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
@ -82,8 +57,4 @@ class MyStatelessWidget extends StatelessWidget {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,33 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for InputDecoration.suffixIconConstraints
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This example shows the differences between two `TextField` widgets when
// [suffixIconConstraints] is set to the default value and when one is not.
//
// Note that [isDense] must be set to true to be able to
// set the constraints smaller than 48px.
//
// If null, [BoxConstraints] with a minimum width and height of 48px is
// used.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -46,14 +25,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
@ -82,8 +57,4 @@ class MyStatelessWidget extends StatelessWidget {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,29 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for ListTile
//
//***************************************************************************
//* description (do not modify or remove section marker)
// Here is an example of a custom list item that resembles a YouTube-related
// video list item created with [Expanded] and [Container] widgets.
//
// ![Custom list item a](https://flutter.github.io/assets-for-api-docs/assets/widgets/custom_list_item_a.png)
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -42,9 +25,6 @@ class MyApp extends StatelessWidget {
}
}
//*****************************************************************************
//* code-preamble (do not modify or remove section marker)
class CustomListItem extends StatelessWidget {
const CustomListItem({
Key? key,
@ -130,17 +110,10 @@ class _VideoDescription extends StatelessWidget {
}
}
//* code-preamble (do not modify or remove section marker)
//*****************************************************************************
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return ListView(
padding: const EdgeInsets.all(8.0),
@ -165,8 +138,4 @@ class MyStatelessWidget extends StatelessWidget {
],
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,30 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for ListTile
//
//***************************************************************************
//* description (do not modify or remove section marker)
// Here is an example of an article list item with multiline titles and
// subtitles. It utilizes [Row]s and [Column]s, as well as [Expanded] and
// [AspectRatio] widgets to organize its layout.
//
// ![Custom list item b](https://flutter.github.io/assets-for-api-docs/assets/widgets/custom_list_item_b.png)
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -43,9 +25,6 @@ class MyApp extends StatelessWidget {
}
}
//*****************************************************************************
//* code-preamble (do not modify or remove section marker)
class _ArticleDescription extends StatelessWidget {
const _ArticleDescription({
Key? key,
@ -171,17 +150,10 @@ class CustomListItemTwo extends StatelessWidget {
}
}
//* code-preamble (do not modify or remove section marker)
//*****************************************************************************
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return ListView(
padding: const EdgeInsets.all(10.0),
@ -210,8 +182,4 @@ class MyStatelessWidget extends StatelessWidget {
],
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,28 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for ListTile.selected
//
//***************************************************************************
//* description (do not modify or remove section marker)
// Here is an example of using a [StatefulWidget] to keep track of the
// selected index, and using that to set the `selected` property on the
// corresponding [ListTile].
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -41,7 +25,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -49,11 +32,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
int _selectedIndex = 0;
@override
@ -73,8 +52,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
},
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,27 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_scaffold_center.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for MaterialStateBorderSide
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This example defines a subclass of [MaterialStateBorderSide], that resolves
// to a red border side when its widget is selected.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -42,7 +27,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -50,11 +34,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
bool isSelected = true;
@override
@ -75,8 +55,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
}),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,34 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_scaffold_center.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for MaterialStateMouseCursor
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This example defines a mouse cursor that resolves to
// [SystemMouseCursors.forbidden] when its widget is disabled.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
//****************************************************************************
//* code-imports (do not modify or remove section marker)
import 'package:flutter/rendering.dart';
//* code-imports (do not modify or remove section marker)
//****************************************************************************
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -49,9 +28,6 @@ class MyApp extends StatelessWidget {
}
}
//*****************************************************************************
//* code-preamble (do not modify or remove section marker)
class ListTileCursor extends MaterialStateMouseCursor {
@override
MouseCursor resolve(Set<MaterialState> states) {
@ -65,17 +41,10 @@ class ListTileCursor extends MaterialStateMouseCursor {
String get debugDescription => 'ListTileCursor()';
}
//* code-preamble (do not modify or remove section marker)
//*****************************************************************************
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return ListTile(
title: const Text('Disabled ListTile'),
@ -83,8 +52,4 @@ class MyStatelessWidget extends StatelessWidget {
mouseCursor: ListTileCursor(),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,28 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_material.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for MaterialStateOutlinedBorder
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This example defines a subclass of [RoundedRectangleBorder] and an
// implementation of [MaterialStateOutlinedBorder], that resolves to
// [RoundedRectangleBorder] when its widget is selected.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -38,9 +22,6 @@ class MyApp extends StatelessWidget {
}
}
//*****************************************************************************
//* code-preamble (do not modify or remove section marker)
class SelectedBorder extends RoundedRectangleBorder
implements MaterialStateOutlinedBorder {
@override
@ -52,10 +33,6 @@ class SelectedBorder extends RoundedRectangleBorder
}
}
//* code-preamble (do not modify or remove section marker)
//*****************************************************************************
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -63,11 +40,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
bool isSelected = true;
@override
@ -85,8 +58,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,30 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_scaffold_center.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for MaterialStateProperty
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This example shows how you can override the default text and icon
// color (the "foreground color") of a [TextButton] with a
// [MaterialStateProperty]. In this example, the button's text color
// will be `Colors.blue` when the button is being pressed, hovered,
// or focused. Otherwise, the text color will be `Colors.red`.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -45,14 +27,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
Color getColor(Set<MaterialState> states) {
const Set<MaterialState> interactiveStates = <MaterialState>{
@ -74,8 +52,4 @@ class MyStatelessWidget extends StatelessWidget {
child: const Text('TextButton'),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,29 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_material.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for NavigationRail
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This example shows a [NavigationRail] used within a Scaffold with 3
// [NavigationRailDestination]s. The main content is separated by a divider
// (although elevation on the navigation rail can be used instead). The
// `_selectedIndex` is updated by the `onDestinationSelected` callback.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -39,7 +22,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -47,11 +29,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
int _selectedIndex = 0;
@override
@ -96,8 +74,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,47 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/freeform.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for NavigationRail.extendedAnimation
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This example shows how to use this animation to create a [FloatingActionButton]
// that animates itself between the normal and extended states of the
// [NavigationRail].
//
// An instance of `MyNavigationRailFab` is created for [NavigationRail.leading].
// Pressing the FAB button toggles the "extended" state of the [NavigationRail].
//* description (do not modify or remove section marker)
//***************************************************************************
//********************************************************************************
//* code-dartImports (do not modify or remove section marker)
import 'dart:ui';
//* code-dartImports (do not modify or remove section marker)
//********************************************************************************
import 'package:flutter/material.dart';
//********************************************************************************
//* code-main (do not modify or remove section marker)
void main() => runApp(const MyApp());
//* code-main (do not modify or remove section marker)
//********************************************************************************
//********************************************************************************
//* code-preamble (do not modify or remove section marker)
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -119,12 +86,6 @@ class _MyNavigationRailState extends State<MyNavigationRail> {
}
}
//* code-preamble (do not modify or remove section marker)
//********************************************************************************
//********************************************************************
//* code (do not modify or remove section marker)
class MyNavigationRailFab extends StatelessWidget {
const MyNavigationRailFab({Key? key, this.onPressed}) : super(key: key);
@ -164,6 +125,3 @@ class MyNavigationRailFab extends StatelessWidget {
);
}
}
//* code (do not modify or remove section marker)
//********************************************************************

View File

@ -2,26 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_scaffold_center.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for OutlinedButton
//
//***************************************************************************
//* description (do not modify or remove section marker)
// Here is an example of a basic [OutlinedButton].
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -41,14 +27,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return OutlinedButton(
onPressed: () {
@ -57,8 +39,4 @@ class MyStatelessWidget extends StatelessWidget {
child: const Text('Click Me'),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,26 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_material_ticker.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for CircularProgressIndicator
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This example shows a [CircularProgressIndicator] with a changing value.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -36,7 +22,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -44,13 +29,9 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
/// AnimationControllers can be created with `vsync: this` because of TickerProviderStateMixin.
class _MyStatefulWidgetState extends State<MyStatefulWidget>
with TickerProviderStateMixin {
//********************************************************************
//* code (do not modify or remove section marker)
late AnimationController controller;
@override
@ -92,8 +73,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget>
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,26 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_material_ticker.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for LinearProgressIndicator
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This example shows a [LinearProgressIndicator] with a changing value.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -36,7 +22,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -44,13 +29,9 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
/// AnimationControllers can be created with `vsync: this` because of TickerProviderStateMixin.
class _MyStatefulWidgetState extends State<MyStatefulWidget>
with TickerProviderStateMixin {
//********************************************************************
//* code (do not modify or remove section marker)
late AnimationController controller;
@override
@ -92,8 +73,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget>
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,39 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_scaffold_center.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for Radio
//
//***************************************************************************
//* description (do not modify or remove section marker)
// Here is an example of Radio widgets wrapped in ListTiles, which is similar
// to what you could get with the RadioListTile widget.
//
// The currently selected character is passed into `groupValue`, which is
// maintained by the example's `State`. In this case, the first `Radio`
// will start off selected because `_character` is initialized to
// `SingingCharacter.lafayette`.
//
// If the second radio button is pressed, the example's state is updated
// with `setState`, updating `_character` to `SingingCharacter.jefferson`.
// This causes the buttons to rebuild with the updated `groupValue`, and
// therefore the selection of the second button.
//
// Requires one of its ancestors to be a [Material] widget.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -54,15 +27,8 @@ class MyApp extends StatelessWidget {
}
}
//*****************************************************************************
//* code-preamble (do not modify or remove section marker)
enum SingingCharacter { lafayette, jefferson }
//* code-preamble (do not modify or remove section marker)
//*****************************************************************************
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -70,11 +36,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
SingingCharacter? _character = SingingCharacter.lafayette;
@override
@ -108,8 +70,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
],
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,27 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for Radio.toggleable
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This example shows how to enable deselecting a radio button by setting the
// [toggleable] attribute.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -40,7 +25,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -48,11 +32,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
int? groupValue;
static const List<String> selections = <String>[
'Hercules Mulligan',
@ -90,8 +70,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,29 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for RadioListTile
//
//***************************************************************************
//* description (do not modify or remove section marker)
// ![RadioListTile sample](https://flutter.github.io/assets-for-api-docs/assets/material/radio_list_tile.png)
//
// This widget shows a pair of radio buttons that control the `_character`
// field. The field is of the type `SingingCharacter`, an enum.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -42,15 +25,8 @@ class MyApp extends StatelessWidget {
}
}
//*****************************************************************************
//* code-preamble (do not modify or remove section marker)
enum SingingCharacter { lafayette, jefferson }
//* code-preamble (do not modify or remove section marker)
//*****************************************************************************
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -58,11 +34,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
SingingCharacter? _character = SingingCharacter.lafayette;
@override
@ -92,8 +64,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
],
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,38 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for RadioListTile
//
//***************************************************************************
//* description (do not modify or remove section marker)
// ![Radio list tile semantics sample](https://flutter.github.io/assets-for-api-docs/assets/material/radio_list_tile_semantics.png)
//
// Here is an example of a custom labeled radio widget, called
// LinkedLabelRadio, that includes an interactive [RichText] widget that
// handles tap gestures.
//* description (do not modify or remove section marker)
//***************************************************************************
//****************************************************************************
//* code-imports (do not modify or remove section marker)
import 'package:flutter/gestures.dart';
//* code-imports (do not modify or remove section marker)
//****************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -51,9 +27,6 @@ class MyApp extends StatelessWidget {
}
}
//*****************************************************************************
//* code-preamble (do not modify or remove section marker)
class LinkedLabelRadio extends StatelessWidget {
const LinkedLabelRadio({
Key? key,
@ -101,10 +74,6 @@ class LinkedLabelRadio extends StatelessWidget {
}
}
//* code-preamble (do not modify or remove section marker)
//*****************************************************************************
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -112,11 +81,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
bool _isRadioSelected = false;
@override
@ -151,8 +116,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,29 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for RadioListTile
//
//***************************************************************************
//* description (do not modify or remove section marker)
// ![Custom radio list tile sample](https://flutter.github.io/assets-for-api-docs/assets/material/radio_list_tile_custom.png)
//
// Here is an example of a custom LabeledRadio widget, but you can easily
// make your own configurable widget.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -42,9 +25,6 @@ class MyApp extends StatelessWidget {
}
}
//*****************************************************************************
//* code-preamble (do not modify or remove section marker)
class LabeledRadio extends StatelessWidget {
const LabeledRadio({
Key? key,
@ -88,10 +68,6 @@ class LabeledRadio extends StatelessWidget {
}
}
//* code-preamble (do not modify or remove section marker)
//*****************************************************************************
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -99,11 +75,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
bool _isRadioSelected = false;
@override
@ -138,8 +110,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,27 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for RadioListTile.toggleable
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This example shows how to enable deselecting a radio button by setting the
// [toggleable] attribute.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -40,7 +25,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -48,11 +32,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
int? groupValue;
static const List<String> selections = <String>[
'Hercules Mulligan',
@ -83,8 +63,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,31 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for RangeSlider
//
//***************************************************************************
//* description (do not modify or remove section marker)
// ![A range slider widget, consisting of 5 divisions and showing the default
// value indicator.](https://flutter.github.io/assets-for-api-docs/assets/material/range_slider.png)
//
// This range values are in intervals of 20 because the Range Slider has 5
// divisions, from 0 to 100. This means are values are split between 0, 20, 40,
// 60, 80, and 100. The range values are initialized with 40 and 80 in this demo.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -44,7 +25,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -52,11 +32,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
RangeValues _currentRangeValues = const RangeValues(40, 80);
@override
@ -77,8 +53,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
},
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,26 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for ReorderableListView
//
//***************************************************************************
//* description (do not modify or remove section marker)
//
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -39,7 +25,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -47,11 +32,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
final List<int> _items = List<int>.generate(50, (int index) => index);
@override
@ -81,8 +62,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
},
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,26 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for ReorderableListView.buildDefaultDragHandles
//
//***************************************************************************
//* description (do not modify or remove section marker)
//
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -39,7 +25,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -47,11 +32,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
final List<int> _items = List<int>.generate(50, (int index) => index);
@override
@ -97,8 +78,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
},
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,26 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_scaffold_center.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for ReorderableListView.ReorderableListView.builder
//
//***************************************************************************
//* description (do not modify or remove section marker)
//
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -41,7 +27,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -49,11 +34,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
final List<int> _items = List<int>.generate(50, (int index) => index);
@override
@ -83,8 +64,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
},
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,31 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_material.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for Scaffold
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This example shows a [Scaffold] with a [body] and [FloatingActionButton].
// The [body] is a [Text] placed in a [Center] in order to center the text
// within the [Scaffold]. The [FloatingActionButton] is connected to a
// callback that increments a counter.
//
// ![The Scaffold has a white background with a blue AppBar at the top. A blue FloatingActionButton is positioned at the bottom right corner of the Scaffold.](https://flutter.github.io/assets-for-api-docs/assets/material/scaffold.png)
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -41,7 +22,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -49,11 +29,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
int _count = 0;
@override
@ -70,8 +46,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,31 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_material.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for Scaffold
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This example shows a [Scaffold] with a blueGrey [backgroundColor], [body]
// and [FloatingActionButton]. The [body] is a [Text] placed in a [Center] in
// order to center the text within the [Scaffold]. The [FloatingActionButton]
// is connected to a callback that increments a counter.
//
// ![](https://flutter.github.io/assets-for-api-docs/assets/material/scaffold_background_color.png)
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -41,7 +22,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -49,11 +29,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
int _count = 0;
@override
@ -71,8 +47,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,33 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_material.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for Scaffold
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This example shows a [Scaffold] with an [AppBar], a [BottomAppBar] and a
// [FloatingActionButton]. The [body] is a [Text] placed in a [Center] in order
// to center the text within the [Scaffold]. The [FloatingActionButton] is
// centered and docked within the [BottomAppBar] using
// [FloatingActionButtonLocation.centerDocked]. The [FloatingActionButton] is
// connected to a callback that increments a counter.
//
// ![](https://flutter.github.io/assets-for-api-docs/assets/material/scaffold_bottom_app_bar.png)
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -43,7 +22,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -51,11 +29,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
int _count = 0;
@override
@ -81,8 +55,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,29 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_material.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for Scaffold.drawer
//
//***************************************************************************
//* description (do not modify or remove section marker)
// To disable the drawer edge swipe, set the
// [Scaffold.drawerEnableOpenDragGesture] to false. Then, use
// [ScaffoldState.openDrawer] to open the drawer and [Navigator.pop] to close
// it.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -39,7 +22,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -47,11 +29,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
void _openDrawer() {
@ -91,8 +69,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
drawerEnableOpenDragGesture: false,
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,29 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_material.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for Scaffold.endDrawer
//
//***************************************************************************
//* description (do not modify or remove section marker)
// To disable the drawer edge swipe, set the
// [Scaffold.endDrawerEnableOpenDragGesture] to false. Then, use
// [ScaffoldState.openEndDrawer] to open the drawer and [Navigator.pop] to
// close it.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -39,7 +22,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -47,11 +29,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
void _openEndDrawer() {
@ -91,8 +69,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
endDrawerEnableOpenDragGesture: false,
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,41 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/freeform.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for Scaffold.of
//
//***************************************************************************
//* description (do not modify or remove section marker)
// Typical usage of the [Scaffold.of] function is to call it from within the
// `build` method of a child of a [Scaffold].
//* description (do not modify or remove section marker)
//***************************************************************************
//****************************************************************************
//* code-imports (do not modify or remove section marker)
import 'package:flutter/material.dart';
//* code-imports (do not modify or remove section marker)
//****************************************************************************
//*************************************************************************
//* code-main (do not modify or remove section marker)
void main() => runApp(const MyApp());
//* code-main (do not modify or remove section marker)
//*************************************************************************
//*****************************************************************************
//* code-preamble (do not modify or remove section marker)
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -57,12 +28,6 @@ class MyApp extends StatelessWidget {
}
}
//* code-preamble (do not modify or remove section marker)
//*****************************************************************************
//********************************************************************
//* code (do not modify or remove section marker)
class MyScaffoldBody extends StatelessWidget {
const MyScaffoldBody({Key? key}) : super(key: key);
@ -100,6 +65,3 @@ class MyScaffoldBody extends StatelessWidget {
);
}
}
//* code (do not modify or remove section marker)
//********************************************************************

View File

@ -2,31 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_material.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for Scaffold.of
//
//***************************************************************************
//* description (do not modify or remove section marker)
// When the [Scaffold] is actually created in the same `build` function, the
// `context` argument to the `build` function can't be used to find the
// [Scaffold] (since it's "above" the widget being returned in the widget
// tree). In such cases, the following technique with a [Builder] can be used
// to provide a new scope with a [BuildContext] that is "under" the
// [Scaffold]:
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -41,14 +22,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Demo')),
@ -90,8 +67,4 @@ class MyStatelessWidget extends StatelessWidget {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,26 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_scaffold_center.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for ScaffoldMessenger
//
//***************************************************************************
//* description (do not modify or remove section marker)
// Here is an example of showing a [SnackBar] when the user presses a button.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -41,14 +27,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return OutlinedButton(
onPressed: () {
@ -61,8 +43,4 @@ class MyStatelessWidget extends StatelessWidget {
child: const Text('Show SnackBar'),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,27 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_scaffold_center.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for ScaffoldMessenger.of
//
//***************************************************************************
//* description (do not modify or remove section marker)
// Typical usage of the [ScaffoldMessenger.of] function is to call it in
// response to a user gesture or an application state change.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -42,14 +27,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return ElevatedButton(
child: const Text('SHOW A SNACKBAR'),
@ -62,8 +43,4 @@ class MyStatelessWidget extends StatelessWidget {
},
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,37 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/freeform.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for ScaffoldMessenger.of
//
//***************************************************************************
//* description (do not modify or remove section marker)
// Sometimes [SnackBar]s are produced by code that doesn't have ready access
// to a valid [BuildContext]. One such example of this is when you show a
// SnackBar from a method outside of the `build` function. In these
// cases, you can assign a [GlobalKey] to the [ScaffoldMessenger]. This
// example shows a key being used to obtain the [ScaffoldMessengerState]
// provided by the [MaterialApp].
//* description (do not modify or remove section marker)
//***************************************************************************
//****************************************************************************
//* code-imports (do not modify or remove section marker)
import 'package:flutter/material.dart';
//* code-imports (do not modify or remove section marker)
//****************************************************************************
//********************************************************************
//* code (do not modify or remove section marker)
void main() => runApp(const MyApp());
class MyApp extends StatefulWidget {
@ -87,6 +60,3 @@ class _MyAppState extends State<MyApp> {
);
}
}
//* code (do not modify or remove section marker)
//********************************************************************

View File

@ -2,26 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_scaffold_center.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for ScaffoldMessengerState.showMaterialBanner
//
//***************************************************************************
//* description (do not modify or remove section marker)
// Here is an example of showing a [MaterialBanner] when the user presses a button.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -41,14 +27,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return OutlinedButton(
onPressed: () {
@ -67,8 +49,4 @@ class MyStatelessWidget extends StatelessWidget {
child: const Text('Show MaterialBanner'),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,26 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_scaffold_center.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for ScaffoldMessengerState.showSnackBar
//
//***************************************************************************
//* description (do not modify or remove section marker)
// Here is an example of showing a [SnackBar] when the user presses a button.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -41,14 +27,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return OutlinedButton(
onPressed: () {
@ -61,8 +43,4 @@ class MyStatelessWidget extends StatelessWidget {
child: const Text('Show SnackBar'),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,28 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for ScaffoldState.showBottomSheet
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This example demonstrates how to use `showBottomSheet` to display a
// bottom sheet when a user taps a button. It also demonstrates how to
// close a bottom sheet using the Navigator.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -41,14 +25,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return Center(
child: ElevatedButton(
@ -80,8 +60,4 @@ class MyStatelessWidget extends StatelessWidget {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,26 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_scaffold_center.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for ScaffoldState.showSnackBar
//
//***************************************************************************
//* description (do not modify or remove section marker)
// Here is an example of showing a [SnackBar] when the user presses a button.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -41,14 +27,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return OutlinedButton(
onPressed: () {
@ -61,8 +43,4 @@ class MyStatelessWidget extends StatelessWidget {
child: const Text('Show SnackBar'),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,27 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateless_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for Scrollbar
//
//***************************************************************************
//* description (do not modify or remove section marker)
// This sample shows a [Scrollbar] that executes a fade animation as scrolling occurs.
// The Scrollbar will fade into view as the user scrolls, and fade out when scrolling stops.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -40,14 +25,10 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
//********************************************************************
//* code (do not modify or remove section marker)
Widget build(BuildContext context) {
return Scrollbar(
child: GridView.builder(
@ -62,8 +43,4 @@ class MyStatelessWidget extends StatelessWidget {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,28 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for Scrollbar
//
//***************************************************************************
//* description (do not modify or remove section marker)
// When isAlwaysShown is true, the scrollbar thumb will remain visible without the
// fade animation. This requires that a ScrollController is provided to controller,
// or that the PrimaryScrollController is available.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -41,7 +25,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -49,11 +32,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
final ScrollController _controllerOne = ScrollController();
@override
@ -74,8 +53,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
),
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

View File

@ -2,30 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Template: dev/snippets/config/templates/stateful_widget_scaffold.tmpl
//
// Comment lines marked with "▼▼▼" and "▲▲▲" are used for authoring
// of samples, and may be ignored if you are just exploring the sample.
// Flutter code sample for Slider
//
//***************************************************************************
//* description (do not modify or remove section marker)
// ![A slider widget, consisting of 5 divisions and showing the default value
// indicator.](https://flutter.github.io/assets-for-api-docs/assets/material/slider.png)
//
// The Sliders value is part of the Stateful widget subclass to change the value
// setState was called.
//* description (do not modify or remove section marker)
//***************************************************************************
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@ -43,7 +25,6 @@ class MyApp extends StatelessWidget {
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@ -51,11 +32,7 @@ class MyStatefulWidget extends StatefulWidget {
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
//********************************************************************
//* code (do not modify or remove section marker)
double _currentSliderValue = 20;
@override
@ -73,8 +50,4 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
},
);
}
//* code (do not modify or remove section marker)
//********************************************************************
}

Some files were not shown because too many files have changed in this diff Show More