alterações em telas
Some checks failed
Main Deploy Workflow / deploy_web (push) Has been cancelled
Main Deploy Workflow / deploy_playstore_internal (push) Has been cancelled
Close stale issues and PRs / stale (push) Has been cancelled

This commit is contained in:
2026-09-12 16:07:05 -03:00
parent 0037b0b9cf
commit 5d97feda86
22 changed files with 1069 additions and 682 deletions

View File

@@ -20,6 +20,7 @@ import 'package:tatchat/widgets/avatar.dart';
import 'package:tatchat/widgets/future_loading_dialog.dart';
import 'package:tatchat/widgets/hover_builder.dart';
import 'package:tatchat/widgets/matrix.dart';
import 'package:tatchat/widgets/mxc_image.dart';
import 'package:go_router/go_router.dart';
import 'package:material_ui/material_ui.dart';
import 'package:matrix/matrix.dart' as sdk;
@@ -385,84 +386,113 @@ class _SpaceViewState extends State<SpaceView> {
final filter = _filterController.text.trim().toLowerCase();
return CustomScrollView(
slivers: [
SliverAppBar(
toolbarHeight: 72,
floating: true,
scrolledUnderElevation: 0,
backgroundColor: Colors.transparent,
automaticallyImplyLeading: false,
title: TextField(
controller: _filterController,
onChanged: (_) => setState(() {}),
textInputAction: TextInputAction.search,
decoration: InputDecoration(
filled: true,
fillColor: theme.colorScheme.secondaryContainer,
border: OutlineInputBorder(
borderSide: BorderSide.none,
borderRadius: BorderRadius.circular(99),
),
contentPadding: EdgeInsets.zero,
hintText: L10n.of(context).search,
hintStyle: TextStyle(
color: theme.colorScheme.onPrimaryContainer,
fontWeight: FontWeight.normal,
),
floatingLabelBehavior: FloatingLabelBehavior.never,
prefixIcon: IconButton(
onPressed: () {},
icon: Icon(
Icons.search_outlined,
color: theme.colorScheme.onPrimaryContainer,
),
),
suffixIcon: PopupMenuButton<SpaceActions>(
icon: Avatar(
size: avatarSize,
mxContent: room.avatar,
name: displayname,
shapeBorder: RoundedSuperellipseBorder(
side: BorderSide(
width: 1,
color: theme.dividerColor,
),
borderRadius: BorderRadius.circular(
AppConfig.spaceBorderRadius,
),
),
borderRadius: BorderRadius.circular(
AppConfig.spaceBorderRadius,
),
),
useRootNavigator: true,
onSelected: _onSpaceAction,
itemBuilder: (context) => [
if (isAdmin)
PopupMenuItem(
value: SpaceActions.addChild,
child: ListTile(
leading: Icon(Icons.edit_square),
title: Text(
L10n.of(context).addChatOrSubSpace,
SliverToBoxAdapter(
child: _spaceCover(
theme: theme,
room: room,
displayname: displayname,
),
),
SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.fromLTRB(12, 8, 12, 4),
child: Row(
children: [
Expanded(
child: TextField(
controller: _filterController,
onChanged: (_) => setState(() {}),
textInputAction: TextInputAction.search,
decoration: InputDecoration(
filled: true,
fillColor:
theme.colorScheme.secondaryContainer,
border: OutlineInputBorder(
borderSide: BorderSide.none,
borderRadius: BorderRadius.circular(99),
),
contentPadding: EdgeInsets.zero,
hintText: L10n.of(context).search,
hintStyle: TextStyle(
color: theme.colorScheme.onPrimaryContainer,
fontWeight: FontWeight.normal,
),
floatingLabelBehavior:
FloatingLabelBehavior.never,
prefixIcon: IconButton(
onPressed: () {},
icon: Icon(
Icons.search_outlined,
color:
theme.colorScheme.onPrimaryContainer,
),
),
),
PopupMenuItem(
value: SpaceActions.settings,
child: ListTile(
leading: Icon(Icons.settings_outlined),
title: Text(L10n.of(context).settings),
suffixIcon: PopupMenuButton<SpaceActions>(
icon: Avatar(
size: avatarSize,
mxContent: room.avatar,
name: displayname,
shapeBorder: RoundedSuperellipseBorder(
side: BorderSide(
width: 1,
color: theme.dividerColor,
),
borderRadius: BorderRadius.circular(
AppConfig.spaceBorderRadius,
),
),
borderRadius: BorderRadius.circular(
AppConfig.spaceBorderRadius,
),
),
useRootNavigator: true,
onSelected: _onSpaceAction,
itemBuilder: (context) => [
if (isAdmin)
PopupMenuItem(
value: SpaceActions.addChild,
child: ListTile(
leading: Icon(Icons.edit_square),
title: Text(
L10n.of(
context,
).addChatOrSubSpace,
),
),
),
PopupMenuItem(
value: SpaceActions.settings,
child: ListTile(
leading: Icon(
Icons.settings_outlined,
),
title: Text(
L10n.of(context).settings,
),
),
),
PopupMenuItem(
value: SpaceActions.leave,
child: ListTile(
leading: Icon(Icons.delete_outlined),
title: Text(L10n.of(context).leave),
),
),
],
),
),
),
PopupMenuItem(
value: SpaceActions.leave,
child: ListTile(
leading: Icon(Icons.delete_outlined),
title: Text(L10n.of(context).leave),
),
const SizedBox(width: 8),
if (isAdmin)
IconButton.filledTonal(
tooltip: L10n.of(context).addChatOrSubSpace,
onPressed: () => context.go(
'/rooms/newgroup?space_id=${widget.spaceId}',
),
icon: const Icon(Icons.add),
),
],
),
],
),
),
),
@@ -641,4 +671,90 @@ class _SpaceViewState extends State<SpaceView> {
),
);
}
Widget _spaceCover({
required ThemeData theme,
required sdk.Room room,
required String displayname,
}) {
const coverHeight = 160.0;
final avatar = room.avatar;
return SizedBox(
height: coverHeight,
width: double.infinity,
child: Stack(
fit: StackFit.expand,
children: [
DecoratedBox(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
theme.colorScheme.primaryContainer,
theme.colorScheme.secondaryContainer,
],
),
),
),
if (avatar != null)
MxcImage(
uri: avatar,
client: room.client,
fit: BoxFit.cover,
width: MediaQuery.sizeOf(context).width,
height: coverHeight,
),
DecoratedBox(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Colors.transparent,
Colors.black.withValues(alpha: 0.55),
],
stops: const [0.4, 1.0],
),
),
),
Positioned(
left: 16,
right: 16,
bottom: 12,
child: Row(
children: [
Avatar(
mxContent: avatar,
name: displayname,
size: 56,
shapeBorder: RoundedSuperellipseBorder(
side: BorderSide(
width: 2,
color: theme.colorScheme.surface,
),
borderRadius: BorderRadius.circular(
AppConfig.spaceBorderRadius,
),
),
),
const SizedBox(width: 12),
Expanded(
child: Text(
displayname,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: theme.textTheme.titleLarge?.copyWith(
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
],
),
),
],
),
);
}
}