Add ability to copy links for rooms and spaces
This commit is contained in:
parent
11c03733cf
commit
f7c6c3bb6a
8 changed files with 52 additions and 4 deletions
|
|
@ -79,7 +79,7 @@ A simple and user-friendly Matrix client made with Flutter and the Matrix Dart S
|
||||||
- [ ] Creating
|
- [ ] Creating
|
||||||
- [ ] Threads
|
- [ ] Threads
|
||||||
- [ ] Profile popouts
|
- [ ] Profile popouts
|
||||||
- [ ] Copy link to [message, room, space]
|
- [x] Copy link to [room, space]
|
||||||
- [ ] Reporting
|
- [ ] Reporting
|
||||||
- [ ] Notifications using UnifiedPush
|
- [ ] Notifications using UnifiedPush
|
||||||
- [ ] Group calls using [MSC4195](https://github.com/matrix-org/matrix-spec-proposals/pull/4195)
|
- [ ] Group calls using [MSC4195](https://github.com/matrix-org/matrix-spec-proposals/pull/4195)
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@ class SpacesController extends AsyncNotifier<IList<Space>> {
|
||||||
title: "Home",
|
title: "Home",
|
||||||
children: topLevelRooms,
|
children: topLevelRooms,
|
||||||
icon: Icon(Icons.home),
|
icon: Icon(Icons.home),
|
||||||
fake: true,
|
|
||||||
),
|
),
|
||||||
Space(
|
Space(
|
||||||
client: client,
|
client: client,
|
||||||
|
|
@ -46,7 +45,6 @@ class SpacesController extends AsyncNotifier<IList<Space>> {
|
||||||
.map((room) => room.fullRoom),
|
.map((room) => room.fullRoom),
|
||||||
),
|
),
|
||||||
icon: Icon(Icons.person),
|
icon: Icon(Icons.person),
|
||||||
fake: true,
|
|
||||||
),
|
),
|
||||||
...(await Future.wait(
|
...(await Future.wait(
|
||||||
topLevelSpaces.map(
|
topLevelSpaces.map(
|
||||||
|
|
@ -54,6 +52,7 @@ class SpacesController extends AsyncNotifier<IList<Space>> {
|
||||||
client: client,
|
client: client,
|
||||||
title: space.title,
|
title: space.title,
|
||||||
avatar: space.avatar,
|
avatar: space.avatar,
|
||||||
|
roomData: space.roomData,
|
||||||
children: await Future.wait(
|
children: await Future.wait(
|
||||||
space.roomData.spaceChildren
|
space.roomData.spaceChildren
|
||||||
.map(
|
.map(
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ abstract class Space with _$Space {
|
||||||
required String title,
|
required String title,
|
||||||
required List<FullRoom> children,
|
required List<FullRoom> children,
|
||||||
required Client client,
|
required Client client,
|
||||||
@Default(false) bool fake,
|
Room? roomData,
|
||||||
Uri? avatar,
|
Uri? avatar,
|
||||||
Icon? icon,
|
Icon? icon,
|
||||||
}) = _Space;
|
}) = _Space;
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import "package:nexus/helpers/extensions/get_headers.dart";
|
||||||
import "package:nexus/models/full_room.dart";
|
import "package:nexus/models/full_room.dart";
|
||||||
import "package:nexus/widgets/appbar.dart";
|
import "package:nexus/widgets/appbar.dart";
|
||||||
import "package:nexus/widgets/avatar_or_hash.dart";
|
import "package:nexus/widgets/avatar_or_hash.dart";
|
||||||
|
import "package:nexus/widgets/chat_page/room_menu.dart";
|
||||||
|
|
||||||
class RoomAppbar extends StatelessWidget implements PreferredSizeWidget {
|
class RoomAppbar extends StatelessWidget implements PreferredSizeWidget {
|
||||||
final bool isDesktop;
|
final bool isDesktop;
|
||||||
|
|
@ -48,10 +49,12 @@ class RoomAppbar extends StatelessWidget implements PreferredSizeWidget {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
|
IconButton(onPressed: () {}, icon: Icon(Icons.push_pin)),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () => onOpenMemberList(context),
|
onPressed: () => onOpenMemberList(context),
|
||||||
icon: Icon(Icons.people),
|
icon: Icon(Icons.people),
|
||||||
),
|
),
|
||||||
|
RoomMenu(room.roomData),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
33
lib/widgets/chat_page/room_menu.dart
Normal file
33
lib/widgets/chat_page/room_menu.dart
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
import "package:clipboard/clipboard.dart";
|
||||||
|
import "package:flutter/material.dart";
|
||||||
|
import "package:matrix/matrix.dart";
|
||||||
|
|
||||||
|
class RoomMenu extends StatelessWidget {
|
||||||
|
final Room room;
|
||||||
|
const RoomMenu(this.room, {super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final danger = Theme.of(context).colorScheme.error;
|
||||||
|
|
||||||
|
return PopupMenuButton(
|
||||||
|
itemBuilder: (_) => [
|
||||||
|
PopupMenuItem(
|
||||||
|
onTap: () async {
|
||||||
|
final link = await room.matrixToInviteLink();
|
||||||
|
await FlutterClipboard.copy(link.toString());
|
||||||
|
},
|
||||||
|
child: ListTile(leading: Icon(Icons.link), title: Text("Copy Link")),
|
||||||
|
),
|
||||||
|
PopupMenuItem(
|
||||||
|
onTap: () =>
|
||||||
|
showDialog(context: context, builder: (context) => AlertDialog()),
|
||||||
|
child: ListTile(
|
||||||
|
leading: Icon(Icons.logout, color: danger),
|
||||||
|
title: Text("Leave", style: TextStyle(color: danger)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -9,6 +9,7 @@ import "package:nexus/helpers/extensions/better_when.dart";
|
||||||
import "package:nexus/helpers/extensions/get_headers.dart";
|
import "package:nexus/helpers/extensions/get_headers.dart";
|
||||||
import "package:nexus/pages/settings_page.dart";
|
import "package:nexus/pages/settings_page.dart";
|
||||||
import "package:nexus/widgets/avatar_or_hash.dart";
|
import "package:nexus/widgets/avatar_or_hash.dart";
|
||||||
|
import "package:nexus/widgets/chat_page/room_menu.dart";
|
||||||
|
|
||||||
class Sidebar extends HookConsumerWidget {
|
class Sidebar extends HookConsumerWidget {
|
||||||
const Sidebar({super.key});
|
const Sidebar({super.key});
|
||||||
|
|
@ -116,6 +117,9 @@ class Sidebar extends HookConsumerWidget {
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
|
actions: [
|
||||||
|
if (space.roomData != null) RoomMenu(space.roomData!),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
body: NavigationRail(
|
body: NavigationRail(
|
||||||
scrollable: true,
|
scrollable: true,
|
||||||
|
|
|
||||||
|
|
@ -201,6 +201,14 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.4.2"
|
version: "0.4.2"
|
||||||
|
clipboard:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: clipboard
|
||||||
|
sha256: "1920c0337f8808be4166c5f1b236301ff381ef69633b0757c502d97f1f740102"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.2"
|
||||||
clock:
|
clock:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ dependencies:
|
||||||
simple_secure_storage: ^0.3.6
|
simple_secure_storage: ^0.3.6
|
||||||
json_annotation: ^4.9.0
|
json_annotation: ^4.9.0
|
||||||
vodozemac: ^0.4.0
|
vodozemac: ^0.4.0
|
||||||
|
clipboard: ^2.0.2
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
build_runner: ^2.4.11
|
build_runner: ^2.4.11
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue