Only show download where supported

This commit is contained in:
Hillel Coren 2021-11-14 12:08:48 +02:00
parent ae1b5bb63a
commit ed602e8216
3 changed files with 14 additions and 8 deletions

View File

@ -8,7 +8,6 @@ import 'package:flutter/material.dart' hide DataRow, DataCell, DataColumn;
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/gestures.dart' show DragStartBehavior; import 'package:flutter/gestures.dart' show DragStartBehavior;
import 'package:invoiceninja_flutter/ui/app/app_scrollbar.dart';
import 'package:invoiceninja_flutter/ui/app/tables/app_data_table.dart'; import 'package:invoiceninja_flutter/ui/app/tables/app_data_table.dart';
import 'package:invoiceninja_flutter/ui/app/tables/app_data_table_source.dart'; import 'package:invoiceninja_flutter/ui/app/tables/app_data_table_source.dart';

View File

@ -248,13 +248,14 @@ class ReportsScreen extends StatelessWidget {
}, },
); );
}), }),
AppTextButton( if (supportsFileDownload())
label: localization.export, AppTextButton(
isInHeader: true, label: localization.export,
onPressed: () { isInHeader: true,
viewModel.onExportPressed(context); onPressed: () {
}, viewModel.onExportPressed(context);
), },
),
], ],
if (isMobile(context) || !state.prefState.isHistoryVisible) if (isMobile(context) || !state.prefState.isHistoryVisible)
Builder( Builder(

View File

@ -11,6 +11,12 @@ import 'package:material_design_icons_flutter/material_design_icons_flutter.dart
import 'package:invoiceninja_flutter/utils/web_stub.dart' import 'package:invoiceninja_flutter/utils/web_stub.dart'
if (dart.library.html) 'package:invoiceninja_flutter/utils/web.dart'; if (dart.library.html) 'package:invoiceninja_flutter/utils/web.dart';
// TODO remove this function
bool supportsFileDownload() => !isDesktopOS();
// TODO remove this function
bool supportsFileUpload() => !isMacOS() && !isLinux();
bool isDesktopOS() => isMacOS() || isWindows() || isLinux(); bool isDesktopOS() => isMacOS() || isWindows() || isLinux();
bool isMobileOS() => isAndroid() || isIOS(); bool isMobileOS() => isAndroid() || isIOS();