Initial commit
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-11 15:59:56 -03:00
commit 0037b0b9cf
651 changed files with 199705 additions and 0 deletions

View File

@@ -0,0 +1,79 @@
// SPDX-FileCopyrightText: 2019-Present Christian Kußowski
// SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
//
// SPDX-License-Identifier: AGPL-3.0-or-later
import 'package:material_ui/material_ui.dart';
import 'package:matrix/matrix.dart';
import 'package:tatchat/l10n/l10n.dart';
import 'package:tatchat/pages/chat_list/chat_list.dart';
import 'package:tatchat/pages/chat_list/chat_list_item.dart';
import 'package:tatchat/pages/chat_list/tabs/empty_tab_view.dart';
import 'package:tatchat/utils/stream_extension.dart';
import 'package:tatchat/widgets/matrix.dart';
class ChannelsTab extends StatelessWidget {
final ChatListController controller;
const ChannelsTab(this.controller, {super.key});
@override
Widget build(BuildContext context) {
final client = Matrix.of(context).client;
final theme = Theme.of(context);
return StreamBuilder(
key: ValueKey(client.userID.toString()),
stream: client.onSync.stream
.where((s) => s.hasRoomUpdate)
.rateLimit(const Duration(seconds: 1)),
builder: (context, _) {
final channels = client.rooms
.where((room) => !room.isSpace && !room.isDirectChat)
.toList();
return CustomScrollView(
slivers: [
SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Row(
children: [
Icon(
Icons.tag_outlined,
color: theme.colorScheme.primary,
),
const SizedBox(width: 8),
Text(
L10n.of(context).channels,
style: theme.textTheme.titleLarge,
),
],
),
),
),
if (channels.isEmpty)
SliverFillRemaining(
hasScrollBody: false,
child: EmptyTabView(
icon: Icons.tag_outlined,
title: L10n.of(context).noChannelsFound,
),
)
else
SliverList.builder(
itemCount: channels.length,
itemBuilder: (context, i) {
final room = channels[i];
return ChatListItem(
room,
key: Key('channel_list_item_${room.id}'),
onTap: () => controller.onChatTap(room),
activeChat: controller.activeChat == room.id,
);
},
),
],
);
},
);
}
}

View File

@@ -0,0 +1,115 @@
// SPDX-FileCopyrightText: 2019-Present Christian Kußowski
// SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
//
// SPDX-License-Identifier: AGPL-3.0-or-later
import 'package:material_ui/material_ui.dart';
import 'package:tatchat/config/themes.dart';
import 'package:tatchat/pages/chat_list/tabs/home_tab.dart';
class ChatTopTabBar extends StatelessWidget {
final HomeTab currentTab;
final ValueChanged<HomeTab> onTabSelected;
const ChatTopTabBar({
super.key,
required this.currentTab,
required this.onTabSelected,
});
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Material(
color: theme.colorScheme.surfaceContainer,
child: Container(
decoration: BoxDecoration(
border: Border(bottom: BorderSide(color: theme.dividerColor)),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
for (final tab in HomeTab.values)
Expanded(
child: InkWell(
onTap: () => onTabSelected(tab),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
tab == currentTab
? tab.selectedIcon
: tab.icon,
size: 20,
color: tab == currentTab
? theme.colorScheme.primary
: theme.colorScheme.onSurfaceVariant,
),
const SizedBox(height: 4),
Text(
tab.label(context),
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: theme.textTheme.labelMedium?.copyWith(
color: tab == currentTab
? theme.colorScheme.primary
: theme.colorScheme.onSurfaceVariant,
fontWeight: tab == currentTab
? FontWeight.w600
: null,
),
),
],
),
),
AnimatedContainer(
duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,
height: 3,
color: tab == currentTab
? theme.colorScheme.primary
: Colors.transparent,
),
],
),
),
),
],
),
),
);
}
}
class ChatBottomTabBar extends StatelessWidget {
final HomeTab currentTab;
final ValueChanged<HomeTab> onTabSelected;
const ChatBottomTabBar({
super.key,
required this.currentTab,
required this.onTabSelected,
});
@override
Widget build(BuildContext context) {
return NavigationBar(
selectedIndex: currentTab.index,
onDestinationSelected: (index) => onTabSelected(HomeTab.values[index]),
destinations: [
for (final tab in HomeTab.values)
NavigationDestination(
icon: Icon(tab.icon),
selectedIcon: Icon(tab.selectedIcon),
label: tab.label(context),
),
],
);
}
}

View File

@@ -0,0 +1,56 @@
// SPDX-FileCopyrightText: 2019-Present Christian Kußowski
// SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
//
// SPDX-License-Identifier: AGPL-3.0-or-later
import 'package:material_ui/material_ui.dart';
class EmptyTabView extends StatelessWidget {
final IconData icon;
final String title;
final String? description;
const EmptyTabView({
super.key,
required this.icon,
required this.title,
this.description,
});
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
icon,
size: 96,
color: theme.colorScheme.secondary,
),
Padding(
padding: const EdgeInsets.all(16.0),
child: Text(
title,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18,
color: theme.colorScheme.secondary,
),
),
),
if (description != null)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 32.0),
child: Text(
description!,
textAlign: TextAlign.center,
style: TextStyle(color: theme.colorScheme.secondary),
),
),
],
),
);
}
}

