call method

void call(
  1. BuildContext context, {
  2. required String title,
  3. required List<Widget> children,
  4. EdgeInsets? margin,
  5. EdgeInsets? padding,
  6. double? elevation,
})

Implementation

void call(
  BuildContext context, {
  required String title,
  required List<Widget> children,
  EdgeInsets? margin,
  EdgeInsets? padding,
  double? elevation,
}) {
  showModalBottomSheet(
    context: context,
    enableDrag: true,
    isScrollControlled: true,
    backgroundColor: Colors.transparent,
    elevation: elevation ?? 0,
    builder: (context) {
      return AnimatedContainer(
        decoration: const BoxDecoration(
          borderRadius: BorderRadius.only(
            topLeft: Radius.circular(4),
            topRight: Radius.circular(4),
          ),
          color: Colors.white,
        ),
        margin: margin ?? const EdgeInsets.only(top: 30),
        padding: padding ??
            EdgeInsets.only(
              top: 8,
              bottom: 24 +
                  MediaQuery.of(context).viewInsets.bottom +
                  MediaQuery.of(context).viewPadding.bottom,
            ),
        duration: const Duration(milliseconds: 300),
        child: Column(
          mainAxisSize: MainAxisSize.min,
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Padding(
                  padding: const EdgeInsets.only(left: 24),
                  child: Text(
                    title,
                    textAlign: TextAlign.left,
                    style: const TextStyle(
                      color: Color(0xFF212124),
                      fontSize: 16,
                      fontWeight: FontWeight.w500,
                    ),
                  ),
                ),
                IconButton(
                  padding: EdgeInsets.zero,
                  onPressed: () => Navigator.pop(context),
                  icon: const Icon(
                    Icons.close,
                    color: Color(0xff75767A),
                  ),
                ),
              ],
            ),
            const Divider(
              color: Color(0xffD9DBE0),
              thickness: 1,
              height: 0,
            ),
            Flexible(
              child: SingleChildScrollView(
                child: Column(
                  mainAxisSize: MainAxisSize.min,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    for (var child in children) child,
                  ],
                ),
              ),
            )
          ],
        ),
      );
    },
  );
}