mirror of
https://github.com/Iconica-Development/flutter_availability.git
synced 2025-05-19 13:13:44 +02:00
fix: allow the entire template card to route to edit page
This commit is contained in:
parent
3238fc2c4a
commit
841bdfbee9
1 changed files with 10 additions and 6 deletions
|
@ -18,7 +18,9 @@ MaterialPageRoute homePageRoute(VoidCallback onExit) => MaterialPageRoute(
|
||||||
);
|
);
|
||||||
|
|
||||||
///
|
///
|
||||||
MaterialPageRoute<AvailabilityTemplateModel?> templateOverviewRoute() =>
|
MaterialPageRoute<AvailabilityTemplateModel?> templateOverviewRoute({
|
||||||
|
bool allowSelection = false,
|
||||||
|
}) =>
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => AvailabilityTemplateOverview(
|
builder: (context) => AvailabilityTemplateOverview(
|
||||||
onExit: () => Navigator.of(context).pop(),
|
onExit: () => Navigator.of(context).pop(),
|
||||||
|
@ -32,9 +34,11 @@ MaterialPageRoute<AvailabilityTemplateModel?> templateOverviewRoute() =>
|
||||||
await Navigator.of(context).push(templateEditDayRoute(null));
|
await Navigator.of(context).push(templateEditDayRoute(null));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onSelectTemplate: (template) async {
|
onSelectTemplate: allowSelection
|
||||||
|
? (template) async {
|
||||||
Navigator.of(context).pop(template);
|
Navigator.of(context).pop(template);
|
||||||
},
|
}
|
||||||
|
: null,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -57,8 +61,8 @@ MaterialPageRoute availabilityViewRoute(
|
||||||
dateRange: dateRange,
|
dateRange: dateRange,
|
||||||
initialAvailabilities: initialAvailabilities,
|
initialAvailabilities: initialAvailabilities,
|
||||||
onTemplateSelection: () async {
|
onTemplateSelection: () async {
|
||||||
var selectedTemplate =
|
var selectedTemplate = Navigator.of(context)
|
||||||
Navigator.of(context).push(templateOverviewRoute());
|
.push(templateOverviewRoute(allowSelection: true));
|
||||||
return selectedTemplate;
|
return selectedTemplate;
|
||||||
},
|
},
|
||||||
onExit: () => Navigator.of(context).pop(),
|
onExit: () => Navigator.of(context).pop(),
|
||||||
|
|
Loading…
Reference in a new issue