mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-24 14:32:37 +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:flutter_gen/gen_l10n/l10n.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_item.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/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/widgets/avatar.dart';
|
||||
import 'package:fluffychat/widgets/profile_bottom_sheet.dart';
|
||||
@ -61,9 +61,10 @@ class ChatListViewBody extends StatelessWidget {
|
||||
if (controller.waitForFirstSync && client.prevBatch != null) {
|
||||
final rooms = controller.filteredRooms;
|
||||
final displayStoriesHeader = {
|
||||
ActiveFilter.allChats,
|
||||
ActiveFilter.messages,
|
||||
}.contains(controller.activeFilter);
|
||||
ActiveFilter.allChats,
|
||||
ActiveFilter.messages,
|
||||
}.contains(controller.activeFilter) &&
|
||||
client.storiesRooms.isNotEmpty;
|
||||
return ListView.builder(
|
||||
controller: controller.scrollController,
|
||||
// add +1 space below in order to properly scroll below the spaces bar
|
||||
@ -184,27 +185,11 @@ class ChatListViewBody extends StatelessWidget {
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(height: 32),
|
||||
Image.asset(
|
||||
'assets/start_chat.png',
|
||||
height: 256,
|
||||
),
|
||||
Divider(
|
||||
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),
|
||||
),
|
||||
const Divider(height: 1),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -238,8 +238,11 @@ class ChatListView extends StatelessWidget {
|
||||
destinations: getNavigationDestinations(context),
|
||||
)
|
||||
: null,
|
||||
floatingActionButton: controller.filteredRooms.isNotEmpty &&
|
||||
selectMode == SelectMode.normal
|
||||
floatingActionButtonLocation:
|
||||
controller.filteredRooms.isEmpty
|
||||
? FloatingActionButtonLocation.centerFloat
|
||||
: null,
|
||||
floatingActionButton: selectMode == SelectMode.normal
|
||||
? KeyBoardShortcuts(
|
||||
keysToPress: {
|
||||
LogicalKeyboardKey.controlLeft,
|
||||
@ -249,7 +252,8 @@ class ChatListView extends StatelessWidget {
|
||||
VRouter.of(context).to('/newprivatechat'),
|
||||
helpLabel: L10n.of(context)!.newChat,
|
||||
child: StartChatFloatingActionButton(
|
||||
controller: controller),
|
||||
controller: controller,
|
||||
),
|
||||
)
|
||||
: null,
|
||||
),
|
||||
|
@ -42,7 +42,9 @@ class StartChatFloatingActionButton extends StatelessWidget {
|
||||
switch (controller.activeFilter) {
|
||||
case ActiveFilter.allChats:
|
||||
case ActiveFilter.messages:
|
||||
return L10n.of(context)!.newChat;
|
||||
return controller.filteredRooms.isEmpty
|
||||
? L10n.of(context)!.startFirstChat
|
||||
: L10n.of(context)!.newChat;
|
||||
case ActiveFilter.groups:
|
||||
return L10n.of(context)!.newGroup;
|
||||
case ActiveFilter.spaces:
|
||||
@ -55,7 +57,11 @@ class StartChatFloatingActionButton extends StatelessWidget {
|
||||
return AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
curve: Curves.easeInOut,
|
||||
width: controller.scrolledToTop ? 144 : 64,
|
||||
width: controller.filteredRooms.isEmpty
|
||||
? null
|
||||
: controller.scrolledToTop
|
||||
? 144
|
||||
: 64,
|
||||
child: controller.scrolledToTop
|
||||
? FloatingActionButton.extended(
|
||||
backgroundColor: Theme.of(context).colorScheme.primary,
|
||||
|
Loading…
Reference in New Issue
Block a user