Your first drawing
Create and edit shapes through one DrawingSession. This focused example uses the same canvas, selection, text editing and undo commands as the playground.
Loading interactive example…Open in new tab ↗
Try it
Click Add shape, drag the selected rectangle, delete it and undo the deletion. Double-click a shape's text to edit it. Reset example disposes this example's session and starts a fresh fixture.
Source: apps/demo/lib/examples/basics/first_drawing.dart. See Session for exact method signatures.
Source
dart
actions: {
'Add shape': (s) => s.createShape(
type: Shapes.rectangle,
worldCenter: const DiagramPoint(230, 170),
),
'Select all': (s) => s.selectAll(),
'Delete selection': (s) => s.deleteSelection().requireAllowed(),
},