mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-19 10:39:26 +01:00
feat: Use SalomonBottomBar
This commit is contained in:
parent
10480ec408
commit
ae0a720d16
@ -56,12 +56,7 @@ class ChatListView extends StatelessWidget {
|
||||
? null
|
||||
: selectMode == SelectMode.select
|
||||
? [
|
||||
if (controller.spaces.isNotEmpty &&
|
||||
!Matrix.of(context)
|
||||
.client
|
||||
.getRoomById(
|
||||
controller.selectedRoomIds.single)
|
||||
.isDirectChat)
|
||||
if (controller.spaces.isNotEmpty)
|
||||
IconButton(
|
||||
tooltip: L10n.of(context).addToSpace,
|
||||
icon: const Icon(Icons.group_work_outlined),
|
||||
|
@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:salomon_bottom_bar/salomon_bottom_bar.dart';
|
||||
|
||||
import 'package:fluffychat/pages/chat_list/chat_list.dart';
|
||||
import 'package:fluffychat/widgets/avatar.dart';
|
||||
@ -17,29 +18,32 @@ class SpacesBottomBar extends StatelessWidget {
|
||||
: controller.spaces
|
||||
.indexWhere((space) => controller.activeSpaceId == space.id) +
|
||||
1;
|
||||
return BottomNavigationBar(
|
||||
return Material(
|
||||
color: Theme.of(context).appBarTheme.backgroundColor,
|
||||
elevation: 6,
|
||||
child: SalomonBottomBar(
|
||||
itemPadding: const EdgeInsets.all(8),
|
||||
currentIndex: currentIndex,
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
landscapeLayout: BottomNavigationBarLandscapeLayout.spread,
|
||||
onTap: (i) => controller.setActiveSpaceId(
|
||||
context,
|
||||
i == 0 ? null : controller.spaces[i - 1].id,
|
||||
),
|
||||
items: [
|
||||
BottomNavigationBarItem(
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
SalomonBottomBarItem(
|
||||
icon: const Icon(CupertinoIcons.chat_bubble_2),
|
||||
label: L10n.of(context).allChats,
|
||||
activeIcon: const Icon(CupertinoIcons.chat_bubble_2_fill),
|
||||
title: Text(L10n.of(context).allChats),
|
||||
),
|
||||
...controller.spaces
|
||||
.map((space) => BottomNavigationBarItem(
|
||||
.map((space) => SalomonBottomBarItem(
|
||||
icon: InkWell(
|
||||
borderRadius: BorderRadius.circular(28),
|
||||
onTap: () => controller.setActiveSpaceId(
|
||||
context,
|
||||
space.id,
|
||||
),
|
||||
onLongPress: () => controller.editSpace(context, space.id),
|
||||
onLongPress: () =>
|
||||
controller.editSpace(context, space.id),
|
||||
child: Avatar(
|
||||
space.avatar,
|
||||
space.displayname,
|
||||
@ -47,10 +51,11 @@ class SpacesBottomBar extends StatelessWidget {
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
label: space.displayname,
|
||||
title: Text(space.displayname),
|
||||
))
|
||||
.toList(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1152,6 +1152,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.26.0"
|
||||
salomon_bottom_bar:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: salomon_bottom_bar
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.1.0"
|
||||
scroll_to_index:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -61,6 +61,7 @@ dependencies:
|
||||
qr_flutter: ^4.0.0
|
||||
receive_sharing_intent: ^1.4.5
|
||||
record: ^3.0.0
|
||||
salomon_bottom_bar: ^3.1.0
|
||||
scroll_to_index: ^2.1.0
|
||||
sembast_web: ^2.0.1+1
|
||||
sentry: ^6.0.1
|
||||
|
Loading…
Reference in New Issue
Block a user