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