diff --git a/lib/main.dart b/lib/main.dart index b8aee2b..a5675be 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -29,45 +29,48 @@ class App extends StatelessWidget { child: Builder( builder: (BuildContext context) => ThemeSwitcherWidget( child: Builder( - builder: (BuildContext context) => StyledToast( - duration: Duration(seconds: 5), - child: MaterialApp( - title: 'FluffyChat', - theme: ThemeSwitcherWidget.of(context).themeData, - localizationsDelegates: [ - AppLocalizationsDelegate(), - GlobalMaterialLocalizations.delegate, - GlobalWidgetsLocalizations.delegate, - GlobalCupertinoLocalizations.delegate, - ], - supportedLocales: [ - const Locale('en'), // English - const Locale('de'), // German - const Locale('hu'), // Hungarian - const Locale('pl'), // Polish - ], - locale: kIsWeb - ? Locale(html.window.navigator.language.split("-").first) - : null, - home: FutureBuilder( - future: Matrix.of(context) - .client - .onLoginStateChanged - .stream - .first, - builder: (context, snapshot) { - if (!snapshot.hasData) { - return Scaffold( - body: Center( - child: CircularProgressIndicator(), - ), - ); - } - if (Matrix.of(context).client.isLogged()) { - return ChatListView(); - } - return HomeserverPicker(); - }, + // Workaround for: https://github.com/JackJonson/flutter_styled_toast/issues/7 + builder: (BuildContext context) => MaterialApp( + home: StyledToast( + duration: Duration(seconds: 5), + child: MaterialApp( + title: 'FluffyChat', + theme: ThemeSwitcherWidget.of(context).themeData, + localizationsDelegates: [ + AppLocalizationsDelegate(), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + ], + supportedLocales: [ + const Locale('en'), // English + const Locale('de'), // German + const Locale('hu'), // Hungarian + const Locale('pl'), // Polish + ], + locale: kIsWeb + ? Locale(html.window.navigator.language.split("-").first) + : null, + home: FutureBuilder( + future: Matrix.of(context) + .client + .onLoginStateChanged + .stream + .first, + builder: (context, snapshot) { + if (!snapshot.hasData) { + return Scaffold( + body: Center( + child: CircularProgressIndicator(), + ), + ); + } + if (Matrix.of(context).client.isLogged()) { + return ChatListView(); + } + return HomeserverPicker(); + }, + ), ), ), ),