enter image description hereplease can you help me how can I build such a design in Flutter, I actually build the most of it, but the problem is I don’t know how to place the main text "Coffee so good, your taste buds will love it." over the main image as you see here in the photo. I tried Stack but it doesn’t work or I didn’t use it properly. please help me in this, I actually have a problem with flutter layouts I see it a little bit challenging, so any advices ?
and here is my code
class OnBoardingScreen extends StatelessWidget {
const OnBoardingScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
Image(
width: MediaQuery.of(context).size.width,
image: const AssetImage(TImages.onBoardingImage1),
fit: BoxFit.fill,
),
Expanded(
child: Container(
width: THelperFunctions.screenWidth(),
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.bottomCenter,
end: Alignment.topCenter,
colors: [
Colors.black.withOpacity(1),
Colors.black.withOpacity(0.95),
]),
),
child: Column(
children: [
const Text(
'Coffee so good, your taste buds will love it.',
style: TextStyle(
color: TColors.textWhite,
fontSize: 34,
fontWeight: FontWeight.w500,
),
textAlign: TextAlign.center,
),
const Text('sub text'),
ElevatedButton(onPressed: () {}, child: const Text('click'))
],
),
),
),
],
),
);
}
}
I tried to use Stack to solve the problem and position the text but it didn’t work with me
2
Answers
Start from here:
Result :
The full design :