Skip to content

Commit

Permalink
ordinati elementi backdrop + quick shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
peppelg committed Nov 3, 2019
1 parent 0cb1b93 commit 3ba2f97
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lib/backdropWidgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ getBackdrop(context) {
Expanded(
child: FlatButton(
onPressed: () {
Navigator.of(context).pushReplacementNamed('/note');
Navigator.of(context).pushReplacementNamed('/orario');
},
child: Text('Note', style: TextStyle(color: Colors.white)),
child: Text('Orario', style: TextStyle(color: Colors.white)),
)),
Expanded(
child: FlatButton(
Expand All @@ -33,9 +33,9 @@ getBackdrop(context) {
Expanded(
child: FlatButton(
onPressed: () {
Navigator.of(context).pushReplacementNamed('/orario');
Navigator.of(context).pushReplacementNamed('/note');
},
child: Text('Orario', style: TextStyle(color: Colors.white)),
child: Text('Note', style: TextStyle(color: Colors.white)),
)),
Expanded(
child: FlatButton(
Expand Down
25 changes: 24 additions & 1 deletion lib/redirectRoute.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:quick_actions/quick_actions.dart';
import 'database.dart';
import 'api.dart';

Expand All @@ -17,7 +18,29 @@ Future tryLogin(context) async {
if (await Database.init() == 'ok') {
var loggedIn = await loadToken();
if (loggedIn == 'OK') {
Navigator.of(context).pushReplacementNamed('/voti');
var redirectTo = '/voti';
var quickActions = QuickActions();
quickActions.initialize((String shortcutType) {
if (shortcutType == 'open_orario') {
redirectTo = '/orario';
}
if (shortcutType == 'open_oggi') {
redirectTo = '/oggi';
}
if (shortcutType == 'open_compiti') {
redirectTo = '/compiti';
}
if (redirectTo != '/voti') {
Navigator.of(context).pushReplacementNamed(
redirectTo); //si put nu altra volta xk x strani motivi funzione run dopo pushreplacementmethod + sotto
}
});
quickActions.setShortcutItems(<ShortcutItem>[
ShortcutItem(type: 'open_orario', localizedTitle: 'Orario'),
ShortcutItem(type: 'open_oggi', localizedTitle: 'Cosa è successo oggi'),
ShortcutItem(type: 'open_compiti', localizedTitle: 'Compiti assegnati')
]);
Navigator.of(context).pushReplacementNamed(redirectTo);
} else {
Navigator.of(context).pushReplacementNamed('/login');
}
Expand Down
7 changes: 7 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
quick_actions:
dependency: "direct main"
description:
name: quick_actions
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.2+2"
quiver:
dependency: transitive
description:
Expand Down
3 changes: 2 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description: App non ufficiale per Argo ScuolaNext.
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+9
version: 1.0.0+10

environment:
sdk: ">=2.1.0 <3.0.0"
Expand All @@ -35,6 +35,7 @@ dependencies:
url_launcher: ^5.2.5
package_info: ^0.4.0+10
yaml: ^2.2.0
quick_actions: ^0.3.2+2

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit 3ba2f97

Please sign in to comment.