Skip to content

Commit 5f6d76f

Browse files
authored
fix: calendart rtl navigation buttons (#415)
1 parent a2616c9 commit 5f6d76f

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.28.5
2+
3+
- **FIX**: `ShadCalendar` back and forward buttons on RTL (thanks to @Harith Haroon).
4+
15
## 0.28.4
26

37
- **FEAT**: Add `cursorColor` to `ShadInput` (thanks to @GuillaumeMCK).

lib/src/components/calendar.dart

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'package:collection/collection.dart';
22
import 'package:flutter/foundation.dart';
33
import 'package:flutter/material.dart';
4-
import 'package:intl/intl.dart';
4+
import 'package:intl/intl.dart' hide TextDirection;
55
import 'package:lucide_icons_flutter/lucide_icons.dart';
66
import 'package:shadcn_ui/src/components/button.dart';
77
import 'package:shadcn_ui/src/components/icon_button.dart';
@@ -1461,17 +1461,19 @@ class _ShadCalendarState extends State<ShadCalendar> {
14611461
final isFirstMonth = index == 0;
14621462
final isLastMonth = index == models.length - 1;
14631463

1464-
final labelNavigation = Stack(
1464+
final labelNavigation = Row(
1465+
textDirection: TextDirection.ltr,
14651466
children: [
14661467
if (isFirstMonth && !effectiveHideNavigation) backButton,
1467-
Center(
1468-
child: Text(
1469-
effectiveFormatMonthYear(dateModel.month),
1470-
style: effectiveHeaderTextStyle,
1468+
Expanded(
1469+
child: Center(
1470+
child: Text(
1471+
effectiveFormatMonthYear(dateModel.month),
1472+
style: effectiveHeaderTextStyle,
1473+
),
14711474
),
14721475
),
1473-
if (isLastMonth && !effectiveHideNavigation)
1474-
Align(alignment: Alignment.topRight, child: forwardButton),
1476+
if (isLastMonth && !effectiveHideNavigation) forwardButton,
14751477
],
14761478
);
14771479

@@ -1496,6 +1498,7 @@ class _ShadCalendarState extends State<ShadCalendar> {
14961498
: switch (effectiveCaptionLayout) {
14971499
ShadCalendarCaptionLayout.label => labelNavigation,
14981500
ShadCalendarCaptionLayout.dropdown => Row(
1501+
textDirection: TextDirection.ltr,
14991502
children: [
15001503
if (!effectiveHideNavigation) backButton,
15011504
Expanded(
@@ -1516,6 +1519,7 @@ class _ShadCalendarState extends State<ShadCalendar> {
15161519
],
15171520
),
15181521
ShadCalendarCaptionLayout.dropdownMonths => Row(
1522+
textDirection: TextDirection.ltr,
15191523
children: [
15201524
if (!effectiveHideNavigation) backButton,
15211525
Expanded(
@@ -1541,6 +1545,7 @@ class _ShadCalendarState extends State<ShadCalendar> {
15411545
],
15421546
),
15431547
ShadCalendarCaptionLayout.dropdownYears => Row(
1548+
textDirection: TextDirection.ltr,
15441549
children: [
15451550
if (!effectiveHideNavigation) backButton,
15461551
Expanded(

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: shadcn_ui
22
description: shadcn/ui ported in Flutter. Awesome UI components for Flutter, fully customizable.
3-
version: 0.28.4
3+
version: 0.28.5
44
homepage: https://flutter-shadcn-ui.mariuti.com
55
repository: https://github.com/nank1ro/flutter-shadcn-ui
66
documentation: https://flutter-shadcn-ui.mariuti.com

0 commit comments

Comments
 (0)