showModalSheet static method

Future showModalSheet({
  1. String? title,
  2. String? subtitle,
  3. List<AilButtonElement>? actions,
})

Implementation

static Future showModalSheet(
    {String? title, String? subtitle, List<AilButtonElement>? actions}) {
  return showModalBottomSheet(
    context: context,
    builder: (context) {
      return Container(
        width: context.width,
        decoration: BoxDecoration(
          color: context.backgroundColor,
          borderRadius: const BorderRadiusDirectional.vertical(
              top: Radius.circular(24)),
        ),
        child: Column(
            mainAxisSize: MainAxisSize.min,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Container(
                      width: 64,
                      height: 3,
                      margin: const EdgeInsets.only(top: 12, bottom: 8),
                      decoration: BoxDecoration(
                          borderRadius: BorderRadius.circular(2),
                          color: context.foregroundColor.withOpacity(0.7)))
                  .center,
              if (title != null || subtitle != null)
                Column(
                    mainAxisSize: MainAxisSize.min,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      if (title != null)
                        title.style(size: 20, weight: FontWeight.w700),
                      if (subtitle != null) subtitle.style().opacity(0.7),
                    ]).paddingAll(16),
              if (actions != null)
                ListView.separated(
                  primary: false,
                  shrinkWrap: true,
                  itemCount: actions.length,
                  separatorBuilder: (x, xx) => Divider(
                      height: 1,
                      color: context.foregroundColor.withOpacity(0.1)),
                  itemBuilder: (context, i) {
                    var item = actions[i];
                    return DecoratedBox(
                      decoration: BoxDecoration(color: item.backgroundColor),
                      child: Material(
                        color: Colors.transparent,
                        child: InkWell(
                          onTap: item.onTap,
                          splashColor:
                              context.foregroundColor.withOpacity(0.05),
                          child: Wrap(
                              spacing: 6,
                              crossAxisAlignment: WrapCrossAlignment.center,
                              alignment: WrapAlignment.center,
                              children: [
                                if (item.icon != null) item.icon!,
                                item.text.style(
                                    size: 16,
                                    color: item.textColor ??
                                        context.foregroundColor),
                              ]).center.paddingAll(22),
                        ),
                      ),
                    );
                  },
                ).radiusAll(12),
            ]),
      );
    },
  );
}