feat: Use SalomonBottomBar

This commit is contained in:
Krille Fear 2021-11-15 07:24:05 +01:00
parent 10480ec408
commit ae0a720d16
4 changed files with 46 additions and 38 deletions

View File

@ -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),

View File

@ -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,40 +18,44 @@ class SpacesBottomBar extends StatelessWidget {
: controller.spaces
.indexWhere((space) => controller.activeSpaceId == space.id) +
1;
return BottomNavigationBar(
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,
icon: const Icon(CupertinoIcons.chat_bubble_2),
label: L10n.of(context).allChats,
return Material(
color: Theme.of(context).appBarTheme.backgroundColor,
elevation: 6,
child: SalomonBottomBar(
itemPadding: const EdgeInsets.all(8),
currentIndex: currentIndex,
onTap: (i) => controller.setActiveSpaceId(
context,
i == 0 ? null : controller.spaces[i - 1].id,
),
...controller.spaces
.map((space) => BottomNavigationBarItem(
icon: InkWell(
borderRadius: BorderRadius.circular(28),
onTap: () => controller.setActiveSpaceId(
context,
space.id,
items: [
SalomonBottomBarItem(
icon: const Icon(CupertinoIcons.chat_bubble_2),
activeIcon: const Icon(CupertinoIcons.chat_bubble_2_fill),
title: Text(L10n.of(context).allChats),
),
...controller.spaces
.map((space) => SalomonBottomBarItem(
icon: InkWell(
borderRadius: BorderRadius.circular(28),
onTap: () => controller.setActiveSpaceId(
context,
space.id,
),
onLongPress: () =>
controller.editSpace(context, space.id),
child: Avatar(
space.avatar,
space.displayname,
size: 24,
fontSize: 12,
),
),
onLongPress: () => controller.editSpace(context, space.id),
child: Avatar(
space.avatar,
space.displayname,
size: 24,
fontSize: 12,
),
),
label: space.displayname,
))
.toList(),
],
title: Text(space.displayname),
))
.toList(),
],
),
);
}
}

View File

@ -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:

View File

@ -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