⚡ Optimize nav transition performance
This commit is contained in:
parent
fa73a28324
commit
37c61a0406
@ -13,6 +13,7 @@ import 'package:surface/providers/theme.dart';
|
|||||||
import 'package:surface/providers/userinfo.dart';
|
import 'package:surface/providers/userinfo.dart';
|
||||||
import 'package:surface/providers/websocket.dart';
|
import 'package:surface/providers/websocket.dart';
|
||||||
import 'package:surface/router.dart';
|
import 'package:surface/router.dart';
|
||||||
|
import 'package:surface/widgets/navigation/app_scaffold.dart';
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
@ -83,6 +84,9 @@ class AppMainContent extends StatelessWidget {
|
|||||||
...context.localizationDelegates,
|
...context.localizationDelegates,
|
||||||
],
|
],
|
||||||
routerConfig: appRouter,
|
routerConfig: appRouter,
|
||||||
|
builder: (context, child) {
|
||||||
|
return AppRootScaffold(body: child ?? const SizedBox.shrink());
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,27 +27,37 @@ final _appRoutes = [
|
|||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/',
|
path: '/',
|
||||||
name: 'home',
|
name: 'home',
|
||||||
builder: (context, state) => const HomeScreen(),
|
pageBuilder: (context, state) => NoTransitionPage(
|
||||||
|
child: const HomeScreen(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/posts',
|
path: '/posts',
|
||||||
name: 'explore',
|
name: 'explore',
|
||||||
builder: (context, state) => const ExploreScreen(),
|
pageBuilder: (context, state) => NoTransitionPage(
|
||||||
|
child: const ExploreScreen(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/account',
|
path: '/account',
|
||||||
name: 'account',
|
name: 'account',
|
||||||
builder: (context, state) => const AccountScreen(),
|
pageBuilder: (context, state) => NoTransitionPage(
|
||||||
|
child: const AccountScreen(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/chat',
|
path: '/chat',
|
||||||
name: 'chat',
|
name: 'chat',
|
||||||
builder: (context, state) => const ChatScreen(),
|
pageBuilder: (context, state) => NoTransitionPage(
|
||||||
|
child: const ChatScreen(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/album',
|
path: '/album',
|
||||||
name: 'album',
|
name: 'album',
|
||||||
builder: (context, state) => const AlbumScreen(),
|
pageBuilder: (context, state) => NoTransitionPage(
|
||||||
|
child: const AlbumScreen(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -130,10 +140,5 @@ final _appRoutes = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
final appRouter = GoRouter(
|
final appRouter = GoRouter(
|
||||||
routes: [
|
routes: _appRoutes,
|
||||||
ShellRoute(
|
|
||||||
builder: (context, state, child) => AppRootScaffold(body: child),
|
|
||||||
routes: _appRoutes,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
|
@ -42,7 +42,7 @@ class ConnectionIndicator extends StatelessWidget {
|
|||||||
)
|
)
|
||||||
.height(
|
.height(
|
||||||
(ws.isBusy || !ws.isConnected) && ua.isAuthorized
|
(ws.isBusy || !ws.isConnected) && ua.isAuthorized
|
||||||
? MediaQuery.of(context).padding.top + 30
|
? MediaQuery.of(context).padding.top + 36
|
||||||
: 0,
|
: 0,
|
||||||
animate: true)
|
animate: true)
|
||||||
.animate(
|
.animate(
|
||||||
|
Loading…
Reference in New Issue
Block a user