diff --git a/packages/flutter/lib/src/material/floating_action_button.dart b/packages/flutter/lib/src/material/floating_action_button.dart index 5e06ca41da6fd7..436798022817bc 100644 --- a/packages/flutter/lib/src/material/floating_action_button.dart +++ b/packages/flutter/lib/src/material/floating_action_button.dart @@ -53,6 +53,58 @@ class _DefaultHeroTag { /// disabled. Consider changing the [backgroundColor] if disabling the floating /// action button. /// +/// {@tool snippet --template=stateless_widget_material} +/// This example shows how to make a simple [FloatingActionButton] in a +/// [Scaffold], with a pink [backgroundColor] and a thumbs up [Icon]. +/// +/// ```dart +/// Widget build(BuildContext context) { +/// return Scaffold( +/// appBar: AppBar( +/// title: Text('Floating Action Button Sample'), +/// ), +/// body: Center( +/// child: Text('Press the button below!') +/// ), +/// floatingActionButton: FloatingActionButton( +/// onPressed: () { +/// // Add your onPressed code here! +/// }, +/// child: Icon(Icons.thumb_up), +/// backgroundColor: Colors.pink, +/// ), +/// ); +/// } +/// ``` +/// {@end-tool} +/// +/// {@tool snippet --template=stateless_widget_material} +/// This example shows how to make an extended [FloatingActionButton] in a +/// [Scaffold], with a pink [backgroundColor] and a thumbs up [Icon] and a +/// [Text] label. +/// +/// ```dart +/// Widget build(BuildContext context) { +/// return Scaffold( +/// appBar: AppBar( +/// title: Text('Floating Action Button Sample'), +/// ), +/// body: Center( +/// child: Text('Press the extended button below!'), +/// ), +/// floatingActionButton: FloatingActionButton.extended( +/// onPressed: () { +/// // Add your onPressed code here! +/// }, +/// label: Text('Approve'), +/// icon: Icon(Icons.thumb_up), +/// backgroundColor: Colors.pink, +/// ), +/// ); +/// } +/// ``` +/// {@end-tool} +/// /// See also: /// /// * [Scaffold], in which floating action buttons typically live.