allow a BasicDialog to optionally flex

so the buttons can be pushed to the bottom of the dialog
This commit is contained in:
sneurlax 2024-04-17 13:05:23 -05:00
parent eff06c88b8
commit 30255c665e
2 changed files with 12 additions and 0 deletions

View file

@ -26,6 +26,7 @@ class BasicDialog extends StatelessWidget {
this.desktopHeight = 474, this.desktopHeight = 474,
this.desktopWidth = 641, this.desktopWidth = 641,
this.canPopWithBackButton = false, this.canPopWithBackButton = false,
this.flex = false,
}) : super(key: key); }) : super(key: key);
final Widget? leftButton; final Widget? leftButton;
@ -41,6 +42,8 @@ class BasicDialog extends StatelessWidget {
final bool canPopWithBackButton; final bool canPopWithBackButton;
final bool flex;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final isDesktop = Util.isDesktop; final isDesktop = Util.isDesktop;
@ -64,6 +67,10 @@ class BasicDialog extends StatelessWidget {
], ],
), ),
), ),
if (flex)
const Spacer(
flex: 2,
),
if (message != null) if (message != null)
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 32), padding: const EdgeInsets.symmetric(horizontal: 32),
@ -72,6 +79,10 @@ class BasicDialog extends StatelessWidget {
style: STextStyles.desktopTextSmall(context), style: STextStyles.desktopTextSmall(context),
), ),
), ),
if (flex)
const Spacer(
flex: 3,
),
if (leftButton != null || rightButton != null) if (leftButton != null || rightButton != null)
const SizedBox( const SizedBox(
height: 32, height: 32,

View file

@ -38,6 +38,7 @@ class TorWarningDialog extends StatelessWidget {
Navigator.of(context).pop(true); Navigator.of(context).pop(true);
}, },
), ),
flex: true,
); );
} }
} }