Skip to content

Commit

Permalink
feat: Added notification pop access in all the pages
Browse files Browse the repository at this point in the history
  • Loading branch information
pratikbaid3 committed Aug 7, 2021
1 parent 2f02d3d commit 9aad8f9
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 20 deletions.
65 changes: 46 additions & 19 deletions lib/Components/base_app_bar.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import 'package:badges/badges.dart';
import 'package:flood_mobile/Constants/app_color.dart';
import 'package:flood_mobile/Provider/home_provider.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import 'notification_popup_dialogue_container.dart';

class BaseAppBar extends StatelessWidget implements PreferredSizeWidget {
final AppBar appBar;
Expand All @@ -8,27 +13,49 @@ class BaseAppBar extends StatelessWidget implements PreferredSizeWidget {

@override
Widget build(BuildContext context) {
return AppBar(
title: Image(
image: AssetImage(
'assets/images/icon.png',
),
width: 60,
height: 60,
),
centerTitle: true,
backgroundColor: AppColor.primaryColor,
elevation: 0,
actions: [
IconButton(
icon: Icon(
Icons.notifications,
color: Colors.white,
return Consumer<HomeProvider>(builder: (context, homeModel, child) {
return AppBar(
title: Image(
image: AssetImage(
'assets/images/icon.png',
),
onPressed: () {},
width: 60,
height: 60,
),
],
);
centerTitle: true,
backgroundColor: AppColor.primaryColor,
elevation: 0,
actions: [
Badge(
badgeColor: AppColor.blueAccentColor,
badgeContent: Center(
child: Text(
homeModel.unreadNotifications.toString(),
style: TextStyle(color: Colors.white),
),
),
position: BadgePosition(top: 0, end: 3),
child: IconButton(
icon: Icon(
Icons.notifications,
color: Colors.white,
),
onPressed: () {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
backgroundColor: AppColor.secondaryColor,
content: notificationPopupDialogueContainer(
context: context),
);
});
},
),
),
],
);
});
}

@override
Expand Down
6 changes: 5 additions & 1 deletion lib/Constants/event_names.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ class Events {
//Transfer rate
static const String TRANSFER_SUMMARY_DIFF_CHANGE =
'TRANSFER_SUMMARY_DIFF_CHANGE';

//Full list of torrents
static const String TORRENT_LIST_FULL_UPDATE = 'TORRENT_LIST_FULL_UPDATE';

//Change in the torrent list
static const String TORRENT_LIST_DIFF_CHANGE = 'TORRENT_LIST_DIFF_CHANGE';
static const String NOTIFICATION_COUNT_CHANGE='NOTIFICATION_COUNT_CHANGE';

//Notifications count changed
static const String NOTIFICATION_COUNT_CHANGE = 'NOTIFICATION_COUNT_CHANGE';
}

0 comments on commit 9aad8f9

Please sign in to comment.