DialogRF constructor

DialogRF(
  1. BuildContext context, {
  2. String title = "Missing Title",
  3. String subTitle = "Missing Sub Title",
  4. Widget? body,
  5. DialogType type = DialogType.full,
  6. bool hideDefaultControls = false,
  7. Function? onAccept,
  8. Function? onCancel,
  9. double height = 300,
  10. IconData avatarIcon = FontAwesomeIcons.magnifyingGlass,
  11. String? avatarImage,
  12. double? avatarIconSize,
  13. double blurAmount = 3,
  14. Color? avatarBackground,
  15. bool hideAvatar = false,
  16. dynamic fullWindowDialogScrollEffect = ScrollPhysicsRF.glow,
})

Implementation

DialogRF(
  this.context, {
  this.title = "Missing Title",
  this.subTitle = "Missing Sub Title",
  this.body,
  this.type = DialogType.full,
  this.hideDefaultControls = false,
  this.onAccept,
  this.onCancel,
  this.height = 300,
  this.avatarIcon = FontAwesomeIcons.magnifyingGlass,
  this.avatarImage,
  this.avatarIconSize,
  this.blurAmount = 3,
  this.avatarBackground,
  this.hideAvatar = false,
  this.fullWindowDialogScrollEffect = ScrollPhysicsRF.glow,
}) {
  if (type == DialogType.full) {
    var content = body ?? Text('Missing Content');
    var fullDlg = Navigator.push(
      context,
      MaterialPageRoute(
        builder: (BuildContext context) => FullWindowDialog(
          title: title,
          body: (fullWindowDialogScrollEffect == ScrollPhysicsRF.glow)
              ? ScrollConfiguration(
                  behavior: BounceScrollBehavior(),
                  child: content,
                )
              : content,
          hidePageHeader: hideDefaultControls,
          onAccept: onAccept,
          onCancel: onCancel,
        ),
        fullscreenDialog: false,
      ),
    );
    fullDlg.whenComplete(() {});
  } else if (type == DialogType.popup) {
    showDialog<String>(
      context: context, barrierDismissible: false, // user must tap button!
      builder: (BuildContext context) {
        return PopupWindowDialogRF(
          title: title,
          subTitle: subTitle,
          avatarIcon: avatarIcon,
          avatarImage: avatarImage,
          avatarSize: avatarIconSize,
          height: height,
          avatarBackground: avatarBackground,
          blurAmount: blurAmount,
          body: body ?? Text('Missing Content'),
          onAccept: onAccept,
          onCancel: onCancel,
        );
      },
    );
  } else if (type == DialogType.bottom) {
    BottomSheetRF(
      title: title,
      subTitle: subTitle,
      context: context,
      body: body!,
      onAccept: onAccept,
      onCancel: onCancel,
      height: height,
      hideDefaultControls: hideDefaultControls,
      avatarIcon: avatarIcon,
      avatarImage: avatarImage,
      avatarSize: avatarIconSize,
      hideAvatar: hideAvatar,
    );
  }
}