Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
nank1ro authored Jan 20, 2025
2 parents 08afc54 + f19c064 commit 97209dc
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 11 deletions.
1 change: 1 addition & 0 deletions .github/workflows/flutter-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
- uses: subosito/flutter-action@v2.18.0
with:
channel: "stable"
cache: true

- name: Install dependencies
run: flutter pub get
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.18.1

- **FIX**: Set `ShadCard` clipBehavior to `Clip.antialias`, add `clipBehavior` to `ShadCard` and `ShadCardTheme`.

## 0.18.0

- **BREAKING CHANGE**: Remove `applyIconColorFilter` from `ShadButton`.
Expand Down
10 changes: 10 additions & 0 deletions lib/src/components/card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class ShadCard extends StatelessWidget {
this.columnCrossAxisAlignment,
this.rowMainAxisSize,
this.columnMainAxisSize,
this.clipBehavior,
});

final Widget? title;
Expand All @@ -46,6 +47,11 @@ class ShadCard extends StatelessWidget {
final MainAxisSize? rowMainAxisSize;
final MainAxisSize? columnMainAxisSize;

/// {@template ShadCard.clipBehavior}
/// The clipBehavior of the card, defaults to [Clip.antiAlias].
/// {@endtemplate}
final Clip? clipBehavior;

@override
Widget build(BuildContext context) {
final theme = ShadTheme.of(context);
Expand Down Expand Up @@ -84,10 +90,14 @@ class ShadCard extends StatelessWidget {
theme.cardTheme.columnCrossAxisAlignment ??
CrossAxisAlignment.start;

final effectiveClipBehavior =
clipBehavior ?? theme.cardTheme.clipBehavior ?? Clip.antiAlias;

return Container(
width: width,
height: height,
padding: effectivePadding,
clipBehavior: effectiveClipBehavior,
decoration: BoxDecoration(
color: effectiveBackgroundColor,
borderRadius: effectiveRadius,
Expand Down
5 changes: 4 additions & 1 deletion lib/src/components/tabs.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:math' as math;

import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -713,7 +714,9 @@ class _ShadTabState<T> extends State<ShadTab<T>> {
? effectiveSelectedHoverBackgroundColor
: effectiveHoverBackgroundColor,
padding: effectivePadding,
decoration: effectiveDecoration,
decoration: selected
? effectiveDecoration.mergeWith(widget.selectedDecoration)
: effectiveDecoration,
foregroundColor: selected
? effectiveSelectedForegroundColor
: effectiveForegroundColor,
Expand Down
29 changes: 20 additions & 9 deletions lib/src/theme/components/card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class ShadCardTheme {
this.columnCrossAxisAlignment,
this.rowMainAxisSize,
this.columnMainAxisSize,
this.clipBehavior,
});

final bool merge;
Expand All @@ -36,6 +37,7 @@ class ShadCardTheme {
final CrossAxisAlignment? columnCrossAxisAlignment;
final MainAxisSize? rowMainAxisSize;
final MainAxisSize? columnMainAxisSize;
final Clip? clipBehavior;

static ShadCardTheme lerp(
ShadCardTheme a,
Expand All @@ -49,15 +51,19 @@ class ShadCardTheme {
padding: EdgeInsets.lerp(a.padding, b.padding, t),
radius: BorderRadius.lerp(a.radius, b.radius, t),
border: Border.lerp(a.border, b.border, t),
shadows: b.shadows,
shadows: t < .5 ? a.shadows : b.shadows,
width: lerpDouble(a.width, b.width, t),
height: lerpDouble(a.height, b.height, t),
rowMainAxisAlignment: b.rowMainAxisAlignment,
rowCrossAxisAlignment: b.rowCrossAxisAlignment,
columnMainAxisAlignment: b.columnMainAxisAlignment,
columnCrossAxisAlignment: b.columnCrossAxisAlignment,
rowMainAxisSize: b.rowMainAxisSize,
columnMainAxisSize: b.columnMainAxisSize,
rowMainAxisAlignment:
t < .5 ? a.rowMainAxisAlignment : b.rowMainAxisAlignment,
rowCrossAxisAlignment:
t < .5 ? a.rowCrossAxisAlignment : b.rowCrossAxisAlignment,
columnMainAxisAlignment:
t < .5 ? a.columnMainAxisAlignment : b.columnMainAxisAlignment,
columnCrossAxisAlignment:
t < .5 ? a.columnCrossAxisAlignment : b.columnCrossAxisAlignment,
rowMainAxisSize: t < .5 ? a.rowMainAxisSize : b.rowMainAxisSize,
columnMainAxisSize: t < .5 ? a.columnMainAxisSize : b.columnMainAxisSize,
);
}

Expand All @@ -76,6 +82,7 @@ class ShadCardTheme {
CrossAxisAlignment? columnCrossAxisAlignment,
MainAxisSize? rowMainAxisSize,
MainAxisSize? columnMainAxisSize,
Clip? clipBehavior,
}) {
return ShadCardTheme(
merge: merge ?? this.merge,
Expand All @@ -95,6 +102,7 @@ class ShadCardTheme {
columnCrossAxisAlignment ?? this.columnCrossAxisAlignment,
rowMainAxisSize: rowMainAxisSize ?? this.rowMainAxisSize,
columnMainAxisSize: columnMainAxisSize ?? this.columnMainAxisSize,
clipBehavior: clipBehavior ?? this.clipBehavior,
);
}

Expand All @@ -115,6 +123,7 @@ class ShadCardTheme {
columnCrossAxisAlignment: other.columnCrossAxisAlignment,
rowMainAxisSize: other.rowMainAxisSize,
columnMainAxisSize: other.columnMainAxisSize,
clipBehavior: other.clipBehavior,
);
}

Expand All @@ -136,7 +145,8 @@ class ShadCardTheme {
other.columnMainAxisAlignment == columnMainAxisAlignment &&
other.columnCrossAxisAlignment == columnCrossAxisAlignment &&
other.rowMainAxisSize == rowMainAxisSize &&
other.columnMainAxisSize == columnMainAxisSize;
other.columnMainAxisSize == columnMainAxisSize &&
other.clipBehavior == clipBehavior;
}

@override
Expand All @@ -154,6 +164,7 @@ class ShadCardTheme {
columnMainAxisAlignment.hashCode ^
columnCrossAxisAlignment.hashCode ^
rowMainAxisSize.hashCode ^
columnMainAxisSize.hashCode;
columnMainAxisSize.hashCode ^
clipBehavior.hashCode;
}
}
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.18.0
version: 0.18.1
homepage: https://flutter-shadcn-ui.mariuti.com
repository: https://github.com/nank1ro/flutter-shadcn-ui
documentation: https://flutter-shadcn-ui.mariuti.com
Expand Down

0 comments on commit 97209dc

Please sign in to comment.