Skip to content

Commit 65d861e

Browse files
Removed unnecessary async keywords. Use own fork for proxies to support PAC files on android.
1 parent 3a29c71 commit 65d861e

File tree

11 files changed

+383
-185
lines changed

11 files changed

+383
-185
lines changed

lib/discord_util.dart

Lines changed: 197 additions & 82 deletions
Large diffs are not rendered by default.

lib/general_util.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class ConfirmationToast extends StatelessWidget {
2727

2828
@override
2929
Widget build(BuildContext context) => HWMToast(
30-
color: Colors.green.shade900.withOpacity(0.8),
30+
color: Colors.green.shade900.withValues(alpha: 0.8),
3131
icon: const Icon(Icons.check),
3232
text: text,
3333
);
@@ -42,7 +42,7 @@ class ErrorToast extends StatelessWidget {
4242

4343
@override
4444
Widget build(BuildContext context) => HWMToast(
45-
color: Colors.redAccent.withOpacity(0.8),
45+
color: Colors.redAccent.withValues(alpha: 0.8),
4646
icon: const Icon(Icons.sms_failed_rounded),
4747
text: text,
4848
);

lib/routes/discord_route.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class _DiscordRouteState extends State<DiscordRoute> {
2222
itemCount: snapshot.data!.length,
2323
child: (position) => DiscordRelationListItem(
2424
dr: snapshot.data![position],
25-
onEdit: () async => showDialog<bool>(
25+
onEdit: () => showDialog<bool>(
2626
context: context,
2727
builder: (context) => DiscordRelationFormDialog(
2828
dr: snapshot.data![position],
@@ -48,7 +48,8 @@ class _DiscordRouteState extends State<DiscordRoute> {
4848
),
4949
action: SnackBarAction(
5050
label: context.locals.deleteDiscordRelationToastUndo,
51-
onPressed: () => DBHelper.insertDiscordRelation(dr).then((value) => setState(() {})),
51+
onPressed: () => DBHelper.insertDiscordRelation(dr)
52+
.then((value) => setState(() {})),
5253
),
5354
),
5455
);
@@ -80,7 +81,7 @@ class _DiscordRouteState extends State<DiscordRoute> {
8081
),
8182
body: discordRelationList(),
8283
floatingActionButton: FloatingActionButton(
83-
onPressed: () async => showDialog<bool>(
84+
onPressed: () => showDialog<bool>(
8485
context: context,
8586
builder: (context) => DiscordRelationFormDialog(
8687
title: context.locals.dialogDiscordRelationAddTitle,

lib/routes/home_route.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class HomeRouteState extends State<HomeRoute> {
3232
itemCount: snapshot.data!.length,
3333
child: (position) => HWListItem(
3434
homework: snapshot.data![position],
35-
onEdit: () async => showDialog(
35+
onEdit: () => showDialog(
3636
context: context,
3737
builder: (context) => HomeworkFormDialog(
3838
homework: snapshot.data![position],
@@ -130,9 +130,7 @@ class HomeRouteState extends State<HomeRoute> {
130130
tooltip: locals.discordHomeworkFetchTitle,
131131
onPressed: !DiscordHelper().isLoggedIn
132132
? null
133-
: () => DiscordHelper().fetchHomework().then((map) async {
134-
/*void Function(String text) discordError =
135-
(String text) => HWMToast(text: text, color: Colors.red, icon: const Icon(Icons.cloud_sync_outlined)).show();*/
133+
: () => DiscordHelper().fetchHomework().then((map) {
136134
void fetchConfirmation(String text) =>
137135
HWMToast(text: text, color: Colors.green.shade900, icon: const Icon(Icons.cloud_sync_outlined)).show();
138136
void fetchStatusUpdate(String text) =>
@@ -162,6 +160,9 @@ class HomeRouteState extends State<HomeRoute> {
162160
DBHelper.insertHWPages(pages.toList());
163161
setState(() {});
164162
});
163+
}).catchError((e,s) {
164+
// TODO: handle misconfiguration of permissions properly!
165+
discordError(e.toString()); return null;
165166
}),
166167
),
167168
IconButton(
@@ -176,7 +177,7 @@ class HomeRouteState extends State<HomeRoute> {
176177
),
177178
body: hwListWidget(),
178179
floatingActionButton: FloatingActionButton(
179-
onPressed: () async => showDialog(
180+
onPressed: () => showDialog(
180181
context: context,
181182
builder: (context) => HomeworkFormDialog(
182183
title: context.locals.dialogHWAddTitle,

lib/routes/image_viewer_route.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,13 @@ class _ImageViewerRouteState extends State<ImageViewerRoute> {
5151
print("REFRESH IMAGES");
5252
}
5353
return FutureBuilder(
54-
future: (() async => DBHelper.retrieveHWPages(widget.homework))(),
54+
future: DBHelper.retrieveHWPages(widget.homework),
5555
builder: (_, snap) {
5656
if (snap.hasData) {
5757
_images.clear();
5858
_images.addAll(
59-
snap.data!.map((e) => Image.memory(e.data, fit: BoxFit.scaleDown, gaplessPlayback: true)),
59+
snap.data!.map((e) => Image.memory(e.data,
60+
fit: BoxFit.scaleDown, gaplessPlayback: true)),
6061
);
6162
return _images[page];
6263
} else {
@@ -91,7 +92,8 @@ class _ImageViewerRouteState extends State<ImageViewerRoute> {
9192
transformationController: _controller,
9293
minScale: 0.75,
9394
maxScale: 50,
94-
boundaryMargin: const EdgeInsets.symmetric(vertical: 200, horizontal: 700),
95+
boundaryMargin:
96+
const EdgeInsets.symmetric(vertical: 200, horizontal: 700),
9597
clipBehavior: Clip.none,
9698
child: SizedBox(
9799
width: MediaQuery.of(context).size.width,
@@ -128,7 +130,8 @@ class _ImageViewerRouteState extends State<ImageViewerRoute> {
128130
icon: const Icon(Icons.delete_rounded),
129131
),
130132
IconButton(
131-
onPressed: () => pickAndAddImage(context, widget.homework).then(_addPage),
133+
onPressed: () =>
134+
pickAndAddImage(context, widget.homework).then(_addPage),
132135
tooltip: context.locals.takePhoto,
133136
icon: const Icon(Icons.add_a_photo_rounded),
134137
),

lib/routes/settings_route.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class SettingsRoute extends StatelessWidget {
127127
leading: const Icon(Icons.task_alt_rounded),
128128
description:
129129
Text(context.locals.settingsUntisTestLoginDescription),
130-
onPressed: (context) async =>
130+
onPressed: (context) =>
131131
UntisHelper().loginWithPreferences().then(
132132
(success) => success
133133
? untisConfirmation(locals.untisLoginSuccess)
@@ -446,7 +446,7 @@ class _SettingsDropdownMenuState<T> extends State<SettingsDropdownMenu<T>> {
446446
@override
447447
void initState() {
448448
widget.rebuildOnValueChange?.addListener(
449-
() => widget.menuEntries().then((entries) async {
449+
() => widget.menuEntries().then((entries) {
450450
if (kDebugMode) {
451451
print("ENTRIES AFTER NOTIFY: $entries");
452452
}

lib/routes/subject_route.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class _SubjectRouteState extends State<SubjectRoute> {
2323
itemCount: snapshot.data!.length,
2424
child: (position) => SubjectListItem(
2525
subject: snapshot.data![position],
26-
onEdit: () async => showDialog<bool>(
26+
onEdit: () => showDialog<bool>(
2727
context: context,
2828
builder: (context) => SubjectFormDialog(
2929
subject: snapshot.data![position],
@@ -49,7 +49,8 @@ class _SubjectRouteState extends State<SubjectRoute> {
4949
),
5050
action: SnackBarAction(
5151
label: context.locals.deleteSubjectToastUndo,
52-
onPressed: () => DBHelper.insertSubject(subject).then((value) => setState(() {})),
52+
onPressed: () => DBHelper.insertSubject(subject)
53+
.then((value) => setState(() {})),
5354
),
5455
),
5556
);
@@ -81,7 +82,7 @@ class _SubjectRouteState extends State<SubjectRoute> {
8182
),
8283
body: subjectList(),
8384
floatingActionButton: FloatingActionButton(
84-
onPressed: () async => showDialog<bool>(
85+
onPressed: () => showDialog<bool>(
8586
context: context,
8687
builder: (context) => SubjectFormDialog(
8788
title: context.locals.dialogSubjectAddTitle,

lib/routes/synchronize_route.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class _SynchronizeRouteState extends State<SynchronizeRoute> {
2222
itemCount: snapshot.data!.length,
2323
child: (position) => SubjectListItem(
2424
subject: snapshot.data![position],
25-
onEdit: () async => showDialog<bool>(
25+
onEdit: () => showDialog<bool>(
2626
context: context,
2727
builder: (context) => SubjectFormDialog(
2828
subject: snapshot.data![position],
@@ -81,7 +81,7 @@ class _SynchronizeRouteState extends State<SynchronizeRoute> {
8181
),
8282
body: subjectList(),
8383
floatingActionButton: FloatingActionButton(
84-
onPressed: () async => showDialog<bool>(
84+
onPressed: () => showDialog<bool>(
8585
context: context,
8686
builder: (context) => SubjectFormDialog(
8787
title: context.locals.dialogSubjectAddTitle,

0 commit comments

Comments
 (0)