Skip to content

Commit fedc7fa

Browse files
authored
Merge branch 'master' into issue-57-multiple-torrent-select
2 parents 1774052 + 5f56558 commit fedc7fa

11 files changed

+216
-170
lines changed

lib/Api/event_handler_api.dart

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -196,37 +196,34 @@ class EventHandlerApi {
196196

197197
static Future<void> filterDataRephrasor(
198198
List<TorrentModel> torrentList, context) async {
199+
FilterProvider filterProvider =
200+
Provider.of<FilterProvider>(context, listen: false);
199201
var maptrackerURIs = {};
200202
var mapStatus = {};
201203
List<String> statusList = [];
202204
torrentLength = torrentList.length.toString();
205+
filterProvider.trackerURIsListMain = [];
203206
try {
204207
for (int i = 0; i < torrentList.length; i++) {
205208
for (int j = 0; j < torrentList[i].trackerURIs.length; j++) {
206-
Provider.of<FilterProvider>(context, listen: false)
207-
.trackerURIsListMain
209+
filterProvider.trackerURIsListMain
208210
.add(torrentList[i].trackerURIs[j].toString());
209-
Provider.of<FilterProvider>(context, listen: false)
210-
.settrackerURIsListMain(
211-
Provider.of<FilterProvider>(context, listen: false)
212-
.trackerURIsListMain);
211+
filterProvider
212+
.settrackerURIsListMain(filterProvider.trackerURIsListMain);
213213
}
214214
}
215215
} catch (e) {
216216
print(e);
217217
}
218218
try {
219-
Provider.of<FilterProvider>(context, listen: false)
220-
.trackerURIsListMain
221-
.forEach((element) {
219+
filterProvider.trackerURIsListMain.forEach((element) {
222220
if (!maptrackerURIs.containsKey(element)) {
223221
maptrackerURIs[element] = 1;
224222
} else {
225223
maptrackerURIs[element] += 1;
226224
}
227225
});
228-
Provider.of<FilterProvider>(context, listen: false)
229-
.setmaptrackerURIs(maptrackerURIs);
226+
filterProvider.setmaptrackerURIs(maptrackerURIs);
230227
} catch (e) {
231228
print(e);
232229
}
@@ -236,8 +233,7 @@ class EventHandlerApi {
236233
statusList.add(torrentList[i].status[j].toString());
237234
}
238235
}
239-
Provider.of<FilterProvider>(context, listen: false)
240-
.setstatusList(statusList);
236+
filterProvider.setstatusList(statusList);
241237
} catch (e) {
242238
print(e);
243239
}
@@ -250,8 +246,7 @@ class EventHandlerApi {
250246
mapStatus[element] += 1;
251247
}
252248
});
253-
Provider.of<FilterProvider>(context, listen: false)
254-
.setmapStatus(mapStatus);
249+
filterProvider.setmapStatus(mapStatus);
255250
} catch (error) {
256251
print(error);
257252
}

lib/Components/RSSFeedHomePage.dart

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,10 @@ class _RSSFeedHomePageState extends State<RSSFeedHomePage>
227227
.information,
228228
'Feed deleted successfully',
229229
'Dismiss');
230+
231+
ScaffoldMessenger.of(
232+
context)
233+
.clearSnackBars();
230234
ScaffoldMessenger.of(
231235
context)
232236
.showSnackBar(
@@ -636,6 +640,8 @@ class _RSSFeedHomePageState extends State<RSSFeedHomePage>
636640
'New Feed added successfully',
637641
'Dismiss');
638642

