chore: Remove workaround of initialUrl

This commit is contained in:
Christian Pauly 2021-06-22 12:31:18 +02:00
parent 30011f4761
commit 0fb9218b89
2 changed files with 3 additions and 8 deletions

View File

@ -28,16 +28,10 @@ import 'package:vrouter/vrouter.dart';
class AppRoutes {
final bool columnMode;
final String initialUrl;
AppRoutes(this.columnMode, {this.initialUrl});
AppRoutes(this.columnMode);
List<VRouteElement> get routes => [
if (initialUrl != null && initialUrl != '/')
VRouteRedirector(
path: '/',
redirectTo: initialUrl,
),
..._homeRoutes,
if (columnMode) ..._tabletRoutes,
if (!columnMode) ..._mobileRoutes,

View File

@ -85,6 +85,7 @@ class _FluffyChatAppState extends State<FluffyChatApp> {
columnMode ??= newColumns > 1;
_router ??= GlobalKey<VRouterState>();
if (columnMode != newColumns > 1) {
Logs().v('Set Column Mode = $columnMode');
WidgetsBinding.instance.addPostFrameCallback((_) {
setState(() {
_initialUrl = _router.currentState.url;
@ -104,7 +105,7 @@ class _FluffyChatAppState extends State<FluffyChatApp> {
locale: kIsWeb
? Locale(html.window.navigator.language.split('-').first)
: null,
routes: AppRoutes(columnMode, initialUrl: _initialUrl).routes,
routes: AppRoutes(columnMode).routes,
builder: (context, child) {
LoadingDialog.defaultTitle = L10n.of(context).loadingPleaseWait;
LoadingDialog.defaultBackLabel = L10n.of(context).close;