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