I want to achieve the attached UI widget using custom paint or any other suitable way around, which should work well across different device sizes. image
In Flutter, how do we achieve this UI using custom paint or a custom clipper?
126 Views Asked by sinnoor c At
2
There are 2 best solutions below
0
On
Similar approach like Niladri Raychaudhuri with Stack and Positioned but I used Card widget for elevation and Container for border.
Center(
child: Stack(
clipBehavior: Clip.none,
alignment: Alignment.topCenter,
children: [
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
elevation: 5.0,
child: Container(
height: 200,
width: MediaQuery.of(context).size.width * .75,
decoration: BoxDecoration(
color: Colors.orange.shade100,
borderRadius: BorderRadius.circular(20),
border: Border.all(color: Colors.orange.shade300)
),
),
),
Positioned(
top: -25,
child: Card(
color: Colors.white,
elevation: 5.0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(100),
),
child: const Padding(
padding: EdgeInsets.all(5.0),
child: CircleAvatar(
backgroundColor: Colors.orangeAccent,
radius: 25,
child: Icon(Icons.check,size: 35,color: Colors.black,),
),
),
),
),
],
),
)

You could use
StackwithPositioned.fillandAlignwidget as below: