Skip to content

Commit

Permalink
Initial fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kawaijoe committed Dec 7, 2024
1 parent d9ac683 commit a8ab485
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion forui/lib/src/widgets/scaffold.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class FScaffold extends StatelessWidget {
/// True if [FScaffoldStyle.contentPadding] should be applied to the [content]. Defaults to `true`.
final bool contentPad;

final bool resizeToAvoidBottomInset;

/// The style. Defaults to [FThemeData.scaffoldStyle].
final FScaffoldStyle? style;

Expand All @@ -35,26 +37,38 @@ class FScaffold extends StatelessWidget {
this.header,
this.footer,
this.contentPad = true,
this.resizeToAvoidBottomInset = true,
this.style,
super.key,
});

@override
Widget build(BuildContext context) {
final style = this.style ?? context.theme.scaffoldStyle;
final viewInsets = MediaQuery.of(context).viewInsets;
Widget content = this.content;
Widget footer = this.footer != null
? DecoratedBox(
decoration: style.footerDecoration,
child: this.footer!,
)
: const SizedBox();

if (contentPad) {
content = Padding(padding: style.contentPadding, child: content);
}

if (viewInsets.bottom > 0 && resizeToAvoidBottomInset) {
footer = SizedBox(height: viewInsets.bottom);
}

return ColoredBox(
color: style.backgroundColor,
child: Column(
children: [
if (header != null) DecoratedBox(decoration: style.headerDecoration, child: header!),
Expanded(child: content),
if (footer != null) DecoratedBox(decoration: style.footerDecoration, child: footer!),
footer,
],
),
);
Expand Down

0 comments on commit a8ab485

Please sign in to comment.