From 17e76d2e775eb02ecaa644a445d8d3c3939f399e Mon Sep 17 00:00:00 2001 From: krishnajithapa Date: Sun, 2 Jul 2023 18:04:06 +0545 Subject: [PATCH 1/2] Add widgetBoxShadow paramter to pass boxshadow for individual child to use when children is passed --- lib/image_stack.dart | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/lib/image_stack.dart b/lib/image_stack.dart index 18eafc1..38a493a 100644 --- a/lib/image_stack.dart +++ b/lib/image_stack.dart @@ -61,6 +61,9 @@ class ImageStack extends StatelessWidget { /// Optional field to set the color of circular border when [children] is passed final Color? widgetBorderColor; + /// Optional field to set the box shadow for individual child when [children] is passed + final BoxShadow? widgetBoxShadow; + /// List of `ImageProvider` final List providers; @@ -78,6 +81,7 @@ class ImageStack extends StatelessWidget { required this.totalCount, this.imageBorderWidth = 2, this.imageBorderColor = Colors.grey, + this.widgetBoxShadow, this.imageSource = ImageSource.Network, this.showTotalCount = true, this.extraCountTextStyle = const TextStyle( @@ -105,6 +109,7 @@ class ImageStack extends StatelessWidget { required this.totalCount, this.widgetBorderWidth = 2, Color this.widgetBorderColor = Colors.grey, + this.widgetBoxShadow, this.showTotalCount = true, this.extraCountTextStyle = const TextStyle( color: Colors.black, @@ -131,6 +136,7 @@ class ImageStack extends StatelessWidget { this.imageCount = 3, required this.totalCount, this.imageBorderWidth = 2, + this.widgetBoxShadow, this.imageBorderColor = Colors.grey, this.showTotalCount = true, this.extraCountTextStyle = const TextStyle( @@ -228,6 +234,7 @@ class ImageStack extends StatelessWidget { color: widgetBorderColor!, width: widgetBorderWidth!, ), + boxShadow: [widgetBoxShadow ?? const BoxShadow()], ), child: ClipRRect( borderRadius: BorderRadius.circular(widgetRadius!), @@ -241,13 +248,13 @@ class ImageStack extends StatelessWidget { height: imageRadius, width: imageRadius, decoration: BoxDecoration( - shape: BoxShape.circle, - color: backgroundColor, - border: Border.all( - color: imageBorderColor!, - width: imageBorderWidth!, - ), - ), + shape: BoxShape.circle, + color: backgroundColor, + border: Border.all( + color: imageBorderColor!, + width: imageBorderWidth!, + ), + boxShadow: [widgetBoxShadow ?? BoxShadow()]), child: Container( decoration: BoxDecoration( shape: BoxShape.circle, @@ -265,13 +272,13 @@ class ImageStack extends StatelessWidget { height: imageRadius, width: imageRadius, decoration: BoxDecoration( - shape: BoxShape.circle, - color: backgroundColor, - border: Border.all( - color: imageBorderColor!, - width: imageBorderWidth!, - ), - ), + shape: BoxShape.circle, + color: backgroundColor, + border: Border.all( + color: imageBorderColor!, + width: imageBorderWidth!, + ), + boxShadow: [widgetBoxShadow ?? const BoxShadow()]), child: Container( decoration: BoxDecoration( shape: BoxShape.circle, From d39389b3978d55a7edd47f3717e5f0419900a4d9 Mon Sep 17 00:00:00 2001 From: krishnajithapa Date: Sun, 2 Jul 2023 18:20:35 +0545 Subject: [PATCH 2/2] Update widgetBoxShadow parameter to accept list of box shadow. --- lib/image_stack.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/image_stack.dart b/lib/image_stack.dart index 38a493a..6bcde7e 100644 --- a/lib/image_stack.dart +++ b/lib/image_stack.dart @@ -62,7 +62,7 @@ class ImageStack extends StatelessWidget { final Color? widgetBorderColor; /// Optional field to set the box shadow for individual child when [children] is passed - final BoxShadow? widgetBoxShadow; + final List? widgetBoxShadow; /// List of `ImageProvider` final List providers; @@ -234,7 +234,7 @@ class ImageStack extends StatelessWidget { color: widgetBorderColor!, width: widgetBorderWidth!, ), - boxShadow: [widgetBoxShadow ?? const BoxShadow()], + boxShadow: widgetBoxShadow, ), child: ClipRRect( borderRadius: BorderRadius.circular(widgetRadius!), @@ -254,7 +254,7 @@ class ImageStack extends StatelessWidget { color: imageBorderColor!, width: imageBorderWidth!, ), - boxShadow: [widgetBoxShadow ?? BoxShadow()]), + boxShadow: widgetBoxShadow), child: Container( decoration: BoxDecoration( shape: BoxShape.circle, @@ -278,7 +278,7 @@ class ImageStack extends StatelessWidget { color: imageBorderColor!, width: imageBorderWidth!, ), - boxShadow: [widgetBoxShadow ?? const BoxShadow()]), + boxShadow: widgetBoxShadow), child: Container( decoration: BoxDecoration( shape: BoxShape.circle,