Posts

Showing posts with the label Shadow

Adding Shadows At The Bottom Of A Container In Flutter?

Image
Answer : Or you can wrap your Container widget with a Material widget which contains an elevation property to give the shadowy effects. Container( child: Row( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Material( elevation: 15.0, child: Container( height: 100, width: 100, color: Colors.blue, child: Center(child: Text("Material",style: TextStyle(color: Colors.white),)), ), ), SizedBox(width: 100,), Container( height: 100, width: 100, decoration: BoxDecoration( boxShadow: <BoxShadow>[ BoxShadow( color: Colors.black54, blurRadius: 15.0, offset: Offset(0.0, 0.75) ...

Android "elevation" Not Showing A Shadow

Answer : I've been playing around with shadows on Lollipop for a bit and this is what I've found: It appears that a parent ViewGroup 's bounds cutoff the shadow of its children for some reason; and shadows set with android:elevation are cutoff by the View 's bounds, not the bounds extended through the margin; the right way to get a child view to show shadow is to set padding on the parent and set android:clipToPadding="false" on that parent. Here's my suggestion to you based on what I know: Set your top-level RelativeLayout to have padding equal to the margins you've set on the relative layout that you want to show shadow; set android:clipToPadding="false" on the same RelativeLayout ; Remove the margin from the RelativeLayout that also has elevation set; [EDIT] you may also need to set a non-transparent background color on the child layout that needs elevation. At the end of the day, your top-level relative layout sho...