Skip to content

Commit

Permalink
TW-613: Create bottom navigation bar for chat list when active select…
Browse files Browse the repository at this point in the history
…ing mode
  • Loading branch information
nqhhdev committed Sep 20, 2023
1 parent 3e2c245 commit 5d9ccfb
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 0 deletions.
51 changes: 51 additions & 0 deletions lib/pages/chat_list/chat_list_bottom_navigator.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import 'package:fluffychat/pages/chat_list/chat_list_bottom_navigator_style.dart';
import 'package:fluffychat/presentation/enum/chat_list/chat_list_enum.dart';
import 'package:fluffychat/utils/responsive/responsive_utils.dart';
import 'package:flutter/material.dart';

class ChatListBottomNavigator extends StatelessWidget {
const ChatListBottomNavigator({super.key});

@override
Widget build(BuildContext context) {
return Container(
height: ResponsiveUtils.heightBottomNavigation,
padding: ChatListBottomNavigatorStyle.padding,
color: Theme.of(context).colorScheme.surface,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: _getNavigationDestinations.map(
(item) {
return SizedBox(
width: ChatListBottomNavigatorStyle.width,
child: Column(
children: [
Icon(
item.icon(context),
size: ChatListBottomNavigatorStyle.iconSize,
color: Theme.of(context).colorScheme.primary,
),
Text(
item.title(context),
style: Theme.of(context).textTheme.labelMedium?.copyWith(
color: Theme.of(context).colorScheme.primary,
),
),
],
),
);
},
).toList(),
),
);
}

List<ChatListBottomNavigatorBar> get _getNavigationDestinations {
return [
ChatListBottomNavigatorBar.read,
ChatListBottomNavigatorBar.mute,
ChatListBottomNavigatorBar.pin,
ChatListBottomNavigatorBar.more,
];
}
}
11 changes: 11 additions & 0 deletions lib/pages/chat_list/chat_list_bottom_navigator_style.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import 'package:flutter/material.dart';

class ChatListBottomNavigatorStyle {
static const EdgeInsetsDirectional padding = EdgeInsetsDirectional.symmetric(
horizontal: 8,
vertical: 12,
);

static const double width = 86;
static const double iconSize = 24;
}
55 changes: 55 additions & 0 deletions lib/presentation/enum/chat_list/chat_list_enum.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';

enum SelectMode {
normal,
select,
}

enum PopupMenuAction {
settings,
invite,
newGroup,
setStatus,
archive,
}

enum ActiveFilter {
allChats,
groups,
messages,
spaces,
}

enum ChatListBottomNavigatorBar {
read,
mute,
pin,
more;

String title(BuildContext context) {
switch (this) {
case ChatListBottomNavigatorBar.read:
return L10n.of(context)!.contacts;
case ChatListBottomNavigatorBar.mute:
return L10n.of(context)!.mute;
case ChatListBottomNavigatorBar.pin:
return L10n.of(context)!.pin;
case ChatListBottomNavigatorBar.more:
return L10n.of(context)!.more;
}
}

IconData icon(BuildContext context) {
switch (this) {
case ChatListBottomNavigatorBar.read:
return Icons.mark_email_read;
case ChatListBottomNavigatorBar.mute:
return Icons.notifications_off;
case ChatListBottomNavigatorBar.pin:
return Icons.push_pin;
case ChatListBottomNavigatorBar.more:
return Icons.more_vert;
}
}
}

0 comments on commit 5d9ccfb

Please sign in to comment.