Skip to content

Commit

Permalink
delete download
Browse files Browse the repository at this point in the history
  • Loading branch information
niuhuan committed Mar 18, 2022
1 parent b8cf8a2 commit 7cdce44
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 7 deletions.
6 changes: 3 additions & 3 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 5BU82VSTV4;
DEVELOPMENT_TEAM = "";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
Expand Down Expand Up @@ -495,7 +495,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 5BU82VSTV4;
DEVELOPMENT_TEAM = "";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
Expand Down Expand Up @@ -523,7 +523,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 5BU82VSTV4;
DEVELOPMENT_TEAM = "";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
Expand Down
5 changes: 5 additions & 0 deletions lib/basic/methods.dart
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,11 @@ class Methods {
.toList()
.cast<DlImage>();
}

/// 创建下载
Future<dynamic> deleteDownload(int id) async {
return _invoke("delete_download", id);
}
}

class _Response {
Expand Down
12 changes: 8 additions & 4 deletions lib/screens/components/comic_download_card.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import 'package:flutter/material.dart';

import '../../basic/methods.dart';
Expand All @@ -8,9 +7,9 @@ class ComicDownloadCard extends StatelessWidget {
final DownloadAlbum comic;

const ComicDownloadCard(
this.comic, {
Key? key,
}) : super(key: key);
this.comic, {
Key? key,
}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -62,6 +61,11 @@ class ComicDownloadCard extends StatelessWidget {
style: const TextStyle(fontSize: 10),
),
])),
...(comic.dlStatus == 3)
? [
const Text("删除中", style: TextStyle(color: Colors.red)),
]
: [],
],
),
),
Expand Down
14 changes: 14 additions & 0 deletions lib/screens/downloads_screen.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:jasmine/basic/commons.dart';
import 'package:jasmine/basic/methods.dart';
import 'package:jasmine/screens/components/content_builder.dart';

Expand Down Expand Up @@ -42,12 +43,25 @@ class _DownloadsScreenState extends State<DownloadsScreen> {
children: snapshot.requireData
.map((e) => GestureDetector(
onTap: () {
if (e.dlStatus == 3) {
return;
}
Navigator.of(context).push(
MaterialPageRoute(builder: (BuildContext context) {
return DownloadAlbumScreen(e);
}),
);
},
onLongPress: () async {
String? action = await chooseListDialog(context,
values: ["删除"], title: "请选择");
if (action != null && action == "删除") {
await methods.deleteDownload(e.id);
setState(() {
_downloadsFuture = methods.allDownloads();
});
}
},
child: ComicDownloadCard(e),
))
.toList(),
Expand Down

0 comments on commit 7cdce44

Please sign in to comment.