showModal static method

Future<FeedbackSubmissionResult?> showModal(
  1. BuildContext context, {
  2. FeedbackDraft? initialDraft,
  3. Future<FeedbackAttachment?> onPickAttachment()?,
})

Presents the composer inside a bottom sheet or dialog.

Implementation

static Future<FeedbackSubmissionResult?> showModal(
  BuildContext context, {
  FeedbackDraft? initialDraft,
  Future<FeedbackAttachment?> Function()? onPickAttachment,
}) {
  final client = CupThreadTheme.clientOf(context);
  final token = CupThreadTheme.userTokenOf(context);

  return showModalBottomSheet<FeedbackSubmissionResult>(
    context: context,
    isScrollControlled: true,
    backgroundColor: Colors.transparent,
    builder: (ctx) => CupThreadTheme(
      client: client,
      userToken: token,
      child: DraggableScrollableSheet(
        initialChildSize: 0.85,
        minChildSize: 0.5,
        maxChildSize: 0.95,
        builder: (sheetCtx, scrollController) => Container(
          decoration: BoxDecoration(
            color: CupThreadTheme.of(sheetCtx).background,
            borderRadius: const BorderRadius.vertical(top: Radius.circular(16)),
          ),
          child: FeedbackComposer(
            initialDraft: initialDraft,
            onPickAttachment: onPickAttachment,
            onSubmitSuccess: (res) => Navigator.of(sheetCtx).pop(res),
          ),
        ),
      ),
    ),
  );
}