-
Notifications
You must be signed in to change notification settings - Fork 29.1k
Closed
Description
How this border 'paints' itself to the dialog's button even if it's behind the dialog and both the button and dialog had a solid background fill of color white?

RynxDialog
class RynxDialog {
static void show({
required BuildContext context,
required RynxDialogView dialogView,
bool closeOnTapOutside = false,
Color? backgroundColor,
}) async {
await showDialog(
context: context,
builder: (context) {
return Dialog(
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(App.radiusM)
),
child: Padding(
padding: const EdgeInsetsGeometry.symmetric(vertical: App.paddingL),
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
dialogView
],
),
)
);
}
);
}
}
RynxDialogView
class RynxDialogView extends StatelessWidget {
final Widget? title;
final Widget? body;
final ActionButton? primaryAction;
final ActionButton? secondaryAction;
final Widget? child;
const RynxDialogView({
super.key,
required this.title,
required this.body,
required this.primaryAction,
this.secondaryAction
}) :
child = null;
const RynxDialogView.custom({
super.key,
required this.child
}) :
title = null,
body = null,
primaryAction = null,
secondaryAction = null;
@override
Widget build(BuildContext context) {
return child ?? Column(
spacing: App.gapM,
children: [
// Header
Container(
padding: const EdgeInsets.symmetric(horizontal: App.paddingL),
width: double.infinity,
child: title
),
const Divider(),
// body
Container(
padding: const EdgeInsets.symmetric(horizontal: App.paddingL),
width: double.infinity,
child: body
),
const Divider(),
// Footer
Container(
padding: const EdgeInsets.symmetric(horizontal: App.paddingL),
width: double.infinity,
child: Row(
spacing: App.gapM,
mainAxisAlignment: MainAxisAlignment.end,
children: [
if (secondaryAction != null)
RynxSecondaryButton(
size: const Size(double.minPositive, double.minPositive),
onPress: secondaryAction!.action,
child: Text(
secondaryAction!.text,
style: const TextStyle(
fontSize: App.fontM
),
)
),
RynxPrimaryButton(
size: const Size(double.minPositive, double.minPositive),
onPress: primaryAction!.action,
child: Text(
primaryAction!.text,
style: const TextStyle(
fontSize: App.fontM
),
)
)
],
),
)
]
);
}
}
class ActionButton {
final String text;
final void Function() action;
ActionButton({
required this.text,
required this.action
});
}
RynxSecondaryButton
class RynxSecondaryButton extends StatelessWidget{
final Widget child;
final VoidCallback onPress;
final Size? size;
final double? borderWidth;
final Color? backgroundColor;
final Color? foregroundColor;
const RynxSecondaryButton({
super.key,
required this.child,
required this.onPress,
this.size,
this.borderWidth,
this.backgroundColor,
this.foregroundColor
});
@override
Widget build(BuildContext context) {
return OutlinedButton(
style: OutlinedButton.styleFrom(
padding: const EdgeInsets.all(App.buttonPadding),
minimumSize: size ?? const Size(double.maxFinite, App.buttonMinHeight),
foregroundColor: App.colorPrimary,
surfaceTintColor: Colors.transparent,
overlayColor: Colors.black.withAlpha(100),
backgroundColor: Colors.transparent,
side: BorderSide(width: borderWidth ?? 1, color: App.colorPrimary),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(App.buttonRadius),
)
),
onPressed: onPress,
child: child,
);
}
}
RynxPrimaryButton
class RynxPrimaryButton extends StatelessWidget{
final Widget child;
final VoidCallback onPress;
final Size? size;
final EdgeInsets? padding;
const RynxPrimaryButton({
super.key,
required this.child,
required this.onPress,
this.size,
this.padding,
});
@override
Widget build(BuildContext context) {
return ElevatedButton(
style: ButtonStyle(
padding: WidgetStatePropertyAll(padding ?? const EdgeInsets.all(App.buttonPadding)),
elevation: const WidgetStatePropertyAll(0),
minimumSize: WidgetStatePropertyAll(size ?? const Size(double.maxFinite, App.buttonMinHeight)),
foregroundColor: const WidgetStatePropertyAll(Colors.white),
surfaceTintColor: const WidgetStatePropertyAll(Colors.transparent),
overlayColor: WidgetStatePropertyAll(Colors.black.withAlpha(100)),
backgroundColor: const WidgetStatePropertyAll(App.colorPrimary),
shape: WidgetStatePropertyAll(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(App.buttonRadius),
)
)
),
onPressed: onPress,
child: child,
);
}
}
Metadata
Metadata
Assignees
Labels
No labels