Fix web language

This commit is contained in:
Christian Pauly 2020-02-05 11:26:00 +01:00
parent a645ee54ac
commit e497de5934
3 changed files with 27 additions and 0 deletions

View file

@ -1,9 +1,11 @@
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/views/sign_up.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:universal_html/prefer_universal/html.dart' as html;
import 'components/matrix.dart';
import 'views/chat_list.dart';
@ -61,6 +63,9 @@ class App extends StatelessWidget {
const Locale('en'), // English
const Locale('de'), // German
],
locale: kIsWeb
? Locale(html.window.navigator.language.split("-").first)
: null,
home: FutureBuilder<LoginState>(
future: Matrix.of(context).client.onLoginStateChanged.stream.first,
builder: (context, snapshot) {

View file

@ -455,6 +455,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
universal_html:
dependency: "direct main"
description:
name: universal_html
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.12"
universal_io:
dependency: transitive
description:
name: universal_io
url: "https://pub.dartlang.org"
source: hosted
version: "0.8.6"
unorm_dart:
dependency: transitive
description:
@ -532,6 +546,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
zone_local:
dependency: transitive
description:
name: zone_local
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2"
sdks:
dart: ">=2.7.0 <3.0.0"
flutter: ">=1.12.13+hotfix.5 <2.0.0"

View file

@ -48,6 +48,7 @@ dependencies:
receive_sharing_intent: ^1.3.2
flutter_secure_storage: ^3.3.1+1
http: ^0.12.0+4
universal_html: ^1.1.12
intl: ^0.16.0
intl_translation: ^0.17.9