From e1daf59a40fb159b4ad9d7031cc40a0bc8b79eeb Mon Sep 17 00:00:00 2001 From: Moe Date: Mon, 16 May 2022 10:27:56 +0700 Subject: [PATCH] Add banner image to center (landscape) --- lib/components/bannerimage.dart | 106 ++++++++++++++++---------------- 1 file changed, 54 insertions(+), 52 deletions(-) diff --git a/lib/components/bannerimage.dart b/lib/components/bannerimage.dart index 46b8401..4437eea 100644 --- a/lib/components/bannerimage.dart +++ b/lib/components/bannerimage.dart @@ -7,57 +7,59 @@ class Bannerimage extends StatelessWidget { @override Widget build(BuildContext context) { - return ClipRRect( - borderRadius: const BorderRadius.all(Radius.circular(5.0)), - child: Stack( - children: [ - Container( - padding: const EdgeInsets.all(0.0), - child: Image.asset( - 'assets/images/slider_1.webp', - width: 600.0, - height: 180.0, - fit: BoxFit.fill, - )), - Padding( - padding: const EdgeInsets.only(top: 25.0, left: 10.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Text( - 'SPRING / SUMMER COLLECTION 2022', - style: TextStyle( - color: Colors.black, - fontSize: 10.5, - fontWeight: FontWeight.bold), - ), - const SizedBox( - height: 8.0, - ), - const Text( - 'Get up to 30% off \nNow Arrivals', - style: TextStyle( - color: Colors.black, - fontSize: 20.0, - fontWeight: FontWeight.bold), - ), - const SizedBox( - height: 8.0, - ), - ElevatedButton( - onPressed: () { - Navigator.pushReplacementNamed(context, '/products'); - }, - style: ElevatedButton.styleFrom( - primary: Colors.red, - textStyle: const TextStyle( - fontSize: 14, fontWeight: FontWeight.bold)), - child: const Text('SHOP NOW'), - ), - ]), - ) - ], - )); + return Center( + child: ClipRRect( + borderRadius: const BorderRadius.all(Radius.circular(5.0)), + child: Stack( + children: [ + Container( + padding: const EdgeInsets.all(0.0), + child: Image.asset( + 'assets/images/slider_1.webp', + width: 600.0, + height: 180.0, + fit: BoxFit.fill, + )), + Padding( + padding: const EdgeInsets.only(top: 25.0, left: 10.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text( + 'SPRING / SUMMER COLLECTION 2022', + style: TextStyle( + color: Colors.black, + fontSize: 10.5, + fontWeight: FontWeight.bold), + ), + const SizedBox( + height: 8.0, + ), + const Text( + 'Get up to 30% off \nNow Arrivals', + style: TextStyle( + color: Colors.black, + fontSize: 20.0, + fontWeight: FontWeight.bold), + ), + const SizedBox( + height: 8.0, + ), + ElevatedButton( + onPressed: () { + Navigator.pushReplacementNamed(context, '/products'); + }, + style: ElevatedButton.styleFrom( + primary: Colors.red, + textStyle: const TextStyle( + fontSize: 14, fontWeight: FontWeight.bold)), + child: const Text('SHOP NOW'), + ), + ]), + ) + ], + )), + ); } }