buildAppBar method
Implementation
AppBar buildAppBar(BuildContext context) {
var unreadCount = widget.fynoInApp.fynoInAppState.unreadCount.toString();
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
return AppBar(
leading: BackButton(
onPressed: () => {
widget.onClick(),
Navigator.pop(context),
if (mounted)
{
setState(() {}),
}
},
),
iconTheme: IconThemeData(
color: isDarkMode
? widget.themeConfig?.darkText ?? Colors.white
: widget.themeConfig?.lightText ?? Colors.black),
backgroundColor: isDarkMode
? widget.themeConfig?.darkBackground ?? Colors.black
: widget.themeConfig?.lightBackground ?? Colors.white,
title: Text(
'Notifications',
style: TextStyle(
color: isDarkMode
? widget.themeConfig?.darkText ?? Colors.white
: widget.themeConfig?.lightText ?? Colors.black,
),
),
actions: [
if (widget.fynoInApp.fynoInAppState.unreadList.isNotEmpty)
IconButton(
onPressed: () {
_showConfirmationDialog(
'Mark All as Read',
'Are you sure you want to mark all notifications as read?',
() {
handleAction('markAllAsRead');
},
);
},
icon: Icon(Icons.done_all),
),
if (widget.fynoInApp.fynoInAppState.list.isNotEmpty)
IconButton(
onPressed: () {
_showConfirmationDialog(
'Delete All',
'Are you sure you want to delete all notifications?',
() {
handleAction('deleteAll');
},
);
},
icon: Icon(Icons.delete_sweep),
),
],
bottom: TabBar(
labelColor: isDarkMode
? widget.themeConfig?.darkText ?? Colors.white
: widget.themeConfig?.lightText ?? Colors.black,
unselectedLabelColor: isDarkMode
? widget.themeConfig?.darkText ?? Colors.white
: widget.themeConfig?.lightText ?? Colors.black,
tabs: [
Tab(text: 'All'),
Tab(text: 'Unread ($unreadCount)'),
],
),
);
}