mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Add an Interactive Example for PhysicalShape (#86423)
This commit is contained in:
parent
0d7e6798c9
commit
acbd280148
@ -1049,6 +1049,47 @@ class PhysicalModel extends SingleChildRenderObjectWidget {
|
||||
/// [PhysicalModel] does the same but only supports shapes that can be expressed
|
||||
/// as rectangles with rounded corners.
|
||||
///
|
||||
/// {@tool dartpad --template=stateless_widget_material}
|
||||
///
|
||||
/// This example shows how to use a [PhysicalShape] on a centered [SizedBox]
|
||||
/// to clip it to a rounded rectangle using a [ShapeBorderClipper] and give it
|
||||
/// an orange color along with a shadow.
|
||||
///
|
||||
/// ```dart
|
||||
/// Widget build(BuildContext context) {
|
||||
/// return Scaffold(
|
||||
/// appBar: AppBar(
|
||||
/// title: const Text('PhysicalShape Sample'),
|
||||
/// ),
|
||||
/// body: Center(
|
||||
/// child: PhysicalShape(
|
||||
/// elevation: 5.0,
|
||||
/// child: const SizedBox(
|
||||
/// child: Center(
|
||||
/// child: Text(
|
||||
/// 'Hello, World!',
|
||||
/// style: TextStyle(
|
||||
/// color: Colors.white,
|
||||
/// fontSize: 20.0,
|
||||
/// ),
|
||||
/// ),
|
||||
/// ),
|
||||
/// height: 200.0,
|
||||
/// width: 200.0,
|
||||
/// ),
|
||||
/// clipper: ShapeBorderClipper(
|
||||
/// shape: RoundedRectangleBorder(
|
||||
/// borderRadius: BorderRadius.circular(10.0),
|
||||
/// )
|
||||
/// ),
|
||||
/// color: Colors.orange,
|
||||
/// ),
|
||||
/// ),
|
||||
/// );
|
||||
/// }
|
||||
/// ```
|
||||
/// {@end-tool}
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [ShapeBorderClipper], which converts a [ShapeBorder] to a [CustomClipper], as
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user