Skip to content

Commit ac95dea

Browse files
committed
action_sheet: Use directional border radius for reaction buttons
Previously, the reaction buttons in the message action sheet used hardcoded physical border radii. In RTL locales, this caused the rounded corners to appear on the inner edges of the button row instead of the outer edges. We now use and resolve it against the context's text direction to ensure the correct corners are rounded regardless of layout direction.
1 parent 9296fb3 commit ac95dea

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/widgets/action_sheet.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,11 +1229,12 @@ class ReactionButtons extends StatelessWidget {
12291229
required bool isFirst,
12301230
}) {
12311231
final designVariables = DesignVariables.of(context);
1232+
final textDirection = Directionality.of(context);
12321233
return Flexible(child: InkWell(
12331234
onTap: () => _handleTapReaction(emoji: emoji, isSelfVoted: isSelfVoted),
12341235
splashFactory: NoSplash.splashFactory,
12351236
borderRadius: isFirst
1236-
? const BorderRadius.only(topLeft: Radius.circular(7))
1237+
? const BorderRadiusDirectional.only(topStart: Radius.circular(7)).resolve(textDirection)
12371238
: null,
12381239
overlayColor: WidgetStateColor.resolveWith((states) =>
12391240
states.any((e) => e == WidgetState.pressed)
@@ -1253,6 +1254,7 @@ class ReactionButtons extends StatelessWidget {
12531254

12541255
@override
12551256
Widget build(BuildContext context) {
1257+
final textDirection = Directionality.of(context);
12561258
final store = PerAccountStoreWidget.of(pageContext);
12571259
final popularEmojiCandidates = store.popularEmojiCandidates();
12581260
assert(popularEmojiCandidates.every(
@@ -1289,7 +1291,7 @@ class ReactionButtons extends StatelessWidget {
12891291
InkWell(
12901292
onTap: _handleTapMore,
12911293
splashFactory: NoSplash.splashFactory,
1292-
borderRadius: const BorderRadius.only(topRight: Radius.circular(7)),
1294+
borderRadius: const BorderRadiusDirectional.only(topEnd: Radius.circular(7)).resolve(textDirection),
12931295
overlayColor: WidgetStateColor.resolveWith((states) =>
12941296
states.any((e) => e == WidgetState.pressed)
12951297
? designVariables.contextMenuItemBg.withFadedAlpha(0.20)

0 commit comments

Comments
 (0)