643+
ScaffoldMessenger.of(context)
644+
.clearSnackBars();
639645
ScaffoldMessenger.of(context)
640646
.showSnackBar(
641647
addFeedSnackbar);
@@ -866,7 +872,7 @@ class _RSSFeedHomePageState extends State<RSSFeedHomePage>
866872
isScrollControlled: true,
867873
context: context,
868874
backgroundColor: ThemeProvider
869-
.theme.backgroundColor,
875+
.theme.primaryColorLight,
870876
builder: (context) {
871877
return ListView(
872878
shrinkWrap: true,
@@ -1474,6 +1480,10 @@ class _RSSFeedHomePageState extends State<RSSFeedHomePage>
14741480
.information,
14751481
'Rule deleted successfully',
14761482
'Dismiss');
1483+
1484+
ScaffoldMessenger.of(
1485+
context)
1486+
.clearSnackBars();
14771487
ScaffoldMessenger.of(
14781488
context)
14791489
.showSnackBar(
@@ -2038,6 +2048,8 @@ class _RSSFeedHomePageState extends State<RSSFeedHomePage>
20382048
'New Rule added successfully',
20392049
'Dismiss');
20402050

2051+
ScaffoldMessenger.of(context)
2052+
.clearSnackBars();
20412053
ScaffoldMessenger.of(context)
20422054
.showSnackBar(
20432055
addRuleSnackbar);

lib/Components/add_automatic_torrent.dart

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,11 @@ class _AddAutoTorrentState extends State<AddAutoTorrent> {
6464
height: 60,
6565
width: double.infinity,
6666
decoration: BoxDecoration(
67-
border: Border.all(color: Colors.white38),
68-
borderRadius: BorderRadius.only(
69-
topRight: Radius.circular(8),
70-
topLeft: Radius.circular(8),
71-
bottomLeft: Radius.circular(8),
72-
bottomRight: Radius.circular(8),
73-
),
67+
border: Border.all(
68+
color: ThemeProvider.themeMode == ThemeMode.light
69+
? Colors.black38
70+
: Colors.white38),
71+
borderRadius: BorderRadius.circular(8),
7472
color: ThemeProvider.theme.primaryColorLight,
7573
),
7674
child: Row(

lib/Components/add_torrent_sheet.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ class _AddTorrentSheetState extends State<AddTorrentSheet> {
279279
'Torrent added successfully',
280280
'Dismiss');
281281

282+
ScaffoldMessenger.of(context).clearSnackBars();
282283
ScaffoldMessenger.of(context)
283284
.showSnackBar(addTorrentSnackbar);
284285
},

lib/Components/bottom_floating_menu_button.dart

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class _BottomFloatingMenuButtonState extends State<BottomFloatingMenuButton>
100100
),
101101
isScrollControlled: true,
102102
context: context,
103-
backgroundColor: ThemeProvider.theme.backgroundColor,
103+
backgroundColor: ThemeProvider.theme.primaryColorLight,
104104
builder: (context) {
105105
return ListView(shrinkWrap: true, children: [
106106
Padding(
@@ -128,13 +128,12 @@ class _BottomFloatingMenuButtonState extends State<BottomFloatingMenuButton>
128128
height: 60,
129129
width: double.infinity,
130130
decoration: BoxDecoration(
131-
border: Border.all(color: Colors.white38),
132-
borderRadius: BorderRadius.only(
133-
topRight: Radius.circular(8),
134-
topLeft: Radius.circular(8),
135-
bottomLeft: Radius.circular(8),
136-
bottomRight: Radius.circular(8),
137-
),
131+
border: Border.all(
132+
color: ThemeProvider.themeMode ==
133+
ThemeMode.light
134+
? Colors.black38
135+
: Colors.white38),
136+
borderRadius: BorderRadius.circular(8),
138137
color:
139138
ThemeProvider.theme.primaryColorLight,
140139
),
@@ -321,6 +320,8 @@ class _BottomFloatingMenuButtonState extends State<BottomFloatingMenuButton>
321320
'Torrent added successfully',
322321
'Dismiss');
323322

323+
ScaffoldMessenger.of(context)
324+
.clearSnackBars();
324325
ScaffoldMessenger.of(context)
325326
.showSnackBar(
326327
addTorrentSnackbar);
@@ -394,7 +395,7 @@ class _BottomFloatingMenuButtonState extends State<BottomFloatingMenuButton>
394395
),
395396
isScrollControlled: true,
396397
context: context,
397-
backgroundColor: ThemeProvider.theme.backgroundColor,
398+
backgroundColor: ThemeProvider.theme.primaryColorLight,
398399
builder: (context) {
399400
return ListView(shrinkWrap: true, children: [
400401
Padding(
@@ -609,6 +610,8 @@ class _BottomFloatingMenuButtonState extends State<BottomFloatingMenuButton>
609610
'Torrent added successfully',
610611
'Dismiss');
611612

613+
ScaffoldMessenger.of(context)
614+
.clearSnackBars();
612615
ScaffoldMessenger.of(context)
613616
.showSnackBar(addTorrentSnackbar);
614617
Navigator.pop(context);

lib/Components/delete_torrent_sheet.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ class _DeleteTorrentSheetState extends State<DeleteTorrentSheet> {
124124
SnackbarType.caution,
125125
'Torrent deleted successfuly',
126126
'Dismiss');
127+
128+
ScaffoldMessenger.of(context).clearSnackBars();
127129
ScaffoldMessenger.of(context)
128130
.showSnackBar(deleteTorrentSnackBar);
129131
},

lib/Components/notification_popup_dialogue_container.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import 'package:flutter/material.dart';
66
import 'package:provider/provider.dart';
77

88
Widget notificationPopupDialogueContainer({required BuildContext context}) {
9+
NotificationApi.getNotifications(context: context);
910
return (Provider.of<HomeProvider>(context)
1011
.notificationModel
1112
.notifications

lib/Components/toast_component.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,14 @@ class Toasts {
2121
textColor: Colors.white,
2222
fontSize: 16.0);
2323
}
24+
25+
static void showExitWarningToast({required String msg}) {
26+
Fluttertoast.showToast(
27+
msg: msg,
28+
toastLength: Toast.LENGTH_LONG,
29+
gravity: ToastGravity.BOTTOM,
30+
backgroundColor: Colors.green.withAlpha(130),
31+
textColor: Colors.white,
32+
fontSize: 16);
33+
}
2434
}

0 commit comments

Comments
 (0)