Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Hareesh-Nandigrama committed Aug 7, 2023
1 parent 616812c commit 05b69e8
Showing 1 changed file with 68 additions and 16 deletions.
84 changes: 68 additions & 16 deletions lib/pages/notifications/notifications.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class NotificationPage extends StatefulWidget {
State<NotificationPage> createState() => _NotificationPageState();
}

class _NotificationPageState extends State<NotificationPage> {
class _NotificationPageState extends State<NotificationPage> with TickerProviderStateMixin{

IconData getIcon(bool readNotif) {
if (!readNotif) {
Expand All @@ -30,9 +30,12 @@ class _NotificationPageState extends State<NotificationPage> {
return Icons.brightness_1_outlined;
}

late TabController tabController;

@override
void initState() {
super.initState();
tabController = TabController(length: 2, vsync: this);
}

@override
Expand Down Expand Up @@ -82,23 +85,72 @@ class _NotificationPageState extends State<NotificationPage> {
}
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
children: [
for(NotifsModel notif in snapshot.data!["userPersonalNotifs"]!)
Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0),
child: NotificationTile(
notifModel: notif,
),
child: SingleChildScrollView(
child: Column(
children: [
TabBar(
indicatorColor: Colors.white,
controller: tabController,
onTap: (int index){
if(index == 0)
{
store.isPersonalNotif = true;
}
else
{
store.isPersonalNotif = false;

}
},
tabs: [
Tab(
child: Text(
'Personal',
style: TextStyle(
color: Colors.white,
fontSize: 14,
fontWeight: FontWeight.w500),
)),
Tab(
child: Text(
'General',
style: TextStyle(
color: Colors.white,
fontSize: 14,
fontWeight: FontWeight.w500),
)),
],
),
for(NotifsModel notif in snapshot.data!["allTopicNotifs"]!)
Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0),
child: NotificationTile(
notifModel: notif,
),
SizedBox(
height: 10,
),
],
Observer(builder: (context){
return store.isPersonalNotif ? Column(
children: [
for(NotifsModel notif in snapshot.data!["userPersonalNotifs"]!)
Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0),
child: NotificationTile(
notifModel: notif,
),
),
],
): Column(
children: [
for(NotifsModel notif in snapshot.data!["allTopicNotifs"]!)
Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0),
child: NotificationTile(
notifModel: notif,
),
),
],
);
}),


],
),
),
);
}
Expand Down

0 comments on commit 05b69e8

Please sign in to comment.