Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/208-theme-lerp #209

Merged
merged 3 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.16.2

- **FIX**: `ShadTabs` and `ShadResizable` lerp
- **FIX**: `ShadTabs` focused border color in dark mode

## 0.16.1

- **FEAT**: Add parameters to `ShadFocusable`.
Expand Down
8 changes: 5 additions & 3 deletions lib/src/components/tabs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ class ShadTabsState<T> extends State<ShadTabs<T>> with RestorationMixin {
widget.padding ?? tabsTheme.padding ?? EdgeInsets.zero;

final effectiveDecoration = ShadDecoration(
merge: false,
color: theme.colorScheme.muted,
border: ShadBorder.all(radius: theme.radius, width: 0),
).mergeWith(tabsTheme.decoration).mergeWith(widget.decoration);
Expand Down Expand Up @@ -699,6 +698,7 @@ class _ShadTabState<T> extends State<ShadTab<T>> {
focusedBorder: ShadBorder.all(
width: 2,
radius: BorderRadius.circular(2),
color: theme.colorScheme.ring,
),
),
false => ShadDecoration(
Expand All @@ -723,12 +723,14 @@ class _ShadTabState<T> extends State<ShadTab<T>> {
isLastTab ? 2 : 0,
2,
),
color: theme.colorScheme.ring,
),
),
};

final effectiveDecoration =
widget.decoration ?? tabsTheme.tabDecoration ?? defaultDecoration;
final effectiveDecoration = defaultDecoration
.mergeWith(tabsTheme.tabDecoration)
.mergeWith(widget.decoration);

return ShadButton.secondary(
icon: widget.icon,
Expand Down
19 changes: 10 additions & 9 deletions lib/src/theme/components/resizable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ class ShadResizableTheme {
if (identical(a, b)) return a;
return ShadResizableTheme(
merge: b.merge,
mainAxisAlignment: b.mainAxisAlignment,
crossAxisAlignment: b.crossAxisAlignment,
mainAxisSize: b.mainAxisSize,
textDirection: b.textDirection,
verticalDirection: b.verticalDirection,
showHandle: b.showHandle,
handleIconSrc: b.handleIconSrc,
mainAxisAlignment: t < 0.5 ? a.mainAxisAlignment : b.mainAxisAlignment,
crossAxisAlignment: t < 0.5 ? a.crossAxisAlignment : b.crossAxisAlignment,
mainAxisSize: t < 0.5 ? a.mainAxisSize : b.mainAxisSize,
textDirection: t < 0.5 ? a.textDirection : b.textDirection,
verticalDirection: t < 0.5 ? a.verticalDirection : b.verticalDirection,
showHandle: t < 0.5 ? a.showHandle : b.showHandle,
handleIconSrc: t < 0.5 ? a.handleIconSrc : b.handleIconSrc,
dividerSize: lerpDouble(a.dividerSize, b.dividerSize, t),
resetOnDoubleTap: b.resetOnDoubleTap,
resetOnDoubleTap: t < 0.5 ? a.resetOnDoubleTap : b.resetOnDoubleTap,
handleDecoration:
ShadDecoration.lerp(a.handleDecoration, b.handleDecoration, t),
handlePadding: EdgeInsets.lerp(a.handlePadding, b.handlePadding, t),
Expand All @@ -79,7 +79,8 @@ class ShadResizableTheme {
handleIconSrc: other.handleIconSrc,
dividerSize: other.dividerSize,
resetOnDoubleTap: other.resetOnDoubleTap,
handleDecoration: other.handleDecoration,
handleDecoration: handleDecoration?.mergeWith(other.handleDecoration) ??
other.handleDecoration,
handlePadding: other.handlePadding,
handleSize: other.handleSize,
dividerColor: other.dividerColor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,6 @@ class ShadDefaultThemeNoSecondaryBorderVariant extends ShadThemeVariant {
dividerColor: colorScheme.border,
resetOnDoubleTap: true,
handleDecoration: ShadDecoration(
merge: false,
color: colorScheme.border,
border: ShadBorder.all(
radius: const BorderRadius.all(Radius.circular(4)),
Expand Down Expand Up @@ -742,7 +741,6 @@ class ShadDefaultThemeNoSecondaryBorderVariant extends ShadThemeVariant {
dragStartBehavior: DragStartBehavior.start,
padding: const EdgeInsets.all(4),
decoration: ShadDecoration(
merge: false,
color: colorScheme.muted,
border: ShadBorder.all(radius: radius, width: 0),
),
Expand Down
8 changes: 5 additions & 3 deletions lib/src/theme/themes/default_theme_variant.dart
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,6 @@ class ShadDefaultThemeVariant extends ShadThemeVariant {
dividerColor: colorScheme.border,
resetOnDoubleTap: true,
handleDecoration: ShadDecoration(
merge: false,
color: colorScheme.border,
border: ShadBorder.all(
radius: const BorderRadius.all(Radius.circular(4)),
Expand Down Expand Up @@ -714,9 +713,12 @@ class ShadDefaultThemeVariant extends ShadThemeVariant {
dragStartBehavior: DragStartBehavior.start,
padding: EdgeInsets.zero,
decoration: ShadDecoration(
merge: false,
color: colorScheme.muted,
border: ShadBorder.all(radius: radius, width: 0),
border: ShadBorder.all(
radius: radius,
width: 0,
color: colorScheme.ring,
),
),
gap: 8,
expandContent: false,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: shadcn_ui
description: shadcn-ui ported in Flutter. Awesome UI components for Flutter, fully customizable.
version: 0.16.1
version: 0.16.2
homepage: https://flutter-shadcn-ui.mariuti.com
repository: https://github.com/nank1ro/flutter-shadcn-ui
documentation: https://flutter-shadcn-ui.mariuti.com
Expand Down