Skip to content

Commit

Permalink
Fix Directionality issue (#515)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
taha-elkholy authored Aug 14, 2024
1 parent 59d0810 commit fb8c7b9
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions lib/fluttertoast.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

Expand Down Expand Up @@ -309,16 +310,14 @@ TransitionBuilder FToastBuilder() {

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

final Widget child;

@override
Widget build(BuildContext context) {
final Overlay overlay = Overlay(
return Overlay(
initialEntries: <OverlayEntry>[
OverlayEntry(
builder: (BuildContext ctx) {
Expand All @@ -327,11 +326,6 @@ class _FToastHolder extends StatelessWidget {
),
],
);

return Directionality(
textDirection: TextDirection.ltr,
child: overlay,
);
}
}

Expand Down

0 comments on commit fb8c7b9

Please sign in to comment.