From 7d6ba708f6c18d8ae0bb318c18cd14dfee7b6f8d Mon Sep 17 00:00:00 2001 From: Joe Date: Sun, 30 Jun 2024 16:46:04 +0800 Subject: [PATCH] Fix pr issues --- forui/CHANGELOG.md | 7 ++++--- forui/lib/src/theme/theme_data.dart | 7 +++---- forui/lib/src/widgets/header/header.dart | 21 +++++++++---------- .../lib/src/widgets/header/nested_header.dart | 2 +- forui/lib/src/widgets/header/root_header.dart | 4 ++-- 5 files changed, 20 insertions(+), 21 deletions(-) diff --git a/forui/CHANGELOG.md b/forui/CHANGELOG.md index 896d446c0..68f6bb14c 100644 --- a/forui/CHANGELOG.md +++ b/forui/CHANGELOG.md @@ -1,11 +1,12 @@ ## 0.2.0 -* Add `NestedHeader` widget. +* Add `Header.nested` widget. ### Breaking changes -* `FHeaderActionStyle.action` parameter has been renamed to `FHeaderStyle.actionStyle`. -* `FHeaderActionStyle.padding` parameter has been moved to `FHeaderStyle.actionSpacing`. +* `FHeaderStyle` have been nested in `FHeaderStyles.rootStyle`. +* `FHeaderActionStyle.action` parameter has been renamed to `FRootHeaderStyle.actionStyle`. +* `FHeaderActionStyle.padding` parameter has been moved to `FRootHeaderStyle.actionSpacing`. ## 0.1.0 diff --git a/forui/lib/src/theme/theme_data.dart b/forui/lib/src/theme/theme_data.dart index 0d5f6e41b..f40f628a2 100644 --- a/forui/lib/src/theme/theme_data.dart +++ b/forui/lib/src/theme/theme_data.dart @@ -38,7 +38,7 @@ final class FThemeData with Diagnosticable { final FDialogStyle dialogStyle; /// The header styles. - final FHeaderStyle headerStyle; + final FHeaderStyles headerStyle; /// The tabs styles. final FTabsStyle tabsStyle; @@ -93,7 +93,7 @@ final class FThemeData with Diagnosticable { buttonStyles: FButtonStyles.inherit(colorScheme: colorScheme, typography: typography, style: style), cardStyle: FCardStyle.inherit(colorScheme: colorScheme, typography: typography, style: style), dialogStyle: FDialogStyle.inherit(colorScheme: colorScheme, typography: typography, style: style), - headerStyle: FHeaderStyle.inherit(colorScheme: colorScheme, typography: typography, style: style), + headerStyle: FHeaderStyles.inherit(colorScheme: colorScheme, typography: typography, style: style), tabsStyle: FTabsStyle.inherit(colorScheme: colorScheme, typography: typography, style: style), textFieldStyle: FTextFieldStyle.inherit(colorScheme: colorScheme, typography: typography, style: style), scaffoldStyle: FScaffoldStyle.inherit(colorScheme: colorScheme, style: style), @@ -127,8 +127,7 @@ final class FThemeData with Diagnosticable { FButtonStyles? buttonStyles, FCardStyle? cardStyle, FDialogStyle? dialogStyle, - FHeaderStyle? headerStyle, - FNestedHeaderStyle? nestedHeaderStyle, + FHeaderStyles? headerStyle, FTabsStyle? tabsStyle, FTextFieldStyle? textFieldStyle, FScaffoldStyle? scaffoldStyle, diff --git a/forui/lib/src/widgets/header/header.dart b/forui/lib/src/widgets/header/header.dart index 1a7c32faf..d355aeee8 100644 --- a/forui/lib/src/widgets/header/header.dart +++ b/forui/lib/src/widgets/header/header.dart @@ -15,11 +15,10 @@ part 'nested_header.dart'; /// A header. /// /// A header contains the page's title and actions. - /// /// See: /// * https://forui.dev/docs/header for working examples. -/// * [FHeaderStyle] for customizing a header's appearance. +/// * [FHeaderStyles] and [FNestedHeaderStyle] for customizing a header's appearance. sealed class FHeader extends StatelessWidget { const FHeader._({super.key}); @@ -46,28 +45,28 @@ sealed class FHeader extends StatelessWidget { } /// [FHeader]'s style. -final class FHeaderStyle with Diagnosticable { +final class FHeaderStyles with Diagnosticable { /// The root header style. final FRootHeaderStyle rootStyle; /// The nested header style. final FNestedHeaderStyle nestedStyle; - /// Creates a [FHeaderStyle]. - const FHeaderStyle({ + /// Creates a [FHeaderStyles]. + const FHeaderStyles({ required this.rootStyle, required this.nestedStyle, }); - /// Creates a [FRootHeaderStyle] that inherits its properties from the given [FColorScheme], [FTypography] and [FStyle]. - FHeaderStyle.inherit({ + /// Creates a [FHeaderStyles] that inherits its properties from the given [FColorScheme], [FTypography] and [FStyle]. + FHeaderStyles.inherit({ required FColorScheme colorScheme, required FTypography typography, required FStyle style, }) : rootStyle = FRootHeaderStyle.inherit(colorScheme: colorScheme, typography: typography, style: style), nestedStyle = FNestedHeaderStyle.inherit(colorScheme: colorScheme, typography: typography, style: style); - /// Returns a copy of this [FHeaderStyle] with the given properties replaced. + /// Returns a copy of this [FHeaderStyles] with the given properties replaced. /// /// ```dart /// final style = FHeaderStyle( @@ -82,11 +81,11 @@ final class FHeaderStyle with Diagnosticable { /// print(style.rootStyle == copy.rootStyle); // true /// print(style.nestedStyle == copy.nestedStyle); // false /// ``` - FHeaderStyle copyWith({ + FHeaderStyles copyWith({ FRootHeaderStyle? rootStyle, FNestedHeaderStyle? nestedStyle, }) => - FHeaderStyle( + FHeaderStyles( rootStyle: rootStyle ?? this.rootStyle, nestedStyle: nestedStyle ?? this.nestedStyle, ); @@ -102,7 +101,7 @@ final class FHeaderStyle with Diagnosticable { @override bool operator ==(Object other) => identical(this, other) || - other is FHeaderStyle && + other is FHeaderStyles && runtimeType == other.runtimeType && rootStyle == other.rootStyle && nestedStyle == other.nestedStyle; diff --git a/forui/lib/src/widgets/header/nested_header.dart b/forui/lib/src/widgets/header/nested_header.dart index 93d81c196..1ba689454 100644 --- a/forui/lib/src/widgets/header/nested_header.dart +++ b/forui/lib/src/widgets/header/nested_header.dart @@ -77,7 +77,7 @@ final class _FNestedHeader extends FHeader { } } -/// [_FNestedHeader]'s style. +/// [FHeader.nested]'s style. final class FNestedHeaderStyle with Diagnosticable { /// The title's [TextStyle]. final TextStyle titleTextStyle; diff --git a/forui/lib/src/widgets/header/root_header.dart b/forui/lib/src/widgets/header/root_header.dart index 76ae91489..ffeb51e77 100644 --- a/forui/lib/src/widgets/header/root_header.dart +++ b/forui/lib/src/widgets/header/root_header.dart @@ -9,7 +9,7 @@ part of 'header.dart'; /// * https://forui.dev/docs/header for working examples. /// * [FRootHeaderStyle] for customizing a header's appearance. final class _FRootHeader extends FHeader { - /// The header's style. Defaults to [FThemeData.headerStyle]. + /// The header's style. Defaults to [FThemeData.headerStyle.rootStyle]. final FRootHeaderStyle? style; /// The title, aligned to the left. @@ -66,7 +66,7 @@ final class _FRootHeader extends FHeader { } } -/// [_FRootHeader]'s style. +/// [FHeader.new]'s style. final class FRootHeaderStyle with Diagnosticable { /// The title's [TextStyle]. final TextStyle titleTextStyle;