mirror of
https://github.com/Iconica-Development/flutter_availability.git
synced 2025-05-19 05:03: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(
|
||||
builder: (context) => AvailabilityTemplateOverview(
|
||||
onExit: () => Navigator.of(context).pop(),
|
||||
|
@ -32,9 +34,11 @@ MaterialPageRoute<AvailabilityTemplateModel?> templateOverviewRoute() =>
|
|||
await Navigator.of(context).push(templateEditDayRoute(null));
|
||||
}
|
||||
},
|
||||
onSelectTemplate: (template) async {
|
||||
onSelectTemplate: allowSelection
|
||||
? (template) async {
|
||||
Navigator.of(context).pop(template);
|
||||
},
|
||||
}
|
||||
: null,
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -57,8 +61,8 @@ MaterialPageRoute availabilityViewRoute(
|
|||
dateRange: dateRange,
|
||||
initialAvailabilities: initialAvailabilities,
|
||||
onTemplateSelection: () async {
|
||||
var selectedTemplate =
|
||||
Navigator.of(context).push(templateOverviewRoute());
|
||||
var selectedTemplate = Navigator.of(context)
|
||||
.push(templateOverviewRoute(allowSelection: true));
|
||||
return selectedTemplate;
|
||||
},
|
||||
onExit: () => Navigator.of(context).pop(),
|
||||
|
|
Loading…
Reference in a new issue