chore: Adjust design of navrail
This commit is contained in:
parent
7be2d3df59
commit
727e442c94
6 changed files with 226 additions and 256 deletions
|
|
@ -197,6 +197,7 @@ abstract class AppRoutes {
|
||||||
? TwoColumnLayout(
|
? TwoColumnLayout(
|
||||||
mainView: Settings(key: state.pageKey),
|
mainView: Settings(key: state.pageKey),
|
||||||
sideView: child,
|
sideView: child,
|
||||||
|
hasNavigationRail: false,
|
||||||
)
|
)
|
||||||
: child,
|
: child,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,9 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:go_router/go_router.dart';
|
|
||||||
|
|
||||||
import 'package:fluffychat/config/setting_keys.dart';
|
import 'package:fluffychat/config/setting_keys.dart';
|
||||||
import 'package:fluffychat/config/themes.dart';
|
import 'package:fluffychat/config/themes.dart';
|
||||||
import 'package:fluffychat/l10n/l10n.dart';
|
|
||||||
import 'package:fluffychat/pages/chat_list/chat_list.dart';
|
import 'package:fluffychat/pages/chat_list/chat_list.dart';
|
||||||
|
import 'package:fluffychat/pages/chat_list/start_chat_fab.dart';
|
||||||
import 'package:fluffychat/widgets/navigation_rail.dart';
|
import 'package:fluffychat/widgets/navigation_rail.dart';
|
||||||
import 'chat_list_body.dart';
|
import 'chat_list_body.dart';
|
||||||
|
|
||||||
|
|
@ -48,16 +46,10 @@ class ChatListView extends StatelessWidget {
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
body: ChatListViewBody(controller),
|
body: ChatListViewBody(controller),
|
||||||
floatingActionButton:
|
floatingActionButton:
|
||||||
!controller.isSearchMode && controller.activeSpaceId == null
|
!controller.isSearchMode &&
|
||||||
? FloatingActionButton(
|
controller.activeSpaceId == null &&
|
||||||
backgroundColor: Theme.of(context).colorScheme.primary,
|
!FluffyThemes.isColumnMode(context)
|
||||||
foregroundColor: Theme.of(
|
? StartChatFab()
|
||||||
context,
|
|
||||||
).colorScheme.onPrimary,
|
|
||||||
onPressed: () => context.go('/rooms/newprivatechat'),
|
|
||||||
tooltip: L10n.of(context).newChat,
|
|
||||||
child: const Icon(Icons.edit_square),
|
|
||||||
)
|
|
||||||
: const SizedBox.shrink(),
|
: const SizedBox.shrink(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
21
lib/pages/chat_list/start_chat_fab.dart
Normal file
21
lib/pages/chat_list/start_chat_fab.dart
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'package:go_router/go_router.dart';
|
||||||
|
|
||||||
|
import 'package:fluffychat/l10n/l10n.dart';
|
||||||
|
|
||||||
|
class StartChatFab extends StatelessWidget {
|
||||||
|
const StartChatFab({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return FloatingActionButton(
|
||||||
|
heroTag: 'start_chat_fab',
|
||||||
|
backgroundColor: Theme.of(context).colorScheme.primary,
|
||||||
|
foregroundColor: Theme.of(context).colorScheme.onPrimary,
|
||||||
|
onPressed: () => context.go('/rooms/newprivatechat'),
|
||||||
|
tooltip: L10n.of(context).newChat,
|
||||||
|
child: const Icon(Icons.edit_square),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6,13 +6,11 @@ import 'package:url_launcher/url_launcher.dart';
|
||||||
import 'package:url_launcher/url_launcher_string.dart';
|
import 'package:url_launcher/url_launcher_string.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/config/app_config.dart';
|
import 'package:fluffychat/config/app_config.dart';
|
||||||
import 'package:fluffychat/config/themes.dart';
|
|
||||||
import 'package:fluffychat/l10n/l10n.dart';
|
import 'package:fluffychat/l10n/l10n.dart';
|
||||||
import 'package:fluffychat/utils/fluffy_share.dart';
|
import 'package:fluffychat/utils/fluffy_share.dart';
|
||||||
import 'package:fluffychat/utils/platform_infos.dart';
|
import 'package:fluffychat/utils/platform_infos.dart';
|
||||||
import 'package:fluffychat/widgets/avatar.dart';
|
import 'package:fluffychat/widgets/avatar.dart';
|
||||||
import 'package:fluffychat/widgets/matrix.dart';
|
import 'package:fluffychat/widgets/matrix.dart';
|
||||||
import 'package:fluffychat/widgets/navigation_rail.dart';
|
|
||||||
import '../../widgets/mxc_image_viewer.dart';
|
import '../../widgets/mxc_image_viewer.dart';
|
||||||
import 'settings.dart';
|
import 'settings.dart';
|
||||||
|
|
||||||
|
|
@ -29,21 +27,8 @@ class SettingsView extends StatelessWidget {
|
||||||
context,
|
context,
|
||||||
).routeInformationProvider.value.uri.path;
|
).routeInformationProvider.value.uri.path;
|
||||||
|
|
||||||
return Row(
|
return Scaffold(
|
||||||
children: [
|
appBar: AppBar(
|
||||||
if (FluffyThemes.isColumnMode(context)) ...[
|
|
||||||
SpacesNavigationRail(
|
|
||||||
activeSpaceId: null,
|
|
||||||
onGoToChats: () => context.go('/rooms'),
|
|
||||||
onGoToSpaceId: (spaceId) => context.go('/rooms?spaceId=$spaceId'),
|
|
||||||
),
|
|
||||||
Container(color: Theme.of(context).dividerColor, width: 1),
|
|
||||||
],
|
|
||||||
Expanded(
|
|
||||||
child: Scaffold(
|
|
||||||
appBar: FluffyThemes.isColumnMode(context)
|
|
||||||
? null
|
|
||||||
: AppBar(
|
|
||||||
title: Text(L10n.of(context).settings),
|
title: Text(L10n.of(context).settings),
|
||||||
leading: Center(
|
leading: Center(
|
||||||
child: BackButton(onPressed: () => context.go('/rooms')),
|
child: BackButton(onPressed: () => context.go('/rooms')),
|
||||||
|
|
@ -60,8 +45,7 @@ class SettingsView extends StatelessWidget {
|
||||||
final profile = snapshot.data;
|
final profile = snapshot.data;
|
||||||
final avatar = profile?.avatarUrl;
|
final avatar = profile?.avatarUrl;
|
||||||
final mxid =
|
final mxid =
|
||||||
Matrix.of(context).client.userID ??
|
Matrix.of(context).client.userID ?? L10n.of(context).user;
|
||||||
L10n.of(context).user;
|
|
||||||
final displayname =
|
final displayname =
|
||||||
profile?.displayName ?? mxid.localpart ?? mxid;
|
profile?.displayName ?? mxid.localpart ?? mxid;
|
||||||
return Row(
|
return Row(
|
||||||
|
|
@ -77,8 +61,7 @@ class SettingsView extends StatelessWidget {
|
||||||
onTap: avatar != null
|
onTap: avatar != null
|
||||||
? () => showDialog(
|
? () => showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (_) =>
|
builder: (_) => MxcImageViewer(avatar),
|
||||||
MxcImageViewer(avatar),
|
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
|
|
@ -90,9 +73,7 @@ class SettingsView extends StatelessWidget {
|
||||||
elevation: 2,
|
elevation: 2,
|
||||||
onPressed: controller.setAvatarAction,
|
onPressed: controller.setAvatarAction,
|
||||||
heroTag: null,
|
heroTag: null,
|
||||||
child: const Icon(
|
child: const Icon(Icons.camera_alt_outlined),
|
||||||
Icons.camera_alt_outlined,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
@ -105,13 +86,9 @@ class SettingsView extends StatelessWidget {
|
||||||
children: [
|
children: [
|
||||||
TextButton.icon(
|
TextButton.icon(
|
||||||
onPressed: controller.setDisplaynameAction,
|
onPressed: controller.setDisplaynameAction,
|
||||||
icon: const Icon(
|
icon: const Icon(Icons.edit_outlined, size: 16),
|
||||||
Icons.edit_outlined,
|
|
||||||
size: 16,
|
|
||||||
),
|
|
||||||
style: TextButton.styleFrom(
|
style: TextButton.styleFrom(
|
||||||
foregroundColor:
|
foregroundColor: theme.colorScheme.onSurface,
|
||||||
theme.colorScheme.onSurface,
|
|
||||||
iconColor: theme.colorScheme.onSurface,
|
iconColor: theme.colorScheme.onSurface,
|
||||||
),
|
),
|
||||||
label: Text(
|
label: Text(
|
||||||
|
|
@ -122,15 +99,10 @@ class SettingsView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextButton.icon(
|
TextButton.icon(
|
||||||
onPressed: () =>
|
onPressed: () => FluffyShare.share(mxid, context),
|
||||||
FluffyShare.share(mxid, context),
|
icon: const Icon(Icons.copy_outlined, size: 14),
|
||||||
icon: const Icon(
|
|
||||||
Icons.copy_outlined,
|
|
||||||
size: 14,
|
|
||||||
),
|
|
||||||
style: TextButton.styleFrom(
|
style: TextButton.styleFrom(
|
||||||
foregroundColor:
|
foregroundColor: theme.colorScheme.secondary,
|
||||||
theme.colorScheme.secondary,
|
|
||||||
iconColor: theme.colorScheme.secondary,
|
iconColor: theme.colorScheme.secondary,
|
||||||
),
|
),
|
||||||
label: Text(
|
label: Text(
|
||||||
|
|
@ -150,9 +122,7 @@ class SettingsView extends StatelessWidget {
|
||||||
FutureBuilder(
|
FutureBuilder(
|
||||||
future: Matrix.of(context).client.getWellknown(),
|
future: Matrix.of(context).client.getWellknown(),
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
final accountManageUrl = snapshot
|
final accountManageUrl = snapshot.data?.additionalProperties
|
||||||
.data
|
|
||||||
?.additionalProperties
|
|
||||||
.tryGetMap<String, Object?>(
|
.tryGetMap<String, Object?>(
|
||||||
'org.matrix.msc2965.authentication',
|
'org.matrix.msc2965.authentication',
|
||||||
)
|
)
|
||||||
|
|
@ -198,8 +168,7 @@ class SettingsView extends StatelessWidget {
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.notifications_outlined),
|
leading: const Icon(Icons.notifications_outlined),
|
||||||
title: Text(L10n.of(context).notifications),
|
title: Text(L10n.of(context).notifications),
|
||||||
tileColor:
|
tileColor: activeRoute.startsWith('/rooms/settings/notifications')
|
||||||
activeRoute.startsWith('/rooms/settings/notifications')
|
|
||||||
? theme.colorScheme.surfaceContainerHigh
|
? theme.colorScheme.surfaceContainerHigh
|
||||||
: null,
|
: null,
|
||||||
onTap: () => context.go('/rooms/settings/notifications'),
|
onTap: () => context.go('/rooms/settings/notifications'),
|
||||||
|
|
@ -224,8 +193,7 @@ class SettingsView extends StatelessWidget {
|
||||||
leading: const Icon(Icons.shield_outlined),
|
leading: const Icon(Icons.shield_outlined),
|
||||||
title: Text(L10n.of(context).security),
|
title: Text(L10n.of(context).security),
|
||||||
onTap: () => context.go('/rooms/settings/security'),
|
onTap: () => context.go('/rooms/settings/security'),
|
||||||
tileColor:
|
tileColor: activeRoute.startsWith('/rooms/settings/security')
|
||||||
activeRoute.startsWith('/rooms/settings/security')
|
|
||||||
? theme.colorScheme.surfaceContainerHigh
|
? theme.colorScheme.surfaceContainerHigh
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
|
|
@ -234,13 +202,11 @@ class SettingsView extends StatelessWidget {
|
||||||
leading: const Icon(Icons.dns_outlined),
|
leading: const Icon(Icons.dns_outlined),
|
||||||
title: Text(
|
title: Text(
|
||||||
L10n.of(context).aboutHomeserver(
|
L10n.of(context).aboutHomeserver(
|
||||||
Matrix.of(context).client.userID?.domain ??
|
Matrix.of(context).client.userID?.domain ?? 'homeserver',
|
||||||
'homeserver',
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onTap: () => context.go('/rooms/settings/homeserver'),
|
onTap: () => context.go('/rooms/settings/homeserver'),
|
||||||
tileColor:
|
tileColor: activeRoute.startsWith('/rooms/settings/homeserver')
|
||||||
activeRoute.startsWith('/rooms/settings/homeserver')
|
|
||||||
? theme.colorScheme.surfaceContainerHigh
|
? theme.colorScheme.surfaceContainerHigh
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
|
|
@ -263,9 +229,6 @@ class SettingsView extends StatelessWidget {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,13 @@ import 'package:fluffychat/config/themes.dart';
|
||||||
class TwoColumnLayout extends StatelessWidget {
|
class TwoColumnLayout extends StatelessWidget {
|
||||||
final Widget mainView;
|
final Widget mainView;
|
||||||
final Widget sideView;
|
final Widget sideView;
|
||||||
|
final bool hasNavigationRail;
|
||||||
|
|
||||||
const TwoColumnLayout({
|
const TwoColumnLayout({
|
||||||
super.key,
|
super.key,
|
||||||
required this.mainView,
|
required this.mainView,
|
||||||
required this.sideView,
|
required this.sideView,
|
||||||
|
this.hasNavigationRail = true,
|
||||||
});
|
});
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -22,7 +24,9 @@ class TwoColumnLayout extends StatelessWidget {
|
||||||
Container(
|
Container(
|
||||||
clipBehavior: Clip.antiAlias,
|
clipBehavior: Clip.antiAlias,
|
||||||
decoration: const BoxDecoration(),
|
decoration: const BoxDecoration(),
|
||||||
width: FluffyThemes.columnWidth + FluffyThemes.navRailWidth,
|
width:
|
||||||
|
FluffyThemes.columnWidth +
|
||||||
|
(hasNavigationRail ? FluffyThemes.navRailWidth : 0),
|
||||||
child: mainView,
|
child: mainView,
|
||||||
),
|
),
|
||||||
Container(width: 1.0, color: theme.dividerColor),
|
Container(width: 1.0, color: theme.dividerColor),
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import 'package:fluffychat/config/app_config.dart';
|
||||||
import 'package:fluffychat/config/themes.dart';
|
import 'package:fluffychat/config/themes.dart';
|
||||||
import 'package:fluffychat/l10n/l10n.dart';
|
import 'package:fluffychat/l10n/l10n.dart';
|
||||||
import 'package:fluffychat/pages/chat_list/navi_rail_item.dart';
|
import 'package:fluffychat/pages/chat_list/navi_rail_item.dart';
|
||||||
|
import 'package:fluffychat/pages/chat_list/start_chat_fab.dart';
|
||||||
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
|
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
|
||||||
import 'package:fluffychat/utils/stream_extension.dart';
|
import 'package:fluffychat/utils/stream_extension.dart';
|
||||||
import 'package:fluffychat/widgets/avatar.dart';
|
import 'package:fluffychat/widgets/avatar.dart';
|
||||||
|
|
@ -27,9 +28,6 @@ class SpacesNavigationRail extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final client = Matrix.of(context).client;
|
final client = Matrix.of(context).client;
|
||||||
final isSettings = GoRouter.of(
|
|
||||||
context,
|
|
||||||
).routeInformationProvider.value.uri.path.startsWith('/rooms/settings');
|
|
||||||
return Material(
|
return Material(
|
||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
child: StreamBuilder(
|
child: StreamBuilder(
|
||||||
|
|
@ -55,7 +53,7 @@ class SpacesNavigationRail extends StatelessWidget {
|
||||||
itemBuilder: (context, i) {
|
itemBuilder: (context, i) {
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
return NaviRailItem(
|
return NaviRailItem(
|
||||||
isSelected: activeSpaceId == null && !isSettings,
|
isSelected: activeSpaceId == null,
|
||||||
onTap: onGoToChats,
|
onTap: onGoToChats,
|
||||||
icon: const Padding(
|
icon: const Padding(
|
||||||
padding: EdgeInsets.all(10.0),
|
padding: EdgeInsets.all(10.0),
|
||||||
|
|
@ -110,18 +108,9 @@ class SpacesNavigationRail extends StatelessWidget {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
NaviRailItem(
|
Padding(
|
||||||
isSelected: isSettings,
|
padding: const EdgeInsets.all(12.0),
|
||||||
onTap: () => context.go('/rooms/settings'),
|
child: StartChatFab(),
|
||||||
icon: const Padding(
|
|
||||||
padding: EdgeInsets.all(10.0),
|
|
||||||
child: Icon(Icons.settings_outlined),
|
|
||||||
),
|
|
||||||
selectedIcon: const Padding(
|
|
||||||
padding: EdgeInsets.all(10.0),
|
|
||||||
child: Icon(Icons.settings),
|
|
||||||
),
|
|
||||||
toolTip: L10n.of(context).settings,
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue