Committed by
David PHAM-VAN
Implement `crossAxisAlignment` for actions
Showing
2 changed files
with
20 additions
and
3 deletions
| @@ -10,6 +10,7 @@ class PdfActionBarTheme with Diagnosticable { | @@ -10,6 +10,7 @@ class PdfActionBarTheme with Diagnosticable { | ||
| 10 | this.textStyle, | 10 | this.textStyle, |
| 11 | this.elevation = 4, | 11 | this.elevation = 4, |
| 12 | this.alignment = WrapAlignment.spaceAround, | 12 | this.alignment = WrapAlignment.spaceAround, |
| 13 | + this.crossAxisAlignment = WrapCrossAlignment.center, | ||
| 13 | }); | 14 | }); |
| 14 | 15 | ||
| 15 | final Color? backgroundColor; | 16 | final Color? backgroundColor; |
| @@ -18,6 +19,7 @@ class PdfActionBarTheme with Diagnosticable { | @@ -18,6 +19,7 @@ class PdfActionBarTheme with Diagnosticable { | ||
| 18 | final TextStyle? textStyle; | 19 | final TextStyle? textStyle; |
| 19 | final double elevation; | 20 | final double elevation; |
| 20 | final WrapAlignment alignment; | 21 | final WrapAlignment alignment; |
| 22 | + final WrapCrossAlignment crossAxisAlignment; | ||
| 21 | 23 | ||
| 22 | /// Creates a copy of this object but with the given fields replaced with the | 24 | /// Creates a copy of this object but with the given fields replaced with the |
| 23 | /// new values. | 25 | /// new values. |
| @@ -28,6 +30,7 @@ class PdfActionBarTheme with Diagnosticable { | @@ -28,6 +30,7 @@ class PdfActionBarTheme with Diagnosticable { | ||
| 28 | TextStyle? textStyle, | 30 | TextStyle? textStyle, |
| 29 | double? elevation, | 31 | double? elevation, |
| 30 | WrapAlignment? alignment, | 32 | WrapAlignment? alignment, |
| 33 | + WrapCrossAlignment? crossAxisAlignment, | ||
| 31 | }) { | 34 | }) { |
| 32 | return PdfActionBarTheme( | 35 | return PdfActionBarTheme( |
| 33 | backgroundColor: backgroundColor ?? this.backgroundColor, | 36 | backgroundColor: backgroundColor ?? this.backgroundColor, |
| @@ -36,12 +39,20 @@ class PdfActionBarTheme with Diagnosticable { | @@ -36,12 +39,20 @@ class PdfActionBarTheme with Diagnosticable { | ||
| 36 | textStyle: textStyle ?? this.textStyle, | 39 | textStyle: textStyle ?? this.textStyle, |
| 37 | elevation: elevation ?? this.elevation, | 40 | elevation: elevation ?? this.elevation, |
| 38 | alignment: alignment ?? this.alignment, | 41 | alignment: alignment ?? this.alignment, |
| 42 | + crossAxisAlignment: crossAxisAlignment ?? this.crossAxisAlignment, | ||
| 39 | ); | 43 | ); |
| 40 | } | 44 | } |
| 41 | 45 | ||
| 42 | @override | 46 | @override |
| 43 | - int get hashCode => Object.hashAll( | ||
| 44 | - [backgroundColor, iconColor, height, textStyle, elevation, alignment]); | 47 | + int get hashCode => Object.hashAll([ |
| 48 | + backgroundColor, | ||
| 49 | + iconColor, | ||
| 50 | + height, | ||
| 51 | + textStyle, | ||
| 52 | + elevation, | ||
| 53 | + alignment, | ||
| 54 | + crossAxisAlignment | ||
| 55 | + ]); | ||
| 45 | 56 | ||
| 46 | @override | 57 | @override |
| 47 | bool operator ==(Object other) { | 58 | bool operator ==(Object other) { |
| @@ -57,7 +68,8 @@ class PdfActionBarTheme with Diagnosticable { | @@ -57,7 +68,8 @@ class PdfActionBarTheme with Diagnosticable { | ||
| 57 | other.height == height && | 68 | other.height == height && |
| 58 | other.textStyle == textStyle && | 69 | other.textStyle == textStyle && |
| 59 | other.elevation == elevation && | 70 | other.elevation == elevation && |
| 60 | - other.alignment == alignment; | 71 | + other.alignment == alignment && |
| 72 | + other.crossAxisAlignment == crossAxisAlignment; | ||
| 61 | } | 73 | } |
| 62 | 74 | ||
| 63 | @override | 75 | @override |
| @@ -70,5 +82,8 @@ class PdfActionBarTheme with Diagnosticable { | @@ -70,5 +82,8 @@ class PdfActionBarTheme with Diagnosticable { | ||
| 70 | properties.add(DoubleProperty('elevation', elevation)); | 82 | properties.add(DoubleProperty('elevation', elevation)); |
| 71 | properties.add(DiagnosticsProperty<WrapAlignment>('alignment', alignment, | 83 | properties.add(DiagnosticsProperty<WrapAlignment>('alignment', alignment, |
| 72 | defaultValue: WrapAlignment.spaceAround)); | 84 | defaultValue: WrapAlignment.spaceAround)); |
| 85 | + properties.add(DiagnosticsProperty<WrapCrossAlignment>( | ||
| 86 | + 'crossAxisAlignment', crossAxisAlignment, | ||
| 87 | + defaultValue: WrapCrossAlignment.center)); | ||
| 73 | } | 88 | } |
| 74 | } | 89 | } |
| @@ -425,6 +425,8 @@ class PdfPreviewState extends State<PdfPreview> { | @@ -425,6 +425,8 @@ class PdfPreviewState extends State<PdfPreview> { | ||
| 425 | child: SafeArea( | 425 | child: SafeArea( |
| 426 | child: Wrap( | 426 | child: Wrap( |
| 427 | alignment: widget.actionBarTheme.alignment, | 427 | alignment: widget.actionBarTheme.alignment, |
| 428 | + crossAxisAlignment: | ||
| 429 | + widget.actionBarTheme.crossAxisAlignment, | ||
| 428 | children: actions, | 430 | children: actions, |
| 429 | ), | 431 | ), |
| 430 | ), | 432 | ), |
-
Please register or login to post a comment