notification fixed

This commit is contained in:
Rajshinde046
2024-04-16 19:39:01 +05:30
parent f9d4532884
commit 0b908dc6c6
6 changed files with 50 additions and 42 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

View File

@@ -146,7 +146,7 @@ GlassmorphicContainer bottomnavigationbar(MainController _mainController) {
), ),
BottomNavigationBarItem( BottomNavigationBarItem(
icon: Image.asset( icon: Image.asset(
'assets/images/png/sidemenu/inactiveshorttrade.png', 'assets/images/png/sidemenu/past perfomance icon.png',
height: 26.h, height: 26.h,
width: 26.w, width: 26.w,
), ),

View File

@@ -27,6 +27,11 @@ class ContentBytesController extends GetxController {
final buttonNotifier = ValueNotifier<ButtonState>(ButtonState.paused); final buttonNotifier = ValueNotifier<ButtonState>(ButtonState.paused);
late AudioPlayer _audioPlayer; late AudioPlayer _audioPlayer;
@override
void dispose() {
_audioPlayer.stop();
super.dispose();
}
void getAudio() => _audioPlayer; void getAudio() => _audioPlayer;

View File

@@ -17,6 +17,24 @@ class NotificationScreen extends StatefulWidget {
class _NotificationScreenState extends State<NotificationScreen> { class _NotificationScreenState extends State<NotificationScreen> {
StreamController<GetNotification> NotificationController = StreamController(); StreamController<GetNotification> NotificationController = StreamController();
late Timer timer;
@override
void initState() {
// timer = Timer.periodic(Duration(seconds: 2), (timer) {
NotificationsAPI().notificationList(streamControl: NotificationController);
// });
super.initState();
}
@override
void dispose() {
// TODO: implement dispose
NotificationController.close();
timer.cancel();
super.dispose();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@@ -26,7 +44,9 @@ class _NotificationScreenState extends State<NotificationScreen> {
stream: NotificationController.stream, stream: NotificationController.stream,
builder: (ctx, snapshot) { builder: (ctx, snapshot) {
if (snapshot.data == null) { if (snapshot.data == null) {
return Text("data"); return Center(
child: text25W600("No Notification!"),
);
} }
if (snapshot.connectionState == ConnectionState.done) { if (snapshot.connectionState == ConnectionState.done) {
if (snapshot.hasError) { if (snapshot.hasError) {
@@ -78,7 +98,7 @@ class _NotificationScreenState extends State<NotificationScreen> {
Row( Row(
children: [ children: [
CircleAvatar( CircleAvatar(
backgroundImage: AssetImage(profileimg), backgroundImage: NetworkImage(profileimg),
radius: 26.5.r, radius: 26.5.r,
), ),
sizedBoxWidth(12.w), sizedBoxWidth(12.w),
@@ -107,51 +127,28 @@ class _NotificationScreenState extends State<NotificationScreen> {
child: text25W600('Notifications'), child: text25W600('Notifications'),
), ),
sizedBoxHeight(40.h), sizedBoxHeight(40.h),
Padding(
padding: EdgeInsets.only(left: 16.w),
child: text16W400('Today'),
),
sizedBoxHeight(25.h),
notificationCard(
profileimg: 'assets/images/png/Ellipse 591.png',
title: 'Mokshada Kesarkar',
subtitle: 'Lorem ipsum dolor sit amet cons......',
time: '30 mins ago'),
Container(
height: 1,
margin: EdgeInsets.symmetric(vertical: 20.h),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Color.fromRGBO(176, 176, 176, 0.5),
width: 1,
),
),
),
),
notificationCard(
profileimg: 'assets/images/png/Ellipse 588.png',
title: 'Mokshada Kesarkar',
subtitle: 'Lorem ipsum dolor sit amet cons......',
time: '1 Hour ago'),
sizedBoxHeight(30.h),
Padding(
padding: EdgeInsets.only(left: 16.w),
child: text16W400('Yesterday'),
),
sizedBoxHeight(30.h),
ListView.builder( ListView.builder(
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
itemCount: CardList.length, itemCount: notificationobj!.data!.list!.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return Column( return Column(
children: [ children: [
notificationCard( notificationCard(
profileimg: CardList[index]['profileimg']!, profileimg: notificationobj!.data!.list!
title: CardList[index]['title']!, .elementAt(index)
subtitle: CardList[index]['subtitle']!, .notificationImage!,
time: CardList[index]['time']!), title: notificationobj!.data!.list!
.elementAt(index)
.notificationMessage!,
subtitle: notificationobj!.data!.list!
.elementAt(index)
.messageName ??
"",
time: notificationobj!.data!.list!
.elementAt(index)
.deliverySchedule ??
""),
if (index != CardList.length - 1) if (index != CardList.length - 1)
Container( Container(
height: 1, height: 1,

View File

@@ -71,6 +71,12 @@ class _ContentBytesState extends State<ContentBytes> {
super.initState(); super.initState();
} }
@override
void dispose() {
contentBytesController.stop();
super.dispose();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WillPopScope( return WillPopScope(

View File

@@ -4,7 +4,7 @@ import 'package:traderscircuit/Utils/base_manager.dart';
import 'package:traderscircuit/data/network/network_api_services.dart'; import 'package:traderscircuit/data/network/network_api_services.dart';
import 'package:traderscircuit/model/Notification/notification_model.dart'; import 'package:traderscircuit/model/Notification/notification_model.dart';
GetNotification? notificationobj; GetNotification?notificationobj;
class NotificationsAPI { class NotificationsAPI {
Future<ResponseData<dynamic>> notificationList( Future<ResponseData<dynamic>> notificationList(