add update message
This commit is contained in:
@@ -22,3 +22,20 @@ const String dataLink =
|
||||
"https://raw.githubusercontent.com/kphanipavan/IIITB_Menu/menu_scraper/out.json";
|
||||
|
||||
enum DataStatus { Loaded, Loading, NotFound }
|
||||
|
||||
Widget newNoMenuWidget = Center(
|
||||
child: Column(children: [
|
||||
const Text("Menu not available for this session",
|
||||
style: TextStyle(fontSize: 20, fontStyle: FontStyle.italic)),
|
||||
RichText(
|
||||
text: const TextSpan(
|
||||
children: [
|
||||
TextSpan(text: "Click "),
|
||||
WidgetSpan(child: Icon(Icons.update_rounded)),
|
||||
TextSpan(text: " to check for updates.")
|
||||
],
|
||||
style: TextStyle(fontSize: 20, fontStyle: FontStyle.italic),
|
||||
),
|
||||
)
|
||||
], mainAxisAlignment: MainAxisAlignment.center),
|
||||
);
|
||||
|
||||
@@ -29,6 +29,8 @@ class GlobalModel extends ChangeNotifier {
|
||||
}
|
||||
|
||||
updateCall() async {
|
||||
this.menuAvailable = DataStatus.Loading;
|
||||
notifyListeners();
|
||||
this.mainData = await GlobalModel.updateLocal();
|
||||
if (this.mainData["dates"].keys.contains(this.date)) {
|
||||
this.menuAvailable = DataStatus.Loaded;
|
||||
|
||||
@@ -148,10 +148,10 @@ class HomePage extends StatelessWidget {
|
||||
MenuListView(menuType: "dn"),
|
||||
]
|
||||
: [
|
||||
noMenuWidget,
|
||||
noMenuWidget,
|
||||
noMenuWidget,
|
||||
noMenuWidget,
|
||||
newNoMenuWidget,
|
||||
newNoMenuWidget,
|
||||
newNoMenuWidget,
|
||||
newNoMenuWidget,
|
||||
]),
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user