addWidget method

void addWidget(
  1. Widget widget, {
  2. Matrix4? matrix4,
  3. bool? isFlipped,
  4. String? pathSticker,
  5. String? stickerID,
})

Implementation

void addWidget(Widget widget,
    {Matrix4? matrix4,
    bool? isFlipped,
    String? pathSticker,
    String? stickerID}) {
  // Generate a unique key for the widget.
  Key key = Key('alpha-${DateTime.now().millisecondsSinceEpoch}-${_nrRnd()}');

  widgets.add(DraggableItemWidget(
      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,
      initMatrix: matrix4,
      isFlipped: isFlipped,
      pathSticker: pathSticker,
      paramStickerID: stickerID,
      borderRadius: borderRadius,
      defaultMatrix: defaultMatrix ?? Matrix4.identity().storage,
      notifier: ValueNotifier(Matrix4.fromList(
        defaultMatrix ?? Matrix4.identity().storage,
      )),
      onBorder: (key) {
        _border(key);
      },
      onDelete: (key) {
        _delete(key);
      },
      onLayer: (key) {
        _layer(key);
      },
      onActionAfterDone: onActionAfterDone,
      onActionAfterDelete: onActionAfterDelete,
      onScaleStickerStart: onScaleStickerStart,
      onTapSticker: onTapSticker,
      onTapOutsideSticker: onTapOutsideSticker,
      child: widget));

  // Highlight the border of the added widget.
  _border(key);
}