Skip to content

Commit

Permalink
Fixed "A dismissed Dismissible widget is still part of the tree."
Browse files Browse the repository at this point in the history
  • Loading branch information
afjal1 committed Feb 11, 2024
1 parent 515ea08 commit 1155f16
Showing 1 changed file with 34 additions and 34 deletions.
68 changes: 34 additions & 34 deletions lib/widgets/dissmiss_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
)),
);
}
}
}

0 comments on commit 1155f16

Please sign in to comment.