File tree 1 file changed +41
-0
lines changed
packages/flutter/lib/src/widgets
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 {
1049
1049
/// [PhysicalModel] does the same but only supports shapes that can be expressed
1050
1050
/// as rectangles with rounded corners.
1051
1051
///
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
+ ///
1052
1093
/// See also:
1053
1094
///
1054
1095
/// * [ShapeBorderClipper] , which converts a [ShapeBorder] to a [CustomClipper] , as
You can’t perform that action at this time.
0 commit comments