addWidget method
dynamic
addWidget(
- Widget widget
)
Implementation
addWidget(Widget widget) {
// Generate a unique key for the widget.
Key key = Key('lindi-${DateTime.now().millisecondsSinceEpoch}-${_nrRnd()}');
// Create a DraggableWidget with specified properties.
widgets.add(DraggableWidget(
key: key,
borderColor: borderColor,
iconColor: iconColor,
showDone: showDone,
showClose: showClose,
showFlip: showFlip,
showStack: showStack,
showLock: showLock,
showAllBorders: showAllBorders,
shouldMove: shouldMove,
shouldRotate: shouldRotate,
shouldScale: shouldScale,
minScale: minScale,
maxScale: maxScale,
onBorder: (key) {
_border(key);
},
onDelete: (key) {
_delete(key);
},
onLayer: (key) {
_layer(key);
},
child: widget));
// Highlight the border of the added widget.
_border(key);
}