buildActionSheetItem method

dynamic buildActionSheetItem(
  1. BuildContext context,
  2. List<ActionSheetItem>? actions
)

Implementation

buildActionSheetItem(BuildContext context, List<ActionSheetItem>? actions) {
  List<Widget> widgets = [];
  if (actionSheet.child != null) return [actionSheet.child];
  for (int i = 0; i < actions!.length; i++) {
    ActionSheetItem action = actions[i];
    widgets.add(Column(
      children: <Widget>[
        DecoratedBox(
            decoration: BoxDecoration(
              color: Style.actionSheetItemBackground,
            ),
            child: Material(
              type: MaterialType.transparency,
              child: InkWell(
                focusColor: (action.disabled || action.loading)
                    ? Style.transparent
                    : Theme.of(context).focusColor,
                highlightColor: (action.disabled || action.loading)
                    ? Style.transparent
                    : Theme.of(context).highlightColor,
                hoverColor: (action.disabled || action.loading)
                    ? Style.transparent
                    : Theme.of(context).hoverColor,
                splashColor: (action.disabled || action.loading)
                    ? Style.transparent
                    : Theme.of(context).splashColor,
                child: Container(
                  height: Style.actionSheetItemHeight,
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: buildActionSheetItemContent(action),
                  ),
                ),
                onTap: () {
                  if (action.loading || action.disabled) return;
                  if (actionSheet.onSelect != null)
                    actionSheet.onSelect!(action, i, context);
                  close(context);
                },
              ),
            )),
        i < actions.length ? NDivider(hairline: true) : Container()
      ],
    ));
  }
  return widgets;
}