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