selectionDialog method

  1. @override
Widget selectionDialog(
  1. AppModel app,
  2. BuildContext context, {
  3. required String title,
  4. bool? includeHeading,
  5. Key? key,
  6. required List<String> options,
  7. required OnSelection onSelection,
  8. String? buttonLabel,
  9. double? widthFraction,
})
override

Implementation

@override
Widget selectionDialog(
  AppModel app,
  BuildContext context, {
  required String title,
  bool? includeHeading,
  Key? key,
  required List<String> options,
  required OnSelection onSelection,
  String? buttonLabel,
  double? widthFraction, // percentage of screen width
}) {
  return dialogHelper.build(
    app,
    context,
    width: widthFraction == null
        ? null
        : fullScreenWidth(context) * widthFraction,
    key: key,
    includeHeading: includeHeading,
    dialogButtonPosition: DialogButtonPosition.topRight,
    title: title,
    buttons: dialogHelper.getCloseButton(app, context, onPressed: () {
      Navigator.of(context).pop();
    }),
    contents: ListView.builder(
        physics: ScrollPhysics(),
        shrinkWrap: true,
        itemCount: options.length,
        itemBuilder: (context, i) {
          return _style.frontEndStyle().buttonStyle().dialogButton(
            app,
            context,
            label: options[i],
            onPressed: () {
              onSelection(i);
              Navigator.of(context).pop();
            },
          );
        }),
    dialogBackgroundColor:
        _style.monaStyleAttributesModel.dialogBackgroundColor,
    dialogSeperatorColor:
        _style.monaStyleAttributesModel.dialogSeperatorColor,
  );
}