Skip to content

Commit

Permalink
Merge pull request #151 from Taskulu/issue/150
Browse files Browse the repository at this point in the history
Fixed #150
  • Loading branch information
ilteoood authored Feb 25, 2021
2 parents c26a2cc + d5213ee commit 6f3e405
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/flutter_i18n.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,10 @@ class FlutterI18n {
/// Build for root widget, to support RTL languages
static rootAppBuilder() {
return (BuildContext context, Widget child) {
final instance = _retrieveCurrentInstance(context);
return StreamBuilder<Locale>(
stream: _retrieveCurrentInstance(context)?._localeStream?.stream,
initialData: instance?.locale,
stream: instance?._localeStream?.stream,
builder: (BuildContext context, AsyncSnapshot<Locale> snapshot) {
return Directionality(
textDirection: _findTextDirection(snapshot.data),
Expand All @@ -141,7 +143,7 @@ class FlutterI18n {
}

static _findTextDirection(final Locale locale) {
return intl.Bidi.isRtlLanguage(locale?.countryCode)
return intl.Bidi.isRtlLanguage(locale?.languageCode)
? TextDirection.rtl
: TextDirection.ltr;
}
Expand Down

0 comments on commit 6f3e405

Please sign in to comment.