Skip to content

Commit

Permalink
fix: flip arrow in iOS navigation tile for RTL languages
Browse files Browse the repository at this point in the history
  • Loading branch information
yadaniyil committed Dec 4, 2023
1 parent e93eee8 commit 37d2ee4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/src/tiles/platforms/ios_settings_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ class IOSSettingsTileState extends State<IOSSettingsTile> {
data: IconTheme.of(context)
.copyWith(color: theme.themeData.leadingIconsColor),
child: Icon(
CupertinoIcons.chevron_forward,
PlatformUtils.languageIsRTL(context)
? CupertinoIcons.chevron_back
: CupertinoIcons.chevron_forward,
size: 18 * scaleFactor,
),
),
Expand Down
20 changes: 20 additions & 0 deletions lib/src/utils/platform_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,24 @@ class PlatformUtils {
return DevicePlatform.windows;
}
}

static bool languageIsRTL(BuildContext context) {
const rtlLanguages = [
"ar",
"arc",
"dv",
"fa",
"ha",
"he",
"khw",
"ks",
"ku",
"ps",
"ur",
"yi"
];
final language = Localizations.localeOf(context).languageCode.toLowerCase();

return rtlLanguages.contains(language);
}
}

0 comments on commit 37d2ee4

Please sign in to comment.