Skip to content

Commit

Permalink
fix: Fix tabBar and segmentedControl animation (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
GittHub-d committed May 26, 2023
1 parent c86449e commit af64b94
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/src/widgets/segmented_control/segmented_control.dart
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,12 @@ class _MoonSegmentedControlState extends State<MoonSegmentedControl> {
return AnimatedOpacity(
opacity: widget.isDisabled ? effectiveDisabledOpacityValue : 1,
duration: effectiveTransitionDuration,
child: Container(
child: AnimatedContainer(
height: effectiveHeight,
width: widget.width,
padding: effectivePadding,
duration: effectiveTransitionDuration,
curve: effectiveTransitionCurve,
constraints: BoxConstraints(minWidth: effectiveHeight),
decoration: widget.decoration ??
ShapeDecorationWithPremultipliedAlpha(
Expand Down
8 changes: 6 additions & 2 deletions lib/src/widgets/tab_bar/tab_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,13 @@ class _MoonTabBarState extends State<MoonTabBar> {

final double effectiveGap = widget.gap ?? context.moonTheme?.tabBarTheme.properties.gap ?? MoonSizes.sizes.x5s;

return Container(
return AnimatedContainer(
height: effectiveHeight,
width: widget.width,
padding: widget.padding,
decoration: widget.decoration,
duration: _effectiveTransitionDuration,
curve: _effectiveTransitionCurve,
constraints: BoxConstraints(minWidth: effectiveHeight),
child: BaseSegmentedTabBar(
gap: effectiveGap,
Expand Down Expand Up @@ -350,8 +352,10 @@ class _IndicatorTabBuilder extends StatelessWidget {
builder: (context, isEnabled, isHovered, isFocused, isPressed) {
final bool isActive = isEnabled && (isSelected || isHovered || isPressed);

return Container(
return AnimatedContainer(
decoration: tabStyle?.decoration,
duration: transitionDuration,
curve: transitionCurve,
child: Stack(
children: [
AnimatedIconTheme(
Expand Down

0 comments on commit af64b94

Please sign in to comment.