Update an IconButton sample, add RaisedButton sample (#27169)
This commit is contained in:
committed by
Hans Muller
parent
4e8b732fe7
commit
b7807ce84c
@@ -47,11 +47,25 @@ const double _kMinButtonSize = 48.0;
|
||||
/// ```
|
||||
///
|
||||
/// ```dart
|
||||
/// Widget build(BuildContext) {
|
||||
/// return IconButton(
|
||||
/// icon: Icon(Icons.volume_up),
|
||||
/// tooltip: 'Increase volume by 10%',
|
||||
/// onPressed: () { setState(() { _volume *= 1.1; }); },
|
||||
/// Widget build(BuildContext context) {
|
||||
/// return Scaffold(
|
||||
/// body: Center(
|
||||
/// child: Column(
|
||||
/// mainAxisSize: MainAxisSize.min,
|
||||
/// children: <Widget>[
|
||||
/// IconButton(
|
||||
/// icon: Icon(Icons.volume_up),
|
||||
/// tooltip: 'Increase volume by 10',
|
||||
/// onPressed: () {
|
||||
/// setState(() {
|
||||
/// _volume += 10;
|
||||
/// });
|
||||
/// },
|
||||
/// ),
|
||||
/// Text('Volume : $_volume')
|
||||
/// ],
|
||||
/// ),
|
||||
/// ),
|
||||
/// );
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@@ -31,6 +31,46 @@ import 'theme_data.dart';
|
||||
/// Raised buttons have a minimum size of 88.0 by 36.0 which can be overidden
|
||||
/// with [ButtonTheme].
|
||||
///
|
||||
/// {@tool snippet --template=stateless_widget}
|
||||
///
|
||||
/// This sample shows how to render a disabled RaisedButton, an enabled RaisedButton
|
||||
/// and lastly a RaisedButton with gradient background.
|
||||
///
|
||||
/// ```dart
|
||||
/// Scaffold(
|
||||
/// body: Center(
|
||||
/// child: Column(
|
||||
/// mainAxisSize: MainAxisSize.min,
|
||||
/// children: <Widget>[
|
||||
/// RaisedButton(
|
||||
/// onPressed: null,
|
||||
/// child: const Text('Disabled Button'),
|
||||
/// ),
|
||||
/// RaisedButton(
|
||||
/// onPressed: () {},
|
||||
/// child: const Text('Enabled Button'),
|
||||
/// ),
|
||||
/// RaisedButton(
|
||||
/// onPressed: () {},
|
||||
/// textColor: Colors.white,
|
||||
/// padding: const EdgeInsets.all(0.0),
|
||||
/// child: Container(
|
||||
/// decoration: const BoxDecoration(
|
||||
/// gradient: LinearGradient(
|
||||
/// colors: <Color>[Colors.red, Colors.green, Colors.blue],
|
||||
/// ),
|
||||
/// ),
|
||||
/// padding: const EdgeInsets.all(10.0),
|
||||
/// child: Text('Gradient Button'),
|
||||
/// ),
|
||||
/// ),
|
||||
/// ],
|
||||
/// ),
|
||||
/// ),
|
||||
/// )
|
||||
/// ```
|
||||
/// {@end-tool}
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [FlatButton], a material design button without a shadow.
|
||||
|
||||
Reference in New Issue
Block a user