View File

@@ -0,0 +1,51 @@
// SPDX-FileCopyrightText: 2019-Present Christian Kußowski
// SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
//
// SPDX-License-Identifier: AGPL-3.0-or-later
import 'package:material_ui/material_ui.dart';
import 'package:tatchat/l10n/l10n.dart';
enum HomeTab { chats, channels, spaces, murals }
extension HomeTabExtension on HomeTab {
String label(BuildContext context) {
final l10n = L10n.of(context);
switch (this) {
case HomeTab.chats:
return l10n.chats;
case HomeTab.channels:
return l10n.channels;
case HomeTab.spaces:
return l10n.spaces;
case HomeTab.murals:
return l10n.murals;
}
}
IconData get icon {
switch (this) {
case HomeTab.chats:
return Icons.forum_outlined;
case HomeTab.channels:
return Icons.tag_outlined;
case HomeTab.spaces:
return Icons.workspaces_outlined;
case HomeTab.murals:
return Icons.dashboard_outlined;
}
}
IconData get selectedIcon {
switch (this) {
case HomeTab.chats:
return Icons.forum;
case HomeTab.channels:
return Icons.tag;
case HomeTab.spaces:
return Icons.workspaces;
case HomeTab.murals:
return Icons.dashboard;
}
}
}

View File

@@ -0,0 +1,46 @@
// SPDX-FileCopyrightText: 2019-Present Christian Kußowski
// SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
//
// SPDX-License-Identifier: AGPL-3.0-or-later
import 'package:material_ui/material_ui.dart';
import 'package:tatchat/l10n/l10n.dart';
import 'package:tatchat/pages/chat_list/tabs/empty_tab_view.dart';
class MuralsTab extends StatelessWidget {
const MuralsTab({super.key});
@override
Widget build(BuildContext context) {
final l10n = L10n.of(context);
return ColoredBox(
color: Theme.of(context).colorScheme.surface,
child: CustomScrollView(
slivers: [
SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Row(
children: [
Icon(
Icons.dashboard_outlined,
color: Theme.of(context).colorScheme.primary,
),
const SizedBox(width: 8),
Text(l10n.murals, style: Theme.of(context).textTheme.titleLarge),
],
),
),
),
SliverFillRemaining(
hasScrollBody: false,
child: EmptyTabView(
icon: Icons.dashboard_outlined,
title: l10n.muralsComingSoon,
),
),
],
),
);
}
}

View File

@@ -0,0 +1,89 @@
// SPDX-FileCopyrightText: 2019-Present Christian Kußowski
// SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
//
// SPDX-License-Identifier: AGPL-3.0-or-later
import 'package:go_router/go_router.dart';
import 'package:material_ui/material_ui.dart';
import 'package:matrix/matrix.dart';
import 'package:tatchat/l10n/l10n.dart';
import 'package:tatchat/pages/chat_list/chat_list.dart';
import 'package:tatchat/pages/chat_list/chat_list_item.dart';
import 'package:tatchat/pages/chat_list/tabs/empty_tab_view.dart';
import 'package:tatchat/pages/chat_list/tabs/home_tab.dart';
import 'package:tatchat/utils/stream_extension.dart';
import 'package:tatchat/widgets/matrix.dart';
class SpacesTab extends StatelessWidget {
final ChatListController controller;
const SpacesTab(this.controller, {super.key});
@override
Widget build(BuildContext context) {
final client = Matrix.of(context).client;
final theme = Theme.of(context);
return StreamBuilder(
key: ValueKey(client.userID.toString()),
stream: client.onSync.stream
.where((s) => s.hasRoomUpdate)
.rateLimit(const Duration(seconds: 1)),
builder: (context, _) {
final spaces = client.rooms.where((room) => room.isSpace).toList();
return CustomScrollView(
slivers: [
SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Row(
children: [
Icon(
Icons.workspaces_outlined,
color: theme.colorScheme.primary,
),
const SizedBox(width: 8),
Text(
L10n.of(context).spaces,
style: theme.textTheme.titleLarge,
),
],
),
),
),
if (spaces.isEmpty)
SliverFillRemaining(
hasScrollBody: false,
child: EmptyTabView(
icon: Icons.workspaces_outlined,
title: L10n.of(context).noSpacesFound,
),
)
else
SliverList.builder(
itemCount: spaces.length + 1,
itemBuilder: (context, i) {
if (i == spaces.length) {
return ListTile(
leading: const Icon(Icons.add),
title: Text(L10n.of(context).createNewSpace),
onTap: () => context.go('/rooms/newspace'),
);
}
final space = spaces[i];
return ChatListItem(
space,
key: Key('spaces_tab_item_${space.id}'),
activeChat: controller.activeSpaceId == space.id,
onTap: () {
controller.setActiveSpace(space.id);
controller.setHomeTab(HomeTab.chats);
},
);
},
),
],
);
},
);
}
}