mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-17 09:35:12 +00:00
chore: Follow up preserve state in 3 column mode
This commit is contained in:
parent
9c3e13cf68
commit
8826815f8e
2 changed files with 68 additions and 54 deletions
|
@ -210,48 +210,45 @@ class AppRoutes {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
GoRoute(
|
ShellRoute(
|
||||||
path: ':roomid',
|
pageBuilder: (context, state, child) => defaultPageBuilder(
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
|
||||||
context,
|
context,
|
||||||
ChatPage(
|
SideViewLayout(
|
||||||
roomId: state.pathParameters['roomid']!,
|
mainView: ChatPage(
|
||||||
|
roomId: state.pathParameters['roomid']!,
|
||||||
|
),
|
||||||
|
sideView:
|
||||||
|
state.fullPath == '/rooms/:roomid' ? null : child,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
redirect: (context, state) => !isLoggedIn ? '/home' : null,
|
|
||||||
routes: [
|
routes: [
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: 'encryption',
|
path: ':roomid',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
const ChatEncryptionSettings(),
|
const EmptyPage(),
|
||||||
),
|
),
|
||||||
redirect: (context, state) =>
|
redirect: (context, state) =>
|
||||||
!isLoggedIn ? '/home' : null,
|
!isLoggedIn ? '/home' : null,
|
||||||
),
|
|
||||||
GoRoute(
|
|
||||||
path: 'invite',
|
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
|
||||||
context,
|
|
||||||
const InvitationSelection(),
|
|
||||||
),
|
|
||||||
redirect: (context, state) =>
|
|
||||||
!isLoggedIn ? '/home' : null,
|
|
||||||
),
|
|
||||||
ShellRoute(
|
|
||||||
pageBuilder: (context, state, child) =>
|
|
||||||
defaultPageBuilder(
|
|
||||||
context,
|
|
||||||
!FluffyThemes.isThreeColumnMode(context)
|
|
||||||
? child
|
|
||||||
: SideViewLayout(
|
|
||||||
mainView: ChatPage(
|
|
||||||
roomId: state.pathParameters['roomid']!,
|
|
||||||
),
|
|
||||||
sideView: child,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
routes: [
|
routes: [
|
||||||
|
GoRoute(
|
||||||
|
path: 'encryption',
|
||||||
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
|
context,
|
||||||
|
const ChatEncryptionSettings(),
|
||||||
|
),
|
||||||
|
redirect: (context, state) =>
|
||||||
|
!isLoggedIn ? '/home' : null,
|
||||||
|
),
|
||||||
|
GoRoute(
|
||||||
|
path: 'invite',
|
||||||
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
|
context,
|
||||||
|
const InvitationSelection(),
|
||||||
|
),
|
||||||
|
redirect: (context, state) =>
|
||||||
|
!isLoggedIn ? '/home' : null,
|
||||||
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: 'details',
|
path: 'details',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
|
|
|
@ -13,28 +13,45 @@ class SideViewLayout extends StatelessWidget {
|
||||||
final sideView = this.sideView;
|
final sideView = this.sideView;
|
||||||
final hideSideView =
|
final hideSideView =
|
||||||
!FluffyThemes.isThreeColumnMode(context) || sideView == null;
|
!FluffyThemes.isThreeColumnMode(context) || sideView == null;
|
||||||
return sideView == null
|
const sideViewWidth = 360.0;
|
||||||
? mainView
|
return Stack(
|
||||||
: hideSideView
|
children: [
|
||||||
? sideView
|
AnimatedPositioned(
|
||||||
: Row(
|
duration: FluffyThemes.animationDuration,
|
||||||
children: [
|
curve: FluffyThemes.animationCurve,
|
||||||
Expanded(
|
top: 0,
|
||||||
child: ClipRRect(child: mainView),
|
left: 0,
|
||||||
),
|
bottom: 0,
|
||||||
Container(
|
right: hideSideView ? 0 : sideViewWidth,
|
||||||
width: 1.0,
|
child: ClipRRect(child: mainView),
|
||||||
color: Theme.of(context).dividerColor,
|
),
|
||||||
),
|
AnimatedPositioned(
|
||||||
AnimatedContainer(
|
duration: FluffyThemes.animationDuration,
|
||||||
duration: FluffyThemes.animationDuration,
|
curve: FluffyThemes.animationCurve,
|
||||||
curve: FluffyThemes.animationCurve,
|
bottom: 0,
|
||||||
clipBehavior: Clip.antiAlias,
|
top: 0,
|
||||||
decoration: const BoxDecoration(),
|
right: 0,
|
||||||
width: hideSideView ? 0 : 360.0,
|
left: !FluffyThemes.isThreeColumnMode(context) && sideView != null
|
||||||
child: hideSideView ? null : sideView,
|
? 0
|
||||||
),
|
: null,
|
||||||
],
|
width: sideView == null
|
||||||
);
|
? 0
|
||||||
|
: !FluffyThemes.isThreeColumnMode(context)
|
||||||
|
? null
|
||||||
|
: sideViewWidth,
|
||||||
|
child: Container(
|
||||||
|
clipBehavior: Clip.hardEdge,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border(
|
||||||
|
left: BorderSide(
|
||||||
|
color: Theme.of(context).dividerColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: sideView,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue