mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-25 06:52:35 +01:00
chore: Follow up fix chat list
This commit is contained in:
parent
220dda715a
commit
05285b46d8
@ -3,13 +3,13 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:animations/animations.dart';
|
import 'package:animations/animations.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
import 'package:vrouter/vrouter.dart';
|
|
||||||
|
|
||||||
import 'package:fluffychat/pages/chat_list/chat_list.dart';
|
import 'package:fluffychat/pages/chat_list/chat_list.dart';
|
||||||
import 'package:fluffychat/pages/chat_list/chat_list_item.dart';
|
import 'package:fluffychat/pages/chat_list/chat_list_item.dart';
|
||||||
import 'package:fluffychat/pages/chat_list/search_title.dart';
|
import 'package:fluffychat/pages/chat_list/search_title.dart';
|
||||||
import 'package:fluffychat/pages/chat_list/space_view.dart';
|
import 'package:fluffychat/pages/chat_list/space_view.dart';
|
||||||
import 'package:fluffychat/pages/chat_list/stories_header.dart';
|
import 'package:fluffychat/pages/chat_list/stories_header.dart';
|
||||||
|
import 'package:fluffychat/utils/matrix_sdk_extensions.dart/client_stories_extension.dart';
|
||||||
import 'package:fluffychat/utils/stream_extension.dart';
|
import 'package:fluffychat/utils/stream_extension.dart';
|
||||||
import 'package:fluffychat/widgets/avatar.dart';
|
import 'package:fluffychat/widgets/avatar.dart';
|
||||||
import 'package:fluffychat/widgets/profile_bottom_sheet.dart';
|
import 'package:fluffychat/widgets/profile_bottom_sheet.dart';
|
||||||
@ -61,9 +61,10 @@ class ChatListViewBody extends StatelessWidget {
|
|||||||
if (controller.waitForFirstSync && client.prevBatch != null) {
|
if (controller.waitForFirstSync && client.prevBatch != null) {
|
||||||
final rooms = controller.filteredRooms;
|
final rooms = controller.filteredRooms;
|
||||||
final displayStoriesHeader = {
|
final displayStoriesHeader = {
|
||||||
ActiveFilter.allChats,
|
ActiveFilter.allChats,
|
||||||
ActiveFilter.messages,
|
ActiveFilter.messages,
|
||||||
}.contains(controller.activeFilter);
|
}.contains(controller.activeFilter) &&
|
||||||
|
client.storiesRooms.isNotEmpty;
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
controller: controller.scrollController,
|
controller: controller.scrollController,
|
||||||
// add +1 space below in order to properly scroll below the spaces bar
|
// add +1 space below in order to properly scroll below the spaces bar
|
||||||
@ -184,27 +185,11 @@ class ChatListViewBody extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(height: 32),
|
|
||||||
Image.asset(
|
Image.asset(
|
||||||
'assets/start_chat.png',
|
'assets/start_chat.png',
|
||||||
|
height: 256,
|
||||||
),
|
),
|
||||||
Divider(
|
const Divider(height: 1),
|
||||||
height: 1,
|
|
||||||
color: Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.onBackground,
|
|
||||||
),
|
|
||||||
const SizedBox(height: 32),
|
|
||||||
FloatingActionButton.extended(
|
|
||||||
backgroundColor:
|
|
||||||
Theme.of(context).colorScheme.primary,
|
|
||||||
foregroundColor:
|
|
||||||
Theme.of(context).colorScheme.onPrimary,
|
|
||||||
icon: const Icon(Icons.edit_outlined),
|
|
||||||
onPressed: () =>
|
|
||||||
VRouter.of(context).to('/newprivatechat'),
|
|
||||||
label: Text(L10n.of(context)!.startFirstChat),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -238,8 +238,11 @@ class ChatListView extends StatelessWidget {
|
|||||||
destinations: getNavigationDestinations(context),
|
destinations: getNavigationDestinations(context),
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
floatingActionButton: controller.filteredRooms.isNotEmpty &&
|
floatingActionButtonLocation:
|
||||||
selectMode == SelectMode.normal
|
controller.filteredRooms.isEmpty
|
||||||
|
? FloatingActionButtonLocation.centerFloat
|
||||||
|
: null,
|
||||||
|
floatingActionButton: selectMode == SelectMode.normal
|
||||||
? KeyBoardShortcuts(
|
? KeyBoardShortcuts(
|
||||||
keysToPress: {
|
keysToPress: {
|
||||||
LogicalKeyboardKey.controlLeft,
|
LogicalKeyboardKey.controlLeft,
|
||||||
@ -249,7 +252,8 @@ class ChatListView extends StatelessWidget {
|
|||||||
VRouter.of(context).to('/newprivatechat'),
|
VRouter.of(context).to('/newprivatechat'),
|
||||||
helpLabel: L10n.of(context)!.newChat,
|
helpLabel: L10n.of(context)!.newChat,
|
||||||
child: StartChatFloatingActionButton(
|
child: StartChatFloatingActionButton(
|
||||||
controller: controller),
|
controller: controller,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
|
@ -42,7 +42,9 @@ class StartChatFloatingActionButton extends StatelessWidget {
|
|||||||
switch (controller.activeFilter) {
|
switch (controller.activeFilter) {
|
||||||
case ActiveFilter.allChats:
|
case ActiveFilter.allChats:
|
||||||
case ActiveFilter.messages:
|
case ActiveFilter.messages:
|
||||||
return L10n.of(context)!.newChat;
|
return controller.filteredRooms.isEmpty
|
||||||
|
? L10n.of(context)!.startFirstChat
|
||||||
|
: L10n.of(context)!.newChat;
|
||||||
case ActiveFilter.groups:
|
case ActiveFilter.groups:
|
||||||
return L10n.of(context)!.newGroup;
|
return L10n.of(context)!.newGroup;
|
||||||
case ActiveFilter.spaces:
|
case ActiveFilter.spaces:
|
||||||
@ -55,7 +57,11 @@ class StartChatFloatingActionButton extends StatelessWidget {
|
|||||||
return AnimatedContainer(
|
return AnimatedContainer(
|
||||||
duration: const Duration(milliseconds: 200),
|
duration: const Duration(milliseconds: 200),
|
||||||
curve: Curves.easeInOut,
|
curve: Curves.easeInOut,
|
||||||
width: controller.scrolledToTop ? 144 : 64,
|
width: controller.filteredRooms.isEmpty
|
||||||
|
? null
|
||||||
|
: controller.scrolledToTop
|
||||||
|
? 144
|
||||||
|
: 64,
|
||||||
child: controller.scrolledToTop
|
child: controller.scrolledToTop
|
||||||
? FloatingActionButton.extended(
|
? FloatingActionButton.extended(
|
||||||
backgroundColor: Theme.of(context).colorScheme.primary,
|
backgroundColor: Theme.of(context).colorScheme.primary,
|
||||||
|
Loading…
Reference in New Issue
Block a user