File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
packages/flutter/lib/src/widgets Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -1049,6 +1049,47 @@ class PhysicalModel extends SingleChildRenderObjectWidget {
10491049/// [PhysicalModel] does the same but only supports shapes that can be expressed
10501050/// as rectangles with rounded corners.
10511051///
1052+ /// {@tool dartpad --template=stateless_widget_material}
1053+ ///
1054+ /// This example shows how to use a [PhysicalShape] on a centered [SizedBox]
1055+ /// to clip it to a rounded rectangle using a [ShapeBorderClipper] and give it
1056+ /// an orange color along with a shadow.
1057+ ///
1058+ /// ```dart
1059+ /// Widget build(BuildContext context) {
1060+ /// return Scaffold(
1061+ /// appBar: AppBar(
1062+ /// title: const Text('PhysicalShape Sample'),
1063+ /// ),
1064+ /// body: Center(
1065+ /// child: PhysicalShape(
1066+ /// elevation: 5.0,
1067+ /// child: const SizedBox(
1068+ /// child: Center(
1069+ /// child: Text(
1070+ /// 'Hello, World!',
1071+ /// style: TextStyle(
1072+ /// color: Colors.white,
1073+ /// fontSize: 20.0,
1074+ /// ),
1075+ /// ),
1076+ /// ),
1077+ /// height: 200.0,
1078+ /// width: 200.0,
1079+ /// ),
1080+ /// clipper: ShapeBorderClipper(
1081+ /// shape: RoundedRectangleBorder(
1082+ /// borderRadius: BorderRadius.circular(10.0),
1083+ /// )
1084+ /// ),
1085+ /// color: Colors.orange,
1086+ /// ),
1087+ /// ),
1088+ /// );
1089+ /// }
1090+ /// ```
1091+ /// {@end-tool}
1092+ ///
10521093/// See also:
10531094///
10541095/// * [ShapeBorderClipper] , which converts a [ShapeBorder] to a [CustomClipper] , as
You can’t perform that action at this time.
0 commit comments