Beispiel #1
0
 public static void showShareView(
     Widget child
     )
 {
     ActionSheetUtils.showModalActionSheet(child);
 }
Beispiel #2
0
        static Widget _buildButtons(BuildContext context, List <ActionSheetItem> items)
        {
            if (items == null || items.Count <= 0)
            {
                return(new Container());
            }

            List <Widget> widgets            = new List <Widget>();
            List <Widget> normalWidgets      = new List <Widget>();
            List <Widget> destructiveWidgets = new List <Widget>();
            List <Widget> cancelWidgets      = new List <Widget>();

            items.ForEach(item => {
                ActionType type  = item.type;
                Color titleColor = CColors.TextBody;
                if (type == ActionType.destructive)
                {
                    titleColor = CColors.Error;
                }

                Widget widget = new Column(
                    children: new List <Widget> {
                    new GestureDetector(
                        onTap: () => {
                        ActionSheetUtils.hiddenModalPopup();
                        if (item.onTap != null)
                        {
                            item.onTap();
                        }
                    },
                        child: new Container(
                            alignment: Alignment.center,
                            height: 49.0f,
                            color: CColors.White,
                            child: new Text(
                                item.title,
                                style: CTextStyle.PLargeBody.copyWith(titleColor)
                                )
                            )
                        ),
                    new CustomDivider(
                        height: 1,
                        color: CColors.Separator2
                        )
                }
                    );
                if (type == ActionType.destructive)
                {
                    destructiveWidgets.Add(widget);
                }
                else if (type == ActionType.cancel)
                {
                    cancelWidgets.Add(widget);
                }
                else
                {
                    normalWidgets.Add(widget);
                }
            });
            widgets.AddRange(normalWidgets);
            widgets.AddRange(destructiveWidgets);
            widgets.AddRange(cancelWidgets);
            return(new Column(
                       children: widgets
                       ));
        }