Открыть боковую панель
Aurora OS
Flutter
Flutter Community Plugins
file_manager
Коммиты
bcf22c57
Коммит
bcf22c57
создал
Ноя 18, 2024
по автору
Minkail Taisunov
Зафиксировано автором
Зарубин Виталий Викторович
Ноя 18, 2024
Просмотр файлов
[internal] Create gitlab-ci file.
владелец
777cef95
Изменения
20
Скрыть пробелы
Построчно
Рядом
.gitlab-ci.yml
0 → 100644
Просмотр файла @
bcf22c57
include
:
-
project
:
'
oss/flutter/gitlab-ci-configuration'
file
:
'
/plugins/.plugin-ci-mono-repo.yml'
analysis_options.yaml
0 → 100644
Просмотр файла @
bcf22c57
# SPDX-FileCopyrightText: Copyright 2024 Open Mobile Platform LLC <community@omp.ru>
# SPDX-License-Identifier: BSD-3-Clause
include
:
package:flutter_lints/flutter.yaml
example/.metadata
удалено
100644 → 0
Просмотр файла @
777cef95
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled.
version:
revision: f076b7bac36b97c5a3169529290835c91f445dca
channel: master
project_type: app
# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: f076b7bac36b97c5a3169529290835c91f445dca
base_revision: f076b7bac36b97c5a3169529290835c91f445dca
- platform: android
create_revision: f076b7bac36b97c5a3169529290835c91f445dca
base_revision: f076b7bac36b97c5a3169529290835c91f445dca
- platform: linux
create_revision: f076b7bac36b97c5a3169529290835c91f445dca
base_revision: f076b7bac36b97c5a3169529290835c91f445dca
- platform: macos
create_revision: f076b7bac36b97c5a3169529290835c91f445dca
base_revision: f076b7bac36b97c5a3169529290835c91f445dca
- platform: web
create_revision: f076b7bac36b97c5a3169529290835c91f445dca
base_revision: f076b7bac36b97c5a3169529290835c91f445dca
- platform: windows
create_revision: f076b7bac36b97c5a3169529290835c91f445dca
base_revision: f076b7bac36b97c5a3169529290835c91f445dca
# User provided section
# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
example/analysis_options.yaml
Просмотр файла @
bcf22c57
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
# SPDX-FileCopyrightText: Copyright 2024 Open Mobile Platform LLC <community@omp.ru>
# SPDX-License-Identifier: BSD-3-Clause
include
:
package:flutter_lints/flutter.yaml
linter
:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules
:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
example/aurora/.gitignore
0 → 100644
Просмотр файла @
bcf22c57
/flutter
example/aurora/CMakeLists.txt
0 → 100644
Просмотр файла @
bcf22c57
# SPDX-FileCopyrightText: Copyright 2024 Open Mobile Platform LLC <community@omp.ru>
# SPDX-License-Identifier: BSD-3-Clause
# CMAKE_SYSTEM_PROCESSOR - CPU architecture name (armv7l, aarch64, x86_64)
# CMAKE_BUILD_TYPE - Build mode (debug, profile, release)
# PSDK_VERSION - Build psdk exact version
# PSDK_MAJOR - Build psdk major version
cmake_minimum_required
(
VERSION 3.10
)
project
(
ru.auroraos.file_manager_example LANGUAGES CXX
)
include
(
GNUInstallDirs
)
set
(
BINARY_NAME
${
CMAKE_PROJECT_NAME
}
)
set
(
FLUTTER_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/flutter
)
set
(
CMAKE_CXX_STANDARD 17
)
set
(
CMAKE_CXX_STANDARD_REQUIRED ON
)
set
(
CMAKE_CXX_FLAGS
"-Wall -Wextra"
)
set
(
CMAKE_CXX_FLAGS_RELEASE
"-O3"
)
set
(
CMAKE_SKIP_RPATH OFF
)
set
(
CMAKE_INSTALL_RPATH
"
\$
ORIGIN/../share/
${
BINARY_NAME
}
/lib"
)
find_package
(
PkgConfig REQUIRED
)
pkg_check_modules
(
FlutterEmbedder REQUIRED IMPORTED_TARGET flutter-embedder
)
add_executable
(
${
BINARY_NAME
}
main.cpp
${
FLUTTER_DIR
}
/generated_plugin_registrant.cpp
)
target_link_libraries
(
${
BINARY_NAME
}
PRIVATE PkgConfig::FlutterEmbedder
)
target_include_directories
(
${
BINARY_NAME
}
PRIVATE
${
FLUTTER_DIR
}
)
include
(
flutter/generated_plugins.cmake
)
set
(
PACKAGE_INSTALL_DIR
${
CMAKE_INSTALL_DATADIR
}
/
${
BINARY_NAME
}
)
set
(
DESKTOP_INSTALL_DIR
${
CMAKE_INSTALL_DATADIR
}
/applications
)
set
(
ICONS_INSTALL_ROOT_DIR
${
CMAKE_INSTALL_DATADIR
}
/icons/hicolor
)
add_custom_command
(
TARGET
${
BINARY_NAME
}
POST_BUILD
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
CMAKE_INSTALL_PREFIX
}
/
${
CMAKE_INSTALL_LIBDIR
}
/libflutter-embedder.so
${
PROJECT_BINARY_DIR
}
/bundle/lib/libflutter-embedder.so
)
install
(
FILES
${
PROJECT_BINARY_DIR
}
/bundle/icudtl.dat DESTINATION
${
PACKAGE_INSTALL_DIR
}
)
install
(
DIRECTORY
${
PROJECT_BINARY_DIR
}
/bundle/flutter_assets DESTINATION
${
PACKAGE_INSTALL_DIR
}
)
install
(
DIRECTORY
${
PROJECT_BINARY_DIR
}
/bundle/lib DESTINATION
${
PACKAGE_INSTALL_DIR
}
)
install
(
TARGETS
${
BINARY_NAME
}
RUNTIME DESTINATION
${
CMAKE_INSTALL_BINDIR
}
)
install
(
FILES desktop/
${
BINARY_NAME
}
.desktop DESTINATION
${
DESKTOP_INSTALL_DIR
}
)
foreach
(
ICONS_SIZE 86x86 108x108 128x128 172x172
)
install
(
FILES icons/
${
ICONS_SIZE
}
.png
RENAME
${
BINARY_NAME
}
.png
DESTINATION
${
ICONS_INSTALL_ROOT_DIR
}
/
${
ICONS_SIZE
}
/apps/
)
endforeach
(
ICONS_SIZE
)
example/aurora/desktop/ru.auroraos.file_manager_example.desktop
0 → 100644
Просмотр файла @
bcf22c57
[Desktop Entry]
Type=Application
Name=File Manager
Comment=The Aurora OS example of file_manager.
Icon=ru.auroraos.file_manager_example
Exec=/usr/bin/ru.auroraos.file_manager_example
X-Nemo-Application-Type=silica-qt5
[X-Application]
Permissions=UserDirs;
OrganizationName=ru.auroraos
ApplicationName=file_manager_example
example/aurora/icons/108x108.png
0 → 100644
Просмотр файла @
bcf22c57
4,4 КБ
example/aurora/icons/128x128.png
0 → 100644
Просмотр файла @
bcf22c57
5,0 КБ
example/aurora/icons/172x172.png
0 → 100644
Просмотр файла @
bcf22c57
5,5 КБ
example/aurora/icons/86x86.png
0 → 100644
Просмотр файла @
bcf22c57
4,3 КБ
example/aurora/main.cpp
0 → 100644
Просмотр файла @
bcf22c57
/**
* SPDX-FileCopyrightText: Copyright 2024 Open Mobile Platform LLC <community@omp.ru>
* SPDX-License-Identifier: BSD-3-Clause
*/
#include
<flutter/flutter_aurora.h>
#include
"generated_plugin_registrant.h"
int
main
(
int
argc
,
char
*
argv
[])
{
aurora
::
Initialize
(
argc
,
argv
);
aurora
::
RegisterPlugins
();
aurora
::
Launch
();
return
0
;
}
example/aurora/rpm/ru.auroraos.file_manager_example.spec
0 → 100644
Просмотр файла @
bcf22c57
%global __provides_exclude_from ^%{_datadir}/%{name}/lib/.*$
%global __requires_exclude ^lib(dconf|flutter-embedder|maliit-glib|.+_platform_plugin)\\.so.*$
Name: ru.auroraos.file_manager_example
Summary: Demonstrates how to use the ffile_manager plugin.
Version: 0.1.0
Release: 1
License: Proprietary
Source0: %{name}-%{version}.tar.zst
BuildRequires: cmake
BuildRequires: ninja
%description
%{summary}.
%prep
%autosetup
%build
%cmake -GNinja -DCMAKE_BUILD_TYPE=%{_flutter_build_type} -DPSDK_VERSION=%{_flutter_psdk_version} -DPSDK_MAJOR=%{_flutter_psdk_major}
%ninja_build
%install
%ninja_install
%files
%{_bindir}/%{name}
%{_datadir}/%{name}/*
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.png
example/lib/main.dart
Просмотр файла @
bcf22c57
// SPDX-FileCopyrightText: Copyright 2024 Open Mobile Platform LLC <community@omp.ru>
// SPDX-License-Identifier: BSD-3-Clause
import
'dart:io'
;
import
'package:file_manager/file_manager.dart'
;
import
'package:flutter/material.dart'
;
void
main
()
=
>
runApp
(
MyApp
());
void
main
()
=
>
runApp
(
const
MyApp
());
class
MyApp
extends
StatefulWidget
{
const
MyApp
({
Key
?
key
})
:
super
(
key:
key
);
@override
_MyAppState
createState
()
=
>
_MyAppState
();
State
<
MyApp
>
createState
()
=
>
_MyAppState
();
}
class
_MyAppState
extends
State
<
MyApp
>
{
...
...
@@ -26,6 +31,8 @@ class _MyAppState extends State<MyApp> {
class
HomePage
extends
StatelessWidget
{
final
FileManagerController
controller
=
FileManagerController
();
HomePage
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
ControlBackButton
(
...
...
@@ -37,15 +44,15 @@ class HomePage extends StatelessWidget {
builder:
(
context
,
snapshot
)
{
final
List
<
FileSystemEntity
>
entities
=
snapshot
;
return
ListView
.
builder
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
2
,
vertical:
0
),
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
2
,
vertical:
0
),
itemCount:
entities
.
length
,
itemBuilder:
(
context
,
index
)
{
FileSystemEntity
entity
=
entities
[
index
];
return
Card
(
child:
ListTile
(
leading:
FileManager
.
isFile
(
entity
)
?
Icon
(
Icons
.
feed_outlined
)
:
Icon
(
Icons
.
folder
),
?
const
Icon
(
Icons
.
feed_outlined
)
:
const
Icon
(
Icons
.
folder
),
title:
Text
(
FileManager
.
basename
(
entity
,
showFileExtension:
true
,
...
...
@@ -94,7 +101,7 @@ class HomePage extends StatelessWidget {
onPressed:
()
async
{
FileManager
.
requestFilesAccessPermission
();
},
label:
Text
(
"Request File Access Permission"
),
label:
const
Text
(
"Request File Access Permission"
),
),
),
);
...
...
@@ -105,15 +112,15 @@ class HomePage extends StatelessWidget {
actions:
[
IconButton
(
onPressed:
()
=
>
createFolder
(
context
),
icon:
Icon
(
Icons
.
create_new_folder_outlined
),
icon:
const
Icon
(
Icons
.
create_new_folder_outlined
),
),
IconButton
(
onPressed:
()
=
>
sort
(
context
),
icon:
Icon
(
Icons
.
sort_rounded
),
icon:
const
Icon
(
Icons
.
sort_rounded
),
),
IconButton
(
onPressed:
()
=
>
selectStorage
(
context
),
icon:
Icon
(
Icons
.
sd_storage_rounded
),
icon:
const
Icon
(
Icons
.
sd_storage_rounded
),
)
],
title:
ValueListenableBuilder
<
String
>(
...
...
@@ -121,7 +128,7 @@ class HomePage extends StatelessWidget {
builder:
(
context
,
title
,
_
)
=
>
Text
(
title
),
),
leading:
IconButton
(
icon:
Icon
(
Icons
.
arrow_back
),
icon:
const
Icon
(
Icons
.
arrow_back
),
onPressed:
()
async
{
await
controller
.
goToParentDirectory
();
},
...
...
@@ -138,14 +145,14 @@ class HomePage extends StatelessWidget {
int
size
=
snapshot
.
data
!.
size
;
return
Text
(
"
${
FileManager.formatBytes(size)
}
"
,
FileManager
.
formatBytes
(
size
),
);
}
return
Text
(
"
${snapshot.data!.modified}
"
.
substring
(
0
,
10
),
);
}
else
{
return
Text
(
""
);
return
const
Text
(
""
);
}
},
);
...
...
@@ -167,7 +174,7 @@ class HomePage extends StatelessWidget {
children:
storageList
.
map
((
e
)
=
>
ListTile
(
title:
Text
(
"
${
FileManager.basename(e)
}
"
,
FileManager
.
basename
(
e
),
),
onTap:
()
{
controller
.
openDirectory
(
e
);
...
...
@@ -177,7 +184,7 @@ class HomePage extends StatelessWidget {
.
toList
()),
);
}
return
Dialog
(
return
const
Dialog
(
child:
CircularProgressIndicator
(),
);
},
...
...
@@ -191,30 +198,30 @@ class HomePage extends StatelessWidget {
context:
context
,
builder:
(
context
)
=
>
Dialog
(
child:
Container
(
padding:
EdgeInsets
.
all
(
10
),
padding:
const
EdgeInsets
.
all
(
10
),
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
[
ListTile
(
title:
Text
(
"Name"
),
title:
const
Text
(
"Name"
),
onTap:
()
{
controller
.
sortBy
(
SortBy
.
name
);
Navigator
.
pop
(
context
);
}),
ListTile
(
title:
Text
(
"Size"
),
title:
const
Text
(
"Size"
),
onTap:
()
{
controller
.
sortBy
(
SortBy
.
size
);
Navigator
.
pop
(
context
);
}),
ListTile
(
title:
Text
(
"Date"
),
title:
const
Text
(
"Date"
),
onTap:
()
{
controller
.
sortBy
(
SortBy
.
date
);
Navigator
.
pop
(
context
);
}),
ListTile
(
title:
Text
(
"type"
),
title:
const
Text
(
"type"
),
onTap:
()
{
controller
.
sortBy
(
SortBy
.
type
);
Navigator
.
pop
(
context
);
...
...
@@ -233,7 +240,7 @@ class HomePage extends StatelessWidget {
TextEditingController
folderName
=
TextEditingController
();
return
Dialog
(
child:
Container
(
padding:
EdgeInsets
.
all
(
10
),
padding:
const
EdgeInsets
.
all
(
10
),
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
[
...
...
@@ -250,12 +257,15 @@ class HomePage extends StatelessWidget {
controller
.
getCurrentPath
,
folderName
.
text
);
// Open Created Folder
controller
.
setCurrentPath
=
controller
.
getCurrentPath
+
"/"
+
folderName
.
text
;
}
catch
(
e
)
{}
Navigator
.
pop
(
context
);
"
${controller.getCurrentPath}
/
${folderName.text}
"
;
}
catch
(
e
)
{
debugPrint
(
'Error:
$e
'
);
}
if
(
context
.
mounted
)
{
Navigator
.
pop
(
context
);
}
},
child:
Text
(
'Create Folder'
),
child:
const
Text
(
'Create Folder'
),
)
],
),
...
...
example/pubspec.lock
Просмотр файла @
bcf22c57
...
...
@@ -69,6 +69,14 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04
url: "https://pub.dev"
source: hosted
version: "2.0.3"
flutter_test:
dependency: "direct dev"
description: flutter
...
...
@@ -98,6 +106,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.0.1"
lints:
dependency: transitive
description:
name: lints
sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452"
url: "https://pub.dev"
source: hosted
version: "2.1.1"
matcher:
dependency: transitive
description:
...
...
@@ -134,10 +150,10 @@ packages:
dependency: transitive
description:
name: path_provider
sha256:
fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378
sha256:
"50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd"
url: "https://pub.dev"
source: hosted
version: "2.1.
4
"
version: "2.1.
5
"
path_provider_android:
dependency: transitive
description:
...
...
@@ -146,6 +162,15 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.2.12"
path_provider_aurora:
dependency: transitive
description:
path: "packages/path_provider_aurora"
ref: "aurora-path_provider_aurora-0.6.0"
resolved-ref: "82e13309171cb454aae989dbbde477282dfa7e20"
url: "https://gitlab.com/omprussia/flutter/packages.git"
source: git
version: "0.6.0"
path_provider_foundation:
dependency: transitive
description:
...
...
@@ -182,10 +207,10 @@ packages:
dependency: transitive
description:
name: platform
sha256: "
9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65
"
sha256: "
5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984
"
url: "https://pub.dev"
source: hosted
version: "3.1.
5
"
version: "3.1.
6
"
plugin_platform_interface:
dependency: transitive
description:
...
...
example/pubspec.yaml
Просмотр файла @
bcf22c57
name
:
example
description
:
A new Flutter project.
# SPDX-FileCopyrightText: Copyright 2024 Open Mobile Platform LLC <community@omp.ru>
# SPDX-License-Identifier: BSD-3-Clause
name
:
file_manager_example
description
:
"
The
Aurora
OS
example
of
file_manager_example."
# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to
:
'
none'
# Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
publish_to
:
'
none'
version
:
1.0.0+1
environment
:
...
...
@@ -29,45 +18,7 @@ dependencies:
dev_dependencies
:
flutter_test
:
sdk
:
flutter
flutter_lints
:
^2.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter
:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design
:
true
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
lib/controller/file_manager_controller.dart
Просмотр файла @
bcf22c57
...
...
@@ -60,8 +60,9 @@ class FileManagerController {
/// Jumps to the parent directory of currently opened directory if the parent is accessible.
Future
<
void
>
goToParentDirectory
()
async
{
if
(
!
(
await
isRootDirectory
()))
if
(
!
(
await
isRootDirectory
()))
{
openDirectory
(
Directory
(
_path
.
value
)
.
parent
);
}
}
/// Open directory by providing [Directory].
...
...
lib/file_manager.dart
Просмотр файла @
bcf22c57
// ignore_for_file: library_private_types_in_public_api
library
file_manager
;
import
'dart:io'
;
...
...
@@ -98,14 +100,14 @@ class FileManager extends StatefulWidget {
/// Hide the files and folders that are hidden.
final
bool
hideHiddenEntity
;
FileManager
({
const
FileManager
({
Key
?
key
,
this
.
emptyFolder
,
this
.
loadingScreen
,
this
.
errorBuilder
,
required
this
.
controller
,
required
this
.
builder
,
this
.
hideHiddenEntity
=
true
,
});
})
:
super
(
key:
key
)
;
@override
_FileManagerState
createState
()
=
>
_FileManagerState
();
...
...
@@ -114,8 +116,8 @@ class FileManager extends StatefulWidget {
if
(
Platform
.
isAndroid
)
{
try
{
await
_methodChannel
.
invokeMethod
(
'requestFilesAccessPermission'
);
}
on
PlatformException
catch
(
e
)
{
throw
e
;
}
on
PlatformException
{
re
throw
;
}
}
else
{
throw
UnsupportedError
(
'Only Android is supported'
);
...
...
@@ -174,7 +176,7 @@ class FileManager extends StatefulWidget {
/// Creates the directory if it doesn't exist.
static
Future
<
void
>
createFolder
(
String
currentPath
,
String
name
)
async
{
await
Directory
(
currentPath
+
"/"
+
name
)
.
create
();
await
Directory
(
"
$
currentPath
/
$
name
"
)
.
create
();
}
/// Return file extension as String.
...
...
@@ -260,7 +262,6 @@ class _FileManagerState extends State<FileManager> {
if
(
snapshot
.
hasData
)
{
return
_body
(
context
);
}
else
if
(
snapshot
.
hasError
)
{
print
(
snapshot
.
error
);
return
_errorPage
(
context
,
snapshot
.
error
);
}
else
{
return
_loadingScreenWidget
();
...
...
@@ -282,7 +283,7 @@ class _FileManagerState extends State<FileManager> {
builder:
(
context
,
snapshot
)
{
if
(
snapshot
.
hasData
)
{
List
<
FileSystemEntity
>
entitys
=
snapshot
.
data
!
;
if
(
entitys
.
length
==
0
)
{
if
(
entitys
.
isEmpty
)
{
return
_emptyFolderWidget
();
}
if
(
widget
.
hideHiddenEntity
)
{
...
...
@@ -297,7 +298,6 @@ class _FileManagerState extends State<FileManager> {
}
return
widget
.
builder
(
context
,
entitys
);
}
else
if
(
snapshot
.
hasError
)
{
print
(
snapshot
.
error
);
return
_errorPage
(
context
,
snapshot
.
error
);
}
else
{
return
_loadingScreenWidget
();
...
...
@@ -310,11 +310,10 @@ class _FileManagerState extends State<FileManager> {
Widget
_emptyFolderWidget
()
{
if
(
widget
.
emptyFolder
==
null
)
{
return
Container
(
child:
Center
(
child:
Text
(
"Empty Directory"
)),
);
}
else
return
const
Center
(
child:
Text
(
"Empty Directory"
));
}
else
{
return
widget
.
emptyFolder
!
;
}
}
Widget
_errorPage
(
BuildContext
context
,
Object
?
error
)
{
...
...
@@ -331,16 +330,12 @@ class _FileManagerState extends State<FileManager> {
Widget
_loadingScreenWidget
()
{
if
((
widget
.
loadingScreen
==
null
))
{
return
Container
(
child:
Center
(
child:
CircularProgressIndicator
(),
),
return
const
Center
(
child:
CircularProgressIndicator
(),
);
}
else
{
return
Container
(
child:
Center
(
child:
widget
.
loadingScreen
,
),
return
Center
(
child:
widget
.
loadingScreen
,
);
}
}
...
...
@@ -371,6 +366,7 @@ class ControlBackButton extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
// ignore: deprecated_member_use
return
WillPopScope
(
child:
child
,
onWillPop:
()
async
{
...
...
lib/utils/extensions.dart
Просмотр файла @
bcf22c57
...
...
@@ -27,18 +27,18 @@ extension FileSystemEntityExtensions on List<FileSystemEntity> {
}
Future
<
List
<
FileSystemEntity
>>
get
sortByDate
async
{
final
List
<
_PathStat
>
_
pathStat
=
[];
final
List
<
_PathStat
>
pathStat
=
[];
for
(
final
entity
in
this
)
{
final
stat
=
await
entity
.
stat
();
_
pathStat
.
add
(
_PathStat
(
entity
.
path
,
stat
.
modified
));
pathStat
.
add
(
_PathStat
(
entity
.
path
,
stat
.
modified
));
}
_
pathStat
.
sort
((
a
,
b
)
=
>
b
.
dateTime
.
compareTo
(
a
.
dateTime
));
pathStat
.
sort
((
a
,
b
)
=
>
b
.
dateTime
.
compareTo
(
a
.
dateTime
));
return
_
pathStat
return
pathStat
.
map
((
pathStat
)
=
>
this
.
firstWhere
((
entity
)
=
>
entity
.
path
==
pathStat
.
path
))
firstWhere
((
entity
)
=
>
entity
.
path
==
pathStat
.
path
))
.
toList
();
}
...
...
@@ -78,8 +78,8 @@ extension FileSystemEntityExtensions on List<FileSystemEntity> {
dirs
.
sort
((
a
,
b
)
=
>
a
.
path
.
toLowerCase
()
.
compareTo
(
b
.
path
.
toLowerCase
()));
files
.
sort
((
a
,
b
)
=
>
b
.
lengthSync
()
.
compareTo
(
a
.
lengthSync
()));
this
.
clear
();
this
.
addAll
([..
.
dirs
,
..
.
files
]);
clear
();
addAll
([..
.
dirs
,
..
.
files
]);
return
this
;
}
...
...
pubspec.yaml
Просмотр файла @
bcf22c57
# SPDX-FileCopyrightText: Copyright 2024 Open Mobile Platform LLC <community@omp.ru>
# SPDX-License-Identifier: BSD-3-Clause
name
:
file_manager
description
:
FileManager is a wonderful widget that allows you to manage files
and folders, pick files and folders, and do a lot more. Designed to feel like
...
...
@@ -15,7 +17,11 @@ dependencies:
flutter
:
sdk
:
flutter
path_provider
:
^2.0.11
path_provider_aurora
:
git
:
url
:
https://gitlab.com/omprussia/flutter/packages.git
ref
:
aurora-path_provider_aurora-0.6.0
path
:
packages/path_provider_aurora
dev_dependencies
:
flutter_test
:
sdk
:
flutter
flutter_lints
:
^2.0.0
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать