fix bug download button in web.
This commit is contained in:
parent
3814bf14ff
commit
1d67da9598
|
|
@ -68,7 +68,6 @@ Future<void> _backgroundCallbackHomeWidget(Uri? uri) async {
|
|||
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
try {
|
||||
if (!kIsWeb) {
|
||||
HomeWidget.registerBackgroundCallback(_backgroundCallbackHomeWidget);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// ignore_for_file: library_private_types_in_public_api, deprecated_member_use, depend_on_referenced_packages
|
||||
// ignore_for_file: library_private_types_in_public_api, deprecated_member_use, depend_on_referenced_packages, unnecessary_import
|
||||
|
||||
import 'dart:io';
|
||||
import 'dart:io' show Platform;
|
||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||
|
||||
import 'package:didvan/config/design_config.dart';
|
||||
import 'package:didvan/config/theme_data.dart';
|
||||
|
|
@ -552,17 +553,33 @@ class _AiChatPageState extends State<AiChatPage> {
|
|||
),
|
||||
),
|
||||
),
|
||||
if (message.file != null && !Platform.isIOS)
|
||||
if (message.file != null && kIsWeb)
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
final url =
|
||||
'${RequestHelper.baseUrl + message.file.toString()}?accessToken=${RequestService.token}';
|
||||
kIsWeb
|
||||
? MediaService
|
||||
.downloadFileFromWeb(url)
|
||||
: await MediaService.downloadFile(
|
||||
MediaService.downloadFileFromWeb(url);
|
||||
},
|
||||
child: Icon(
|
||||
DidvanIcons.download_solid,
|
||||
size: 18,
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.focusedBorder,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (message.file != null && !kIsWeb)
|
||||
!Platform.isIOS
|
||||
? Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
final url =
|
||||
'${RequestHelper.baseUrl + message.file.toString()}?accessToken=${RequestService.token}';
|
||||
await MediaService.downloadFile(
|
||||
url,
|
||||
name: message.fileName);
|
||||
},
|
||||
|
|
@ -574,7 +591,8 @@ class _AiChatPageState extends State<AiChatPage> {
|
|||
.focusedBorder,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
if (message.error != null && message.error!)
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
|
|
|
|||
Loading…
Reference in New Issue