requestPlanSelection function
Request plan selection.
Implementation
Future<void> requestPlanSelection(BuildContext context, NmPlanController controller, String id) async {
if (controller.requestSelectPlan(id)) return;
final l10n = NmTelecom.l10n(context);
final discard = await showDialog<bool>(
context: context,
builder: (_) => AlertDialog(
title: Text(NmL10n.of(context).stateUnsaved),
content: Text(l10n.planUnsavedBody),
actions: [
TextButton(onPressed: () => Navigator.pop(context, false), child: Text(l10n.planKeepEditing)),
TextButton(onPressed: () => Navigator.pop(context, true), child: Text(l10n.planDiscardChanges)),
],
),
);
if (discard == true) {
controller.discardAndContinue();
} else {
controller.keepEditing();
}
}