From e52db038f4f34fad9b459e591797a3166d8f6c7f Mon Sep 17 00:00:00 2001 From: Phani Pavan K Date: Thu, 14 Nov 2024 09:37:23 +0530 Subject: [PATCH 1/2] 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, + ), ), )), ], From 975a6dab88b60999b5a8c3469afdbfe074ab7cdd Mon Sep 17 00:00:00 2001 From: Phani Pavan K Date: Thu, 14 Nov 2024 09:54:16 +0530 Subject: [PATCH 2/2] added gh repo link in about --- assets/gh.png | Bin 0 -> 2961 bytes lib/constants.dart | 8 +++-- lib/views/about.dart | 28 +++++++++++++----- macos/Flutter/GeneratedPluginRegistrant.swift | 2 ++ pubspec.yaml | 2 ++ 5 files changed, 29 insertions(+), 11 deletions(-) create mode 100644 assets/gh.png diff --git a/assets/gh.png b/assets/gh.png new file mode 100644 index 0000000000000000000000000000000000000000..b8205ae558ab4d452dfb427a5e87798631c0dfb7 GIT binary patch literal 2961 zcmV;C3vTp@P)C zK~#90?VWqDRaF_lfA{dd$OR-o1@%IPm>`fshGdkQNr+CVnN5lgjTV%KsbdePDRokr zXk-eVQmnM;F+QSk2(u|C1_x0pQ6A|K$PI9kS6m*4d+#~@(RZ5dVV`~WV|{Dwea`;P ze8b$im-YC*wbx#It?yeOc`CUn*6ZntF+dv1<<+$CdG}-{@ z1xy5{0B4Ad2Sx+^W0Y3{b^-qcHUb-f^}t$Sze4-1ll1}62FwJ`6`2YgXQAGb42IRf z^CEjK)SClL0`36*3>*c@DUfa%47UMeTq~#%nFxFj*p>og*OLT5TA5j5GVmyHI0XhYIV=1LnC)7*Y35?!1yPo3gK5fI;1bu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-;|4+`lnPXw$SCO0i8gQM(0niOxX+9wxRoyBuWvfSLAe;Ec&~ZH@~ahf3JB#8KnQ zvOsxC`NlF=j0TokUT0OyHDMZhnoJdOjQ1+=sO&5z>1daHmYPaa?~)0?L&`}w!pQC@ zK_0(bdZyPmE1Qq~)F`RQbiF_wY2hNVz@U;P1G+Tim z7+COBW|&2i`Xo(JMO-s(F{UrgmYr}?>hm&-6RLq^K-2sUwTa?_LzMiC`5t*KWX}>HdyoqxW z#!X|gD`4swY4~>1E(ejwPo}`Y_2g?NI@%XlAF~0g0$iIeGPqh^Zla?R`B(}J93*d; zbi|#SU}Gofu*X!ABo}!ITjUGCwV`Xt9Mc`XKW0NZ>tqVOH(^J2h)0tP9!r6t{p1Oa z&h}5>uU0Ex(3$e@%?b7h?$zjQNNl9pjVc{-0k{g|VrH@E^x3)VFRRog^791Xg$QMq ze2yrm%Bk7wUtB@G8ZyIh=>4gp?|*wCI3`}M=BR`qjbo7bE4 zcnt6jrG7=lrGrOVQp`EKg{56aUz7&F<5~ST0!JJVfG@aKz*M?6^mUf+-FW>y8I$RR3mIJ^Z**)x(S4g+=RjOgIxd>d8cH>u=WWXCZ zteoz+uSE-e>;}H#xSx?3Bky-@(xIrltdXnRQ#R;PelA?SGWn!@xmGQtUh7~r!ai2^c2E7JM zbKDumyuJ-|w4uF-wdmZ<|DYIi7D|mn#Lap+S*!hYFo zkgND=h0*6!ah}{Z5_HVGHw919a{=uu%4HkPaQBfKgXFmQ#i|8YQQXB`Gg-WxyoTQ* zE^C?zpNx>T&4yFu_L5$}YH<@!14AX&u~im#l~-6!PP+LoO;wBc%rX literal 0 HcmV?d00001 diff --git a/lib/constants.dart b/lib/constants.dart index 1d9701a..a01f525 100644 --- a/lib/constants.dart +++ b/lib/constants.dart @@ -24,7 +24,7 @@ const String dataLink = enum DataStatus { Loaded, Loading, NotFound } Widget newNoMenuWidget = Center( - child: Column(children: [ + child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [ const Text("Menu not available for this session", style: TextStyle(fontSize: 20, fontStyle: FontStyle.italic)), RichText( @@ -36,6 +36,8 @@ Widget newNoMenuWidget = Center( ], style: TextStyle(fontSize: 20, fontStyle: FontStyle.italic), ), - ) - ], mainAxisAlignment: MainAxisAlignment.center), + ), + ]), ); + +Uri ghURI = Uri.parse("https://github.com/kphanipavan/IIITB_Menu"); diff --git a/lib/views/about.dart b/lib/views/about.dart index bc3b183..46e93ef 100644 --- a/lib/views/about.dart +++ b/lib/views/about.dart @@ -1,4 +1,6 @@ import 'package:flutter/material.dart'; +import "package:iiitb_menu/constants.dart"; +import "package:url_launcher/url_launcher.dart"; class AboutPage extends StatelessWidget { const AboutPage({Key? key}) : super(key: key); @@ -7,13 +9,15 @@ class AboutPage extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: const Text("About")), - body: const Column( + body: Column( children: [ - Padding( - padding: EdgeInsets.only(left: 100, right: 100, top: 50), - child: Image(image: AssetImage("assets/plate.png")), + const Flexible( + child: Padding( + padding: EdgeInsets.only(left: 100, right: 100, top: 50), + child: Image(image: AssetImage("assets/plate.png")), + ), ), - Center( + const Center( child: Text( "IIIT Bangalore's Unofficial Menu App", textAlign: TextAlign.center, @@ -22,13 +26,21 @@ class AboutPage extends StatelessWidget { ), ), ), - Center( + const Center( child: Text("Proud Ass Web 1.0 App built with Flutter"), ), - Center( + const Center( child: Text( "Menu updates every other Tuesday or when FoodComm does it."), - ) + ), + InkWell( + child: + const Image(image: AssetImage("assets/gh.png"), height: 20), + onTap: () async { + if (await canLaunchUrl(ghURI)) { + launchUrl(ghURI); + } + }), ], ), ); diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index c3f782e..5f07798 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -8,9 +8,11 @@ import Foundation import path_provider_foundation import share_plus import shared_preferences_foundation +import url_launcher_macos func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin")) SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) + UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) } diff --git a/pubspec.yaml b/pubspec.yaml index 807e9b2..d4ed0d3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -43,6 +43,7 @@ dependencies: # localstorage: ^4.0.1+4 shared_preferences: ^2.2.0 share_plus: ^10.1.1 + url_launcher: ^6.3.1 # sembast: dev_dependencies: @@ -69,6 +70,7 @@ flutter: # To add assets to your application, add an assets section, like this: assets: - assets/plate.png + - assets/gh.png # - images/a_dot_ham.jpeg # An image asset can refer to one or more resolution-specific "variants", see