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

View File

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

View File

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

View File

@@ -17,6 +17,24 @@ class NotificationScreen extends StatefulWidget {
class _NotificationScreenState extends State<NotificationScreen> {
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
Widget build(BuildContext context) {
return Scaffold(
@@ -26,7 +44,9 @@ class _NotificationScreenState extends State<NotificationScreen> {
stream: NotificationController.stream,
builder: (ctx, snapshot) {
if (snapshot.data == null) {
return Text("data");
return Center(
child: text25W600("No Notification!"),
);
}
if (snapshot.connectionState == ConnectionState.done) {
if (snapshot.hasError) {
@@ -78,7 +98,7 @@ class _NotificationScreenState extends State<NotificationScreen> {
Row(
children: [
CircleAvatar(
backgroundImage: AssetImage(profileimg),
backgroundImage: NetworkImage(profileimg),
radius: 26.5.r,
),
sizedBoxWidth(12.w),
@@ -107,51 +127,28 @@ class _NotificationScreenState extends State<NotificationScreen> {
child: text25W600('Notifications'),
),
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(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: CardList.length,
itemCount: notificationobj!.data!.list!.length,
itemBuilder: (context, index) {
return Column(
children: [
notificationCard(
profileimg: CardList[index]['profileimg']!,
title: CardList[index]['title']!,
subtitle: CardList[index]['subtitle']!,
time: CardList[index]['time']!),
profileimg: notificationobj!.data!.list!
.elementAt(index)
.notificationImage!,
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)
Container(
height: 1,

View File

@@ -71,6 +71,12 @@ class _ContentBytesState extends State<ContentBytes> {
super.initState();
}
@override
void dispose() {
contentBytesController.stop();
super.dispose();
}
@override
Widget build(BuildContext context) {
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/model/Notification/notification_model.dart';
GetNotification? notificationobj;
GetNotification?notificationobj;
class NotificationsAPI {
Future<ResponseData<dynamic>> notificationList(