Question:
I am working on a Flutter project and aiming to replicate the design shown in the following image:
How can I achieve a similar layout and design in Flutter? Below is the code I have tried so far:
CODE I TRIED:
import 'package:flutter/material.dart';
class OnboardingScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
ClipPath(
clipper: InverseWaveClipper(),
child: Container(
color: Colors.green,
height: MediaQuery.of(context).size.height *
0.5,
width: double.infinity,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"أهلاً",
style: TextStyle(
color: Colors.white,
fontSize: 30,
fontWeight: FontWeight.bold,
),
),
Text(
"مرحباً بك في فيت بوكس",
style: TextStyle(
color: Colors.white,
fontSize: 20,
),
),
],
),
),
),
),
Expanded(
child: Container(
color: Colors.white,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"قبل أن نبدأ الرحله،",
style: TextStyle(
color: Colors.black,
fontSize: 24,
fontWeight: FontWeight.bold,
),
),
Text(
"دعونا نتحدث",
style: TextStyle(
color: Colors.black,
fontSize: 20,
),
),
SizedBox(height: 20),
TextField(
decoration: InputDecoration(
hintText: "أدخل اسمك",
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
),
),
),
SizedBox(height: 20),
ElevatedButton(
onPressed: () {},
child: Text("التالي"),
),
],
),
),
),
),
],
),
);
}
}
class InverseWaveClipper extends CustomClipper<Path> {
@override
Path getClip(Size size) {
var path = Path();
path.lineTo(0, size.height - 60);
var controlPoint1 = Offset(size.width / 4, size.height - 100);
var endPoint1 = Offset(size.width / 2, size.height - 60);
path.quadraticBezierTo(
controlPoint1.dx, controlPoint1.dy, endPoint1.dx, endPoint1.dy);
var controlPoint2 = Offset(size.width * 3 / 4, size.height - 20);
var endPoint2 = Offset(size.width, size.height - 60);
path.quadraticBezierTo(
controlPoint2.dx, controlPoint2.dy, endPoint2.dx, endPoint2.dy);
path.lineTo(size.width, 0);
path.close();
return path;
}
@override
bool shouldReclip(CustomClipper<Path> oldClipper) {
return false;
}
}
I'm stucked in this problem, Any guidance or suggestions would be greatly appreciated!
I have created a custom layout by trying below code
body: Container(
color: Colors.white,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
decoration: BoxDecoration(
color: Colors.green,
borderRadius:
BorderRadius.only(bottomRight: Radius.circular(100))),
height: 200,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [Text("your text"), Text("your text")],
)),
),
Container(
color: Colors.green,
width: 81,
child: Row(
children: [
Container(
decoration: BoxDecoration(
color: Colors.green,
),
height: 100,
width: 1),
Container(
height: 100,
width: 80,
decoration: BoxDecoration(
color: Colors.white,
borderRadius:
BorderRadius.only(topLeft: Radius.circular(100))),
),
],
),
),
Container(
width: MediaQuery.of(context).size.width,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("your text"),
SizedBox(height: 100),
Text("your text")
],
))
],
),
),
Change height, width and border radius as your requirement.