From 47c835fb2bd84875455fe04ff5586ab520cd4d9c Mon Sep 17 00:00:00 2001 From: Shivam Bhasin <32370728+shivamvk@users.noreply.github.com> Date: Fri, 1 Mar 2019 00:59:32 +0530 Subject: [PATCH] Add Sample code for FlatButton #21136 (#27751) * Update flat_button.dart * Added smaple code for Flat Button * Update flat_button.dart * Revert "Update flat_button.dart" This reverts commit c8f00dff39e18b267295890bd0c5a86979b58c24. * Revert "Added smaple code for Flat Button" This reverts commit adc4234bc7956293a5b56f39701c6967fe3e919a. * Update flat_button.dart * Update flat_button.dart * Update flat_button.dart * remove white spaces * remove white spaces * add two different samples * Update flat_button.dart --- .../flutter/lib/src/material/flat_button.dart | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/packages/flutter/lib/src/material/flat_button.dart b/packages/flutter/lib/src/material/flat_button.dart index fd56a273bd..70377b516c 100644 --- a/packages/flutter/lib/src/material/flat_button.dart +++ b/packages/flutter/lib/src/material/flat_button.dart @@ -40,6 +40,48 @@ import 'theme_data.dart'; /// /// The [clipBehavior] argument must not be null. /// +/// {@tool sample} +/// +/// This example shows a simple [FlatButton]. +/// +/// ```dart +/// FlatButton( +/// onPressed: () { +/// /*...*/ +/// }, +/// child: Text( +/// "Flat Button", +/// ), +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool sample} +/// +/// This example shows a [FlatButton] that is normally white-on-blue, +/// with splashes rendered in a different shade of blue. +/// It turns black-on-grey when disabled. +/// The button has 8px of padding on each side, and the text is 20px high. +/// +/// ```dart +/// FlatButton( +/// color: Colors.blue, +/// textColor: Colors.white, +/// disabledColor: Colors.grey, +/// disabledTextColor: Colors.black, +/// padding: EdgeInsets.all(8.0), +/// splashColor: Colors.blueAccent, +/// onPressed: () { +/// /*...*/ +/// }, +/// child: Text( +/// "Flat Button", +/// style: TextStyle(fontSize: 20.0), +/// ), +/// ) +/// ``` +/// {@end-tool} +/// /// See also: /// /// * [RaisedButton], a filled button whose material elevates when pressed.