updated new flutter version

This commit is contained in:
2023-12-15 21:34:23 +08:00
parent bcf21d90ac
commit f8a90ad305
20 changed files with 304 additions and 297 deletions

View File

@@ -2,6 +2,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import "package:universal_html/html.dart";
import '../../constants.dart';
import '../../generated/l10n.dart';
@@ -22,7 +23,7 @@ class DownloadItem extends StatefulWidget {
}
class DownloadItemState extends State<DownloadItem> {
final double buttonWidth = 114.0;
final double buttonWidth = 122.0;
final double iconWidth = 48.0;
@override
@@ -275,8 +276,14 @@ class DownloadItemState extends State<DownloadItem> {
],
),
onPressed: () async {
if (await canLaunch(downloadUrl)) {
await launch('$downloadUrl');
if (kIsWeb) {
AnchorElement anchorElement = new AnchorElement(href: downloadUrl);
anchorElement.download = downloadUrl;
anchorElement.click();
} else {
if (!await launchUrl(Uri.parse('$downloadUrl'))) {
throw 'Could not launch $downloadUrl';
}
}
},
);