Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pretty date and gh link #3

Merged
merged 3 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/gh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 5 additions & 3 deletions lib/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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");
4 changes: 4 additions & 0 deletions lib/models/globalModel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
28 changes: 20 additions & 8 deletions lib/views/about.dart
Original file line number Diff line number Diff line change
@@ -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);
Expand All @@ -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,
Expand All @@ -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);
}
}),
],
),
);
Expand Down
35 changes: 22 additions & 13 deletions lib/views/homePage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}),
Expand Down Expand Up @@ -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) {
Expand All @@ -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,
Expand All @@ -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(
Expand All @@ -121,7 +128,7 @@ class HomePage extends StatelessWidget {
data.setDateToADay();
},
child: Center(
child: Text(data.date),
child: Text(data.prettyDate),
),
),
InkWell(
Expand All @@ -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,
),
),
)),
],
Expand Down
2 changes: 2 additions & 0 deletions macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
}
2 changes: 2 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
Loading