Skip to content

Commit 397e249

Browse files
committed
dart format
1 parent 4ac10bd commit 397e249

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

lib/Api/torrent_api.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ class TorrentApi {
263263
String rawBody = json.encode(mp);
264264
print(rawBody);
265265
await Future.delayed(Duration(seconds: 4));
266-
if(undoDeletes == id) return;
266+
if (undoDeletes == id) return;
267267
print('---DELETING TORRENT---');
268268
response = await dio.post(
269269
url,
@@ -281,7 +281,7 @@ class TorrentApi {
281281
}
282282
undoDeletes = null;
283283
}
284-
284+
285285
static Future<void> undoDelete({
286286
required List<int> id,
287287
}) async {

lib/Pages/widgets/delete_torrent_sheet.dart

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,19 @@ class _DeleteTorrentSheetState extends State<DeleteTorrentSheet> {
121121
),
122122
child: ElevatedButton(
123123
onPressed: () {
124-
final homeScreenBloc = BlocProvider.of<HomeScreenBloc>(context);
125-
List<TorrentModel> torrentList = homeScreenBloc.state.torrentList;
124+
final homeScreenBloc =
125+
BlocProvider.of<HomeScreenBloc>(context);
126+
List<TorrentModel> torrentList =
127+
homeScreenBloc.state.torrentList;
126128

127-
List<TorrentModel> remainingTorrents = torrentList.where((torrent) =>
128-
!widget.torrents.any((deletedTorrent) => deletedTorrent == torrent))
129+
List<TorrentModel> remainingTorrents = torrentList
130+
.where((torrent) => !widget.torrents.any(
131+
(deletedTorrent) => deletedTorrent == torrent))
129132
.toList();
130133

131-
final SetTorrentListEvent setTorrentListEvent = SetTorrentListEvent(newTorrentList: remainingTorrents);
134+
final SetTorrentListEvent setTorrentListEvent =
135+
SetTorrentListEvent(
136+
newTorrentList: remainingTorrents);
132137
homeScreenBloc.add(setTorrentListEvent);
133138

134139
List<String> hashes = [];
@@ -146,15 +151,12 @@ class _DeleteTorrentSheetState extends State<DeleteTorrentSheet> {
146151
SnackbarType.caution,
147152
context.l10n.torrent_delete_snackbar,
148153
context.l10n.button_dismiss,
149-
undoText: context.l10n.button_undo,
150-
undoFunction: (){
151-
final SetTorrentListEvent setTorrentListEvent = SetTorrentListEvent(newTorrentList: torrentList);
152-
homeScreenBloc.add(setTorrentListEvent);
153-
TorrentApi.undoDelete(
154-
id: widget.indexes
155-
);
156-
}
157-
);
154+
undoText: context.l10n.button_undo, undoFunction: () {
155+
final SetTorrentListEvent setTorrentListEvent =
156+
SetTorrentListEvent(newTorrentList: torrentList);
157+
homeScreenBloc.add(setTorrentListEvent);
158+
TorrentApi.undoDelete(id: widget.indexes);
159+
});
158160

159161
ScaffoldMessenger.of(context).clearSnackBars();
160162
ScaffoldMessenger.of(context)

0 commit comments

Comments
 (0)