From 1155f160ecd9c2fba1629e0ded64d9230f3e38d1 Mon Sep 17 00:00:00 2001 From: afjal1 Date: Sun, 11 Feb 2024 23:56:36 +0530 Subject: [PATCH] Fixed "A dismissed Dismissible widget is still part of the tree." --- lib/widgets/dissmiss_widget.dart | 68 ++++++++++++++++---------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/lib/widgets/dissmiss_widget.dart b/lib/widgets/dissmiss_widget.dart index 627654d..f9c2bf1 100644 --- a/lib/widgets/dissmiss_widget.dart +++ b/lib/widgets/dissmiss_widget.dart @@ -3,15 +3,14 @@ import 'package:jobhunt_mobile/utility/color_util.dart'; import 'package:jobhunt_mobile/widgets/anim_widget.dart'; class JobSlideWidget extends StatelessWidget { - const JobSlideWidget({ - super.key, - required this.jobKey, - this.index, - required this.child, - required this.icon, - this.primaryColor, - this.onDismissed - }); + const JobSlideWidget( + {super.key, + required this.jobKey, + this.index, + required this.child, + required this.icon, + this.primaryColor, + this.onDismissed}); final Key jobKey; final IconData icon; @@ -23,42 +22,43 @@ class JobSlideWidget extends StatelessWidget { @override Widget build(BuildContext context) { return AnimationFadeSlide( - dx: index != null ? 0.05*index! : 0.3, - duration: index != null ? 150*index! : 300, - child: Dismissible( - key: jobKey, + dx: index != null ? 0.05 * index! : 0.3, + duration: index != null ? 150 * index! : 300, + child: Dismissible( + key: UniqueKey(), background: Container( - color : primaryColor != null ? primaryColor!.withOpacity(0.25) : Theme.of(context).primaryColor.withOpacity(0.25), - child: Icon(icon , color: Theme.of(context).primaryColor), + color: primaryColor != null + ? primaryColor!.withOpacity(0.25) + : Theme.of(context).primaryColor.withOpacity(0.25), + child: Icon(icon, color: Theme.of(context).primaryColor), alignment: Alignment.centerLeft, padding: EdgeInsets.only(left: 20.0), ), secondaryBackground: Container( - color: primaryColor ?? Theme.of(context).primaryColor.withOpacity(0.25), + color: primaryColor ?? + Theme.of(context).primaryColor.withOpacity(0.25), child: Icon(icon, color: Theme.of(context).primaryColor), alignment: Alignment.centerRight, padding: EdgeInsets.only(right: 20.0), ), dismissThresholds: { - DismissDirection.endToStart : 0.25, - DismissDirection.startToEnd : 0.25, + DismissDirection.endToStart: 0.25, + DismissDirection.startToEnd: 0.25, }, onDismissed: onDismissed, - child:Card( - elevation: 5, - shadowColor: ColorUtil.isDarkMode(context) ? - Colors.black54: Colors.grey.shade50, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(6), - topRight: Radius.circular(16), - bottomLeft: Radius.circular(16), - bottomRight: Radius.circular(6) - ) - ), - child: child, - ) - ), + child: Card( + elevation: 5, + shadowColor: ColorUtil.isDarkMode(context) + ? Colors.black54 + : Colors.grey.shade50, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(6), + topRight: Radius.circular(16), + bottomLeft: Radius.circular(16), + bottomRight: Radius.circular(6))), + child: child, + )), ); } -} \ No newline at end of file +}