Merge pull request #3006 from pangeachat/public-space-refinement
Public space refinement
This commit is contained in:
commit
b3a15edc26
3 changed files with 63 additions and 25 deletions
|
|
@ -1,11 +1,15 @@
|
|||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
||||
import 'package:fluffychat/l10n/l10n.dart';
|
||||
import 'package:fluffychat/pangea/common/config/environment.dart';
|
||||
import 'package:fluffychat/pangea/spaces/constants/space_constants.dart';
|
||||
import 'package:fluffychat/utils/adaptive_bottom_sheet.dart';
|
||||
import 'package:fluffychat/utils/fluffy_share.dart';
|
||||
import 'package:fluffychat/widgets/avatar.dart';
|
||||
|
|
@ -196,12 +200,25 @@ class PublicRoomBottomSheetState extends State<PublicRoomBottomSheet> {
|
|||
Row(
|
||||
spacing: 16.0,
|
||||
children: [
|
||||
Avatar(
|
||||
mxContent: chunk?.avatarUrl,
|
||||
name: chunk?.name,
|
||||
size: 160.0,
|
||||
borderRadius: BorderRadius.circular(24.0),
|
||||
),
|
||||
(chunk?.avatarUrl != null)
|
||||
? Avatar(
|
||||
mxContent: chunk?.avatarUrl,
|
||||
name: chunk?.name,
|
||||
size: 160.0,
|
||||
borderRadius: BorderRadius.circular(24.0),
|
||||
)
|
||||
: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(24.0),
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: SpaceConstants
|
||||
.publicSpaceIcons[Random().nextInt(
|
||||
SpaceConstants.publicSpaceIcons.length,
|
||||
)],
|
||||
width: 160.0,
|
||||
height: 160.0,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
height: 160.0,
|
||||
|
|
@ -221,17 +238,17 @@ class PublicRoomBottomSheetState extends State<PublicRoomBottomSheet> {
|
|||
),
|
||||
],
|
||||
),
|
||||
if (chunk?.topic != null)
|
||||
Flexible(
|
||||
child: SingleChildScrollView(
|
||||
child: Text(
|
||||
chunk!.topic!,
|
||||
softWrap: true,
|
||||
textAlign: TextAlign.start,
|
||||
maxLines: null,
|
||||
),
|
||||
Flexible(
|
||||
child: SingleChildScrollView(
|
||||
child: Text(
|
||||
chunk?.topic ??
|
||||
L10n.of(context).noSpaceDescriptionYet,
|
||||
softWrap: true,
|
||||
textAlign: TextAlign.start,
|
||||
maxLines: null,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -1,10 +1,14 @@
|
|||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
||||
import 'package:fluffychat/l10n/l10n.dart';
|
||||
import 'package:fluffychat/pangea/common/widgets/pressable_button.dart';
|
||||
import 'package:fluffychat/pangea/public_spaces/public_room_bottom_sheet.dart';
|
||||
import 'package:fluffychat/pangea/spaces/constants/space_constants.dart';
|
||||
import 'package:fluffychat/widgets/mxc_image.dart';
|
||||
|
||||
class PublicSpaceCard extends StatelessWidget {
|
||||
|
|
@ -66,7 +70,15 @@ class PublicSpaceCard extends StatelessWidget {
|
|||
height: width,
|
||||
fit: BoxFit.cover,
|
||||
)
|
||||
: const SizedBox(),
|
||||
: CachedNetworkImage(
|
||||
imageUrl: SpaceConstants
|
||||
.publicSpaceIcons[Random().nextInt(
|
||||
SpaceConstants.publicSpaceIcons.length,
|
||||
)],
|
||||
width: width,
|
||||
height: width,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
|
|
@ -123,16 +135,16 @@ class PublicSpaceCard extends StatelessWidget {
|
|||
),
|
||||
],
|
||||
),
|
||||
if (space.topic != null)
|
||||
Flexible(
|
||||
child: Text(
|
||||
space.topic!,
|
||||
style: theme.textTheme.bodySmall,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.start,
|
||||
maxLines: 5,
|
||||
),
|
||||
Flexible(
|
||||
child: Text(
|
||||
space.topic ??
|
||||
L10n.of(context).noSpaceDescriptionYet,
|
||||
style: theme.textTheme.bodySmall,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.start,
|
||||
maxLines: 5,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -20,4 +20,13 @@ class SpaceConstants {
|
|||
'${AppConfig.assetsBaseURL}/Announment_2.png',
|
||||
'${AppConfig.assetsBaseURL}/Announcement_3.jpg',
|
||||
];
|
||||
|
||||
static List<String> publicSpaceIcons = [
|
||||
'${AppConfig.assetsBaseURL}/Space+template+1.png',
|
||||
'${AppConfig.assetsBaseURL}/Space+template+2.png',
|
||||
'${AppConfig.assetsBaseURL}/Space+template+3.png',
|
||||
'${AppConfig.assetsBaseURL}/Space+template+4.png',
|
||||
'${AppConfig.assetsBaseURL}/Space+template+5.png',
|
||||
'${AppConfig.assetsBaseURL}/Space+template+6.png',
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue