chore: Remove workaround of initialUrl
This commit is contained in:
parent
1ab089ef0d
commit
e607bc2c21
2 changed files with 3 additions and 8 deletions
|
|
@ -28,16 +28,10 @@ import 'package:vrouter/vrouter.dart';
|
||||||
|
|
||||||
class AppRoutes {
|
class AppRoutes {
|
||||||
final bool columnMode;
|
final bool columnMode;
|
||||||
final String initialUrl;
|
|
||||||
|
|
||||||
AppRoutes(this.columnMode, {this.initialUrl});
|
AppRoutes(this.columnMode);
|
||||||
|
|
||||||
List<VRouteElement> get routes => [
|
List<VRouteElement> get routes => [
|
||||||
if (initialUrl != null && initialUrl != '/')
|
|
||||||
VRouteRedirector(
|
|
||||||
path: '/',
|
|
||||||
redirectTo: initialUrl,
|
|
||||||
),
|
|
||||||
..._homeRoutes,
|
..._homeRoutes,
|
||||||
if (columnMode) ..._tabletRoutes,
|
if (columnMode) ..._tabletRoutes,
|
||||||
if (!columnMode) ..._mobileRoutes,
|
if (!columnMode) ..._mobileRoutes,
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,7 @@ class _FluffyChatAppState extends State<FluffyChatApp> {
|
||||||
columnMode ??= newColumns > 1;
|
columnMode ??= newColumns > 1;
|
||||||
_router ??= GlobalKey<VRouterState>();
|
_router ??= GlobalKey<VRouterState>();
|
||||||
if (columnMode != newColumns > 1) {
|
if (columnMode != newColumns > 1) {
|
||||||
|
Logs().v('Set Column Mode = $columnMode');
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_initialUrl = _router.currentState.url;
|
_initialUrl = _router.currentState.url;
|
||||||
|
|
@ -104,7 +105,7 @@ class _FluffyChatAppState extends State<FluffyChatApp> {
|
||||||
locale: kIsWeb
|
locale: kIsWeb
|
||||||
? Locale(html.window.navigator.language.split('-').first)
|
? Locale(html.window.navigator.language.split('-').first)
|
||||||
: null,
|
: null,
|
||||||
routes: AppRoutes(columnMode, initialUrl: _initialUrl).routes,
|
routes: AppRoutes(columnMode).routes,
|
||||||
builder: (context, child) {
|
builder: (context, child) {
|
||||||
LoadingDialog.defaultTitle = L10n.of(context).loadingPleaseWait;
|
LoadingDialog.defaultTitle = L10n.of(context).loadingPleaseWait;
|
||||||
LoadingDialog.defaultBackLabel = L10n.of(context).close;
|
LoadingDialog.defaultBackLabel = L10n.of(context).close;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue