From e52db038f4f34fad9b459e591797a3166d8f6c7f Mon Sep 17 00:00:00 2001 From: Phani Pavan K Date: Thu, 14 Nov 2024 09:37:23 +0530 Subject: [PATCH] Added date pretty print --- lib/models/globalModel.dart | 4 ++++ lib/views/homePage.dart | 35 ++++++++++++++++++++++------------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/lib/models/globalModel.dart b/lib/models/globalModel.dart index 558d902..0a1ece0 100644 --- a/lib/models/globalModel.dart +++ b/lib/models/globalModel.dart @@ -157,6 +157,10 @@ class GlobalModel extends ChangeNotifier { return DateFormat("dd-MM-yyyy").format(this.currentDate); } + String get prettyDate { + return DateFormat("EEE, MMM d").format(this.currentDate); + } + void incrDate() { this.currentDate = this.currentDate.add(const Duration(days: 1)); this.isMenuAvailable(); diff --git a/lib/views/homePage.dart b/lib/views/homePage.dart index 8368b90..455733f 100644 --- a/lib/views/homePage.dart +++ b/lib/views/homePage.dart @@ -30,8 +30,8 @@ class HomePage extends StatelessWidget { child: ListView( children: [ ListTile( - leading: Icon(Icons.arrow_back), - title: Text("Menu"), + leading: const Icon(Icons.arrow_back), + title: const Text("Menu"), onTap: () { Navigator.pop(context); }), @@ -69,7 +69,7 @@ class HomePage extends StatelessWidget { title: Text(data.menuTime), bottom: TabBar( controller: cont, - // splashFactory: InkSplash.splashFactory, + splashFactory: NoSplash.splashFactory, // indicator: const UnderlineTabIndicator( // insets: EdgeInsets.fromLTRB(10, 3, 10, 3)), onTap: (int index) { @@ -87,9 +87,14 @@ class HomePage extends StatelessWidget { onTap: () { data.updateCall(); }, - child: Icon(data.menuAvailable == DataStatus.Loading - ? Icons.downloading_rounded - : Icons.update_rounded), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Center( + child: Icon(data.menuAvailable == DataStatus.Loading + ? Icons.downloading_rounded + : Icons.update_rounded), + ), + ), ), InkWell( splashFactory: NoSplash.splashFactory, @@ -98,9 +103,11 @@ class HomePage extends StatelessWidget { }, child: const Padding( padding: EdgeInsets.symmetric(horizontal: 10), - child: Icon( - Icons.keyboard_arrow_left_rounded, - size: 30, + child: Center( + child: Icon( + Icons.keyboard_arrow_left_rounded, + size: 30, + ), ), )), InkWell( @@ -121,7 +128,7 @@ class HomePage extends StatelessWidget { data.setDateToADay(); }, child: Center( - child: Text(data.date), + child: Text(data.prettyDate), ), ), InkWell( @@ -131,9 +138,11 @@ class HomePage extends StatelessWidget { }, child: const Padding( padding: EdgeInsets.symmetric(horizontal: 10), - child: Icon( - Icons.keyboard_arrow_right_rounded, - size: 30, + child: Center( + child: Icon( + Icons.keyboard_arrow_right_rounded, + size: 30, + ), ), )), ],