2016 the confirm and cancel buttons not in the right place (#2019)
* chore: revert to fluffychat's add chat dialog * chore: revert to fluffychat's add chat dialog
This commit is contained in:
parent
bfe2ac446a
commit
cf56691c57
1 changed files with 48 additions and 66 deletions
|
|
@ -14,11 +14,11 @@ 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/extensions/pangea_room_extension.dart';
|
||||
import 'package:fluffychat/pangea/spaces/widgets/add_room_dialog.dart';
|
||||
import 'package:fluffychat/utils/adaptive_bottom_sheet.dart';
|
||||
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
||||
import 'package:fluffychat/utils/stream_extension.dart';
|
||||
import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
|
||||
import 'package:fluffychat/widgets/adaptive_dialogs/show_text_input_dialog.dart';
|
||||
import 'package:fluffychat/widgets/avatar.dart';
|
||||
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
|
|
@ -26,9 +26,7 @@ import 'package:fluffychat/widgets/public_room_bottom_sheet.dart';
|
|||
|
||||
enum AddRoomType {
|
||||
chat,
|
||||
// #Pangea
|
||||
// subspace,
|
||||
// Pangea#
|
||||
subspace,
|
||||
}
|
||||
|
||||
class SpaceView extends StatefulWidget {
|
||||
|
|
@ -340,39 +338,34 @@ class _SpaceViewState extends State<SpaceView> {
|
|||
// ],
|
||||
// );
|
||||
// if (roomType == null) return;
|
||||
const roomType = AddRoomType.chat;
|
||||
// Pangea#
|
||||
|
||||
// #Pangea
|
||||
final RoomResponse? response = await showDialog<RoomResponse?>(
|
||||
final names = await showTextInputDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return const AddRoomDialog();
|
||||
// #Pangea
|
||||
// title: roomType == AddRoomType.subspace
|
||||
// ? L10n.of(context).createNewSpace
|
||||
// : L10n.of(context).createGroup,
|
||||
// hintText: roomType == AddRoomType.subspace
|
||||
// ? L10n.of(context).spaceName
|
||||
// : L10n.of(context).groupName,
|
||||
title: L10n.of(context).createChat,
|
||||
hintText: L10n.of(context).chatName,
|
||||
// Pangea#
|
||||
minLines: 1,
|
||||
maxLines: 1,
|
||||
maxLength: 64,
|
||||
validator: (text) {
|
||||
if (text.isEmpty) {
|
||||
return L10n.of(context).pleaseChoose;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
okLabel: L10n.of(context).create,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
);
|
||||
if (response == null) return;
|
||||
|
||||
// final names = await showTextInputDialog(
|
||||
// context: context,
|
||||
// title: roomType == AddRoomType.subspace
|
||||
// ? L10n.of(context).createNewSpace
|
||||
// : L10n.of(context).createGroup,
|
||||
// hintText: roomType == AddRoomType.subspace
|
||||
// ? L10n.of(context).spaceName
|
||||
// : L10n.of(context).groupName,
|
||||
// minLines: 1,
|
||||
// maxLines: 1,
|
||||
// maxLength: 64,
|
||||
// validator: (text) {
|
||||
// if (text.isEmpty) {
|
||||
// return L10n.of(context).pleaseChoose;
|
||||
// }
|
||||
// return null;
|
||||
// },
|
||||
// okLabel: L10n.of(context).create,
|
||||
// cancelLabel: L10n.of(context).cancel,
|
||||
// );
|
||||
// if (names == null) return;
|
||||
// Pangea#
|
||||
if (names == null) return;
|
||||
final client = Matrix.of(context).client;
|
||||
final result = await showFutureLoadingDialog(
|
||||
context: context,
|
||||
|
|
@ -381,42 +374,31 @@ class _SpaceViewState extends State<SpaceView> {
|
|||
final activeSpace = client.getRoomById(widget.spaceId)!;
|
||||
await activeSpace.postLoad();
|
||||
|
||||
// #Pangea
|
||||
// if (roomType == AddRoomType.subspace) {
|
||||
// roomId = await client.createSpace(
|
||||
// name: names,
|
||||
// visibility: activeSpace.joinRules == JoinRules.public
|
||||
// ? sdk.Visibility.public
|
||||
// : sdk.Visibility.private,
|
||||
// );
|
||||
// } else {
|
||||
// Pangea#
|
||||
roomId = await client.createGroupChat(
|
||||
if (roomType == AddRoomType.subspace) {
|
||||
// #Pangea
|
||||
// groupName: names,
|
||||
// preset: activeSpace.joinRules == JoinRules.public
|
||||
// ? CreateRoomPreset.publicChat
|
||||
// : CreateRoomPreset.privateChat,
|
||||
// visibility: activeSpace.joinRules == JoinRules.public
|
||||
// ? sdk.Visibility.public
|
||||
// : sdk.Visibility.private,
|
||||
groupName: response.roomName,
|
||||
preset: response.joinRules == sdk.JoinRules.public
|
||||
? CreateRoomPreset.publicChat
|
||||
: CreateRoomPreset.privateChat,
|
||||
visibility: response.visibility,
|
||||
initialState: response.roomDescription.isNotEmpty
|
||||
? [
|
||||
StateEvent(
|
||||
type: EventTypes.RoomTopic,
|
||||
content: {'topic': response.roomDescription},
|
||||
),
|
||||
]
|
||||
: null,
|
||||
enableEncryption: false,
|
||||
// roomId = await client.createSpace(
|
||||
// name: names,
|
||||
// visibility: activeSpace.joinRules == JoinRules.public
|
||||
// ? sdk.Visibility.public
|
||||
// : sdk.Visibility.private,
|
||||
// );
|
||||
// Pangea#
|
||||
);
|
||||
// }
|
||||
} else {
|
||||
roomId = await client.createGroupChat(
|
||||
groupName: names,
|
||||
// #Pangea
|
||||
// preset: activeSpace.joinRules == JoinRules.public
|
||||
// ? CreateRoomPreset.publicChat
|
||||
// : CreateRoomPreset.privateChat,
|
||||
// visibility: activeSpace.joinRules == JoinRules.public
|
||||
// ? sdk.Visibility.public
|
||||
// : sdk.Visibility.private,
|
||||
preset: sdk.CreateRoomPreset.publicChat,
|
||||
visibility: sdk.Visibility.private,
|
||||
enableEncryption: false,
|
||||
// Pangea#
|
||||
);
|
||||
}
|
||||
await activeSpace.setSpaceChild(roomId);
|
||||
},
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue