Updates size property on web from kb to bytes

This commit is contained in:
Miguel Ruivo 2021-01-08 22:50:58 +00:00
parent 55127843c9
commit 9500baac97
4 changed files with 21 additions and 17 deletions

View File

@ -1,5 +1,9 @@
## 2.1.5+1
- Web: Updates `size` property from `PlatformFile` to be in bytes instead of kb;
- Applies minor refactor to example app. Thank you @Abhishek01039;
## 2.1.5
Updates `size` property from `PlatformFile` to be in bytes instead of kb.
iOS & Android: Updates `size` property from `PlatformFile` to be in bytes instead of kb.
## 2.1.4
iOS: Fixes iOS ViewController which is nil when UIWindow.rootViewController have changed. ([#525](https://github.com/miguelpruivo/flutter_file_picker/issues/525)). Thank you @devcxm.

View File

@ -86,31 +86,31 @@ class _FilePickerDemoState extends State<FilePickerDemo> {
Padding(
padding: const EdgeInsets.only(top: 20.0),
child: DropdownButton(
hint: Text('LOAD PATH FROM'),
hint: const Text('LOAD PATH FROM'),
value: _pickingType,
items: <DropdownMenuItem>[
DropdownMenuItem(
child: Text('FROM AUDIO'),
child: const Text('FROM AUDIO'),
value: FileType.audio,
),
DropdownMenuItem(
child: Text('FROM IMAGE'),
child: const Text('FROM IMAGE'),
value: FileType.image,
),
DropdownMenuItem(
child: Text('FROM VIDEO'),
child: const Text('FROM VIDEO'),
value: FileType.video,
),
DropdownMenuItem(
child: Text('FROM MEDIA'),
child: const Text('FROM MEDIA'),
value: FileType.media,
),
DropdownMenuItem(
child: Text('FROM ANY'),
child: const Text('FROM ANY'),
value: FileType.any,
),
DropdownMenuItem(
child: Text('CUSTOM FORMAT'),
child: const Text('CUSTOM FORMAT'),
value: FileType.custom,
),
],
@ -149,17 +149,17 @@ class _FilePickerDemoState extends State<FilePickerDemo> {
padding: const EdgeInsets.only(top: 50.0, bottom: 20.0),
child: Column(
children: <Widget>[
RaisedButton(
ElevatedButton(
onPressed: () => _openFileExplorer(),
child: Text("Open file picker"),
child: const Text("Open file picker"),
),
RaisedButton(
ElevatedButton(
onPressed: () => _selectFolder(),
child: Text("Pick folder"),
child: const Text("Pick folder"),
),
RaisedButton(
ElevatedButton(
onPressed: () => _clearCachedFiles(),
child: Text("Clear temporary files"),
child: const Text("Clear temporary files"),
),
],
),
@ -172,7 +172,7 @@ class _FilePickerDemoState extends State<FilePickerDemo> {
)
: _directoryPath != null
? ListTile(
title: Text('Directory path'),
title: const Text('Directory path'),
subtitle: Text(_directoryPath),
)
: _paths != null

View File

@ -75,7 +75,7 @@ class FilePickerWeb extends FilePicker {
pickedFiles.add(PlatformFile(
name: file.name,
path: path,
size: bytes != null ? bytes.length ~/ 1024 : file.size,
size: bytes != null ? bytes.length : file.size,
bytes: bytes,
readStream: readStream,
));

View File

@ -1,7 +1,7 @@
name: file_picker
description: A package that allows you to use a native file explorer to pick single or multiple absolute file paths, with extension filtering support.
homepage: https://github.com/miguelpruivo/plugins_flutter_file_picker
version: 2.1.5
version: 2.1.5+1
dependencies:
flutter: