-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add first use dialog, check for NFC (0.6.1)
- Added dialog to cache data on first use - Added option to re-fetch cached data, if dataset has changed since last cache - Show "check card value" option, only if NFC support is present - Added icon for "Search" quick action - Fixed about dialog text color
- Loading branch information
Showing
11 changed files
with
207 additions
and
119 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
import '../utils/bus_api.dart'; | ||
|
||
class FetchDataDialog extends StatefulWidget { | ||
const FetchDataDialog({@required this.isSetup }); | ||
final bool isSetup; | ||
|
||
@override | ||
State<StatefulWidget> createState() { | ||
return _FetchDataDialogState(); | ||
} | ||
} | ||
|
||
|
||
class _FetchDataDialogState extends State<FetchDataDialog> { | ||
double progress = 0.25; | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
_fetchData(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return AlertDialog( | ||
title: Text(widget.isSetup ? 'Performing first time setup' : 'Re-fetching cached data'), | ||
content: Column( | ||
mainAxisSize: MainAxisSize.min, | ||
children: <Widget>[ | ||
LinearProgressIndicator(value: progress), | ||
Text('${(progress * 100).toInt()}%'), | ||
], | ||
), | ||
); | ||
} | ||
|
||
Future<void> _fetchData() async { | ||
await BusAPI().fetchAndStoreBusStops(); | ||
setState(() { | ||
progress += 0.25; | ||
}); | ||
await BusAPI().fetchAndStoreBusServices(); | ||
setState(() { | ||
progress += 0.40; | ||
}); | ||
await BusAPI().fetchAndStoreBusServiceRoutes(); | ||
setState(() { | ||
progress += 0.10; | ||
}); | ||
Navigator.pop(context); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.