diff --git a/lib/src/dialogs/yaru_alert_dialog.dart b/lib/src/dialogs/yaru_alert_dialog.dart deleted file mode 100644 index d7e2fe235..000000000 --- a/lib/src/dialogs/yaru_alert_dialog.dart +++ /dev/null @@ -1,80 +0,0 @@ -import 'package:flutter/material.dart'; -import '../constants.dart'; -import 'yaru_dialog_title.dart'; - -class YaruAlertDialog extends StatelessWidget { - const YaruAlertDialog({ - super.key, - required this.title, - required this.child, - this.closeIconData, - this.alignment, - this.width, - this.height, - this.titleTextAlign, - this.actions, - this.contentPadding = EdgeInsets.zero, - this.scrollable = false, - }); - - /// The title of the dialog, displayed in a large font at the top of the [YaruDialogTitle]. - final String title; - - /// The icon used inside the close button - final IconData? closeIconData; - - /// The child displayed underneath the title. It comes without any padding - /// or [ScrollView] so one has the full freedom to put anything inside. - final Widget child; - - /// How to align the [Dialog] on the Screen. - /// - /// If null, then [DialogTheme.alignment] is used. If that is also null, the - /// default is [Alignment.center]. - final AlignmentGeometry? alignment; - - /// The width of the dialog which can be provided and constraints all children with the same width. - /// - /// Default is [kYaruPageWidth] - final double? width; - - /// The optional height of the dialog which can be provided to limit the height - /// of the [SingleChildScrollView] where the [children] are placed. - final double? height; - - /// Optional [TextAlign] used for the [YaruDialogTitle] - final TextAlign? titleTextAlign; - - /// A [List] of [Widget] - typically [OutlinedButton], [ElevatedButton] or [TextButton] - final List? actions; - - /// Padding around the [content] - /// - /// Defaults to [EdgeInsets.zero] - final EdgeInsetsGeometry contentPadding; - - /// Forwards the [scrollable] flag to the [AlertDialog] - final bool? scrollable; - - @override - Widget build(BuildContext context) { - return SizedBox( - width: width ?? kYaruPageWidth, - child: AlertDialog( - actionsPadding: const EdgeInsets.all(kYaruPagePadding / 2), - contentPadding: contentPadding, - scrollable: scrollable ?? false, - titlePadding: EdgeInsets.zero, - title: YaruDialogTitle( - mainAxisAlignment: MainAxisAlignment.start, - textAlign: titleTextAlign, - title: title, - closeIconData: closeIconData ?? Icons.close, - ), - content: SizedBox(height: height, width: width, child: child), - actions: actions, - alignment: alignment, - ), - ); - } -} diff --git a/lib/src/dialogs/yaru_simple_dialog.dart b/lib/src/dialogs/yaru_simple_dialog.dart deleted file mode 100644 index ae9c94662..000000000 --- a/lib/src/dialogs/yaru_simple_dialog.dart +++ /dev/null @@ -1,79 +0,0 @@ -import 'package:flutter/material.dart'; -import '../constants.dart'; -import 'yaru_dialog_title.dart'; - -class YaruSimpleDialog extends StatelessWidget { - /// Create a [SimpleDialog] with a close button - const YaruSimpleDialog({ - super.key, - required this.title, - required this.closeIconData, - required this.children, - this.semanticLabel, - this.alignment, - required this.width, - this.titleTextAlign = TextAlign.center, - }); - - /// The title of the dialog, displayed in a large font at the top of the [YaruDialogTitle]. - final String title; - - /// The icon used inside the close button - final IconData closeIconData; - - /// The content of the dialog, displayed underneath the title. - final List children; - - /// The semantic label of the dialog used by accessibility frameworks to - /// announce screen transitions when the dialog is opened and closed. - /// - /// If this label is not provided, a semantic label will be inferred from the - /// [title] if it is not null. If there is no title, the label will be taken - /// from [MaterialLocalizations.dialogLabel]. - /// - /// See also: - /// - /// * [SemanticsConfiguration.namesRoute], for a description of how this - /// value is used. - final String? semanticLabel; - - /// How to align the [Dialog] on the Screen. - /// - /// If null, then [DialogTheme.alignment] is used. If that is also null, the - /// default is [Alignment.center]. - final AlignmentGeometry? alignment; - - /// The width of the dialog which must be provided and constraints all children with the same width. - /// - final double width; - - /// Optional [TextAlign] used for the [YaruDialogTitle] - final TextAlign? titleTextAlign; - - @override - Widget build(BuildContext context) { - return SizedBox( - width: width, - child: SimpleDialog( - titlePadding: EdgeInsets.zero, - title: YaruDialogTitle( - title: title, - closeIconData: closeIconData, - textAlign: titleTextAlign, - mainAxisAlignment: MainAxisAlignment.center, - ), - contentPadding: const EdgeInsets.fromLTRB( - kYaruPagePadding, - kYaruPagePadding, - kYaruPagePadding, - kYaruPagePadding, - ), - children: [ - for (var child in children) SizedBox(child: child, width: width) - ], - semanticLabel: semanticLabel, - alignment: alignment, - ), - ); - } -} diff --git a/lib/yaru_widgets.dart b/lib/yaru_widgets.dart index 6284151f2..6d31f8a06 100644 --- a/lib/yaru_widgets.dart +++ b/lib/yaru_widgets.dart @@ -9,9 +9,7 @@ export 'src/controls/yaru_icon_button.dart'; export 'src/controls/yaru_option_button.dart'; export 'src/controls/yaru_progress_indicator.dart'; // Dialogs -export 'src/dialogs/yaru_alert_dialog.dart'; export 'src/dialogs/yaru_dialog_title.dart'; -export 'src/dialogs/yaru_simple_dialog.dart'; // Extensions export 'src/extensions/border_radius_extension.dart'; // Pages layouts