dialog style
Added TextStyle to generalDialog title and message
Showing
1 changed file
with
35 additions
and
27 deletions
@@ -500,6 +500,7 @@ extension GetNavigation on GetInterface { | @@ -500,6 +500,7 @@ extension GetNavigation on GetInterface { | ||
500 | /// Custom UI Dialog. | 500 | /// Custom UI Dialog. |
501 | Future<T> defaultDialog<T>({ | 501 | Future<T> defaultDialog<T>({ |
502 | String title = "Alert", | 502 | String title = "Alert", |
503 | + TextStyle titleStyle, | ||
503 | Widget content, | 504 | Widget content, |
504 | VoidCallback onConfirm, | 505 | VoidCallback onConfirm, |
505 | VoidCallback onCancel, | 506 | VoidCallback onCancel, |
@@ -515,7 +516,9 @@ extension GetNavigation on GetInterface { | @@ -515,7 +516,9 @@ extension GetNavigation on GetInterface { | ||
515 | Color backgroundColor, | 516 | Color backgroundColor, |
516 | Color buttonColor, | 517 | Color buttonColor, |
517 | String middleText = "Dialog made in 3 lines of code", | 518 | String middleText = "Dialog made in 3 lines of code", |
519 | + TextStyle middleTextStyle, | ||
518 | double radius = 20.0, | 520 | double radius = 20.0, |
521 | + ThemeData themeData, | ||
519 | List<Widget> actions, | 522 | List<Widget> actions, |
520 | }) { | 523 | }) { |
521 | bool leanCancel = onCancel != null || textCancel != null; | 524 | bool leanCancel = onCancel != null || textCancel != null; |
@@ -564,34 +567,39 @@ extension GetNavigation on GetInterface { | @@ -564,34 +567,39 @@ extension GetNavigation on GetInterface { | ||
564 | })); | 567 | })); |
565 | } | 568 | } |
566 | } | 569 | } |
567 | - return dialog(AlertDialog( | ||
568 | - titlePadding: EdgeInsets.all(8), | ||
569 | - contentPadding: EdgeInsets.all(8), | ||
570 | - backgroundColor: backgroundColor ?? theme.dialogBackgroundColor, | ||
571 | - shape: RoundedRectangleBorder( | ||
572 | - borderRadius: BorderRadius.all(Radius.circular(radius))), | ||
573 | - title: Text(title, textAlign: TextAlign.center), | ||
574 | - content: Column( | ||
575 | - crossAxisAlignment: CrossAxisAlignment.center, | ||
576 | - mainAxisSize: MainAxisSize.min, | ||
577 | - children: [ | ||
578 | - content ?? Text(middleText ?? "", textAlign: TextAlign.center), | ||
579 | - SizedBox(height: 16), | ||
580 | - ButtonTheme( | ||
581 | - minWidth: 78.0, | ||
582 | - height: 34.0, | ||
583 | - child: Wrap( | ||
584 | - alignment: WrapAlignment.center, | ||
585 | - spacing: 8, | ||
586 | - runSpacing: 8, | ||
587 | - children: actions, | ||
588 | - ), | ||
589 | - ) | ||
590 | - ], | 570 | + |
571 | + return dialog( | ||
572 | + AlertDialog( | ||
573 | + titlePadding: EdgeInsets.all(8), | ||
574 | + contentPadding: EdgeInsets.all(8), | ||
575 | + backgroundColor: backgroundColor ?? theme.dialogBackgroundColor, | ||
576 | + shape: RoundedRectangleBorder( | ||
577 | + borderRadius: BorderRadius.all(Radius.circular(radius))), | ||
578 | + title: Text(title, textAlign: TextAlign.center, style: titleStyle), | ||
579 | + content: Column( | ||
580 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
581 | + mainAxisSize: MainAxisSize.min, | ||
582 | + children: [ | ||
583 | + content ?? | ||
584 | + Text(middleText ?? "", | ||
585 | + textAlign: TextAlign.center, style: middleTextStyle), | ||
586 | + SizedBox(height: 16), | ||
587 | + ButtonTheme( | ||
588 | + minWidth: 78.0, | ||
589 | + height: 34.0, | ||
590 | + child: Wrap( | ||
591 | + alignment: WrapAlignment.center, | ||
592 | + spacing: 8, | ||
593 | + runSpacing: 8, | ||
594 | + children: actions, | ||
595 | + ), | ||
596 | + ) | ||
597 | + ], | ||
598 | + ), | ||
599 | + // actions: actions, // ?? <Widget>[cancelButton, confirmButton], | ||
600 | + buttonPadding: EdgeInsets.zero, | ||
591 | ), | 601 | ), |
592 | - // actions: actions, // ?? <Widget>[cancelButton, confirmButton], | ||
593 | - buttonPadding: EdgeInsets.zero, | ||
594 | - )); | 602 | + ); |
595 | } | 603 | } |
596 | 604 | ||
597 | Future<T> bottomSheet<T>( | 605 | Future<T> bottomSheet<T>( |
-
Please register or login to post a comment