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,15 +210,26 @@ class AppRoutes {
|
|||
),
|
||||
],
|
||||
),
|
||||
ShellRoute(
|
||||
pageBuilder: (context, state, child) => defaultPageBuilder(
|
||||
context,
|
||||
SideViewLayout(
|
||||
mainView: ChatPage(
|
||||
roomId: state.pathParameters['roomid']!,
|
||||
),
|
||||
sideView:
|
||||
state.fullPath == '/rooms/:roomid' ? null : child,
|
||||
),
|
||||
),
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: ':roomid',
|
||||
pageBuilder: (context, state) => defaultPageBuilder(
|
||||
context,
|
||||
ChatPage(
|
||||
roomId: state.pathParameters['roomid']!,
|
||||
const EmptyPage(),
|
||||
),
|
||||
),
|
||||
redirect: (context, state) => !isLoggedIn ? '/home' : null,
|
||||
redirect: (context, state) =>
|
||||
!isLoggedIn ? '/home' : null,
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: 'encryption',
|
||||
|
@ -238,20 +249,6 @@ class AppRoutes {
|
|||
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: [
|
||||
GoRoute(
|
||||
path: 'details',
|
||||
pageBuilder: (context, state) => defaultPageBuilder(
|
||||
|
|
|
@ -13,26 +13,43 @@ class SideViewLayout extends StatelessWidget {
|
|||
final sideView = this.sideView;
|
||||
final hideSideView =
|
||||
!FluffyThemes.isThreeColumnMode(context) || sideView == null;
|
||||
return sideView == null
|
||||
? mainView
|
||||
: hideSideView
|
||||
? sideView
|
||||
: Row(
|
||||
const sideViewWidth = 360.0;
|
||||
return Stack(
|
||||
children: [
|
||||
Expanded(
|
||||
child: ClipRRect(child: mainView),
|
||||
),
|
||||
Container(
|
||||
width: 1.0,
|
||||
color: Theme.of(context).dividerColor,
|
||||
),
|
||||
AnimatedContainer(
|
||||
AnimatedPositioned(
|
||||
duration: FluffyThemes.animationDuration,
|
||||
curve: FluffyThemes.animationCurve,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: const BoxDecoration(),
|
||||
width: hideSideView ? 0 : 360.0,
|
||||
child: hideSideView ? null : sideView,
|
||||
top: 0,
|
||||
left: 0,
|
||||
bottom: 0,
|
||||
right: hideSideView ? 0 : sideViewWidth,
|
||||
child: ClipRRect(child: mainView),
|
||||
),
|
||||
AnimatedPositioned(
|
||||
duration: FluffyThemes.animationDuration,
|
||||
curve: FluffyThemes.animationCurve,
|
||||
bottom: 0,
|
||||
top: 0,
|
||||
right: 0,
|
||||
left: !FluffyThemes.isThreeColumnMode(context) && sideView != null
|
||||
? 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