Skip to content

Commit

Permalink
Merge pull request #49 from mkobuolys/fix/styling-issues
Browse files Browse the repository at this point in the history
fix: adjust control widget styling and the default slide background color
  • Loading branch information
mkobuolys committed Dec 20, 2023
2 parents 0755984 + 4b84314 commit 2a4ab59
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 37 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
# 0.9.1

- fix: adjust control widget styling and the default slide background color

# 0.9.0

- feat: add `FlutterDeckSlideSize` to set the slide size for the whole presentation
Expand Down
4 changes: 2 additions & 2 deletions example/lib/main.dart
Expand Up @@ -56,8 +56,8 @@ class FlutterDeckExample extends StatelessWidget {
),
// Use a custom slide size.
slideSize: FlutterDeckSlideSize.fromAspectRatio(
aspectRatio: const FlutterDeckAspectRatio.ratio16x10(),
resolution: const FlutterDeckResolution.fromWidth(1440),
aspectRatio: const FlutterDeckAspectRatio.ratio16x9(),
resolution: const FlutterDeckResolution.fhd(),
),
// Use a custom transition between slides.
transition: const FlutterDeckTransition.fade(),
Expand Down
9 changes: 3 additions & 6 deletions lib/src/flutter_deck_slide.dart
Expand Up @@ -319,10 +319,7 @@ class FlutterDeckSlide extends StatelessWidget {
Widget build(BuildContext context) {
final materialTheme = Theme.of(context);
final theme = FlutterDeckTheme.of(context).merge(_theme);

final slideTheme = theme.slideTheme;
final backgroundColor = slideTheme.backgroundColor;
final color = slideTheme.color;
final color = theme.slideTheme.color;

return Theme(
data: materialTheme.copyWith(
Expand All @@ -339,7 +336,6 @@ class FlutterDeckSlide extends StatelessWidget {
child: FlutterDeckMarker(
notifier: context.flutterDeck.markerNotifier,
child: Scaffold(
backgroundColor: backgroundColor,
drawer: const FlutterDeckDrawer(),
body: _SlideBody(child: _builder(context)),
),
Expand Down Expand Up @@ -381,7 +377,8 @@ class _SlideBody extends StatelessWidget {
color: Colors.black,
child: Center(
child: FittedBox(
child: SizedBox(
child: Container(
color: FlutterDeckTheme.of(context).slideTheme.backgroundColor,
height: slideSize.height,
width: slideSize.width,
child: body,
Expand Down
84 changes: 56 additions & 28 deletions lib/src/widgets/internal/controls/flutter_deck_controls.dart
Expand Up @@ -46,26 +46,9 @@ class FlutterDeckControls extends StatelessWidget {
children: [
child!,
if (controlsNotifier.controlsVisible)
Align(
const Align(
alignment: AlignmentDirectional.bottomCenter,
child: Container(
margin: FlutterDeckLayout.slidePadding,
padding: const EdgeInsets.all(4),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(32),
color: Theme.of(context).colorScheme.surface,
),
child: const Row(
mainAxisSize: MainAxisSize.min,
children: [
_PreviousButton(),
_SlideNumberButton(),
_NextButton(),
_MarkerControls(),
_OptionsMenuButton(),
],
),
),
child: _Controls(),
),
],
),
Expand All @@ -74,6 +57,42 @@ class FlutterDeckControls extends StatelessWidget {
}
}

class _Controls extends StatefulWidget {
const _Controls();

@override
State<_Controls> createState() => _ControlsState();
}

class _ControlsState extends State<_Controls> {
@override
Widget build(BuildContext context) {
return Theme(
data: ThemeData.light(),
child: Builder(
builder: (context) => Container(
margin: FlutterDeckLayout.slidePadding,
padding: const EdgeInsets.all(4),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(32),
color: Theme.of(context).colorScheme.surface,
),
child: const Row(
mainAxisSize: MainAxisSize.min,
children: [
_PreviousButton(),
_SlideNumberButton(),
_NextButton(),
_MarkerControls(),
_OptionsMenuButton(),
],
),
),
),
);
}
}

class _PreviousButton extends StatelessWidget {
const _PreviousButton();

Expand Down Expand Up @@ -253,16 +272,25 @@ class _OptionsMenuButton extends StatelessWidget {

@override
Widget build(BuildContext context) {
return MenuAnchor(
builder: (context, controller, child) => IconButton(
icon: const Icon(Icons.more_vert_rounded),
tooltip: 'Open menu',
onPressed: controller.isOpen ? controller.close : controller.open,
return MenuButtonTheme(
data: MenuButtonThemeData(
style: ButtonStyle(
backgroundColor: MaterialStatePropertyAll(
Theme.of(context).colorScheme.surface,
),
),
),
child: MenuAnchor(
builder: (context, controller, child) => IconButton(
icon: const Icon(Icons.more_vert_rounded),
tooltip: 'Open menu',
onPressed: controller.isOpen ? controller.close : controller.open,
),
menuChildren: const [
_ThemeButton(),
_MarkerButton(),
],
),
menuChildren: const [
_ThemeButton(),
_MarkerButton(),
],
);
}
}
2 changes: 1 addition & 1 deletion pubspec.yaml
@@ -1,6 +1,6 @@
name: flutter_deck
description: A lightweight, customizable, and easy-to-use framework to create presentations in Flutter.
version: 0.9.0
version: 0.9.1
homepage: https://github.com/mkobuolys/flutter_deck
repository: https://github.com/mkobuolys/flutter_deck
issue_tracker: https://github.com/mkobuolys/flutter_deck/issues
Expand Down

0 comments on commit 2a4ab59

Please sign in to comment.