Merge pull request #3202 from pangeachat/3178-add-no-subroom-placeholder-when-deleting-space

chore: change delete message for empty spaces
pull/2245/head
ggurdin 5 months ago committed by GitHub
commit dcf4bd2079
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -5032,5 +5032,6 @@
} }
} }
}, },
"failedToFetchTranscription": "Failed to fetch transcription" "failedToFetchTranscription": "Failed to fetch transcription",
"deleteEmptySpaceDesc": "The space will be deleted for all participants. This action cannot be undone."
} }

@ -115,6 +115,7 @@ class DeleteSpaceDialogState extends State<DeleteSpaceDialog> {
child: Container( child: Container(
constraints: const BoxConstraints( constraints: const BoxConstraints(
maxWidth: 400, maxWidth: 400,
maxHeight: 600,
), ),
padding: const EdgeInsets.symmetric(vertical: 20), padding: const EdgeInsets.symmetric(vertical: 20),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -138,75 +139,78 @@ class DeleteSpaceDialogState extends State<DeleteSpaceDialog> {
vertical: 8.0, vertical: 8.0,
), ),
child: Text( child: Text(
L10n.of(context).deleteSpaceDesc, widget.space.spaceChildCount > 0
? L10n.of(context).deleteSpaceDesc
: L10n.of(context).deleteEmptySpaceDesc,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle(color: Theme.of(context).colorScheme.error), style: TextStyle(color: Theme.of(context).colorScheme.error),
), ),
), ),
SizedBox( Expanded(
height: 300, child: SingleChildScrollView(
child: Builder( child: Builder(
builder: (context) { builder: (context) {
if (_loadingRooms) { if (_loadingRooms) {
return const Center( return const Center(
child: SizedBox( child: SizedBox(
height: 20, height: 20,
width: 20, width: 20,
child: CircularProgressIndicator.adaptive(), child: CircularProgressIndicator.adaptive(),
), ),
); );
} }
if (_roomLoadError != null) { if (_roomLoadError != null) {
return Center( return Center(
child: Column( child: Column(
spacing: 8.0, spacing: 8.0,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Icon( Icon(
Icons.error_outline, Icons.error_outline,
color: Theme.of(context).colorScheme.error, color: Theme.of(context).colorScheme.error,
), ),
Text(L10n.of(context).oopsSomethingWentWrong), Text(L10n.of(context).oopsSomethingWentWrong),
], ],
), ),
); );
} }
return Padding( return Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0), padding: const EdgeInsets.symmetric(vertical: 16.0),
child: ListView.builder( child: ListView.builder(
shrinkWrap: true, shrinkWrap: true,
itemCount: _rooms.length, itemCount: _rooms.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
final chunk = _rooms[index]; final chunk = _rooms[index];
final room = final room =
widget.space.client.getRoomById(chunk.roomId); widget.space.client.getRoomById(chunk.roomId);
final isMember = room != null && final isMember = room != null &&
room.membership == Membership.join && room.membership == Membership.join &&
room.isRoomAdmin; room.isRoomAdmin;
final displayname = chunk.name ?? final displayname = chunk.name ??
chunk.canonicalAlias ?? chunk.canonicalAlias ??
L10n.of(context).emptyChat; L10n.of(context).emptyChat;
return AnimatedOpacity( return AnimatedOpacity(
duration: FluffyThemes.animationDuration, duration: FluffyThemes.animationDuration,
opacity: isMember ? 1 : 0.5, opacity: isMember ? 1 : 0.5,
child: CheckboxListTile( child: CheckboxListTile(
value: _roomsToDelete.contains(chunk), value: _roomsToDelete.contains(chunk),
onChanged: isMember onChanged: isMember
? (value) => _onRoomSelected(value, chunk) ? (value) => _onRoomSelected(value, chunk)
: null, : null,
title: Text(displayname), title: Text(displayname),
controlAffinity: ListTileControlAffinity.leading, controlAffinity: ListTileControlAffinity.leading,
), ),
); );
}, },
), ),
); );
}, },
),
), ),
), ),
Padding( Padding(

Loading…
Cancel
Save