Compare commits
No commits in common. "5f9622e1c95147cb09651180f9401dff31e67640" and "7e7e6877e2e62635b23471eb711473578e60c374" have entirely different histories.
5f9622e1c9
...
7e7e6877e2
12 changed files with 45 additions and 58 deletions
|
|
@ -88,7 +88,6 @@ class SpacesController extends Notifier<IList<Space>> {
|
||||||
|
|
||||||
final children = childRoomsBySpaceId[id] ?? .new();
|
final children = childRoomsBySpaceId[id] ?? .new();
|
||||||
return Space(
|
return Space(
|
||||||
subSpaces: const IList.empty(), // TODO
|
|
||||||
id: id,
|
id: id,
|
||||||
title: room.metadata?.name ?? "Unnamed Room",
|
title: room.metadata?.name ?? "Unnamed Room",
|
||||||
room: room,
|
room: room,
|
||||||
|
|
@ -104,14 +103,12 @@ class SpacesController extends Notifier<IList<Space>> {
|
||||||
title: "Home",
|
title: "Home",
|
||||||
icon: Icons.home,
|
icon: Icons.home,
|
||||||
children: homeRooms,
|
children: homeRooms,
|
||||||
subSpaces: .new(),
|
|
||||||
),
|
),
|
||||||
.new(
|
.new(
|
||||||
id: "dms",
|
id: "dms",
|
||||||
title: "Direct Messages",
|
title: "Direct Messages",
|
||||||
icon: Icons.people,
|
icon: Icons.people,
|
||||||
children: dmRooms,
|
children: dmRooms,
|
||||||
subSpaces: .new(),
|
|
||||||
),
|
),
|
||||||
...topLevelSpacesList,
|
...topLevelSpacesList,
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import "dart:io";
|
import "dart:io";
|
||||||
import "package:dynamic_color/dynamic_color.dart";
|
|
||||||
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
||||||
import "package:flutter/foundation.dart";
|
import "package:flutter/foundation.dart";
|
||||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||||
|
|
@ -18,6 +17,7 @@ import "package:nexus/widgets/error_dialog.dart";
|
||||||
import "package:nexus/widgets/loading.dart";
|
import "package:nexus/widgets/loading.dart";
|
||||||
import "package:window_manager/window_manager.dart";
|
import "package:window_manager/window_manager.dart";
|
||||||
import "package:flutter/material.dart";
|
import "package:flutter/material.dart";
|
||||||
|
import "package:dynamic_system_colors/dynamic_system_colors.dart";
|
||||||
|
|
||||||
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
|
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
||||||
import "package:flutter/widgets.dart";
|
import "package:flutter/widgets.dart";
|
||||||
import "package:freezed_annotation/freezed_annotation.dart";
|
import "package:freezed_annotation/freezed_annotation.dart";
|
||||||
import "package:nexus/models/room.dart";
|
import "package:nexus/models/room.dart";
|
||||||
import "package:nexus/models/subspace.dart";
|
|
||||||
part "space.freezed.dart";
|
part "space.freezed.dart";
|
||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
|
|
@ -13,6 +12,5 @@ abstract class Space with _$Space {
|
||||||
IconData? icon,
|
IconData? icon,
|
||||||
Room? room,
|
Room? room,
|
||||||
required IList<Room> children,
|
required IList<Room> children,
|
||||||
required IList<Subspace> subSpaces,
|
|
||||||
}) = _Space;
|
}) = _Space;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
|
||||||
import "package:freezed_annotation/freezed_annotation.dart";
|
|
||||||
import "package:nexus/models/room.dart";
|
|
||||||
part "subspace.freezed.dart";
|
|
||||||
|
|
||||||
@freezed
|
|
||||||
abstract class Subspace with _$Subspace {
|
|
||||||
const factory Subspace({required Room room, required IList<Room> children}) =
|
|
||||||
_Subspace;
|
|
||||||
}
|
|
||||||
|
|
@ -84,15 +84,9 @@ class JoinDialog extends HookWidget {
|
||||||
space?.id ??
|
space?.id ??
|
||||||
spaces
|
spaces
|
||||||
.firstWhere(
|
.firstWhere(
|
||||||
(space) =>
|
(space) => space.children.any(
|
||||||
space.children.any(
|
(child) => child.metadata?.id == id,
|
||||||
(child) =>
|
),
|
||||||
child.metadata?.id == id,
|
|
||||||
) ||
|
|
||||||
space.subSpaces.any(
|
|
||||||
(child) =>
|
|
||||||
child.room.metadata?.id == id,
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
.id,
|
.id,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,9 @@
|
||||||
import "package:collection/collection.dart";
|
import "package:collection/collection.dart";
|
||||||
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
|
||||||
import "package:flutter/material.dart";
|
import "package:flutter/material.dart";
|
||||||
import "package:hooks_riverpod/hooks_riverpod.dart";
|
import "package:hooks_riverpod/hooks_riverpod.dart";
|
||||||
import "package:navigation_rail_m3e/navigation_rail_m3e.dart";
|
import "package:navigation_rail_m3e/navigation_rail_m3e.dart";
|
||||||
import "package:nexus/controllers/key_controller.dart";
|
import "package:nexus/controllers/key_controller.dart";
|
||||||
import "package:nexus/controllers/spaces_controller.dart";
|
import "package:nexus/controllers/spaces_controller.dart";
|
||||||
import "package:nexus/models/room.dart";
|
|
||||||
import "package:nexus/widgets/avatar_or_hash.dart";
|
import "package:nexus/widgets/avatar_or_hash.dart";
|
||||||
import "package:nexus/widgets/join_dialog.dart";
|
import "package:nexus/widgets/join_dialog.dart";
|
||||||
import "package:nexus/widgets/room_menu.dart";
|
import "package:nexus/widgets/room_menu.dart";
|
||||||
|
|
@ -45,27 +43,6 @@ class Sidebar extends HookConsumerWidget {
|
||||||
? null
|
? null
|
||||||
: indexOfSelectedRoom;
|
: indexOfSelectedRoom;
|
||||||
|
|
||||||
List<NavigationRailM3EDestination> roomsToDestinations(IList<Room> rooms) =>
|
|
||||||
rooms
|
|
||||||
.map(
|
|
||||||
(room) => NavigationRailM3EDestination(
|
|
||||||
label: room.metadata?.name ?? "Unnamed Room",
|
|
||||||
badgeCount: switch (room.metadata?.unreadNotifications) {
|
|
||||||
0 || null => room.metadata?.unreadMessages == 0 ? null : 0,
|
|
||||||
int unread => unread,
|
|
||||||
},
|
|
||||||
icon: AvatarOrHash(
|
|
||||||
room.metadata?.avatar,
|
|
||||||
room.metadata?.name ?? "Unnamed Room",
|
|
||||||
fallback: selectedSpaceId == "dms"
|
|
||||||
? null
|
|
||||||
: Icon(Icons.numbers),
|
|
||||||
// space.client.headers,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
return Drawer(
|
return Drawer(
|
||||||
width: 340,
|
width: 340,
|
||||||
shape: Border(),
|
shape: Border(),
|
||||||
|
|
@ -212,15 +189,29 @@ class Sidebar extends HookConsumerWidget {
|
||||||
selectedIndex: selectedRoomIndex ?? 0,
|
selectedIndex: selectedRoomIndex ?? 0,
|
||||||
sections: [
|
sections: [
|
||||||
.new(
|
.new(
|
||||||
destinations: roomsToDestinations(selectedSpace.children),
|
destinations: selectedSpace.children
|
||||||
|
.map(
|
||||||
|
(room) => NavigationRailM3EDestination(
|
||||||
|
label: room.metadata?.name ?? "Unnamed Room",
|
||||||
|
badgeCount: switch (room
|
||||||
|
.metadata
|
||||||
|
?.unreadNotifications) {
|
||||||
|
0 || null =>
|
||||||
|
room.metadata?.unreadMessages == 0 ? null : 0,
|
||||||
|
int unread => unread,
|
||||||
|
},
|
||||||
|
icon: AvatarOrHash(
|
||||||
|
room.metadata?.avatar,
|
||||||
|
room.metadata?.name ?? "Unnamed Room",
|
||||||
|
fallback: selectedSpaceId == "dms"
|
||||||
|
? null
|
||||||
|
: Icon(Icons.numbers),
|
||||||
|
// space.client.headers,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
),
|
),
|
||||||
for (final subSpace in selectedSpace.subSpaces)
|
|
||||||
.new(
|
|
||||||
header: Text(
|
|
||||||
subSpace.room.metadata?.name ?? "Unnamed Room",
|
|
||||||
),
|
|
||||||
destinations: roomsToDestinations(subSpace.children),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
onDestinationSelected: (value) {
|
onDestinationSelected: (value) {
|
||||||
selectedRoomIdNotifier.set(
|
selectedRoomIdNotifier.set(
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
#include "generated_plugin_registrant.h"
|
#include "generated_plugin_registrant.h"
|
||||||
|
|
||||||
#include <dynamic_color/dynamic_color_plugin.h>
|
#include <dynamic_color/dynamic_color_plugin.h>
|
||||||
|
#include <dynamic_system_colors/dynamic_color_plugin.h>
|
||||||
#include <file_selector_linux/file_selector_plugin.h>
|
#include <file_selector_linux/file_selector_plugin.h>
|
||||||
#include <media_kit_libs_linux/media_kit_libs_linux_plugin.h>
|
#include <media_kit_libs_linux/media_kit_libs_linux_plugin.h>
|
||||||
#include <media_kit_video/media_kit_video_plugin.h>
|
#include <media_kit_video/media_kit_video_plugin.h>
|
||||||
|
|
@ -18,6 +19,9 @@ void fl_register_plugins(FlPluginRegistry* registry) {
|
||||||
g_autoptr(FlPluginRegistrar) dynamic_color_registrar =
|
g_autoptr(FlPluginRegistrar) dynamic_color_registrar =
|
||||||
fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin");
|
fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin");
|
||||||
dynamic_color_plugin_register_with_registrar(dynamic_color_registrar);
|
dynamic_color_plugin_register_with_registrar(dynamic_color_registrar);
|
||||||
|
g_autoptr(FlPluginRegistrar) dynamic_system_colors_registrar =
|
||||||
|
fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin");
|
||||||
|
dynamic_color_plugin_register_with_registrar(dynamic_system_colors_registrar);
|
||||||
g_autoptr(FlPluginRegistrar) file_selector_linux_registrar =
|
g_autoptr(FlPluginRegistrar) file_selector_linux_registrar =
|
||||||
fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin");
|
fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin");
|
||||||
file_selector_plugin_register_with_registrar(file_selector_linux_registrar);
|
file_selector_plugin_register_with_registrar(file_selector_linux_registrar);
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
dynamic_color
|
dynamic_color
|
||||||
|
dynamic_system_colors
|
||||||
file_selector_linux
|
file_selector_linux
|
||||||
media_kit_libs_linux
|
media_kit_libs_linux
|
||||||
media_kit_video
|
media_kit_video
|
||||||
|
|
|
||||||
10
pubspec.lock
10
pubspec.lock
|
|
@ -282,7 +282,7 @@ packages:
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.2"
|
version: "2.1.2"
|
||||||
dynamic_color:
|
dynamic_color:
|
||||||
dependency: "direct main"
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: dynamic_color
|
name: dynamic_color
|
||||||
sha256: "43a5a6679649a7731ab860334a5812f2067c2d9ce6452cf069c5e0c25336c17c"
|
sha256: "43a5a6679649a7731ab860334a5812f2067c2d9ce6452cf069c5e0c25336c17c"
|
||||||
|
|
@ -297,6 +297,14 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.0.7"
|
version: "0.0.7"
|
||||||
|
dynamic_system_colors:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: dynamic_system_colors
|
||||||
|
sha256: "6cda994363fe362e3c433e068af83feffc2c9a26ba0be7ecdb2b96f676d2dfd8"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.9.0"
|
||||||
emoji_text_field:
|
emoji_text_field:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ dependencies:
|
||||||
image_picker: 1.2.2
|
image_picker: 1.2.2
|
||||||
file_picker: 11.0.2
|
file_picker: 11.0.2
|
||||||
path: 1.9.1
|
path: 1.9.1
|
||||||
dynamic_color: 1.8.1
|
dynamic_system_colors: 1.9.0
|
||||||
collection: 1.19.1
|
collection: 1.19.1
|
||||||
window_manager: 0.5.1
|
window_manager: 0.5.1
|
||||||
color_hash: 1.0.1
|
color_hash: 1.0.1
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
#include "generated_plugin_registrant.h"
|
#include "generated_plugin_registrant.h"
|
||||||
|
|
||||||
#include <dynamic_color/dynamic_color_plugin_c_api.h>
|
#include <dynamic_color/dynamic_color_plugin_c_api.h>
|
||||||
|
#include <dynamic_system_colors/dynamic_color_plugin_c_api.h>
|
||||||
#include <file_selector_windows/file_selector_windows.h>
|
#include <file_selector_windows/file_selector_windows.h>
|
||||||
#include <media_kit_libs_windows_video/media_kit_libs_windows_video_plugin_c_api.h>
|
#include <media_kit_libs_windows_video/media_kit_libs_windows_video_plugin_c_api.h>
|
||||||
#include <media_kit_video/media_kit_video_plugin_c_api.h>
|
#include <media_kit_video/media_kit_video_plugin_c_api.h>
|
||||||
|
|
@ -15,6 +16,8 @@
|
||||||
#include <window_manager/window_manager_plugin.h>
|
#include <window_manager/window_manager_plugin.h>
|
||||||
|
|
||||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||||
|
DynamicColorPluginCApiRegisterWithRegistrar(
|
||||||
|
registry->GetRegistrarForPlugin("DynamicColorPluginCApi"));
|
||||||
DynamicColorPluginCApiRegisterWithRegistrar(
|
DynamicColorPluginCApiRegisterWithRegistrar(
|
||||||
registry->GetRegistrarForPlugin("DynamicColorPluginCApi"));
|
registry->GetRegistrarForPlugin("DynamicColorPluginCApi"));
|
||||||
FileSelectorWindowsRegisterWithRegistrar(
|
FileSelectorWindowsRegisterWithRegistrar(
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
dynamic_color
|
dynamic_color
|
||||||
|
dynamic_system_colors
|
||||||
file_selector_windows
|
file_selector_windows
|
||||||
media_kit_libs_windows_video
|
media_kit_libs_windows_video
|
||||||
media_kit_video
|
media_kit_video
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue