mirror of
https://github.com/Iconica-Development/flutter_availability.git
synced 2025-05-19 13:13:44 +02:00
Merge 6643068575
into 9487cf2e57
This commit is contained in:
commit
7d08eafd8c
8 changed files with 31 additions and 13 deletions
|
@ -1,3 +1,7 @@
|
|||
## 1.1.2
|
||||
|
||||
* Added the use of onExit to show BackButton on the OverviewScreen
|
||||
|
||||
## 1.1.1
|
||||
|
||||
* Removed custom definition of CustomSemantics to use the one from flutter_accessibility instead
|
||||
|
|
|
@ -216,7 +216,7 @@ class AvailabilityColors {
|
|||
/// Builder definition for providing a base screen surrounding each page
|
||||
typedef BaseScreenBuilder = Widget Function(
|
||||
BuildContext context,
|
||||
VoidCallback onBack,
|
||||
VoidCallback? onBack,
|
||||
Widget child,
|
||||
);
|
||||
|
||||
|
|
|
@ -7,13 +7,13 @@ import "package:flutter_availability/src/ui/screens/template_week_modification.d
|
|||
import "package:flutter_availability_data_interface/flutter_availability_data_interface.dart";
|
||||
|
||||
///
|
||||
MaterialPageRoute homePageRoute(VoidCallback onExit) => MaterialPageRoute(
|
||||
MaterialPageRoute homePageRoute(VoidCallback? onExit) => MaterialPageRoute(
|
||||
builder: (context) => AvailabilityOverview(
|
||||
onEditDateRange: (range, availabilities) async => Navigator.of(context)
|
||||
.push(availabilityViewRoute(range, availabilities)),
|
||||
onViewTemplates: () async =>
|
||||
Navigator.of(context).push(templateOverviewRoute()),
|
||||
onExit: () => onExit(),
|
||||
onExit: onExit,
|
||||
),
|
||||
);
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ class AvailabilityOverview extends StatefulHookWidget {
|
|||
const AvailabilityOverview({
|
||||
required this.onEditDateRange,
|
||||
required this.onViewTemplates,
|
||||
required this.onExit,
|
||||
this.onExit,
|
||||
super.key,
|
||||
});
|
||||
|
||||
|
@ -27,7 +27,7 @@ class AvailabilityOverview extends StatefulHookWidget {
|
|||
final VoidCallback onViewTemplates;
|
||||
|
||||
/// Callback for when the user wants to navigate back
|
||||
final VoidCallback onExit;
|
||||
final VoidCallback? onExit;
|
||||
|
||||
@override
|
||||
State<AvailabilityOverview> createState() => _AvailabilityOverviewState();
|
||||
|
@ -52,8 +52,10 @@ class _AvailabilityOverviewState extends State<AvailabilityOverview> {
|
|||
);
|
||||
|
||||
useEffect(() {
|
||||
availabilityScope.popHandler.add(widget.onExit);
|
||||
return () => availabilityScope.popHandler.remove(widget.onExit);
|
||||
var onExit = widget.onExit;
|
||||
if (onExit == null) return null;
|
||||
availabilityScope.popHandler.add(onExit);
|
||||
return () => availabilityScope.popHandler.remove(onExit);
|
||||
});
|
||||
|
||||
var availabilitySnapshot = useStream(availabilityStream);
|
||||
|
|
|
@ -6,25 +6,37 @@ class DefaultBaseScreen extends StatelessWidget {
|
|||
/// Create a base screen
|
||||
const DefaultBaseScreen({
|
||||
required this.child,
|
||||
this.onBack,
|
||||
super.key,
|
||||
});
|
||||
|
||||
/// Builder as default option
|
||||
static Widget builder(
|
||||
BuildContext context,
|
||||
VoidCallback onBack,
|
||||
VoidCallback? onBack,
|
||||
Widget child,
|
||||
) =>
|
||||
DefaultBaseScreen(child: child);
|
||||
DefaultBaseScreen(
|
||||
onBack: onBack,
|
||||
child: child,
|
||||
);
|
||||
|
||||
/// Content of the page
|
||||
final Widget child;
|
||||
|
||||
/// Callback to return to next page
|
||||
final VoidCallback? onBack;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var translations = AvailabilityScope.of(context).options.translations;
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: onBack != null
|
||||
? BackButton(
|
||||
onPressed: onBack,
|
||||
)
|
||||
: null,
|
||||
title: Text(translations.appbarTitle),
|
||||
),
|
||||
body: SafeArea(
|
||||
|
|
|
@ -71,7 +71,7 @@ class _AvailabilityUserStoryState extends State<AvailabilityUserStory> {
|
|||
onPop: _popHandler.handlePop,
|
||||
child: Navigator(
|
||||
onGenerateInitialRoutes: (state, route) => [
|
||||
homePageRoute(widget.onExit ?? () {}),
|
||||
homePageRoute(widget.onExit),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: flutter_availability
|
||||
description: "Flutter availability userstory package"
|
||||
version: 1.1.1
|
||||
version: 1.1.2
|
||||
|
||||
publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub
|
||||
|
||||
|
@ -14,7 +14,7 @@ dependencies:
|
|||
flutter_hooks: ^0.20.5
|
||||
flutter_availability_data_interface:
|
||||
hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub
|
||||
version: ^1.1.1
|
||||
version: ^1.1.2
|
||||
flutter_accessibility:
|
||||
hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub
|
||||
version: ^0.0.3
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: flutter_availability_data_interface
|
||||
description: "The data interface for the flutter_availability component"
|
||||
version: 1.1.1
|
||||
version: 1.1.2
|
||||
|
||||
publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub
|
||||
|
||||
|
|
Loading…
Reference in a new issue