Skip to content

Commit fb8c7b9

Browse files
authored
Fix Directionality issue (#515)
The _FToastHolder which returns the Overlay widget with a specific directionality [Directionality.ltr] prevents the app from mirroring when we switch the localization to a new locale that uses [Directionality.rtl] and after removing it the issue fixes
1 parent 59d0810 commit fb8c7b9

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

lib/fluttertoast.dart

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'dart:async';
2+
23
import 'package:flutter/material.dart';
34
import 'package:flutter/services.dart';
45

@@ -309,16 +310,14 @@ TransitionBuilder FToastBuilder() {
309310

310311
/// Simple StatelessWidget which holds the child
311312
/// and creates an [Overlay] to display the toast
312-
/// which returns the Directionality widget with [TextDirection.ltr]
313-
/// and [Overlay] widget
314313
class _FToastHolder extends StatelessWidget {
315314
const _FToastHolder({Key? key, required this.child}) : super(key: key);
316315

317316
final Widget child;
318317

319318
@override
320319
Widget build(BuildContext context) {
321-
final Overlay overlay = Overlay(
320+
return Overlay(
322321
initialEntries: <OverlayEntry>[
323322
OverlayEntry(
324323
builder: (BuildContext ctx) {
@@ -327,11 +326,6 @@ class _FToastHolder extends StatelessWidget {
327326
),
328327
],
329328
);
330-
331-
return Directionality(
332-
textDirection: TextDirection.ltr,
333-
child: overlay,
334-
);
335329
}
336330
}
337331

0 commit comments

Comments
 (0)