Added ElevatedButton code sample (#76221)
This commit is contained in:
committed by
GitHub
parent
e301aca0b0
commit
1c7f038dbb
@@ -47,6 +47,38 @@ import 'theme_data.dart';
|
||||
/// If [onPressed] and [onLongPress] callbacks are null, then the
|
||||
/// button will be disabled.
|
||||
///
|
||||
/// {@tool dartpad --template=stateful_widget_scaffold}
|
||||
///
|
||||
/// This sample produces an enabled and a disabled ElevatedButton.
|
||||
///
|
||||
/// ```dart
|
||||
/// Widget build(BuildContext context) {
|
||||
/// final ButtonStyle style =
|
||||
/// ElevatedButton.styleFrom(textStyle: TextStyle(fontSize: 20));
|
||||
///
|
||||
/// return Center(
|
||||
/// child: Column(
|
||||
/// mainAxisSize: MainAxisSize.min,
|
||||
/// children: <Widget>[
|
||||
/// ElevatedButton(
|
||||
/// style: style,
|
||||
/// onPressed: null,
|
||||
/// child: const Text('Disabled'),
|
||||
/// ),
|
||||
/// const SizedBox(height: 30),
|
||||
/// ElevatedButton(
|
||||
/// style: style,
|
||||
/// onPressed: () {},
|
||||
/// child: const Text('Enabled'),
|
||||
/// ),
|
||||
/// ],
|
||||
/// ),
|
||||
/// );
|
||||
/// }
|
||||
///
|
||||
/// ```
|
||||
/// {@end-tool}
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [TextButton], a simple flat button without a shadow.
|
||||
|
||||
Reference in New Issue
Block a user