Skip to content

Commit 13bf7b5

Browse files
committed
Update portal preview UI.
1 parent 47f8313 commit 13bf7b5

File tree

1 file changed

+46
-9
lines changed

1 file changed

+46
-9
lines changed

lib/src/transformers/node_transformers/passive_rectangle_transformer.dart

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,7 @@ class PassiveRectangleWidget extends StatelessWidget {
137137
Positioned.fill(
138138
child: settings.isPreview
139139
// Show stripes in preview mode
140-
? CustomPaint(
141-
painter: StripePainter(
142-
bgColor: const Color(0xFFBA79F4).withOpacity(0.1),
143-
stripeColor: const Color(0xFFBA79F4),
144-
nbOfStripes:
145-
(node.outerBoxGlobal.size.longestSide / 20)
146-
.round(),
147-
),
148-
)
140+
? PortalPreviewWidget(node: node)
149141
: manager.layoutRetrievalBuilder(
150142
context,
151143
node.innerBoxLocal.size,
@@ -166,6 +158,51 @@ class PassiveRectangleWidget extends StatelessWidget {
166158
}
167159
}
168160

161+
class PortalPreviewWidget extends StatelessWidget {
162+
final BaseNode node;
163+
164+
const PortalPreviewWidget({
165+
super.key,
166+
required this.node,
167+
});
168+
169+
@override
170+
Widget build(BuildContext context) {
171+
return Container(
172+
clipBehavior: Clip.antiAlias,
173+
decoration: BoxDecoration(
174+
borderRadius: BorderRadius.circular(4),
175+
border: Border.all(
176+
color: const Color(0xFFBA79F4),
177+
width: 2,
178+
),
179+
),
180+
child: CustomPaint(
181+
painter: StripePainter(
182+
bgColor: const Color(0xFFBA79F4).withOpacity(0.1),
183+
stripeColor: const Color(0xFFBA79F4),
184+
nbOfStripes: (node.outerBoxGlobal.size.longestSide / 10).round(),
185+
),
186+
child: Center(
187+
child: Container(
188+
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
189+
decoration: BoxDecoration(
190+
color: const Color(0xFFBA79F4),
191+
borderRadius: BorderRadius.circular(4),
192+
),
193+
child: const Text(
194+
'Embedded Canvas',
195+
style: TextStyle(
196+
color: Colors.white,
197+
),
198+
),
199+
),
200+
),
201+
),
202+
);
203+
}
204+
}
205+
169206
List<Widget> wrapWithPaddingNoScroll(
170207
BaseNode node,
171208
List<Widget> children, {

0 commit comments

Comments
 (0)