update about page, add share button but not working

This commit is contained in:
2024-10-25 16:37:20 +05:30
parent ca13f575a2
commit fdff2bcfee
10 changed files with 135 additions and 67 deletions

View File

@@ -73,6 +73,8 @@ class GlobalModel extends ChangeNotifier {
String rawHash = md5.convert(utf8.encode(rawData)).toString(); String rawHash = md5.convert(utf8.encode(rawData)).toString();
if (remoteHash != rawHash) { if (remoteHash != rawHash) {
print("Local data is out of date, updating local"); print("Local data is out of date, updating local");
print("Old Hash: $rawHash");
print("New Hash: $remoteHash");
// Donwload new data and save it. // Donwload new data and save it.
rawData = await getLatestData(); rawData = await getLatestData();
Map returnData = jsonDecode(rawData); Map returnData = jsonDecode(rawData);

View File

@@ -6,13 +6,28 @@ class AboutPage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar(title: const Text("About Page")), appBar: AppBar(title: const Text("About")),
body: const Column( body: const Column(
children: [ children: [
Image(image: AssetImage("assets/plate.png")), Padding(
Text( padding: EdgeInsets.only(left: 100, right: 100, top: 50),
"IIIT Bangalore Unofficial Mess Menu", child: Image(image: AssetImage("assets/plate.png")),
style: TextStyle(fontSize: 50), ),
Center(
child: Text(
"IIIT Bangalore's Unofficial Menu App",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 50,
),
),
),
Center(
child: Text("Proud Ass Web 1.0 App built with Flutter"),
),
Center(
child: Text(
"Menu updates every other Tuesday or when FoodComm does it."),
) )
], ],
), ),

View File

@@ -6,6 +6,7 @@ import "package:iiitb_menu/models/globalModel.dart";
import "package:iiitb_menu/models/initialPageIndexFunction.dart"; import "package:iiitb_menu/models/initialPageIndexFunction.dart";
import "package:iiitb_menu/views/menuListView.dart"; import "package:iiitb_menu/views/menuListView.dart";
import "package:provider/provider.dart"; import "package:provider/provider.dart";
import "package:share_plus/share_plus.dart";
class HomePage extends StatelessWidget { class HomePage extends StatelessWidget {
const HomePage({Key? key}) : super(key: key); const HomePage({Key? key}) : super(key: key);
@@ -29,23 +30,35 @@ class HomePage extends StatelessWidget {
child: ListView( child: ListView(
children: [ children: [
ListTile( ListTile(
leading: Icon(Icons.menu), leading: Icon(Icons.arrow_back),
title: Text("Menu"), title: Text("Menu"),
onTap: () { onTap: () {
Navigator.pop(context); Navigator.pop(context);
}), }),
// ListTile(
// leading: Icon(Icons.star),
// title: Text("Specials"),
// ),
const Divider(),
// ListTile(
// leading: Icon(Icons.settings),
// title: Text("Settings"),
// ),
ListTile( ListTile(
leading: Icon(Icons.star), leading: const Icon(Icons.share_rounded),
title: Text("Specials"), title: const Text("Share"),
), onTap: () {
Divider(), var ret = Share.share(
ListTile( "Hey, use this to track IIITB's Mess Menu. https://kphanipavan.github.io/IIITB_Menu/",
leading: Icon(Icons.settings), // subject: "IIITB Menu App",
title: Text("Settings"), );
), ret.then((value) {
print(value.status);
});
}),
ListTile( ListTile(
leading: Icon(Icons.info), leading: Icon(Icons.info),
title: Text("About App"), title: Text("About"),
onTap: () { onTap: () {
Navigator.pushNamed(context, "/info"); Navigator.pushNamed(context, "/info");
}), }),
@@ -53,7 +66,7 @@ class HomePage extends StatelessWidget {
), ),
), ),
appBar: AppBar( appBar: AppBar(
title: Text("Daily ${data.menuTime} Menu"), title: Text(data.menuTime),
bottom: TabBar( bottom: TabBar(
controller: cont, controller: cont,
// splashFactory: InkSplash.splashFactory, // splashFactory: InkSplash.splashFactory,
@@ -74,7 +87,9 @@ class HomePage extends StatelessWidget {
onTap: () { onTap: () {
data.updateCall(); data.updateCall();
}, },
child: const Icon(Icons.refresh), child: Icon(data.menuAvailable == DataStatus.Loading
? Icons.downloading_rounded
: Icons.update_rounded),
), ),
InkWell( InkWell(
splashFactory: NoSplash.splashFactory, splashFactory: NoSplash.splashFactory,

View File

@@ -6,6 +6,10 @@
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
#include <url_launcher_linux/url_launcher_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) { void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
} }

View File

@@ -3,6 +3,7 @@
# #
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
url_launcher_linux
) )
list(APPEND FLUTTER_FFI_PLUGIN_LIST list(APPEND FLUTTER_FFI_PLUGIN_LIST

View File

@@ -6,9 +6,11 @@ import FlutterMacOS
import Foundation import Foundation
import path_provider_foundation import path_provider_foundation
import share_plus
import shared_preferences_foundation import shared_preferences_foundation
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
} }

View File

@@ -42,6 +42,7 @@ dependencies:
path_provider: path_provider:
# localstorage: ^4.0.1+4 # localstorage: ^4.0.1+4
shared_preferences: ^2.2.0 shared_preferences: ^2.2.0
share_plus: ^10.1.1
# sembast: # sembast:
dev_dependencies: dev_dependencies:

View File

@@ -1,8 +1,7 @@
<!DOCTYPE html> <!doctype html>
<html> <html>
<head>
<head> <!--
<!--
If you are serving your web app in a path other than the root, change the If you are serving your web app in a path other than the root, change the
href value below to reflect the base path you are serving from. href value below to reflect the base path you are serving from.
@@ -15,54 +14,75 @@
This is a placeholder for base href that will be replaced by the value of This is a placeholder for base href that will be replaced by the value of
the `--base-href` argument provided to `flutter build`. the `--base-href` argument provided to `flutter build`.
--> -->
<base href="$FLUTTER_BASE_HREF"> <base href="$FLUTTER_BASE_HREF" />
<meta charset="UTF-8"> <meta charset="UTF-8" />
<meta content="IE=Edge" http-equiv="X-UA-Compatible"> <meta content="IE=Edge" http-equiv="X-UA-Compatible" />
<meta name="description" content="Bi-Weekly Menu"> <meta name="description" content="Bi-Weekly Menu" />
<!-- iOS meta tags & icons --> <!-- iOS meta tags & icons -->
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black"> <meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="apple-mobile-web-app-title" content="IIITB Menu"> <meta name="apple-mobile-web-app-title" content="IIITB Menu" />
<link rel="apple-touch-icon" sizes="180x180" href="icons/apple-touch-icon.png"> <link
rel="apple-touch-icon"
sizes="180x180"
href="icons/apple-touch-icon.png"
/>
<!-- Favicon --> <!-- Favicon -->
<link rel="icon" type="image/ico" href="favicon.ico" /> <link rel="icon" type="image/ico" href="favicon.ico" />
<link rel="mask-icon" href="icons/safari-pinned-tab.svg" color="#5bbad5"> <link
<link rel="icon" type="image/png" sizes="96x96" href="icons/favicon-96x96.png"> rel="mask-icon"
<link rel="icon" type="image/png" sizes="32x32" href="icons/favicon-32x32.png"> href="icons/safari-pinned-tab.svg"
<link rel="icon" type="image/png" sizes="16x16" href="icons/favicon-16x16.png"> color="#5bbad5"
<title>iiitb_menu</title> />
<link rel="manifest" href="manifest.json"> <link
rel="icon"
type="image/png"
sizes="96x96"
href="icons/favicon-96x96.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="icons/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="icons/favicon-16x16.png"
/>
<title>iiitb_menu</title>
<link rel="manifest" href="manifest.json" />
<script> <script>
// The value below is injected by flutter build, do not touch. // The value below is injected by flutter build, do not touch.
const serviceWorkerVersion = null; const serviceWorkerVersion = null;
</script> </script>
<!-- This script adds the flutter initialization JS code --> <!-- This script adds the flutter initialization JS code -->
<script src="flutter.js" defer></script> <script src="flutter.js" defer></script>
</head> </head>
<body>
<script>
window.addEventListener('load', function (ev)
{
// Download main.dart.js
_flutter.loader.loadEntrypoint({
serviceWorker: {
serviceWorkerVersion: serviceWorkerVersion,
},
onEntrypointLoaded: function (engineInitializer)
{
engineInitializer.initializeEngine().then(function (appRunner)
{
appRunner.runApp();
});
}
});
});
</script>
</body>
<body>
<script>
window.addEventListener("load", function (ev) {
// Download main.dart.js
_flutter.loader.loadEntrypoint({
serviceWorker: {
serviceWorkerVersion: serviceWorkerVersion,
},
onEntrypointLoaded: function (engineInitializer) {
engineInitializer
.initializeEngine()
.then(function (appRunner) {
appRunner.runApp();
});
},
});
});
</script>
</body>
</html> </html>

View File

@@ -6,6 +6,12 @@
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
#include <share_plus/share_plus_windows_plugin_c_api.h>
#include <url_launcher_windows/url_launcher_windows.h>
void RegisterPlugins(flutter::PluginRegistry* registry) { void RegisterPlugins(flutter::PluginRegistry* registry) {
SharePlusWindowsPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi"));
UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
} }

View File

@@ -3,6 +3,8 @@
# #
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
share_plus
url_launcher_windows
) )
list(APPEND FLUTTER_FFI_PLUGIN_LIST list(APPEND FLUTTER_FFI_PLUGIN_LIST