Skip to content

Commit

Permalink
bruig: Add new message and group chat to mobile chats lists
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlyp authored Feb 23, 2024
1 parent 7f33f4a commit e3c7ea0
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 78 deletions.
78 changes: 55 additions & 23 deletions bruig/flutterui/bruig/lib/components/chats_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ class _ChatsListState extends State<_ChatsList> {
var darkTextColor = theme.dividerColor;
var selectedBackgroundColor = theme.highlightColor;
var backgroundColor = theme.backgroundColor;
var newMessageHoverColor = theme.indicatorColor;

var sortedList = client.sortedChats.toList();

Expand All @@ -307,29 +308,60 @@ class _ChatsListState extends State<_ChatsList> {
if (isScreenSmall) {
return Consumer<ThemeNotifier>(
builder: (context, theme, _) => Container(
margin: const EdgeInsets.all(1),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(3),
color: backgroundColor),
padding: const EdgeInsets.all(0),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Container(
padding: const EdgeInsets.only(
left: 0, right: 5, top: 5, bottom: 5),
child: ListView.builder(
physics: const ScrollPhysics(),
controller: sortedListScroll,
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: sortedList.length,
itemBuilder: (context, index) =>
_ChatHeadingW(sortedList[index], client,
makeActive, showSubMenu)))),
]),
));
margin: const EdgeInsets.all(1),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(3),
color: backgroundColor),
padding: const EdgeInsets.all(0),
child: Stack(children: [
Expanded(
child: Container(
padding: const EdgeInsets.only(
left: 0, right: 5, top: 5, bottom: 5),
child: ListView.builder(
physics: const ScrollPhysics(),
controller: sortedListScroll,
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: sortedList.length,
itemBuilder: (context, index) => _ChatHeadingW(
sortedList[index],
client,
makeActive,
showSubMenu)))),
Positioned(
bottom: 20,
right: 10,
child: Material(
borderRadius: BorderRadius.circular(30),
color: selectedBackgroundColor,
child: IconButton(
hoverColor: newMessageHoverColor.withOpacity(0.25),
splashRadius: 28,
iconSize: 40,
tooltip: "New Message",
onPressed: showAddressBook,
icon: Icon(
size: 40,
color: darkTextColor,
Icons.edit_outlined)))),
Positioned(
bottom: 90,
right: 10,
child: Material(
borderRadius: BorderRadius.circular(30),
color: selectedBackgroundColor,
child: IconButton(
hoverColor: newMessageHoverColor.withOpacity(0.25),
splashRadius: 28,
iconSize: 40,
tooltip: "Create new group chat",
onPressed: showGroupChat,
icon: Icon(
size: 40,
color: darkTextColor,
Icons.people_outline)))),
])));
}
return Consumer<ThemeNotifier>(
builder: (context, theme, _) => Container(
Expand Down
120 changes: 65 additions & 55 deletions bruig/flutterui/bruig/lib/screens/overview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,7 @@ class _OverviewScreenState extends State<OverviewScreen> {
padding: const EdgeInsets.all(3),
child: menuItem.icon),
title: Consumer<ThemeNotifier>(
builder: (context, theme, child) => Text(
menuItem.label,
builder: (context, theme, _) => Text(menuItem.label,
style: TextStyle(
fontSize: theme.getMediumFont(context)))))
: Theme(
Expand Down Expand Up @@ -523,59 +522,70 @@ class _OverviewScreenState extends State<OverviewScreen> {
)
])),
bottomNavigationBar: isScreenSmall && !removeBottomBar
? BottomNavigationBar(
iconSize: 40,
items: <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: client.hasUnreadChats
? Stack(children: [
Container(
padding: const EdgeInsets.all(3),
child: const SidebarSvgIcon(
"assets/icons/icons-menu-chat.svg")),
const Positioned(
top: 1,
right: 1,
child: CircleAvatar(
backgroundColor: Colors.red, radius: 4)),
])
: Container(
padding: const EdgeInsets.all(3),
child: const SidebarSvgIcon(
"assets/icons/icons-menu-chat.svg")),
label: 'Chat',
),
BottomNavigationBarItem(
icon: widget.feed.hasUnreadPostsComments
? Stack(children: [
Container(
padding: const EdgeInsets.all(3),
child: const SidebarSvgIcon(
"assets/icons/icons-menu-news.svg")),
const Positioned(
top: 1,
right: 1,
child: CircleAvatar(
backgroundColor: Colors.red, radius: 4)),
])
: Container(
padding: const EdgeInsets.all(3),
child: const SidebarSvgIcon(
"assets/icons/icons-menu-news.svg")),
label: 'Feed',
),
BottomNavigationBarItem(
icon: Container(
padding: const EdgeInsets.all(3),
child: const SidebarSvgIcon(
"assets/icons/icons-menu-pages.svg")),
label: 'Pages',
),
],

currentIndex: selectedIndex, //New
onTap: _onItemTapped, //New
)
? Consumer<ThemeNotifier>(
builder: (context, theme, _) => BottomNavigationBar(
selectedFontSize: theme.getLargeFont(context),
unselectedFontSize: theme.getMediumFont(context),
selectedItemColor: selectedColor,
unselectedItemColor: unselectedTextColor,
selectedLabelStyle:
const TextStyle(fontWeight: FontWeight.w700),
unselectedLabelStyle:
const TextStyle(fontWeight: FontWeight.w200),
iconSize: 40,
items: <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: client.hasUnreadChats
? Stack(children: [
Container(
padding: const EdgeInsets.all(3),
child: const SidebarSvgIcon(
"assets/icons/icons-menu-chat.svg")),
const Positioned(
top: 1,
right: 1,
child: CircleAvatar(
backgroundColor: Colors.red,
radius: 4)),
])
: Container(
padding: const EdgeInsets.all(3),
child: const SidebarSvgIcon(
"assets/icons/icons-menu-chat.svg")),
label: 'Chat',
),
BottomNavigationBarItem(
icon: widget.feed.hasUnreadPostsComments
? Stack(children: [
Container(
padding: const EdgeInsets.all(3),
child: const SidebarSvgIcon(
"assets/icons/icons-menu-news.svg")),
const Positioned(
top: 1,
right: 1,
child: CircleAvatar(
backgroundColor: Colors.red,
radius: 4)),
])
: Container(
padding: const EdgeInsets.all(3),
child: const SidebarSvgIcon(
"assets/icons/icons-menu-news.svg")),
label: 'Feed',
),
BottomNavigationBarItem(
icon: Container(
padding: const EdgeInsets.all(3),
child: const SidebarSvgIcon(
"assets/icons/icons-menu-pages.svg")),
label: 'Pages',
),
],

currentIndex: selectedIndex, //New
onTap: _onItemTapped, //New
))
: null,
);
}
Expand Down

0 comments on commit e3c7ea0

Please sign in to comment.