From 6cba01c2fd10c8961a56a140877e778928f390ef Mon Sep 17 00:00:00 2001 From: flofriday Date: Mon, 16 Aug 2021 20:49:14 +0200 Subject: [PATCH] Fix unused imports --- lib/main.dart | 1 - lib/models/tiss_login_manager.dart | 2 +- lib/models/update_manager.dart | 1 - lib/screens/login_screen.dart | 13 ++++++------- lib/screens/settings_screen.dart | 2 +- lib/widgets/employee_card.dart | 4 ++-- 6 files changed, 10 insertions(+), 13 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index c2da61f..38144be 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,6 +1,5 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; -import 'package:shared_preferences/shared_preferences.dart'; import 'package:tu_wien_addressbook/models/tiss_login_manager.dart'; import 'package:tu_wien_addressbook/models/update_manager.dart'; import 'package:tu_wien_addressbook/screens/login_screen.dart'; diff --git a/lib/models/tiss_login_manager.dart b/lib/models/tiss_login_manager.dart index a9503dd..68e0fff 100644 --- a/lib/models/tiss_login_manager.dart +++ b/lib/models/tiss_login_manager.dart @@ -216,9 +216,9 @@ class TissLoginManager { if (!resp.isRedirect) { break; } else { + if (resp.headers['location'] == null) break; sessionUrl = resp.headers['location']!; print("Redirect to: ${resp.headers['location']}"); - if (sessionUrl == null) break; } } diff --git a/lib/models/update_manager.dart b/lib/models/update_manager.dart index 5ad9707..d9eceb8 100644 --- a/lib/models/update_manager.dart +++ b/lib/models/update_manager.dart @@ -1,7 +1,6 @@ import 'dart:convert'; import 'package:package_info_plus/package_info_plus.dart'; -import 'package:shared_preferences/shared_preferences.dart'; import 'package:tu_wien_addressbook/models/github_tag.dart'; import 'package:tu_wien_addressbook/models/semver.dart'; import 'package:http/http.dart' as http; diff --git a/lib/screens/login_screen.dart b/lib/screens/login_screen.dart index 765e019..4779b82 100644 --- a/lib/screens/login_screen.dart +++ b/lib/screens/login_screen.dart @@ -1,9 +1,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:package_info_plus/package_info_plus.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:tu_wien_addressbook/models/tiss_login_manager.dart'; -import 'package:tu_wien_addressbook/widgets/utils.dart'; class LoginScreen extends StatefulWidget { const LoginScreen({Key? key}) : super(key: key); @@ -17,7 +15,6 @@ class _LoginScreenState extends State { TextEditingController _passwordController = TextEditingController(); bool _loading = false; - // TODO: On Android (release build) the app is stuck here and never leaves void _login() async { setState(() { _loading = true; @@ -51,7 +48,7 @@ class _LoginScreenState extends State { ), actions: [ TextButton( - child: const Text('Close'), + child: const Text('CLOSE'), onPressed: () { Navigator.of(context).pop(); }, @@ -104,7 +101,7 @@ class _LoginScreenState extends State { if (!_loading) ElevatedButton( onPressed: () => _login(), - child: Text("Login"), + child: Text("LOGIN"), ), if (_loading) Padding( @@ -113,7 +110,7 @@ class _LoginScreenState extends State { if (_loading) ElevatedButton( onPressed: null, - child: Text("Login"), + child: Text("LOGIN"), ) ], ), @@ -191,7 +188,9 @@ class _LoginScreenState extends State { mainAxisSize: MainAxisSize.min, children: [ Text("TISS protects students privacy, therefore you " - "need to be logged in to find them.\n\n" + "need to be logged in to find them.\n" + "Without logging in you can still search for faculty " + "staff.\n\n" "Your credentials are only saved locally on this " "device and are only ever used to authenticate " "you with TISS."), diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart index 05bef6a..b1ea300 100644 --- a/lib/screens/settings_screen.dart +++ b/lib/screens/settings_screen.dart @@ -84,7 +84,7 @@ class _SettingsScreenState extends State { style: ButtonStyle( backgroundColor: MaterialStateProperty.all(Colors.red)), - child: const Text('Delete'), + child: const Text('DELETE'), onPressed: () async { await SuggestionManager().clear(); Navigator.of(context).pop(); diff --git a/lib/widgets/employee_card.dart b/lib/widgets/employee_card.dart index e001ccd..20287d4 100644 --- a/lib/widgets/employee_card.dart +++ b/lib/widgets/employee_card.dart @@ -94,7 +94,7 @@ class EmployeeCard extends StatelessWidget { // Open a bottom modal sheet and ask the user which website // they wanna see - String choice = await showModalBottomSheet( + String? choice = await showModalBottomSheet( shape: RoundedRectangleBorder( borderRadius: BorderRadius.vertical( top: Radius.circular(10)), @@ -154,7 +154,7 @@ class EmployeeCard extends StatelessWidget { // Open a bottom modal sheet and ask the user which website // they wanna see - String choice = await showModalBottomSheet( + String? choice = await showModalBottomSheet( shape: RoundedRectangleBorder( borderRadius: BorderRadius.vertical( top: Radius.circular(10)),