Fix StyledToast

This commit is contained in:
Christian Pauly 2020-05-13 09:10:29 +02:00
parent bed0d821e3
commit 12f4f6e192

View file

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