diff --git a/packages/flutter_deck/lib/src/flutter_deck_app.dart b/packages/flutter_deck/lib/src/flutter_deck_app.dart index 80f2c4a..eddadef 100644 --- a/packages/flutter_deck/lib/src/flutter_deck_app.dart +++ b/packages/flutter_deck/lib/src/flutter_deck_app.dart @@ -210,18 +210,25 @@ class _FlutterDeckAppState extends State { FlutterDeckRouterSlide? _buildRouterSlide((int, Widget) indexedSlide) { final (index, slide) = indexedSlide; - final slideConfiguration = - slide is FlutterDeckSlideWidget ? slide.configuration : null; - if (slideConfiguration?.hidden ?? false) return null; + var slideWidget = slide; - final configuration = slideConfiguration ?? - FlutterDeckSlideConfiguration(route: '/slide-${index + 1}'); + if (slideWidget is! FlutterDeckSlideWidget) { + final defaultConfiguration = FlutterDeckSlideConfiguration( + route: '/slide-${index + 1}', + ); + + slideWidget = slide.withSlideConfiguration(defaultConfiguration); + } + + final configuration = slideWidget.configuration!; + + if (configuration.hidden) return null; return FlutterDeckRouterSlide( configuration: configuration.mergeWithGlobal(widget.configuration), route: configuration.route, - widget: slide, + widget: slideWidget, ); } diff --git a/packages/flutter_deck/lib/src/flutter_deck_slide.dart b/packages/flutter_deck/lib/src/flutter_deck_slide.dart index 402003f..bed76e9 100644 --- a/packages/flutter_deck/lib/src/flutter_deck_slide.dart +++ b/packages/flutter_deck/lib/src/flutter_deck_slide.dart @@ -391,3 +391,16 @@ class _SlideBody extends StatelessWidget { ); } } + +/// +extension FlutterDeckSlideWidgetX on Widget { + /// + FlutterDeckSlideWidget withSlideConfiguration( + FlutterDeckSlideConfiguration configuration, + ) { + return FlutterDeckSlide.custom( + configuration: configuration, + builder: (context) => this, + ); + } +}