|
|
|
|
@ -15,6 +15,7 @@ import 'package:fluffychat/pages/chat_list/chat_list.dart';
|
|
|
|
|
import 'package:fluffychat/pages/chat_list/chat_list_item.dart';
|
|
|
|
|
import 'package:fluffychat/pages/chat_list/search_title.dart';
|
|
|
|
|
import 'package:fluffychat/pangea/chat_settings/constants/pangea_room_types.dart';
|
|
|
|
|
import 'package:fluffychat/pangea/chat_settings/widgets/delete_space_dialog.dart';
|
|
|
|
|
import 'package:fluffychat/pangea/common/utils/error_handler.dart';
|
|
|
|
|
import 'package:fluffychat/pangea/extensions/pangea_room_extension.dart';
|
|
|
|
|
import 'package:fluffychat/pangea/onboarding/onboarding.dart';
|
|
|
|
|
@ -375,6 +376,23 @@ class _SpaceViewState extends State<SpaceView> {
|
|
|
|
|
if (!mounted) return;
|
|
|
|
|
if (success.error != null) return;
|
|
|
|
|
widget.onBack();
|
|
|
|
|
// #Pangea
|
|
|
|
|
case SpaceActions.delete:
|
|
|
|
|
if (space == null) {
|
|
|
|
|
ScaffoldMessenger.of(context).showSnackBar(
|
|
|
|
|
SnackBar(content: Text(L10n.of(context).oopsSomethingWentWrong)),
|
|
|
|
|
);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
final resp = await showDialog<bool?>(
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (_) => DeleteSpaceDialog(space: space),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (resp == true) {
|
|
|
|
|
context.go("/rooms?spaceId=clear");
|
|
|
|
|
}
|
|
|
|
|
// Pangea#
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -662,12 +680,44 @@ class _SpaceViewState extends State<SpaceView> {
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
const Icon(Icons.delete_outlined),
|
|
|
|
|
// #Pangea
|
|
|
|
|
// const Icon(Icons.delete_outlined),
|
|
|
|
|
const Icon(Icons.logout_outlined),
|
|
|
|
|
// Pangea#
|
|
|
|
|
const SizedBox(width: 12),
|
|
|
|
|
Text(L10n.of(context).leave),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
// #Pangea
|
|
|
|
|
if (Matrix.of(context)
|
|
|
|
|
.client
|
|
|
|
|
.getRoomById(widget.spaceId)
|
|
|
|
|
?.isRoomAdmin ??
|
|
|
|
|
false)
|
|
|
|
|
PopupMenuItem(
|
|
|
|
|
value: SpaceActions.delete,
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
Icon(
|
|
|
|
|
Icons.delete_outlined,
|
|
|
|
|
color:
|
|
|
|
|
Theme.of(context).colorScheme.onErrorContainer,
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(width: 12),
|
|
|
|
|
Text(
|
|
|
|
|
L10n.of(context).delete,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Theme.of(context)
|
|
|
|
|
.colorScheme
|
|
|
|
|
.onErrorContainer,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
// Pangea#
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
@ -978,4 +1028,7 @@ enum SpaceActions {
|
|
|
|
|
settings,
|
|
|
|
|
invite,
|
|
|
|
|
leave,
|
|
|
|
|
// #Pangea
|
|
|
|
|
delete,
|
|
|
|
|
// Pangea#
|
|
|
|
|
}
|
|
|
|
|
|