From e942957a47a7a81c87188db6b0b2d6e21b2a8520 Mon Sep 17 00:00:00 2001 From: raf-dev1 Date: Wed, 18 Jun 2025 12:49:58 +0300 Subject: [PATCH] enhance it Done and yazan has watched it --- lib/pages/home/view/home_card.dart | 83 ++++++++++++++++++++++---- lib/pages/home/view/home_page_web.dart | 2 +- 2 files changed, 73 insertions(+), 12 deletions(-) diff --git a/lib/pages/home/view/home_card.dart b/lib/pages/home/view/home_card.dart index 4fbe1aa8..0861452c 100644 --- a/lib/pages/home/view/home_card.dart +++ b/lib/pages/home/view/home_card.dart @@ -34,17 +34,9 @@ class HomeCard extends StatelessWidget { child: Row( mainAxisAlignment: MainAxisAlignment.start, children: [ - Flexible( - child: FittedBox( - fit: BoxFit.scaleDown, - child: Text( - name, - style: const TextStyle( - fontSize: 30, - color: Colors.white, - fontWeight: FontWeight.bold, - ), - ), + Expanded( + child: SpliteNameHelperWidget( + name: name, ), ), ], @@ -63,3 +55,72 @@ class HomeCard extends StatelessWidget { ); } } + +class SpliteNameHelperWidget extends StatelessWidget { + final String name; + const SpliteNameHelperWidget({ + super.key, + required this.name, + }); + + @override + Widget build(BuildContext context) { + List parts = name.split(' '); + + if (parts.length == 2) { + // Two-word string + return Padding( + padding: const EdgeInsetsGeometry.only(top: 10, left: 10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: FittedBox( + fit: BoxFit.scaleDown, + child: Text( + parts[0], + style: const TextStyle( + fontSize: 30, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + Expanded( + child: FittedBox( + fit: BoxFit.scaleDown, + child: Text( + parts[1], + style: const TextStyle( + fontSize: 30, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + ], + ), + ); + } else { + // One-word string + return Text( + name, + style: const TextStyle( + fontSize: 30, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ); + } + } +} +// Text( +// name, +// style: const TextStyle( +// fontSize: 32, +// color: Colors.white, +// fontWeight: FontWeight.bold, +// ), +// ) diff --git a/lib/pages/home/view/home_page_web.dart b/lib/pages/home/view/home_page_web.dart index 1be60c39..ea211ac5 100644 --- a/lib/pages/home/view/home_page_web.dart +++ b/lib/pages/home/view/home_page_web.dart @@ -92,7 +92,7 @@ class _HomeWebPageState extends State { flex: 4, child: SizedBox( height: size.height * 0.6, - width: size.width * 0.68, + width: size.width * 0.8, child: GridView.builder( itemCount: homeBloc.homeItems.length, gridDelegate: