buildSafaehSheetShell function

Widget buildSafaehSheetShell({
  1. required Widget body,
  2. List<Widget> actions = const [],
  3. Widget? title,
  4. bool showTitleInBody = true,
  5. double padding = kSafaehSheetPadding,
})

Shared sheet body: optional in-body title, content, action row.

Bottom safe/IME inset is owned by showSafaeh. Do not wrap this in another bottom SafeArea.

Implementation

Widget buildSafaehSheetShell({
  required Widget body,
  List<Widget> actions = const [],
  Widget? title,
  bool showTitleInBody = true,
  double padding = kSafaehSheetPadding,
}) {
  return SafeArea(
    top: false,
    bottom: false,
    child: SingleChildScrollView(
      physics: const AlwaysScrollableScrollPhysics(),
      child: Padding(
        padding: EdgeInsets.only(
          top: 0,
          bottom: showTitleInBody ? padding : 0,
        ),
        child: Column(
          mainAxisSize: MainAxisSize.min,
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: [
            if (showTitleInBody && title != null)
              Padding(
                padding: EdgeInsets.fromLTRB(padding, 0, padding, 8),
                child: title,
              ),
            Padding(
              padding: EdgeInsets.symmetric(horizontal: padding),
              child: body,
            ),
            if (actions.isNotEmpty) ...[
              const SizedBox(height: _kBodyActionsGap),
              Padding(
                padding: EdgeInsets.symmetric(horizontal: padding),
                child: OverflowBar(
                  alignment: MainAxisAlignment.end,
                  spacing: _kActionsSpacing,
                  overflowAlignment: OverflowBarAlignment.end,
                  overflowSpacing: _kActionsSpacing,
                  children: actions,
                ),
              ),
            ],
          ],
        ),
      ),
    ),
  );
}