Correct web build with windows file picker
This commit is contained in:
parent
60b7d57a5d
commit
a83fd664eb
|
|
@ -515,7 +515,7 @@ const Map<int, String> kModules = {
|
|||
kModuleTasks: 'tasks',
|
||||
kModuleVendors: 'vendors',
|
||||
kModuleExpenses: 'expenses',
|
||||
//kModuleRecurringExpenses: 'recurring_expenses',
|
||||
kModuleRecurringExpenses: 'recurring_expenses',
|
||||
//kModuleTickets: 'tickets',
|
||||
//kModuleRecurringTasks: 'recurring_tasks',
|
||||
//kModuleRecurringQuotes: 'recurring_quotes',
|
||||
|
|
|
|||
|
|
@ -419,14 +419,12 @@ class MenuDrawer extends StatelessWidget {
|
|||
iconTooltip: localization.newExpense,
|
||||
),
|
||||
// STARTER: menu - do not remove comment
|
||||
/*
|
||||
DrawerTile(
|
||||
company: company,
|
||||
entityType: EntityType.recurringExpense,
|
||||
icon: getEntityIcon(EntityType.recurringExpense),
|
||||
title: localization.recurringExpenses,
|
||||
),
|
||||
*/
|
||||
DrawerTile(
|
||||
company: company,
|
||||
icon: getEntityIcon(EntityType.reports),
|
||||
|
|
|
|||
|
|
@ -1,11 +1,13 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
//import 'package:filepicker_windows/filepicker_windows.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:invoiceninja_flutter/utils/platforms.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
// ignore: unused_import
|
||||
import 'package:invoiceninja_flutter/utils/web_stub.dart'
|
||||
if (dart.library.html) 'package:invoiceninja_flutter/utils/web.dart';
|
||||
|
||||
Future<MultipartFile> pickFile(
|
||||
{String fileIndex,
|
||||
|
|
@ -18,19 +20,10 @@ Future<MultipartFile> pickFile(
|
|||
allowedExtensions: allowedExtensions,
|
||||
);
|
||||
} else if (isWindows()) {
|
||||
/*
|
||||
final filePicker = OpenFilePicker();
|
||||
final file = filePicker.getFile();
|
||||
|
||||
if (file == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return MultipartFile.fromBytes(
|
||||
fileIndex ?? 'file', await file.readAsBytes(),
|
||||
filename: file.path.split('\\').last.split('/').last);
|
||||
*/
|
||||
return null;
|
||||
return WebUtils.pickFile(
|
||||
fileIndex: fileIndex,
|
||||
allowedExtensions: allowedExtensions,
|
||||
fileType: fileType);
|
||||
} else {
|
||||
final permission = await (fileType == FileType.image && Platform.isIOS
|
||||
? Permission.photos.status
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ import 'dart:convert';
|
|||
import 'dart:html';
|
||||
import 'dart:typed_data';
|
||||
import 'dart:ui' as ui;
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||
import 'package:invoiceninja_flutter/utils/formatting.dart';
|
||||
import 'package:redux/redux.dart';
|
||||
|
|
@ -62,6 +64,13 @@ class WebUtils {
|
|||
});
|
||||
}
|
||||
|
||||
static Future<MultipartFile> pickFile(
|
||||
{String fileIndex,
|
||||
FileType fileType,
|
||||
List<String> allowedExtensions}) async {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
String loadToken() {
|
||||
final cookies = document.cookie;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
import 'dart:typed_data';
|
||||
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:filepicker_windows/filepicker_windows.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||
import 'package:redux/redux.dart';
|
||||
|
||||
|
|
@ -20,6 +23,22 @@ class WebUtils {
|
|||
|
||||
static void warnChanges(Store<AppState> store) {}
|
||||
|
||||
static Future<MultipartFile> pickFile(
|
||||
{String fileIndex,
|
||||
FileType fileType,
|
||||
List<String> allowedExtensions}) async {
|
||||
final filePicker = OpenFilePicker();
|
||||
final file = filePicker.getFile();
|
||||
|
||||
if (file == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return MultipartFile.fromBytes(
|
||||
fileIndex ?? 'file', await file.readAsBytes(),
|
||||
filename: file.path.split('\\').last.split('/').last);
|
||||
}
|
||||
|
||||
/*
|
||||
static String loadToken() => null;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue