Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [1.12.3]
* Added support for `routerConfig` to `MacosApp.router`. ([#388](https://github.com/macosui/macos_ui/issues/388))

## [1.12.2]
* Fixed a bug where clicking on a overflowed toolbar item with a navigation callback wouldn't work ([#346](https://github.com/GroovinChip/macos_ui/issues/346)).

Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ packages:
path: ".."
relative: true
source: path
version: "1.12.2"
version: "1.12.3"
matcher:
dependency: transitive
description:
Expand Down
22 changes: 15 additions & 7 deletions lib/src/macos_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,17 @@ class MacosApp extends StatefulWidget {
}) : routeInformationProvider = null,
routeInformationParser = null,
routerDelegate = null,
backButtonDispatcher = null;
backButtonDispatcher = null,
routerConfig = null;

/// Creates a [MacosApp] that uses the [Router] instead of a [Navigator].
MacosApp.router({
super.key,
this.routeInformationProvider,
required RouteInformationParser<Object> this.routeInformationParser,
required RouterDelegate<Object> this.routerDelegate,
this.routeInformationParser,
this.routerDelegate,
this.backButtonDispatcher,
this.routerConfig,
this.builder,
this.title = '',
this.onGenerateTitle,
Expand All @@ -104,7 +106,8 @@ class MacosApp extends StatefulWidget {
this.themeMode,
this.theme,
this.darkTheme,
}) : assert(supportedLocales.isNotEmpty),
}) : assert(routerDelegate != null || routerConfig != null),
assert(supportedLocales.isNotEmpty),
navigatorObservers = null,
navigatorKey = null,
onGenerateRoute = null,
Expand Down Expand Up @@ -157,6 +160,9 @@ class MacosApp extends StatefulWidget {
/// {@macro flutter.widgets.widgetsApp.backButtonDispatcher}
final BackButtonDispatcher? backButtonDispatcher;

/// {@macro flutter.widgets.widgetsApp.routerConfig}
final RouterConfig<Object>? routerConfig;

/// {@macro flutter.widgets.widgetsApp.builder}
final TransitionBuilder? builder;

Expand Down Expand Up @@ -300,7 +306,8 @@ class MacosApp extends StatefulWidget {
}

class _MacosAppState extends State<MacosApp> {
bool get _usesRouter => widget.routerDelegate != null;
bool get _usesRouter =>
widget.routerDelegate != null || widget.routerConfig != null;

Widget _macosBuilder(BuildContext context, Widget? child) {
final mode = widget.themeMode ?? ThemeMode.system;
Expand Down Expand Up @@ -346,9 +353,10 @@ class _MacosAppState extends State<MacosApp> {
return c.CupertinoApp.router(
key: GlobalObjectKey(this),
routeInformationProvider: widget.routeInformationProvider,
routeInformationParser: widget.routeInformationParser!,
routerDelegate: widget.routerDelegate!,
routeInformationParser: widget.routeInformationParser,
routerDelegate: widget.routerDelegate,
backButtonDispatcher: widget.backButtonDispatcher,
routerConfig: widget.routerConfig,
builder: _macosBuilder,
title: widget.title,
onGenerateTitle: widget.onGenerateTitle,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: macos_ui
description: Flutter widgets and themes implementing the current macOS design language.
version: 1.12.2
version: 1.12.3
homepage: "https://macosui.dev"
repository: "https://github.com/GroovinChip/macos_ui"

Expand Down