Skip to content

Commit 640ad0c

Browse files
authored
Respect ancestor text direction in SentryScreenshotWidget (#3046)
* Respect ancestor text direction in `SentryScreenshotWidget` * add cl entry
1 parent ec78888 commit 640ad0c

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Fixes
6+
7+
- Respect ancestor text direction in `SentryScreenshotWidget` ([#3046](https://github.com/getsentry/sentry-dart/pull/3046))
8+
39
## 9.4.0-beta.1
410

511
### Fixes

flutter/lib/src/screenshot/sentry_screenshot_widget.dart

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,17 +122,25 @@ class _SentryScreenshotWidgetState extends State<SentryScreenshotWidget> {
122122
unregisterCallbacks.forEach(SentryScreenshotWidget._onBuild.remove);
123123
}
124124

125+
// Detect the current text direction or fall back to LTR
126+
TextDirection textDirection;
127+
try {
128+
textDirection = Directionality.of(context);
129+
} catch (_) {
130+
textDirection = TextDirection.ltr;
131+
}
132+
125133
return RepaintBoundary(
126134
child: Directionality(
127-
textDirection: TextDirection.ltr,
135+
textDirection: textDirection,
128136
child: Stack(
129137
children: [
130138
Container(
131139
child: widget.child,
132140
),
133141
if (_isScreenshotButtonVisible)
134-
Positioned(
135-
right: 32,
142+
PositionedDirectional(
143+
end: 32,
136144
bottom: 32,
137145
child: ElevatedButton.icon(
138146
key: const ValueKey(

0 commit comments

Comments
 (0)