FAB Snippet for API Docs (#28752)
* Added code snippets for FloatingActionButton Class. ref:#21136 * Extraneous white spaces. Co-Authored-By: Piinks <katelovett@google.com> * Alignment correction. * The analyze result wasn't showing on github interface. Checked through Cirrus and it's all-green. Co-Authored-By: Piinks <katelovett@google.com>
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user