import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:lba/gen/assets.gen.dart'; class Bestnearby extends StatelessWidget { const Bestnearby({super.key,}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( backgroundColor: Colors.white, elevation: 2, shadowColor: Colors.grey, automaticallyImplyLeading: false, leading: InkWell( onTap: () => Navigator.pop(context), child: SvgPicture.asset( Assets.icons.back.path, fit: BoxFit.scaleDown, ), ), title: const Text("Top Deals & Stores", style: TextStyle(fontSize: 18)), ), body: SingleChildScrollView( child: Column( children: [ NearbyItems(detailsType: 0), NearbyItems(detailsType: 1), NearbyItems(detailsType: 2) ], ), ), ); } } class NearbyItems extends StatelessWidget { const NearbyItems({super.key, required this.detailsType}); final int detailsType; @override Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.all(8.0), child: Column( children: [ Padding( padding: const EdgeInsets.all(8.0), child: Row( children: [ Text( detailsType==0?"Highest Discount Areas":detailsType==1?"Highest Discount Areas":detailsType==2?"Best Deal, Don't Miss":"", style: TextStyle(fontSize: 15), ), const SizedBox(width: 8), const Expanded( child: Divider(color: Colors.grey, thickness: 2), ), ], ), ), SizedBox( height: detailsType==0?180:detailsType==1?240:detailsType==2?240:200, child: ListView.builder( itemCount: 5, scrollDirection: Axis.horizontal, itemBuilder: (context, index) { return Padding( padding: const EdgeInsets.symmetric(horizontal: 8.0), child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox(height: 7), Container( width: 120, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: Colors.grey[200], ), child: Image.asset( Assets.images.topDealsAndStores.path, ), ), SizedBox(height: 5), Text( "Dubai Outlet Mall", style: TextStyle(fontWeight: FontWeight.bold), ), SizedBox(height: 5), detailsType == 0 ? Row( children: [ SvgPicture.asset(Assets.icons.routing.path), SizedBox(width: 4), Text( "1.2 km away", style: TextStyle(fontSize: 12), ), ], ) : detailsType == 1 ? Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox(height: 2), Row( children: [ SvgPicture.asset(Assets.icons.category2.path), SizedBox(width: 4), Text("Stationery store"), ], ), SizedBox(height: 5), Row( children: [ SvgPicture.asset( Assets.icons.icRoundLocalOffer.path, ), SizedBox(width: 4), Text( "22 - 35% off", style: TextStyle(color: Colors.red), ), ], ), SizedBox(height: 5), Row( children: [ SvgPicture.asset(Assets.icons.routing.path), SizedBox(width: 4), Text("3.6 km away"), ], ), ], ) : detailsType == 2 ? Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox(height: 2), Row( children: [ SvgPicture.asset(Assets.icons.shop2.path), SizedBox(width: 4), Text("Jumbo Electronics "), ], ), SizedBox(height: 5), Row( children: [ SvgPicture.asset( Assets.icons.icRoundLocalOffer.path, ), SizedBox(width: 4), Text( "22 - 35% off", style: TextStyle(color: Colors.red), ), ], ), SizedBox(height: 5), Row( children: [ SvgPicture.asset(Assets.icons.routing.path), SizedBox(width: 4), Text("3.6 km away"), ], ), ], ) : SizedBox(), ], ), ); }, ), ), ], ), ); } }