Skip to content

Commit 5c00afa

Browse files
committed
fix: Turntile link will wrap for some specific width of screen
1 parent 5914c87 commit 5c00afa

File tree

1 file changed

+45
-38
lines changed

1 file changed

+45
-38
lines changed

lib/widgets/turntile/link_turntile.dart

+45-38
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:go_router/go_router.dart';
22
import 'package:fluent_ui/fluent_ui.dart';
3+
import 'package:rune/providers/responsive_providers.dart';
34
import 'package:rune/widgets/navigation_bar/utils/activate_link_action.dart';
45

56
import '../../widgets/ax_pressure.dart';
@@ -59,50 +60,56 @@ class _LinkTurntileState extends State<LinkTurntile> {
5960

6061
final blurRadius = _isFocused ? 10.0 : 0.0;
6162

62-
return AxPressure(
63-
child: GestureDetector(
64-
onTap: onPressed,
65-
child: FocusableActionDetector(
66-
onShowFocusHighlight: _handleFocusHighlight,
67-
onShowHoverHighlight: _handleHoverHighlight,
68-
actions: {
69-
ActivateIntent: ActivateLinkAction(context, onPressed),
70-
},
71-
child: TweenAnimationBuilder(
72-
tween: ColorTween(
73-
begin: color.withAlpha(alpha),
74-
end: color.withAlpha(alpha),
75-
),
76-
duration: theme.fastAnimationDuration,
77-
builder: (BuildContext context, Color? color, Widget? child) {
78-
return TweenAnimationBuilder(
79-
tween: Tween<double>(
80-
begin: blurRadius,
81-
end: blurRadius,
63+
return SmallerOrEqualToScreenSize(
64+
maxWidth: 160,
65+
builder: (context, isMini) {
66+
return AxPressure(
67+
child: GestureDetector(
68+
onTap: onPressed,
69+
child: FocusableActionDetector(
70+
onShowFocusHighlight: _handleFocusHighlight,
71+
onShowHoverHighlight: _handleHoverHighlight,
72+
actions: {
73+
ActivateIntent: ActivateLinkAction(context, onPressed),
74+
},
75+
child: TweenAnimationBuilder(
76+
tween: ColorTween(
77+
begin: color.withAlpha(alpha),
78+
end: color.withAlpha(alpha),
8279
),
8380
duration: theme.fastAnimationDuration,
84-
builder:
85-
(BuildContext context, double blurRadius, Widget? child) {
86-
return Text(
87-
widget.title,
88-
textAlign: TextAlign.start,
89-
style: theme.typography.title?.apply(
90-
fontWeightDelta: -100,
91-
color: color,
92-
shadows: [
93-
Shadow(
94-
color: theme.accentColor,
95-
blurRadius: blurRadius,
96-
),
97-
],
81+
builder: (BuildContext context, Color? color, Widget? child) {
82+
return TweenAnimationBuilder(
83+
tween: Tween<double>(
84+
begin: blurRadius,
85+
end: blurRadius,
9886
),
87+
duration: theme.fastAnimationDuration,
88+
builder: (BuildContext context, double blurRadius,
89+
Widget? child) {
90+
return Text(
91+
widget.title,
92+
textAlign: TextAlign.start,
93+
style: theme.typography.title?.apply(
94+
fontWeightDelta: -100,
95+
fontSizeFactor: isMini ? 0.69 : 1,
96+
color: color,
97+
shadows: [
98+
Shadow(
99+
color: theme.accentColor,
100+
blurRadius: blurRadius,
101+
),
102+
],
103+
),
104+
);
105+
},
99106
);
100107
},
101-
);
102-
},
108+
),
109+
),
103110
),
104-
),
105-
),
111+
);
112+
},
106113
);
107114
}
108115
}

0 commit comments

Comments
 (0)