Issue
Flutter need a top shadow, top left and top right shadow line to the half of the container. I have tried with below code .
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Center(
child: Padding(
padding: const EdgeInsets.all(30.0),
child: ClipRRect(
borderRadius: BorderRadius.circular(5.0),
child: Container(
height: 500.0,
margin: const EdgeInsets.only(top: 6.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.vertical(top: Radius.circular(30.0)),
color: Colors.blue,
boxShadow: [
BoxShadow(
color: Colors.grey,
offset: Offset(0.0, 1.0), //(x,y)
blurRadius: 5.0,
),
],
),
),
),
),
),
);
Required out put in the below image
Solution
I just added one container inside another container and put a gradient beginning and ending to top container
Container(
width: 320,
height: 620,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(20.0)),
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.center,
colors: [
Colors.green.shade800,
Colors.white,
Colors.white,
])), child: Container(
width: 310,
height: 610,
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(10)),
color: Colors.white,
),
alignment: Alignment.center,
child: const Text('text'),
) )
Answered By - gopinath
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.