flutter_deck
flutter_deck copied to clipboard
feat: Support direct slide widget creation
The current structural approach of flutter_deck
is to subclass FlutterDeckSlideWidget
to create a slide. This requirement seems to result in a lot more code than should be necessary to describe a desired slide show.
For example, I'd like to start defining my presentation with something like this:
@override
Widget build(BuildContext context) {
return FlutterDeckApp(
slides: [
FlutterDeckSlide.title(title: 'The Art of Flutter Testing'),
],
);
}
But the above won't compile. The slide is a FlutterDeckSlide
, but the slides
list wants FlutterDeckSlideWidget
s.
Therefore, I have to write the following code for the exact same effect:
@override
Widget build(BuildContext context) {
return FlutterDeckApp(
slides: [
const MyTitleSlide(),
],
);
}
class MyTitleSlide extends FlutterDeckSlideWidget {
const MyTitleSlide()
: super(
configuration: const FlutterDeckSlideConfiguration(route: '/'),
);
@override
FlutterDeckSlide build(BuildContext context) {
return FlutterDeckSlide.title(title: 'The Art of Flutter Testing');
}
}
I'm sure there are some details behind the scenes that lead to this, but in terms of UX, I really think we should be able to directly use existing slide types within the slides
list without subclassing. I know there's code generation tooling, but in this case, that seems like a solution to a problem that doesn't need to exist.