Unverified Commit 665fff00 authored by Greg Spencer's avatar Greg Spencer Committed by GitHub

Update Scaffold docs and example code (#24159)

Upgraded Scaffold example to an application example.
parent b4cc19ed
...@@ -657,32 +657,39 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr ...@@ -657,32 +657,39 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr
/// [ScaffoldState] for the current [BuildContext] via [Scaffold.of] and use the /// [ScaffoldState] for the current [BuildContext] via [Scaffold.of] and use the
/// [ScaffoldState.showSnackBar] and [ScaffoldState.showBottomSheet] functions. /// [ScaffoldState.showSnackBar] and [ScaffoldState.showBottomSheet] functions.
/// ///
/// {@tool sample} /// {@tool snippet --template=stateful_widget}
/// ///
/// This example shows a [Scaffold] with an [AppBar], a [BottomAppBar] /// This example shows a [Scaffold] with an [AppBar], a [BottomAppBar] and a
/// and a [FloatingActionButton]. The [body] is a [Text] placed in a [Center] /// [FloatingActionButton]. The [body] is a [Text] placed in a [Center] in order
/// in order to center the text within the [Scaffold] and the /// to center the text within the [Scaffold] and the [FloatingActionButton] is
/// [FloatingActionButton] is centered and docked within the /// centered and docked within the [BottomAppBar] using
/// [BottomAppBar] using [FloatingActionButtonLocation.centerDocked]. /// [FloatingActionButtonLocation.centerDocked]. The [FloatingActionButton] is
/// connected to a callback that increments a counter.
/// ///
/// ```dart /// ```dart
/// Scaffold( /// int _count = 0;
/// appBar: AppBar( ///
/// title: Text('Sample Code'), /// Widget build(BuildContext context) {
/// ), /// return Scaffold(
/// body: Center( /// appBar: AppBar(
/// child: Text('Scaffold'), /// title: Text('Sample Code'),
/// ), /// ),
/// bottomNavigationBar: BottomAppBar( /// body: Center(
/// child: Container(height: 50.0,), /// child: Text('You have pressed the button $_count times.'),
/// ), /// ),
/// floatingActionButton: FloatingActionButton( /// bottomNavigationBar: BottomAppBar(
/// onPressed: () {}, /// child: Container(height: 50.0,),
/// tooltip: 'Increment', /// ),
/// child: Icon(Icons.add), /// floatingActionButton: FloatingActionButton(
/// ), /// onPressed: () => setState(() {
/// floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, /// _count++;
/// ) /// }),
/// tooltip: 'Increment Counter',
/// child: Icon(Icons.add),
/// ),
/// floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
/// );
/// }
/// ``` /// ```
/// {@end-tool} /// {@end-tool}
/// ///
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment