From 3b03deb2d75dab0692fb4cbf2b4080f69c535da6 Mon Sep 17 00:00:00 2001 From: Frederik Feichtmeier Date: Wed, 30 Oct 2024 23:40:12 +0100 Subject: [PATCH] chore: update sdk version, yaru and add CI and release workflows (#1) * chore: update sdk version, yaru and add CI and release workflows --- .github/workflows/ci.yaml | 54 +++ .github/workflows/release.yaml | 19 + analysis_options.yaml | 31 +- clipboard_viewer/.gitignore | 44 -- clipboard_viewer/.metadata | 30 -- clipboard_viewer/.vscode/launch.json | 26 -- clipboard_viewer/README.md | 16 - clipboard_viewer/analysis_options.yaml | 8 - clipboard_viewer/lib/main.dart | 91 ---- clipboard_viewer/linux/.gitignore | 1 - clipboard_viewer/linux/CMakeLists.txt | 139 ------ clipboard_viewer/linux/flutter/CMakeLists.txt | 88 ---- .../flutter/generated_plugin_registrant.cc | 23 - .../flutter/generated_plugin_registrant.h | 15 - .../linux/flutter/generated_plugins.cmake | 26 -- clipboard_viewer/linux/main.cc | 6 - clipboard_viewer/linux/my_application.cc | 104 ----- clipboard_viewer/linux/my_application.h | 18 - clipboard_viewer/pubspec.lock | 274 ----------- clipboard_viewer/pubspec.yaml | 31 -- clipboard_viewer/test/widget_test.dart | 19 - lib/backend/database/helper.dart | 10 +- lib/backend/database/model.dart | 29 +- lib/backend/entity_info.dart | 8 +- lib/backend/fetch.dart | 8 +- lib/backend/folder_provider.dart | 49 +- lib/backend/path_parts.dart | 37 +- lib/backend/providers.dart | 2 +- lib/backend/stat_cache_proxy.dart | 14 +- lib/backend/utils.dart | 73 ++- lib/backend/workspace.dart | 15 +- lib/main.dart | 20 +- lib/widgets/breadcrumbs_bar.dart | 42 +- lib/widgets/context_menu.dart | 60 +-- lib/widgets/double_scrollbars.dart | 30 +- lib/widgets/drive_list.dart | 26 +- lib/widgets/entity_context_menu.dart | 28 +- lib/widgets/folder_dialog.dart | 8 +- lib/widgets/grid.dart | 55 ++- lib/widgets/separated_flex.dart | 20 +- lib/widgets/side_pane.dart | 18 +- lib/widgets/tab_strip.dart | 36 +- lib/widgets/table.dart | 94 ++-- lib/widgets/timed_inkwell.dart | 12 +- lib/widgets/workspace.dart | 88 ++-- linux/flutter/generated_plugin_registrant.cc | 8 +- linux/flutter/generated_plugins.cmake | 2 +- pubspec.lock | 438 ++++++++++++------ pubspec.yaml | 21 +- .../flutter/generated_plugin_registrant.cc | 6 +- windows/flutter/generated_plugins.cmake | 2 +- 51 files changed, 776 insertions(+), 1546 deletions(-) create mode 100644 .github/workflows/ci.yaml create mode 100644 .github/workflows/release.yaml delete mode 100755 clipboard_viewer/.gitignore delete mode 100755 clipboard_viewer/.metadata delete mode 100755 clipboard_viewer/.vscode/launch.json delete mode 100755 clipboard_viewer/README.md delete mode 100755 clipboard_viewer/analysis_options.yaml delete mode 100755 clipboard_viewer/lib/main.dart delete mode 100755 clipboard_viewer/linux/.gitignore delete mode 100755 clipboard_viewer/linux/CMakeLists.txt delete mode 100755 clipboard_viewer/linux/flutter/CMakeLists.txt delete mode 100755 clipboard_viewer/linux/flutter/generated_plugin_registrant.cc delete mode 100755 clipboard_viewer/linux/flutter/generated_plugin_registrant.h delete mode 100755 clipboard_viewer/linux/flutter/generated_plugins.cmake delete mode 100755 clipboard_viewer/linux/main.cc delete mode 100755 clipboard_viewer/linux/my_application.cc delete mode 100755 clipboard_viewer/linux/my_application.h delete mode 100755 clipboard_viewer/pubspec.lock delete mode 100755 clipboard_viewer/pubspec.yaml delete mode 100755 clipboard_viewer/test/widget_test.dart diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..c32424e --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,54 @@ +name: CI + +on: + pull_request: + branches: [master] + +env: + FLUTTER_VERSION: '3.24.3' + +jobs: + analyze: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: subosito/flutter-action@v2 + with: + channel: 'stable' + flutter-version: ${{env.FLUTTER_VERSION}} + - run: flutter pub get + - run: flutter analyze --fatal-infos + + format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: subosito/flutter-action@v2 + with: + channel: 'stable' + flutter-version: ${{env.FLUTTER_VERSION}} + - run: flutter pub get + - run: dart format --set-exit-if-changed . + + # test: + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v4 + # - uses: subosito/flutter-action@v2 + # with: + # channel: 'stable' + # flutter-version: ${{env.FLUTTER_VERSION}} + # - run: flutter test + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: subosito/flutter-action@v2 + with: + channel: 'stable' + flutter-version: ${{env.FLUTTER_VERSION}} + - run: sudo apt update + - run: sudo apt install -y clang cmake curl libgtk-3-dev ninja-build pkg-config unzip libunwind-dev + - run: flutter pub get + - run: flutter build linux -v \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..a16c2f0 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,19 @@ +name: Release + +on: + push: + branches: + - master + workflow_dispatch: + +permissions: + contents: write + pull-requests: write + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: googleapis/release-please-action@v4 + with: + release-type: dart diff --git a/analysis_options.yaml b/analysis_options.yaml index fa6fb0d..b8a22b9 100755 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,6 +1,27 @@ -include: package:lint/analysis_options.yaml +include: package:flutter_lints/flutter.yaml -analyzer: - exclude: - - lib/generated_plugin_registrant.dart - - lib/**/*.g.dart \ No newline at end of file +linter: + rules: + prefer_single_quotes: true + require_trailing_commas: true + always_declare_return_types: true + avoid_catches_without_on_clauses: true + avoid_equals_and_hash_code_on_mutable_classes: true + avoid_types_on_closure_parameters: true + cancel_subscriptions: true + directives_ordering: true + eol_at_end_of_file: true + prefer_asserts_in_initializer_lists: true + prefer_const_constructors: true + prefer_final_in_for_each: true + prefer_final_locals: true + prefer_null_aware_method_calls: true + prefer_null_aware_operators: true + sort_unnamed_constructors_first: true + sort_pub_dependencies: true + type_annotate_public_apis: true + unawaited_futures: true + unnecessary_lambdas: true + unnecessary_parenthesis: true + use_named_constants: true + use_super_parameters: true \ No newline at end of file diff --git a/clipboard_viewer/.gitignore b/clipboard_viewer/.gitignore deleted file mode 100755 index 24476c5..0000000 --- a/clipboard_viewer/.gitignore +++ /dev/null @@ -1,44 +0,0 @@ -# Miscellaneous -*.class -*.log -*.pyc -*.swp -.DS_Store -.atom/ -.buildlog/ -.history -.svn/ -migrate_working_dir/ - -# IntelliJ related -*.iml -*.ipr -*.iws -.idea/ - -# The .vscode folder contains launch configuration and tasks you configure in -# VS Code which you may wish to be included in version control, so this line -# is commented out by default. -#.vscode/ - -# Flutter/Dart/Pub related -**/doc/api/ -**/ios/Flutter/.last_build_id -.dart_tool/ -.flutter-plugins -.flutter-plugins-dependencies -.packages -.pub-cache/ -.pub/ -/build/ - -# Symbolication related -app.*.symbols - -# Obfuscation related -app.*.map.json - -# Android Studio will place build artifacts here -/android/app/debug -/android/app/profile -/android/app/release diff --git a/clipboard_viewer/.metadata b/clipboard_viewer/.metadata deleted file mode 100755 index aa38c60..0000000 --- a/clipboard_viewer/.metadata +++ /dev/null @@ -1,30 +0,0 @@ -# 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: f9ad42a32d7e116f321569ec118416f981806151 - channel: master - -project_type: app - -# Tracks metadata for the flutter migrate command -migration: - platforms: - - platform: root - create_revision: f9ad42a32d7e116f321569ec118416f981806151 - base_revision: f9ad42a32d7e116f321569ec118416f981806151 - - platform: linux - create_revision: f9ad42a32d7e116f321569ec118416f981806151 - base_revision: f9ad42a32d7e116f321569ec118416f981806151 - - # 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' diff --git a/clipboard_viewer/.vscode/launch.json b/clipboard_viewer/.vscode/launch.json deleted file mode 100755 index 8fae015..0000000 --- a/clipboard_viewer/.vscode/launch.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "clipboard_viewer", - "request": "launch", - "type": "dart", - "args": ["--enable-experiment=records"] - }, - { - "name": "clipboard_viewer (profile mode)", - "request": "launch", - "type": "dart", - "flutterMode": "profile" - }, - { - "name": "clipboard_viewer (release mode)", - "request": "launch", - "type": "dart", - "flutterMode": "release" - } - ] -} \ No newline at end of file diff --git a/clipboard_viewer/README.md b/clipboard_viewer/README.md deleted file mode 100755 index 4590572..0000000 --- a/clipboard_viewer/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# clipboard_viewer - -A new Flutter project. - -## Getting Started - -This project is a starting point for a Flutter application. - -A few resources to get you started if this is your first Flutter project: - -- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) -- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) - -For help getting started with Flutter development, view the -[online documentation](https://docs.flutter.dev/), which offers tutorials, -samples, guidance on mobile development, and a full API reference. diff --git a/clipboard_viewer/analysis_options.yaml b/clipboard_viewer/analysis_options.yaml deleted file mode 100755 index a93d96a..0000000 --- a/clipboard_viewer/analysis_options.yaml +++ /dev/null @@ -1,8 +0,0 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - enable-experiment: - - records - -linter: - rules: diff --git a/clipboard_viewer/lib/main.dart b/clipboard_viewer/lib/main.dart deleted file mode 100755 index 333238f..0000000 --- a/clipboard_viewer/lib/main.dart +++ /dev/null @@ -1,91 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:pasteboard/pasteboard.dart'; -import 'package:super_clipboard/super_clipboard.dart'; -// ignore: implementation_imports -import 'package:super_clipboard/src/format_conversions.dart'; - -void main() { - runApp(const MyApp()); -} - -class MyApp extends StatelessWidget { - const MyApp({super.key}); - - @override - Widget build(BuildContext context) { - return MaterialApp( - title: 'Flutter Demo', - theme: ThemeData( - colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), - useMaterial3: true, - ), - home: const MyHomePage(title: 'Flutter Demo Home Page'), - ); - } -} - -class MyHomePage extends StatefulWidget { - const MyHomePage({super.key, required this.title}); - - final String title; - - @override - State createState() => _MyHomePageState(); -} - -class _MyHomePageState extends State { - final List<(ClipboardDataReader, Object?)> items = []; - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - backgroundColor: Theme.of(context).colorScheme.inversePrimary, - title: Text(widget.title), - ), - body: ListView.builder( - itemCount: items.length, - itemBuilder: (context, index) { - final item = items[index]; - final rawReader = item.$1.rawReader; - - return ListTile( - title: SelectableText(item.$2.toString()), - subtitle: SelectableText( - item.$1.platformFormats.map((e) => "'$e'").join(", ")), - ); - }, - ), - floatingActionButton: FloatingActionButton( - onPressed: () async { - await Pasteboard.writeFiles(["/home/davide"]); - return; - final data = await ClipboardReader.readClipboard(); - final value = await data.readValue(linuxFileUri); - - setState(() { - items.add((data, value)); - }); - }, - tooltip: 'Increment', - child: const Icon(Icons.add), - ), - ); - } -} - -final linuxFileUri = SimpleValueFormat( - android: Formats.fileUri.android, - ios: Formats.fileUri.ios, - linux: const SimplePlatformCodec( - formats: ['application/vnd.portal.files'], - decodingFormats: ['application/vnd.portal.files'], - encodingFormats: ['application/vnd.portal.files'], - onDecode: fileUriFromString, - onEncode: fileUriToString, - ), - macos: Formats.fileUri.macos, - windows: Formats.fileUri.windows, - web: Formats.fileUri.web, - fallback: Formats.fileUri.fallback, -); diff --git a/clipboard_viewer/linux/.gitignore b/clipboard_viewer/linux/.gitignore deleted file mode 100755 index d3896c9..0000000 --- a/clipboard_viewer/linux/.gitignore +++ /dev/null @@ -1 +0,0 @@ -flutter/ephemeral diff --git a/clipboard_viewer/linux/CMakeLists.txt b/clipboard_viewer/linux/CMakeLists.txt deleted file mode 100755 index 835c801..0000000 --- a/clipboard_viewer/linux/CMakeLists.txt +++ /dev/null @@ -1,139 +0,0 @@ -# Project-level configuration. -cmake_minimum_required(VERSION 3.10) -project(runner LANGUAGES CXX) - -# The name of the executable created for the application. Change this to change -# the on-disk name of your application. -set(BINARY_NAME "clipboard_viewer") -# The unique GTK application identifier for this application. See: -# https://wiki.gnome.org/HowDoI/ChooseApplicationID -set(APPLICATION_ID "io.hrx.clipboard_viewer") - -# Explicitly opt in to modern CMake behaviors to avoid warnings with recent -# versions of CMake. -cmake_policy(SET CMP0063 NEW) - -# Load bundled libraries from the lib/ directory relative to the binary. -set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") - -# Root filesystem for cross-building. -if(FLUTTER_TARGET_PLATFORM_SYSROOT) - set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) - set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) - set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) - set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) - set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) - set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -endif() - -# Define build configuration options. -if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - set(CMAKE_BUILD_TYPE "Debug" CACHE - STRING "Flutter build mode" FORCE) - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS - "Debug" "Profile" "Release") -endif() - -# Compilation settings that should be applied to most targets. -# -# Be cautious about adding new options here, as plugins use this function by -# default. In most cases, you should add new options to specific targets instead -# of modifying this function. -function(APPLY_STANDARD_SETTINGS TARGET) - target_compile_features(${TARGET} PUBLIC cxx_std_14) - target_compile_options(${TARGET} PRIVATE -Wall -Werror) - target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") - target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") -endfunction() - -# Flutter library and tool build rules. -set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") -add_subdirectory(${FLUTTER_MANAGED_DIR}) - -# System-level dependencies. -find_package(PkgConfig REQUIRED) -pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) - -add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") - -# Define the application target. To change its name, change BINARY_NAME above, -# not the value here, or `flutter run` will no longer work. -# -# Any new source files that you add to the application should be added here. -add_executable(${BINARY_NAME} - "main.cc" - "my_application.cc" - "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" -) - -# Apply the standard set of build settings. This can be removed for applications -# that need different build settings. -apply_standard_settings(${BINARY_NAME}) - -# Add dependency libraries. Add any application-specific dependencies here. -target_link_libraries(${BINARY_NAME} PRIVATE flutter) -target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) - -# Run the Flutter tool portions of the build. This must not be removed. -add_dependencies(${BINARY_NAME} flutter_assemble) - -# Only the install-generated bundle's copy of the executable will launch -# correctly, since the resources must in the right relative locations. To avoid -# people trying to run the unbundled copy, put it in a subdirectory instead of -# the default top-level location. -set_target_properties(${BINARY_NAME} - PROPERTIES - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" -) - - -# Generated plugin build rules, which manage building the plugins and adding -# them to the application. -include(flutter/generated_plugins.cmake) - - -# === Installation === -# By default, "installing" just makes a relocatable bundle in the build -# directory. -set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") -if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) -endif() - -# Start with a clean build bundle directory every time. -install(CODE " - file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") - " COMPONENT Runtime) - -set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") -set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") - -install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" - COMPONENT Runtime) - -install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" - COMPONENT Runtime) - -install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" - COMPONENT Runtime) - -foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) - install(FILES "${bundled_library}" - DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" - COMPONENT Runtime) -endforeach(bundled_library) - -# Fully re-copy the assets directory on each build to avoid having stale files -# from a previous install. -set(FLUTTER_ASSET_DIR_NAME "flutter_assets") -install(CODE " - file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") - " COMPONENT Runtime) -install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" - DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) - -# Install the AOT library on non-Debug builds only. -if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") - install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" - COMPONENT Runtime) -endif() diff --git a/clipboard_viewer/linux/flutter/CMakeLists.txt b/clipboard_viewer/linux/flutter/CMakeLists.txt deleted file mode 100755 index d5bd016..0000000 --- a/clipboard_viewer/linux/flutter/CMakeLists.txt +++ /dev/null @@ -1,88 +0,0 @@ -# This file controls Flutter-level build steps. It should not be edited. -cmake_minimum_required(VERSION 3.10) - -set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") - -# Configuration provided via flutter tool. -include(${EPHEMERAL_DIR}/generated_config.cmake) - -# TODO: Move the rest of this into files in ephemeral. See -# https://github.com/flutter/flutter/issues/57146. - -# Serves the same purpose as list(TRANSFORM ... PREPEND ...), -# which isn't available in 3.10. -function(list_prepend LIST_NAME PREFIX) - set(NEW_LIST "") - foreach(element ${${LIST_NAME}}) - list(APPEND NEW_LIST "${PREFIX}${element}") - endforeach(element) - set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) -endfunction() - -# === Flutter Library === -# System-level dependencies. -find_package(PkgConfig REQUIRED) -pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) -pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) -pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) - -set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") - -# Published to parent scope for install step. -set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) -set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) -set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) -set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) - -list(APPEND FLUTTER_LIBRARY_HEADERS - "fl_basic_message_channel.h" - "fl_binary_codec.h" - "fl_binary_messenger.h" - "fl_dart_project.h" - "fl_engine.h" - "fl_json_message_codec.h" - "fl_json_method_codec.h" - "fl_message_codec.h" - "fl_method_call.h" - "fl_method_channel.h" - "fl_method_codec.h" - "fl_method_response.h" - "fl_plugin_registrar.h" - "fl_plugin_registry.h" - "fl_standard_message_codec.h" - "fl_standard_method_codec.h" - "fl_string_codec.h" - "fl_value.h" - "fl_view.h" - "flutter_linux.h" -) -list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") -add_library(flutter INTERFACE) -target_include_directories(flutter INTERFACE - "${EPHEMERAL_DIR}" -) -target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") -target_link_libraries(flutter INTERFACE - PkgConfig::GTK - PkgConfig::GLIB - PkgConfig::GIO -) -add_dependencies(flutter flutter_assemble) - -# === Flutter tool backend === -# _phony_ is a non-existent file to force this command to run every time, -# since currently there's no way to get a full input/output list from the -# flutter tool. -add_custom_command( - OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} - ${CMAKE_CURRENT_BINARY_DIR}/_phony_ - COMMAND ${CMAKE_COMMAND} -E env - ${FLUTTER_TOOL_ENVIRONMENT} - "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" - ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} - VERBATIM -) -add_custom_target(flutter_assemble DEPENDS - "${FLUTTER_LIBRARY}" - ${FLUTTER_LIBRARY_HEADERS} -) diff --git a/clipboard_viewer/linux/flutter/generated_plugin_registrant.cc b/clipboard_viewer/linux/flutter/generated_plugin_registrant.cc deleted file mode 100755 index 218c8eb..0000000 --- a/clipboard_viewer/linux/flutter/generated_plugin_registrant.cc +++ /dev/null @@ -1,23 +0,0 @@ -// -// Generated file. Do not edit. -// - -// clang-format off - -#include "generated_plugin_registrant.h" - -#include -#include -#include - -void fl_register_plugins(FlPluginRegistry* registry) { - g_autoptr(FlPluginRegistrar) irondash_engine_context_registrar = - fl_plugin_registry_get_registrar_for_plugin(registry, "IrondashEngineContextPlugin"); - irondash_engine_context_plugin_register_with_registrar(irondash_engine_context_registrar); - g_autoptr(FlPluginRegistrar) pasteboard_registrar = - fl_plugin_registry_get_registrar_for_plugin(registry, "PasteboardPlugin"); - pasteboard_plugin_register_with_registrar(pasteboard_registrar); - g_autoptr(FlPluginRegistrar) super_native_extensions_registrar = - fl_plugin_registry_get_registrar_for_plugin(registry, "SuperNativeExtensionsPlugin"); - super_native_extensions_plugin_register_with_registrar(super_native_extensions_registrar); -} diff --git a/clipboard_viewer/linux/flutter/generated_plugin_registrant.h b/clipboard_viewer/linux/flutter/generated_plugin_registrant.h deleted file mode 100755 index e0f0a47..0000000 --- a/clipboard_viewer/linux/flutter/generated_plugin_registrant.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// Generated file. Do not edit. -// - -// clang-format off - -#ifndef GENERATED_PLUGIN_REGISTRANT_ -#define GENERATED_PLUGIN_REGISTRANT_ - -#include - -// Registers Flutter plugins. -void fl_register_plugins(FlPluginRegistry* registry); - -#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/clipboard_viewer/linux/flutter/generated_plugins.cmake b/clipboard_viewer/linux/flutter/generated_plugins.cmake deleted file mode 100755 index b46599d..0000000 --- a/clipboard_viewer/linux/flutter/generated_plugins.cmake +++ /dev/null @@ -1,26 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST - irondash_engine_context - pasteboard - super_native_extensions -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/clipboard_viewer/linux/main.cc b/clipboard_viewer/linux/main.cc deleted file mode 100755 index e7c5c54..0000000 --- a/clipboard_viewer/linux/main.cc +++ /dev/null @@ -1,6 +0,0 @@ -#include "my_application.h" - -int main(int argc, char** argv) { - g_autoptr(MyApplication) app = my_application_new(); - return g_application_run(G_APPLICATION(app), argc, argv); -} diff --git a/clipboard_viewer/linux/my_application.cc b/clipboard_viewer/linux/my_application.cc deleted file mode 100755 index 9654de7..0000000 --- a/clipboard_viewer/linux/my_application.cc +++ /dev/null @@ -1,104 +0,0 @@ -#include "my_application.h" - -#include -#ifdef GDK_WINDOWING_X11 -#include -#endif - -#include "flutter/generated_plugin_registrant.h" - -struct _MyApplication { - GtkApplication parent_instance; - char** dart_entrypoint_arguments; -}; - -G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) - -// Implements GApplication::activate. -static void my_application_activate(GApplication* application) { - MyApplication* self = MY_APPLICATION(application); - GtkWindow* window = - GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); - - // Use a header bar when running in GNOME as this is the common style used - // by applications and is the setup most users will be using (e.g. Ubuntu - // desktop). - // If running on X and not using GNOME then just use a traditional title bar - // in case the window manager does more exotic layout, e.g. tiling. - // If running on Wayland assume the header bar will work (may need changing - // if future cases occur). - gboolean use_header_bar = TRUE; -#ifdef GDK_WINDOWING_X11 - GdkScreen* screen = gtk_window_get_screen(window); - if (GDK_IS_X11_SCREEN(screen)) { - const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); - if (g_strcmp0(wm_name, "GNOME Shell") != 0) { - use_header_bar = FALSE; - } - } -#endif - if (use_header_bar) { - GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); - gtk_widget_show(GTK_WIDGET(header_bar)); - gtk_header_bar_set_title(header_bar, "clipboard_viewer"); - gtk_header_bar_set_show_close_button(header_bar, TRUE); - gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); - } else { - gtk_window_set_title(window, "clipboard_viewer"); - } - - gtk_window_set_default_size(window, 1280, 720); - gtk_widget_show(GTK_WIDGET(window)); - - g_autoptr(FlDartProject) project = fl_dart_project_new(); - fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); - - FlView* view = fl_view_new(project); - gtk_widget_show(GTK_WIDGET(view)); - gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); - - fl_register_plugins(FL_PLUGIN_REGISTRY(view)); - - gtk_widget_grab_focus(GTK_WIDGET(view)); -} - -// Implements GApplication::local_command_line. -static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { - MyApplication* self = MY_APPLICATION(application); - // Strip out the first argument as it is the binary name. - self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); - - g_autoptr(GError) error = nullptr; - if (!g_application_register(application, nullptr, &error)) { - g_warning("Failed to register: %s", error->message); - *exit_status = 1; - return TRUE; - } - - g_application_activate(application); - *exit_status = 0; - - return TRUE; -} - -// Implements GObject::dispose. -static void my_application_dispose(GObject* object) { - MyApplication* self = MY_APPLICATION(object); - g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); - G_OBJECT_CLASS(my_application_parent_class)->dispose(object); -} - -static void my_application_class_init(MyApplicationClass* klass) { - G_APPLICATION_CLASS(klass)->activate = my_application_activate; - G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; - G_OBJECT_CLASS(klass)->dispose = my_application_dispose; -} - -static void my_application_init(MyApplication* self) {} - -MyApplication* my_application_new() { - return MY_APPLICATION(g_object_new(my_application_get_type(), - "application-id", APPLICATION_ID, - "flags", G_APPLICATION_NON_UNIQUE, - nullptr)); -} diff --git a/clipboard_viewer/linux/my_application.h b/clipboard_viewer/linux/my_application.h deleted file mode 100755 index 72271d5..0000000 --- a/clipboard_viewer/linux/my_application.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef FLUTTER_MY_APPLICATION_H_ -#define FLUTTER_MY_APPLICATION_H_ - -#include - -G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, - GtkApplication) - -/** - * my_application_new: - * - * Creates a new Flutter-based application. - * - * Returns: a new #MyApplication. - */ -MyApplication* my_application_new(); - -#endif // FLUTTER_MY_APPLICATION_H_ diff --git a/clipboard_viewer/pubspec.lock b/clipboard_viewer/pubspec.lock deleted file mode 100755 index 3ff2564..0000000 --- a/clipboard_viewer/pubspec.lock +++ /dev/null @@ -1,274 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - async: - dependency: transitive - description: - name: async - sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 - url: "https://pub.dev" - source: hosted - version: "2.10.0" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - characters: - dependency: transitive - description: - name: characters - sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" - url: "https://pub.dev" - source: hosted - version: "1.3.0" - clock: - dependency: transitive - description: - name: clock - sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf - url: "https://pub.dev" - source: hosted - version: "1.1.1" - collection: - dependency: transitive - description: - name: collection - sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c" - url: "https://pub.dev" - source: hosted - version: "1.17.1" - crypto: - dependency: transitive - description: - name: crypto - sha256: aa274aa7774f8964e4f4f38cc994db7b6158dd36e9187aaceaddc994b35c6c67 - url: "https://pub.dev" - source: hosted - version: "3.0.2" - cupertino_icons: - dependency: "direct main" - description: - name: cupertino_icons - sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be - url: "https://pub.dev" - source: hosted - version: "1.0.5" - fake_async: - dependency: transitive - description: - name: fake_async - sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" - url: "https://pub.dev" - source: hosted - version: "1.3.1" - ffi: - dependency: transitive - description: - name: ffi - sha256: a38574032c5f1dd06c4aee541789906c12ccaab8ba01446e800d9c5b79c4a978 - url: "https://pub.dev" - source: hosted - version: "2.0.1" - flutter: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - flutter_lints: - dependency: "direct dev" - description: - name: flutter_lints - sha256: aeb0b80a8b3709709c9cc496cdc027c5b3216796bc0af0ce1007eaf24464fd4c - url: "https://pub.dev" - source: hosted - version: "2.0.1" - flutter_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" - flutter_web_plugins: - dependency: transitive - description: flutter - source: sdk - version: "0.0.0" - irondash_engine_context: - dependency: transitive - description: - name: irondash_engine_context - sha256: "18c1636c1fe53032862cdbfabb28b1a1bffaed4cf143118308618f63784b757b" - url: "https://pub.dev" - source: hosted - version: "0.1.0" - irondash_message_channel: - dependency: transitive - description: - name: irondash_message_channel - sha256: a35566b1e7c8747b7ff6c64e43f8d8fe68b6f9a9d79158d6e4147b46ab4e43b4 - url: "https://pub.dev" - source: hosted - version: "0.1.0" - js: - dependency: transitive - description: - name: js - sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 - url: "https://pub.dev" - source: hosted - version: "0.6.7" - lints: - dependency: transitive - description: - name: lints - sha256: "5e4a9cd06d447758280a8ac2405101e0e2094d2a1dbdd3756aec3fe7775ba593" - url: "https://pub.dev" - source: hosted - version: "2.0.1" - matcher: - dependency: transitive - description: - name: matcher - sha256: c94db23593b89766cda57aab9ac311e3616cf87c6fa4e9749df032f66f30dcb8 - url: "https://pub.dev" - source: hosted - version: "0.12.14" - material_color_utilities: - dependency: transitive - description: - name: material_color_utilities - sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 - url: "https://pub.dev" - source: hosted - version: "0.2.0" - meta: - dependency: transitive - description: - name: meta - sha256: "12307e7f0605ce3da64cf0db90e5fcab0869f3ca03f76be6bb2991ce0a55e82b" - url: "https://pub.dev" - source: hosted - version: "1.9.0" - pasteboard: - dependency: "direct main" - description: - name: pasteboard - sha256: "1c8b6a8b3f1d12e55d4e9404433cda1b4abe66db6b17bc2d2fb5965772c04674" - url: "https://pub.dev" - source: hosted - version: "0.2.0" - path: - dependency: transitive - description: - name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" - url: "https://pub.dev" - source: hosted - version: "1.8.3" - plugin_platform_interface: - dependency: transitive - description: - name: plugin_platform_interface - sha256: "6a2128648c854906c53fa8e33986fc0247a1116122f9534dd20e3ab9e16a32bc" - url: "https://pub.dev" - source: hosted - version: "2.1.4" - sky_engine: - dependency: transitive - description: flutter - source: sdk - version: "0.0.99" - source_span: - dependency: transitive - description: - name: source_span - sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 - url: "https://pub.dev" - source: hosted - version: "1.9.1" - stack_trace: - dependency: transitive - description: - name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 - url: "https://pub.dev" - source: hosted - version: "1.11.0" - stream_channel: - dependency: transitive - description: - name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - string_scanner: - dependency: transitive - description: - name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" - url: "https://pub.dev" - source: hosted - version: "1.2.0" - super_clipboard: - dependency: "direct main" - description: - name: super_clipboard - sha256: f2e00032c90ca495b85d9b7a0cb43463e13edff3a038fda1d95018ff4356cbdf - url: "https://pub.dev" - source: hosted - version: "0.2.3" - super_native_extensions: - dependency: "direct main" - description: - name: super_native_extensions - sha256: "4ba1bf4151cdfddfb62d83147ebf10ba2a67ebb6d0e618f502db942e37b68d48" - url: "https://pub.dev" - source: hosted - version: "0.2.3" - term_glyph: - dependency: transitive - description: - name: term_glyph - sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 - url: "https://pub.dev" - source: hosted - version: "1.2.1" - test_api: - dependency: transitive - description: - name: test_api - sha256: "6182294da5abf431177fccc1ee02401f6df30f766bc6130a0852c6b6d7ee6b2d" - url: "https://pub.dev" - source: hosted - version: "0.4.18" - typed_data: - dependency: transitive - description: - name: typed_data - sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5" - url: "https://pub.dev" - source: hosted - version: "1.3.1" - uuid: - dependency: transitive - description: - name: uuid - sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313" - url: "https://pub.dev" - source: hosted - version: "3.0.7" - vector_math: - dependency: transitive - description: - name: vector_math - sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" - url: "https://pub.dev" - source: hosted - version: "2.1.4" -sdks: - dart: ">=3.0.0-313.0.dev <4.0.0" - flutter: ">=3.0.0" diff --git a/clipboard_viewer/pubspec.yaml b/clipboard_viewer/pubspec.yaml deleted file mode 100755 index 3242415..0000000 --- a/clipboard_viewer/pubspec.yaml +++ /dev/null @@ -1,31 +0,0 @@ -name: clipboard_viewer -description: A new Flutter project. -publish_to: 'none' -version: 1.0.0+1 - -environment: - sdk: '>=3.0.0-313.0.dev <4.0.0' - -dependencies: - flutter: - sdk: flutter - - cupertino_icons: ^1.0.2 - super_clipboard: ^0.2.3 - super_native_extensions: ^0.2.3 - pasteboard: ^0.2.0 - -dev_dependencies: - flutter_test: - sdk: flutter - - flutter_lints: ^2.0.0 - - -flutter: - uses-material-design: true - - - - - \ No newline at end of file diff --git a/clipboard_viewer/test/widget_test.dart b/clipboard_viewer/test/widget_test.dart deleted file mode 100755 index ae39a95..0000000 --- a/clipboard_viewer/test/widget_test.dart +++ /dev/null @@ -1,19 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; - -import 'package:clipboard_viewer/main.dart'; - -void main() { - testWidgets('Counter increments smoke test', (WidgetTester tester) async { - await tester.pumpWidget(const MyApp()); - - expect(find.text('0'), findsOneWidget); - expect(find.text('1'), findsNothing); - - await tester.tap(find.byIcon(Icons.add)); - await tester.pump(); - - expect(find.text('0'), findsNothing); - expect(find.text('1'), findsOneWidget); - }); -} diff --git a/lib/backend/database/helper.dart b/lib/backend/database/helper.dart index 31ef32b..ea8a193 100755 --- a/lib/backend/database/helper.dart +++ b/lib/backend/database/helper.dart @@ -5,11 +5,10 @@ import 'package:files/backend/providers.dart'; class EntityStatCacheHelper { Future get(String path) async { - final EntityStat? stat = - isar.entityStats.where().pathEqualTo(path).findFirstSync(); + final stat = isar.entityStats.where().pathEqualTo(path).findFirstSync(); if (stat == null) { - final EntityStat fetchedStat = EntityStat.fromStat( + final fetchedStat = EntityStat.fromStat( path, await FileStat.stat(path), ); @@ -19,7 +18,6 @@ class EntityStatCacheHelper { return stat; } - Future set(EntityStat entity) async { - isar.writeTxn(() => isar.entityStats.put(entity)); - } + Future set(EntityStat entity) => + isar.writeTxn(() => isar.entityStats.put(entity)); } diff --git a/lib/backend/database/model.dart b/lib/backend/database/model.dart index 01f6d2e..b53f2c9 100755 --- a/lib/backend/database/model.dart +++ b/lib/backend/database/model.dart @@ -10,20 +10,6 @@ part 'model.g.dart'; @Collection() class EntityStat with ChangeNotifier { - Id? id; - - @Index(unique: true, type: IndexType.hash) - late String path; - - late DateTime changed; - late DateTime modified; - late DateTime accessed; - - @enumerated - late EntityType type; - late int mode; - late int size; - EntityStat(); EntityStat.fastInit({ @@ -46,9 +32,22 @@ class EntityStat with ChangeNotifier { mode: stat.mode, size: stat.size, ); + Id? id; + + @Index(unique: true, type: IndexType.hash) + late String path; + + late DateTime changed; + late DateTime modified; + late DateTime accessed; + + @enumerated + late EntityType type; + late int mode; + late int size; Future fetchUpdate() async { - final FileStat ioStat = await FileStat.stat(path); + final ioStat = await FileStat.stat(path); if (!_statIdentical(ioStat)) { changed = ioStat.changed; diff --git a/lib/backend/entity_info.dart b/lib/backend/entity_info.dart index 3af3129..ca67642 100755 --- a/lib/backend/entity_info.dart +++ b/lib/backend/entity_info.dart @@ -17,14 +17,16 @@ limitations under the License. import 'dart:io'; import 'package:files/backend/database/model.dart'; +import 'package:flutter/foundation.dart'; +@immutable class EntityInfo { + const EntityInfo._(this._entity, this.stat, this.entityType); + final FileSystemEntity _entity; final EntityStat stat; final EntityType entityType; - const EntityInfo._(this._entity, this.stat, this.entityType); - String get path => _entity.path; FileSystemEntity get entity => _entity; @@ -41,7 +43,7 @@ class EntityInfo { } @override - bool operator ==(Object? other) { + bool operator ==(Object other) { if (other is EntityInfo) { return _equals(other); } diff --git a/lib/backend/fetch.dart b/lib/backend/fetch.dart index 9b35231..6275f08 100755 --- a/lib/backend/fetch.dart +++ b/lib/backend/fetch.dart @@ -49,7 +49,7 @@ class CancelableFsFetch { .list() .where( (element) => - !Utils.getEntityName(element.path).startsWith(".") || + !Utils.getEntityName(element.path).startsWith('.') || showHidden, ) .toList(); @@ -58,11 +58,11 @@ class CancelableFsFetch { _cancelled = true; return; } - final List directories = []; - final List files = []; + final directories = []; + final files = []; _running = true; - for (int i = 0; i < list.length; i++) { + for (var i = 0; i < list.length; i++) { if (_cancelled) { onCancel?.call(); cancelableCompleter.complete(); diff --git a/lib/backend/folder_provider.dart b/lib/backend/folder_provider.dart index 9bc22ce..a940aea 100755 --- a/lib/backend/folder_provider.dart +++ b/lib/backend/folder_provider.dart @@ -21,9 +21,10 @@ import 'package:files/backend/utils.dart'; import 'package:flutter/material.dart'; import 'package:windows_path_provider/windows_path_provider.dart'; import 'package:xdg_directories/xdg_directories.dart'; -import 'package:yaru_icons/yaru_icons.dart'; +import 'package:yaru/yaru.dart'; class FolderProvider { + const FolderProvider._(this._folders, this._destinations); final List _folders; final List _destinations; @@ -31,23 +32,23 @@ class FolderProvider { List get destinations => List.from(_destinations); static Future init() async { - final List folders = []; + final folders = []; if (Platform.isWindows) { - for (final WindowsFolder folder in WindowsFolder.values) { - final String? path = await WindowsPathProvider.getPath(folder); + for (final folder in WindowsFolder.values) { + final path = await WindowsPathProvider.getPath(folder); if (path == null) continue; - final FolderType? type = folder.toFolderType(); + final type = folder.toFolderType(); if (type == null) continue; folders.add(BuiltinFolder(type, Directory(path))); } } else if (Platform.isLinux) { - final Set dirNames = getUserDirectoryNames(); + final dirNames = getUserDirectoryNames(); - final List backDir = getUserDirectory(dirNames.first)! + final backDir = getUserDirectory(dirNames.first)! .path .split(Platform.pathSeparator) ..removeLast(); @@ -58,8 +59,8 @@ class FolderProvider { ), ); - for (final String element in dirNames) { - final FolderType? type = FolderType.fromString(element); + for (final element in dirNames) { + final type = FolderType.fromString(element); if (type == null) continue; folders.add( @@ -70,10 +71,10 @@ class FolderProvider { ); } } else { - throw Exception("Platform not supported"); + throw Exception('Platform not supported'); } - final List destinations = [ + final destinations = [ for (final BuiltinFolder element in folders) SideDestination( _icons[element.type]!, @@ -85,8 +86,6 @@ class FolderProvider { return FolderProvider._(folders, destinations); } - const FolderProvider._(this._folders, this._destinations); - IconData getIconForType(FolderType type) { return _icons[type]!; } @@ -115,18 +114,16 @@ enum FolderType { } class BuiltinFolder { + const BuiltinFolder(this.type, this.directory); final FolderType type; final Directory directory; - - const BuiltinFolder(this.type, this.directory); } class SideDestination { + const SideDestination(this.icon, this.label, this.path); final IconData icon; final String label; final String path; - - const SideDestination(this.icon, this.label, this.path); } const Map _icons = { @@ -144,23 +141,23 @@ const Map _icons = { String windowsFolderToString(WindowsFolder folder) { switch (folder) { case WindowsFolder.profile: - return "HOME"; + return 'HOME'; case WindowsFolder.desktop: - return "DESKTOP"; + return 'DESKTOP'; case WindowsFolder.documents: - return "DOCUMENTS"; + return 'DOCUMENTS'; case WindowsFolder.pictures: - return "PICTURES"; + return 'PICTURES'; case WindowsFolder.downloads: - return "DOWNLOAD"; + return 'DOWNLOAD'; case WindowsFolder.videos: - return "VIDEOS"; + return 'VIDEOS'; case WindowsFolder.music: - return "MUSIC"; + return 'MUSIC'; case WindowsFolder.public: - return "PUBLICSHARE"; + return 'PUBLICSHARE'; case WindowsFolder.templates: - return "TEMPLATES"; + return 'TEMPLATES'; } } diff --git a/lib/backend/path_parts.dart b/lib/backend/path_parts.dart index 30d7518..c244d0a 100755 --- a/lib/backend/path_parts.dart +++ b/lib/backend/path_parts.dart @@ -1,28 +1,28 @@ class PathParts { + const PathParts(this.root, this.parts, this.separator); + final String root; final List parts; final String separator; - const PathParts(this.root, this.parts, this.separator); - factory PathParts.parse(String path) { late final String root; late final String separator; - if (path.startsWith("/")) { - root = "/"; - separator = "/"; - } else if (path.startsWith(RegExp(r"[A-Z]:\\", caseSensitive: false))) { - root = RegExp(r"^[A-Z]:\\", caseSensitive: false) + if (path.startsWith('/')) { + root = '/'; + separator = '/'; + } else if (path.startsWith(RegExp(r'[A-Z]:\\', caseSensitive: false))) { + root = RegExp(r'^[A-Z]:\\', caseSensitive: false) .firstMatch(path)! .group(0)!; - separator = "\\"; + separator = '\\'; } - final String cleanPath = path.replaceFirst(root, ""); + final cleanPath = path.replaceFirst(root, ''); late final List parts; if (cleanPath.isNotEmpty) { - parts = path.replaceFirst(root, "").split(separator); + parts = path.replaceFirst(root, '').split(separator); } else { parts = []; } @@ -31,18 +31,17 @@ class PathParts { } String toPath([int? numOfParts]) { - final int resolvedNumOfParts = numOfParts ?? parts.length; + final resolvedNumOfParts = numOfParts ?? parts.length; assert(resolvedNumOfParts >= 0 && resolvedNumOfParts <= parts.length); - final List transformedPathParts = - parts.sublist(0, resolvedNumOfParts); - final String path = transformedPathParts.join(separator); + final transformedPathParts = parts.sublist(0, resolvedNumOfParts); + final path = transformedPathParts.join(separator); - return "$root$path"; + return '$root$path'; } PathParts trim(int numOfParts) { assert(numOfParts >= 0 && numOfParts <= parts.length); - final List transformedPathParts = parts.sublist(0, numOfParts); + final transformedPathParts = parts.sublist(0, numOfParts); return PathParts(root, transformedPathParts, separator); } @@ -52,9 +51,9 @@ class PathParts { @override String toString() { return { - "root": root, - "parts": parts, - "separator": separator, + 'root': root, + 'parts': parts, + 'separator': separator, }.toString(); } } diff --git a/lib/backend/providers.dart b/lib/backend/providers.dart index f238d55..1d71d7a 100755 --- a/lib/backend/providers.dart +++ b/lib/backend/providers.dart @@ -10,7 +10,7 @@ import 'package:path_provider/path_provider.dart'; import 'package:ubuntu_service/ubuntu_service.dart'; String _isarPath(Directory dir) { - final String path = p.join(dir.path, 'isar'); + final path = p.join(dir.path, 'isar'); if (!Directory(path).existsSync()) Directory(path).create(); return path; } diff --git a/lib/backend/stat_cache_proxy.dart b/lib/backend/stat_cache_proxy.dart index a9850c9..2ccffdf 100755 --- a/lib/backend/stat_cache_proxy.dart +++ b/lib/backend/stat_cache_proxy.dart @@ -1,19 +1,23 @@ +import 'dart:async'; + import 'package:files/backend/database/model.dart'; import 'package:files/backend/providers.dart'; class StatCacheProxy { - final Map _runtimeCache = {}; - StatCacheProxy(); + final Map _runtimeCache = {}; Future get(String path) async { if (!_runtimeCache.containsKey(path)) { - final stat = await helper.get(path) - ..fetchUpdate(); + final stat = await helper.get(path); + await stat.fetchUpdate(); _runtimeCache[path] = stat; return stat; } - return _runtimeCache[path]!..fetchUpdate(); + final runtimeCache = _runtimeCache[path]; + await runtimeCache!.fetchUpdate(); + + return runtimeCache; } } diff --git a/lib/backend/utils.dart b/lib/backend/utils.dart index f9258ef..d1c83cf 100755 --- a/lib/backend/utils.dart +++ b/lib/backend/utils.dart @@ -1,56 +1,55 @@ import 'dart:io'; -import 'package:files/backend/folder_provider.dart'; import 'package:files/backend/path_parts.dart'; import 'package:files/backend/providers.dart'; import 'package:flutter/material.dart'; import 'package:material_design_icons_flutter/material_design_icons_flutter.dart'; import 'package:mime/mime.dart'; -import 'package:yaru_icons/yaru_icons.dart'; +import 'package:yaru/yaru.dart'; class Utils { Utils._(); static Map get iconsPerMime => { - "application/java-archive": MdiIcons.languageJava, - "application/json": MdiIcons.codeBraces, - "application/msword": MdiIcons.fileWordOutline, - "application/octet-stream": MdiIcons.fileDocumentOutline, - "application/pdf": MdiIcons.fileDocumentOutline, - "application/vnd.microsoft.portable-executable": + 'application/java-archive': MdiIcons.languageJava, + 'application/json': MdiIcons.codeBraces, + 'application/msword': MdiIcons.fileWordOutline, + 'application/octet-stream': MdiIcons.fileDocumentOutline, + 'application/pdf': MdiIcons.fileDocumentOutline, + 'application/vnd.microsoft.portable-executable': MdiIcons.microsoftWindows, - "application/vnd.ms-excel": MdiIcons.fileExcelOutline, - "application/vnd.ms-powerpoint": MdiIcons.filePowerpointOutline, - "application/vnd.openxmlformats-officedocument.presentationml.presentation": + 'application/vnd.ms-excel': MdiIcons.fileExcelOutline, + 'application/vnd.ms-powerpoint': MdiIcons.filePowerpointOutline, + 'application/vnd.openxmlformats-officedocument.presentationml.presentation': MdiIcons.filePowerpointOutline, - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': MdiIcons.fileExcelOutline, - "application/vnd.openxmlformats-officedocument.wordprocessingml.document": + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': MdiIcons.fileWordOutline, - "application/vnd.rar": MdiIcons.zipBoxOutline, - "application/x-7z-compressed": MdiIcons.zipBoxOutline, - "application/x-iso9660-image": MdiIcons.disc, - "application/x-msdownload": MdiIcons.microsoftWindows, - "application/x-rar-compressed": MdiIcons.zipBoxOutline, - "application/x-sql": MdiIcons.databaseOutline, - "application/zip": MdiIcons.zipBoxOutline, - "audio/mpeg": MdiIcons.fileMusicOutline, - "audio/ogg": MdiIcons.fileMusicOutline, - "image/gif": Icons.animation, - "image/jpeg": MdiIcons.fileImageOutline, - "image/png": MdiIcons.fileImageOutline, - "image/svg+xml": MdiIcons.svg, - "text/css": MdiIcons.fileCodeOutline, - "text/csv": MdiIcons.fileDocumentOutline, - "text/javascript": MdiIcons.languageJavascript, - "text/html": MdiIcons.languageHtml5, - "text/plain": MdiIcons.fileDocumentOutline, - "video/mp4": MdiIcons.fileVideoOutline, - "video/ogg": MdiIcons.fileVideoOutline, + 'application/vnd.rar': MdiIcons.zipBoxOutline, + 'application/x-7z-compressed': MdiIcons.zipBoxOutline, + 'application/x-iso9660-image': MdiIcons.disc, + 'application/x-msdownload': MdiIcons.microsoftWindows, + 'application/x-rar-compressed': MdiIcons.zipBoxOutline, + 'application/x-sql': MdiIcons.databaseOutline, + 'application/zip': MdiIcons.zipBoxOutline, + 'audio/mpeg': MdiIcons.fileMusicOutline, + 'audio/ogg': MdiIcons.fileMusicOutline, + 'image/gif': Icons.animation, + 'image/jpeg': MdiIcons.fileImageOutline, + 'image/png': MdiIcons.fileImageOutline, + 'image/svg+xml': MdiIcons.svg, + 'text/css': MdiIcons.fileCodeOutline, + 'text/csv': MdiIcons.fileDocumentOutline, + 'text/javascript': MdiIcons.languageJavascript, + 'text/html': MdiIcons.languageHtml5, + 'text/plain': MdiIcons.fileDocumentOutline, + 'video/mp4': MdiIcons.fileVideoOutline, + 'video/ogg': MdiIcons.fileVideoOutline, }; static IconData iconForPath(String path) { - final String? mime = lookupMimeType(path); + final mime = lookupMimeType(path); if (mime != null) { return iconsPerMime[mime] ?? YaruIcons.document_filled; @@ -60,8 +59,8 @@ class Utils { } static IconData iconForFolder(String path) { - final BuiltinFolder? builtinFolder = folderProvider.isBuiltinFolder(path); - final IconData? builtinFolderIcon = builtinFolder != null + final builtinFolder = folderProvider.isBuiltinFolder(path); + final builtinFolderIcon = builtinFolder != null ? folderProvider.getIconForType(builtinFolder.type) : null; @@ -69,7 +68,7 @@ class Utils { } static String getEntityName(String path) { - final PathParts pathParts = PathParts.parse(path); + final pathParts = PathParts.parse(path); return pathParts.integralParts.last; } diff --git a/lib/backend/workspace.dart b/lib/backend/workspace.dart index 5261f10..30aeec5 100755 --- a/lib/backend/workspace.dart +++ b/lib/backend/workspace.dart @@ -153,8 +153,7 @@ class WorkspaceController with ChangeNotifier { if (updateHistory) { if (_historyOffset != 0) { - final List validHistory = - _history.reversed.toList().sublist(_historyOffset); + final validHistory = _history.reversed.toList().sublist(_historyOffset); _history.clear(); _history.addAll(validHistory.reversed); _historyOffset = 0; @@ -195,17 +194,16 @@ class WorkspaceController with ChangeNotifier { } class TableViewState { - final double firstWidth; - final double secondWidth; - final double thirdWidth; - final double fourthWidth; - const TableViewState({ required this.firstWidth, required this.secondWidth, required this.thirdWidth, required this.fourthWidth, }); + final double firstWidth; + final double secondWidth; + final double thirdWidth; + final double fourthWidth; List get widths => [ firstWidth, @@ -245,9 +243,8 @@ class TableViewState { } class GridViewState { - final double size; - const GridViewState({ required this.size, }); + final double size; } diff --git a/lib/main.dart b/lib/main.dart index 168949e..45d9e3a 100755 --- a/lib/main.dart +++ b/lib/main.dart @@ -21,7 +21,6 @@ import 'package:files/widgets/tab_strip.dart'; import 'package:files/widgets/workspace.dart'; import 'package:flutter/material.dart'; import 'package:yaru/yaru.dart'; -import 'package:yaru_widgets/yaru_widgets.dart'; Future main(List args) async { WidgetsFlutterBinding.ensureInitialized(); @@ -30,7 +29,7 @@ Future main(List args) async { await initProviders(); await driveProvider.init(); - final String? initialDir = args.isNotEmpty ? args.first : null; + final initialDir = args.isNotEmpty ? args.first : null; runApp(Files(initialDir: initialDir)); } @@ -40,7 +39,7 @@ ThemeData? _applyThemeValues(ThemeData? theme) { outlinedButtonTheme: OutlinedButtonThemeData( style: theme.outlinedButtonTheme.style?.merge( OutlinedButton.styleFrom( - backgroundColor: theme.colorScheme.surfaceVariant, + backgroundColor: theme.colorScheme.surfaceContainerHighest, ), ), ), @@ -48,9 +47,8 @@ ThemeData? _applyThemeValues(ThemeData? theme) { } class Files extends StatelessWidget { - final String? initialDir; - const Files({this.initialDir, super.key}); + final String? initialDir; @override Widget build(BuildContext context) { @@ -72,12 +70,11 @@ class Files extends StatelessWidget { } class FilesHome extends StatefulWidget { - final String? initialDir; - const FilesHome({this.initialDir, super.key}); + final String? initialDir; @override - _FilesHomeState createState() => _FilesHomeState(); + State createState() => _FilesHomeState(); } class _FilesHomeState extends State { @@ -93,7 +90,7 @@ class _FilesHomeState extends State { @override Widget build(BuildContext context) { return Material( - color: Theme.of(context).colorScheme.background, + color: Theme.of(context).colorScheme.surface, child: Column( children: [ GestureDetector( @@ -131,8 +128,7 @@ class _FilesHomeState extends State { StreamBuilder( stream: YaruWindow.states(context), builder: (context, snapshot) { - final bool maximized = - snapshot.data?.isMaximized ?? false; + final maximized = snapshot.data?.isMaximized ?? false; return YaruWindowControl( type: maximized @@ -161,7 +157,7 @@ class _FilesHomeState extends State { SidePane( destinations: folderProvider.destinations, workspace: workspaces[currentWorkspace], - onNewTab: (String tabPath) { + onNewTab: (tabPath) { workspaces.add(WorkspaceController(initialDir: tabPath)); currentWorkspace = workspaces.length - 1; setState(() {}); diff --git a/lib/widgets/breadcrumbs_bar.dart b/lib/widgets/breadcrumbs_bar.dart index ceb901a..e383179 100755 --- a/lib/widgets/breadcrumbs_bar.dart +++ b/lib/widgets/breadcrumbs_bar.dart @@ -8,13 +8,6 @@ import 'package:files/backend/utils.dart'; import 'package:flutter/material.dart'; class BreadcrumbsBar extends StatefulWidget { - final PathParts path; - final ValueChanged? onBreadcrumbPress; - final ValueChanged? onPathSubmitted; - final List? leading; - final List? actions; - final double? loadingProgress; - const BreadcrumbsBar({ required this.path, this.onBreadcrumbPress, @@ -25,6 +18,13 @@ class BreadcrumbsBar extends StatefulWidget { super.key, }); + final PathParts path; + final ValueChanged? onBreadcrumbPress; + final ValueChanged? onPathSubmitted; + final List? leading; + final List? actions; + final double? loadingProgress; + @override State createState() => _BreadcrumbsBarState(); } @@ -75,7 +75,8 @@ class _BreadcrumbsBarState extends State { child: Padding( padding: const EdgeInsets.all(8.0), child: Material( - color: Theme.of(context).colorScheme.surfaceVariant, + color: + Theme.of(context).colorScheme.surfaceContainerHighest, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(6), side: !focusNode.hasFocus @@ -127,18 +128,17 @@ class _BreadcrumbsBarState extends State { final List actualParts; // We need home folder on last position here to emulate a low priority entry - final List sortedFolders = folderProvider.folders; - final int homeIndex = + final sortedFolders = folderProvider.folders; + final homeIndex = sortedFolders.indexWhere((e) => e.type == FolderType.home); sortedFolders.add(sortedFolders.removeAt(homeIndex)); - final BuiltinFolder? builtinFolder = sortedFolders.firstWhereOrNull( + final builtinFolder = sortedFolders.firstWhereOrNull( (e) => widget.path.toPath().startsWith(e.directory.path), ); if (builtinFolder != null) { - final PathParts builtinParts = - PathParts.parse(builtinFolder.directory.path); + final builtinParts = PathParts.parse(builtinFolder.directory.path); actualParts = [ builtinParts, ...List.generate( @@ -158,7 +158,7 @@ class _BreadcrumbsBarState extends State { return ListView.builder( scrollDirection: Axis.horizontal, itemBuilder: (context, index) { - final bool isInsideBuiltin = builtinFolder != null && + final isInsideBuiltin = builtinFolder != null && actualParts[index].toPath() == builtinFolder.directory.path; return _BreadcrumbChip( @@ -200,7 +200,8 @@ class _BreadcrumbChip extends StatelessWidget { return SizedBox( height: double.infinity, child: DragTarget( - onAccept: (data) => Utils.moveFileToDest(data, path.toPath()), + onAcceptWithDetails: (details) => + Utils.moveFileToDest(details.data, path.toPath()), builder: (context, candidateData, rejectedData) { return InkWell( child: Row( @@ -222,13 +223,12 @@ class _BreadcrumbChip extends StatelessWidget { } class _LoadingIndicator extends StatefulWidget { - final double? progress; - final Widget child; - const _LoadingIndicator({ required this.progress, required this.child, }); + final double? progress; + final Widget child; @override _LoadingIndicatorState createState() => _LoadingIndicatorState(); @@ -272,15 +272,15 @@ class _LoadingIndicatorState extends State<_LoadingIndicator> if (widget.progress != old.progress) { if (widget.progress != null && old.progress == null) { fadeController.value = 1; - progressController.animateTo(widget.progress!); + await progressController.animateTo(widget.progress!); } else if (widget.progress == null && old.progress != null) { await fadeController.reverse(); progressController.value = 0; } else if (widget.progress != null && old.progress != null) { if (widget.progress! > old.progress!) { - progressController.animateTo(widget.progress!); + await progressController.animateTo(widget.progress!); } else if (widget.progress! < old.progress!) { - progressController.animateBack(widget.progress!); + await progressController.animateBack(widget.progress!); } } } diff --git a/lib/widgets/context_menu.dart b/lib/widgets/context_menu.dart index 90486b2..1819de0 100755 --- a/lib/widgets/context_menu.dart +++ b/lib/widgets/context_menu.dart @@ -1,13 +1,7 @@ import 'package:flutter/material.dart'; -import 'package:yaru_icons/yaru_icons.dart'; -import 'package:yaru_widgets/yaru_widgets.dart'; +import 'package:yaru/yaru.dart'; class ContextMenu extends StatefulWidget { - final List entries; - final Widget child; - final bool openOnLongPress; - final bool openOnSecondaryPress; - const ContextMenu({ required this.entries, required this.child, @@ -16,6 +10,11 @@ class ContextMenu extends StatefulWidget { super.key, }); + final List entries; + final Widget child; + final bool openOnLongPress; + final bool openOnSecondaryPress; + @override State createState() => _ContextMenuState(); } @@ -42,13 +41,12 @@ class _ContextMenuState extends State { } class _EnabledBuilder extends StatelessWidget { - final bool enabled; - final Widget child; - const _EnabledBuilder({ required this.enabled, required this.child, }); + final bool enabled; + final Widget child; @override Widget build(BuildContext context) { @@ -63,17 +61,16 @@ class _EnabledBuilder extends StatelessWidget { } abstract class BaseContextMenuItem { - final Widget child; - final Widget? leading; - final Widget? trailing; - final bool enabled; - const BaseContextMenuItem({ required this.child, this.enabled = true, this.leading, this.trailing, }); + final Widget child; + final Widget? leading; + final Widget? trailing; + final bool enabled; Widget buildWrapper(BuildContext context) => _EnabledBuilder(enabled: enabled, child: build(context)); @@ -84,14 +81,13 @@ abstract class BaseContextMenuItem { } class SubmenuMenuItem extends BaseContextMenuItem { - final List menuChildren; - const SubmenuMenuItem({ required super.child, required this.menuChildren, super.leading, super.enabled, }) : super(trailing: null); + final List menuChildren; @override Widget? buildTrailing(BuildContext context) { @@ -105,7 +101,7 @@ class SubmenuMenuItem extends BaseContextMenuItem { leadingIcon: buildLeading(context), trailingIcon: buildTrailing(context), style: const ButtonStyle( - padding: MaterialStatePropertyAll( + padding: WidgetStatePropertyAll( EdgeInsets.symmetric(horizontal: 16), ), ), @@ -115,9 +111,6 @@ class SubmenuMenuItem extends BaseContextMenuItem { } class ContextMenuItem extends BaseContextMenuItem { - final VoidCallback? onTap; - final MenuSerializableShortcut? shortcut; - const ContextMenuItem({ required super.child, this.onTap, @@ -126,10 +119,12 @@ class ContextMenuItem extends BaseContextMenuItem { this.shortcut, super.enabled, }); + final VoidCallback? onTap; + final MenuSerializableShortcut? shortcut; @override Widget build(BuildContext context) { - final Widget? leading = buildLeading(context); + final leading = buildLeading(context); return MenuItemButton( leadingIcon: leading != null @@ -142,7 +137,7 @@ class ContextMenuItem extends BaseContextMenuItem { onPressed: onTap, shortcut: shortcut, style: const ButtonStyle( - padding: MaterialStatePropertyAll( + padding: WidgetStatePropertyAll( EdgeInsets.symmetric(horizontal: 16), ), ), @@ -152,11 +147,6 @@ class ContextMenuItem extends BaseContextMenuItem { } class RadioMenuItem extends ContextMenuItem { - final T value; - final T? groupValue; - final ValueChanged? onChanged; - final bool toggleable; - const RadioMenuItem({ required this.value, required this.groupValue, @@ -167,6 +157,10 @@ class RadioMenuItem extends ContextMenuItem { super.shortcut, super.enabled, }) : super(leading: null, onTap: null); + final T value; + final T? groupValue; + final ValueChanged? onChanged; + final bool toggleable; @override VoidCallback? get onTap => onChanged == null @@ -195,10 +189,6 @@ class RadioMenuItem extends ContextMenuItem { } class CheckboxMenuItem extends ContextMenuItem { - final bool? value; - final ValueChanged? onChanged; - final bool tristate; - const CheckboxMenuItem({ required this.value, this.onChanged, @@ -208,6 +198,9 @@ class CheckboxMenuItem extends ContextMenuItem { super.shortcut, super.enabled, }) : super(leading: null, onTap: null); + final bool? value; + final ValueChanged? onChanged; + final bool tristate; @override VoidCallback? get onTap => onChanged == null @@ -216,13 +209,10 @@ class CheckboxMenuItem extends ContextMenuItem { switch (value) { case false: onChanged!.call(true); - break; case true: onChanged!.call(tristate ? null : false); - break; case null: onChanged!.call(false); - break; } }; diff --git a/lib/widgets/double_scrollbars.dart b/lib/widgets/double_scrollbars.dart index d1989bd..7b2482a 100755 --- a/lib/widgets/double_scrollbars.dart +++ b/lib/widgets/double_scrollbars.dart @@ -1,10 +1,6 @@ import 'package:flutter/material.dart'; class DoubleScrollbars extends StatelessWidget { - final ScrollController horizontalController; - final ScrollController verticalController; - final Widget child; - const DoubleScrollbars({ required this.horizontalController, required this.verticalController, @@ -12,6 +8,10 @@ class DoubleScrollbars extends StatelessWidget { super.key, }); + final ScrollController horizontalController; + final ScrollController verticalController; + final Widget child; + @override Widget build(BuildContext context) { return SizedBox.expand( @@ -49,13 +49,12 @@ class DoubleScrollbars extends StatelessWidget { } class _ScrollReceiver extends StatefulWidget { - final Axis direction; - final Widget child; - const _ScrollReceiver({ required this.direction, required this.child, }); + final Axis direction; + final Widget child; @override _ScrollReceiverState createState() => _ScrollReceiverState(); @@ -78,12 +77,11 @@ class _ScrollReceiverState extends State<_ScrollReceiver> { } class _ScrollReceiverInheritedWidget extends InheritedWidget { - final _ScrollReceiverState state; - const _ScrollReceiverInheritedWidget({ required this.state, required super.child, }); + final _ScrollReceiverState state; @override bool updateShouldNotify(covariant InheritedWidget oldWidget) { @@ -97,6 +95,8 @@ class HorizontalScrollReceiver extends _ScrollReceiverInheritedWidget { required super.child, }); + // TODO(@Feichtmeier): fix ignore + // ignore: library_private_types_in_public_api static _ScrollReceiverState of(BuildContext context) { return context .dependOnInheritedWidgetOfExactType()! @@ -110,6 +110,8 @@ class VerticalScrollReceiver extends _ScrollReceiverInheritedWidget { required super.child, }); + // TODO(@Feichtmeier): fix ignore + // ignore: library_private_types_in_public_api static _ScrollReceiverState of(BuildContext context) { return context .dependOnInheritedWidgetOfExactType()! @@ -118,14 +120,13 @@ class VerticalScrollReceiver extends _ScrollReceiverInheritedWidget { } class ScrollProxy extends StatelessWidget { - final Axis direction; - final Widget child; - const ScrollProxy({ required this.direction, required this.child, super.key, }); + final Axis direction; + final Widget child; @override Widget build(BuildContext context) { @@ -136,10 +137,8 @@ class ScrollProxy extends StatelessWidget { switch (direction) { case Axis.vertical: provider = VerticalScrollReceiver.of(context); - break; case Axis.horizontal: provider = HorizontalScrollReceiver.of(context); - break; } provider.notify(notification); @@ -151,12 +150,11 @@ class ScrollProxy extends StatelessWidget { } class ScrollNotificationIsolater extends StatelessWidget { - final Widget child; - const ScrollNotificationIsolater({ required this.child, super.key, }); + final Widget child; @override Widget build(BuildContext context) { diff --git a/lib/widgets/drive_list.dart b/lib/widgets/drive_list.dart index 90b7b27..dec9d14 100755 --- a/lib/widgets/drive_list.dart +++ b/lib/widgets/drive_list.dart @@ -6,14 +6,13 @@ import 'package:files/widgets/separated_flex.dart'; import 'package:filesize/filesize.dart'; import 'package:flutter/material.dart'; import 'package:udisks/udisks.dart'; -import 'package:yaru_icons/yaru_icons.dart'; -import 'package:yaru_widgets/yaru_widgets.dart'; +import 'package:yaru/yaru.dart'; class DriveList extends StatelessWidget { - final ValueChanged? onDriveTap; - const DriveList({this.onDriveTap, super.key}); + final ValueChanged? onDriveTap; + @override Widget build(BuildContext context) { return AnimatedBuilder( @@ -26,8 +25,8 @@ class DriveList extends StatelessWidget { children: driveProvider.blockDevices .where( (e) => - !e.userspaceMountOptions.contains("x-gdu.hide") && - !e.userspaceMountOptions.contains("x-gvfs-hide"), + !e.userspaceMountOptions.contains('x-gdu.hide') && + !e.userspaceMountOptions.contains('x-gvfs-hide'), ) .where((e) => !e.hintIgnore && e.filesystem != null) .map( @@ -44,13 +43,12 @@ class DriveList extends StatelessWidget { } class _DriveTile extends StatefulWidget { - final UDisksBlockDevice blockDevice; - final ValueChanged? onTap; - const _DriveTile({ required this.blockDevice, this.onTap, }); + final UDisksBlockDevice blockDevice; + final ValueChanged? onTap; @override State<_DriveTile> createState() => _DriveTileState(); @@ -75,7 +73,7 @@ class _DriveTileState extends State<_DriveTile> { } void _onPoll(Timer ref) { - final String? currentMountPoint = getMountPoint(); + final currentMountPoint = getMountPoint(); if (mountPoint != currentMountPoint) { mountPoint = currentMountPoint; @@ -91,14 +89,14 @@ class _DriveTileState extends State<_DriveTile> { @override Widget build(BuildContext context) { - String? mountPoint = widget.blockDevice.filesystem!.mountPoints.isNotEmpty + var mountPoint = widget.blockDevice.filesystem!.mountPoints.isNotEmpty ? widget.blockDevice.filesystem!.mountPoints.first.decode() : null; - final String? idLabel = widget.blockDevice.idLabel.isNotEmpty + final idLabel = widget.blockDevice.idLabel.isNotEmpty ? widget.blockDevice.idLabel : null; - final String? hintName = widget.blockDevice.hintName.isNotEmpty + final hintName = widget.blockDevice.hintName.isNotEmpty ? widget.blockDevice.hintName : null; @@ -113,7 +111,7 @@ class _DriveTileState extends State<_DriveTile> { title: Text( idLabel ?? hintName ?? - "${filesize(widget.blockDevice.size, 1)} drive", + '${filesize(widget.blockDevice.size, 1)} drive', ), subtitle: mountPoint != null ? Text(mountPoint) : null, trailing: mountPoint != null diff --git a/lib/widgets/entity_context_menu.dart b/lib/widgets/entity_context_menu.dart index be689ba..c9e4381 100755 --- a/lib/widgets/entity_context_menu.dart +++ b/lib/widgets/entity_context_menu.dart @@ -1,16 +1,9 @@ import 'package:files/widgets/context_menu.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:yaru_icons/yaru_icons.dart'; +import 'package:yaru/yaru.dart'; class EntityContextMenu extends StatelessWidget { - final Widget child; - final VoidCallback? onOpen; - final VoidCallback? onOpenWith; - final VoidCallback? onCopy; - final VoidCallback? onCut; - final VoidCallback? onPaste; - const EntityContextMenu({ required this.child, this.onOpen, @@ -21,6 +14,13 @@ class EntityContextMenu extends StatelessWidget { super.key, }); + final Widget child; + final VoidCallback? onOpen; + final VoidCallback? onOpenWith; + final VoidCallback? onCopy; + final VoidCallback? onCut; + final VoidCallback? onPaste; + @override Widget build(BuildContext context) { return CallbackShortcuts( @@ -32,37 +32,37 @@ class EntityContextMenu extends StatelessWidget { child: ContextMenu( entries: [ ContextMenuItem( - child: const Text("Open"), + child: const Text('Open'), onTap: onOpen, shortcut: const SingleActivator(LogicalKeyboardKey.enter), ), ContextMenuItem( - child: const Text("Open with other application"), + child: const Text('Open with other application'), onTap: onOpenWith, enabled: false, ), const ContextMenuDivider(), ContextMenuItem( leading: const Icon(YaruIcons.copy), - child: const Text("Copy file"), + child: const Text('Copy file'), onTap: onCopy, shortcut: const SingleActivator(LogicalKeyboardKey.keyC, control: true), ), ContextMenuItem( leading: const Icon(YaruIcons.cut), - child: const Text("Cut file"), + child: const Text('Cut file'), onTap: onCut, shortcut: const SingleActivator(LogicalKeyboardKey.keyX, control: true), ), ContextMenuItem( leading: const Icon(YaruIcons.paste), - child: const Text("Paste file"), + child: const Text('Paste file'), onTap: onPaste, shortcut: const SingleActivator(LogicalKeyboardKey.keyV, control: true), - ) + ), ], child: child, ), diff --git a/lib/widgets/folder_dialog.dart b/lib/widgets/folder_dialog.dart index a6d2fb6..3fdbf84 100755 --- a/lib/widgets/folder_dialog.dart +++ b/lib/widgets/folder_dialog.dart @@ -16,11 +16,11 @@ class _FolderDialogState extends State { @override Widget build(BuildContext context) { return AlertDialog( - title: const Text("New Folder"), + title: const Text('New Folder'), content: TextField( autofocus: true, decoration: const InputDecoration( - hintText: "Folder name", + hintText: 'Folder name', ), controller: controller, onSubmitted: (value) { @@ -29,7 +29,7 @@ class _FolderDialogState extends State { ), actions: [ TextButton( - child: const Text("Cancel"), + child: const Text('Cancel'), onPressed: () { Navigator.pop(context); }, @@ -41,7 +41,7 @@ class _FolderDialogState extends State { value.text.isNotEmpty && folderValidator.hasMatch(value.text) ? () => Navigator.of(context).pop(controller.text) : null, - child: const Text("Create"), + child: const Text('Create'), ), ), ], diff --git a/lib/widgets/grid.dart b/lib/widgets/grid.dart index 0aa3b45..959016e 100755 --- a/lib/widgets/grid.dart +++ b/lib/widgets/grid.dart @@ -11,16 +11,6 @@ typedef EntityCallback = void Function(EntityInfo entity); typedef DropAcceptCallback = void Function(String path); class FilesGrid extends StatefulWidget { - final List entities; - final EntityCallback? onEntityTap; - final EntityCallback? onEntityDoubleTap; - final EntityCallback? onEntityLongTap; - final EntityCallback? onEntitySecondaryTap; - final ValueChanged? onSizeChange; - final DropAcceptCallback? onDropAccept; - final double size; - final ScrollController? controller; - const FilesGrid({ required this.entities, this.onEntityTap, @@ -34,6 +24,16 @@ class FilesGrid extends StatefulWidget { super.key, }); + final List entities; + final EntityCallback? onEntityTap; + final EntityCallback? onEntityDoubleTap; + final EntityCallback? onEntityLongTap; + final EntityCallback? onEntitySecondaryTap; + final ValueChanged? onSizeChange; + final DropAcceptCallback? onDropAccept; + final double size; + final ScrollController? controller; + @override State createState() => _FilesGridState(); } @@ -45,7 +45,7 @@ class _FilesGridState extends State { @override Widget build(BuildContext context) { - final WorkspaceController controller = WorkspaceController.of(context); + final controller = WorkspaceController.of(context); return GestureDetector( onTap: controller.clearSelectedItems, @@ -62,7 +62,7 @@ class _FilesGridState extends State { itemCount: widget.entities.length, controller: scrollController, itemBuilder: (context, index) { - final EntityInfo entityInfo = widget.entities[index]; + final entityInfo = widget.entities[index]; return Draggable( data: entityInfo.entity, @@ -100,14 +100,6 @@ class _FilesGridState extends State { } class FileCell extends StatelessWidget { - final EntityInfo entity; - final bool selected; - final EntityCallback? onTap; - final EntityCallback? onDoubleTap; - final EntityCallback? onLongTap; - final EntityCallback? onSecondaryTap; - final DropAcceptCallback? onDropAccept; - const FileCell({ required this.entity, this.selected = false, @@ -118,18 +110,25 @@ class FileCell extends StatelessWidget { this.onDropAccept, super.key, }); + final EntityInfo entity; + final bool selected; + final EntityCallback? onTap; + final EntityCallback? onDoubleTap; + final EntityCallback? onLongTap; + final EntityCallback? onSecondaryTap; + final DropAcceptCallback? onDropAccept; @override Widget build(BuildContext context) { return DragTarget( - onWillAccept: (data) { + onWillAcceptWithDetails: (details) { if (!entity.isDirectory) return false; - if (data!.path == entity.path) return false; + if (details.data.path == entity.path) return false; return true; }, - onAccept: (_) => onDropAccept?.call(entity.path), + onAcceptWithDetails: (_) => onDropAccept?.call(entity.path), builder: (context, _, __) => Material( clipBehavior: Clip.antiAlias, shape: RoundedRectangleBorder( @@ -169,16 +168,15 @@ class FileCell extends StatelessWidget { } class Cell extends StatelessWidget { - final String name; - final IconData icon; - final Color? iconColor; - const Cell({ required this.name, required this.icon, this.iconColor, super.key, }); + final String name; + final IconData icon; + final Color? iconColor; @override Widget build(BuildContext context) { @@ -209,9 +207,8 @@ class Cell extends StatelessWidget { } class _ConstrainedIcon extends StatelessWidget { - final Widget child; - const _ConstrainedIcon({required this.child}); + final Widget child; @override Widget build(BuildContext context) { diff --git a/lib/widgets/separated_flex.dart b/lib/widgets/separated_flex.dart index 5e15f03..08f92b8 100755 --- a/lib/widgets/separated_flex.dart +++ b/lib/widgets/separated_flex.dart @@ -1,14 +1,8 @@ import 'package:flutter/material.dart'; class SeparatedFlex extends StatelessWidget { - final List children; - final Widget separator; - final Axis axis; - final MainAxisAlignment mainAxisAlignment; - final CrossAxisAlignment crossAxisAlignment; - final MainAxisSize mainAxisSize; - const SeparatedFlex({ + super.key, required this.children, required this.separator, required this.axis, @@ -18,6 +12,7 @@ class SeparatedFlex extends StatelessWidget { }); const SeparatedFlex.horizontal({ + super.key, required this.children, required this.separator, this.mainAxisAlignment = MainAxisAlignment.start, @@ -26,16 +21,23 @@ class SeparatedFlex extends StatelessWidget { }) : axis = Axis.horizontal; const SeparatedFlex.vertical({ + super.key, required this.children, required this.separator, this.mainAxisAlignment = MainAxisAlignment.start, this.crossAxisAlignment = CrossAxisAlignment.start, this.mainAxisSize = MainAxisSize.max, }) : axis = Axis.vertical; + final List children; + final Widget separator; + final Axis axis; + final MainAxisAlignment mainAxisAlignment; + final CrossAxisAlignment crossAxisAlignment; + final MainAxisSize mainAxisSize; @override Widget build(BuildContext context) { - final List separatedChildren = children.isNotEmpty + final separatedChildren = children.isNotEmpty ? List.generate(children.length * 2 - 1, (index) { if (index.isEven) { return children[index ~/ 2]; @@ -43,7 +45,7 @@ class SeparatedFlex extends StatelessWidget { return separator; } }) - : []; + : []; return Flex( direction: axis, diff --git a/lib/widgets/side_pane.dart b/lib/widgets/side_pane.dart index 6bea9ca..15493b8 100755 --- a/lib/widgets/side_pane.dart +++ b/lib/widgets/side_pane.dart @@ -5,15 +5,11 @@ import 'package:files/backend/workspace.dart'; import 'package:files/widgets/context_menu.dart'; import 'package:files/widgets/drive_list.dart'; import 'package:flutter/material.dart'; -import 'package:yaru_widgets/yaru_widgets.dart'; +import 'package:yaru/yaru.dart'; typedef NewTabCallback = void Function(String); class SidePane extends StatefulWidget { - final List destinations; - final WorkspaceController workspace; - final NewTabCallback onNewTab; - const SidePane({ required this.destinations, required this.workspace, @@ -21,8 +17,12 @@ class SidePane extends StatefulWidget { super.key, }); + final List destinations; + final WorkspaceController workspace; + final NewTabCallback onNewTab; + @override - _SidePaneState createState() => _SidePaneState(); + State createState() => _SidePaneState(); } class _SidePaneState extends State { @@ -77,16 +77,16 @@ class _SidePaneState extends State { return ContextMenu( entries: [ ContextMenuItem( - child: const Text("Open"), + child: const Text('Open'), onTap: () => widget.workspace .changeCurrentDir(widget.destinations[index].path), ), ContextMenuItem( - child: const Text("Open in new tab"), + child: const Text('Open in new tab'), onTap: () => widget.onNewTab(widget.destinations[index].path), ), ContextMenuItem( - child: const Text("Open in new window"), + child: const Text('Open in new window'), onTap: () async { await Process.start( Platform.resolvedExecutable, diff --git a/lib/widgets/tab_strip.dart b/lib/widgets/tab_strip.dart index 10584cb..809f771 100755 --- a/lib/widgets/tab_strip.dart +++ b/lib/widgets/tab_strip.dart @@ -2,18 +2,9 @@ import 'package:files/backend/utils.dart'; import 'package:files/backend/workspace.dart'; import 'package:files/widgets/context_menu.dart'; import 'package:flutter/material.dart'; -import 'package:yaru_icons/yaru_icons.dart'; -import 'package:yaru_widgets/yaru_widgets.dart'; +import 'package:yaru/yaru.dart'; class TabStrip extends StatelessWidget { - final List tabs; - final int selectedTab; - final bool allowClosing; - final ValueChanged? onTabChanged; - final ValueChanged? onTabClosed; - final VoidCallback? onNewTab; - final List trailing; - const TabStrip({ required this.tabs, required this.selectedTab, @@ -25,6 +16,14 @@ class TabStrip extends StatelessWidget { super.key, }); + final List tabs; + final int selectedTab; + final bool allowClosing; + final ValueChanged? onTabChanged; + final ValueChanged? onTabClosed; + final VoidCallback? onNewTab; + final List trailing; + @override Widget build(BuildContext context) { return SizedBox.expand( @@ -36,11 +35,11 @@ class TabStrip extends StatelessWidget { openOnLongPress: false, entries: [ ContextMenuItem( - child: const Text("Create new tab"), + child: const Text('Create new tab'), onTap: () => onNewTab?.call(), ), ContextMenuItem( - child: const Text("Close tab"), + child: const Text('Close tab'), onTap: () => onTabClosed?.call(index), enabled: allowClosing, ), @@ -80,12 +79,6 @@ class TabStrip extends StatelessWidget { } class _Tab extends StatefulWidget { - final WorkspaceController tab; - final bool selected; - final VoidCallback? onTap; - final VoidCallback? onClosed; - final bool allowClosing; - const _Tab({ required this.tab, required this.selected, @@ -93,6 +86,11 @@ class _Tab extends StatefulWidget { this.onClosed, this.allowClosing = true, }); + final WorkspaceController tab; + final bool selected; + final VoidCallback? onTap; + final VoidCallback? onClosed; + final bool allowClosing; @override State<_Tab> createState() => _TabState(); @@ -122,7 +120,7 @@ class _TabState extends State<_Tab> { height: double.infinity, child: Material( color: widget.selected - ? Theme.of(context).colorScheme.surfaceVariant + ? Theme.of(context).colorScheme.surfaceContainerHighest : Theme.of(context).colorScheme.surface, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(6), diff --git a/lib/widgets/table.dart b/lib/widgets/table.dart index e4fd855..528a0c5 100755 --- a/lib/widgets/table.dart +++ b/lib/widgets/table.dart @@ -16,7 +16,7 @@ import 'package:recase/recase.dart'; // ignore: implementation_imports import 'package:super_clipboard/src/format_conversions.dart'; import 'package:super_clipboard/super_clipboard.dart'; -import 'package:yaru_icons/yaru_icons.dart'; +import 'package:yaru/yaru.dart'; typedef HeaderTapCallback = void Function( bool newAscending, @@ -29,17 +29,6 @@ typedef HeaderResizeCallback = void Function( ); class FilesTable extends StatelessWidget { - final List rows; - final List columns; - final double rowHeight; - final double rowHorizontalPadding; - final bool ascending; - final int columnIndex; - final HeaderTapCallback? onHeaderCellTap; - final HeaderResizeCallback? onHeaderResize; - final ScrollController horizontalController; - final ScrollController verticalController; - const FilesTable({ required this.rows, required this.columns, @@ -54,14 +43,25 @@ class FilesTable extends StatelessWidget { super.key, }); + final List rows; + final List columns; + final double rowHeight; + final double rowHorizontalPadding; + final bool ascending; + final int columnIndex; + final HeaderTapCallback? onHeaderCellTap; + final HeaderResizeCallback? onHeaderResize; + final ScrollController horizontalController; + final ScrollController verticalController; + @override Widget build(BuildContext context) { - final WorkspaceController controller = WorkspaceController.of(context); + final controller = WorkspaceController.of(context); return LayoutBuilder( builder: (context, constraints) { return GestureDetector( - onTap: () => controller.clearSelectedItems(), + onTap: controller.clearSelectedItems, child: DoubleScrollbars( horizontalController: horizontalController, verticalController: verticalController, @@ -104,7 +104,7 @@ class FilesTable extends StatelessWidget { return SizedBox( height: 32, child: Material( - color: Theme.of(context).colorScheme.background, + color: Theme.of(context).colorScheme.surface, child: Row( mainAxisSize: MainAxisSize.min, children: [ @@ -116,7 +116,7 @@ class FilesTable extends StatelessWidget { ), Container( width: rowHorizontalPadding, - color: Theme.of(context).colorScheme.background, + color: Theme.of(context).colorScheme.surface, ), ], ), @@ -167,7 +167,7 @@ class FilesTable extends StatelessWidget { } Widget _buildHeaderCell(FilesColumn column, int index) { - final double startPadding = index == 0 ? rowHorizontalPadding : 0; + final startPadding = index == 0 ? rowHorizontalPadding : 0; return InkWell( onTap: column.allowSorting @@ -184,7 +184,7 @@ class FilesTable extends StatelessWidget { width: column.normalizedWidth + startPadding, constraints: BoxConstraints(minWidth: startPadding + 80), padding: EdgeInsetsDirectional.only( - start: startPadding, + start: startPadding.toDouble(), ), child: Stack( clipBehavior: Clip.none, @@ -240,17 +240,16 @@ class FilesTable extends StatelessWidget { } class FilesColumn { - final double width; - final FilesColumnType type; - final bool allowSorting; - - double get normalizedWidth => width.clamp(80, double.infinity); - const FilesColumn({ required this.width, required this.type, this.allowSorting = true, }); + final double width; + final FilesColumnType type; + final bool allowSorting; + + double get normalizedWidth => width.clamp(80, double.infinity); } enum FilesColumnType { @@ -263,13 +262,6 @@ enum FilesColumnType { } class FilesRow { - final EntityInfo entity; - final bool selected; - final VoidCallback? onTap; - final VoidCallback? onDoubleTap; - final VoidCallback? onLongTap; - final VoidCallback? onSecondaryTap; - const FilesRow({ required this.entity, this.selected = false, @@ -278,20 +270,25 @@ class FilesRow { this.onLongTap, this.onSecondaryTap, }); + final EntityInfo entity; + final bool selected; + final VoidCallback? onTap; + final VoidCallback? onDoubleTap; + final VoidCallback? onLongTap; + final VoidCallback? onSecondaryTap; } class _FilesRow extends StatefulWidget { - final FilesRow row; - final List columns; - final Size size; - final double horizontalPadding; - const _FilesRow({ required this.row, required this.columns, required this.size, required this.horizontalPadding, }); + final FilesRow row; + final List columns; + final Size size; + final double horizontalPadding; @override _FilesRowState createState() => _FilesRowState(); @@ -311,14 +308,15 @@ class _FilesRowState extends State<_FilesRow> { @override Widget build(BuildContext context) { return DragTarget( - onWillAccept: (data) { + onWillAcceptWithDetails: (details) { if (!widget.row.entity.isDirectory) return false; - if (data!.path == widget.row.entity.path) return false; + if (details.data.path == widget.row.entity.path) return false; return true; }, - onAccept: (data) => Utils.moveFileToDest(data, widget.row.entity.path), + onAcceptWithDetails: (details) => + Utils.moveFileToDest(details.data, widget.row.entity.path), builder: (context, candidateData, rejectedData) { return LayoutBuilder( builder: (context, constraints) { @@ -403,29 +401,25 @@ class _FilesRowState extends State<_FilesRow> { ), ], ); - break; case FilesColumnType.date: child = Text( - DateFormat("HH:mm - d MMM yyyy").format(entity.stat.modified), + DateFormat('HH:mm - d MMM yyyy').format(entity.stat.modified), overflow: TextOverflow.ellipsis, ); - break; case FilesColumnType.type: - final String fileExtension = - p.extension(entity.path).replaceAll(".", "").toUpperCase(); - final String fileLabel = - fileExtension.isNotEmpty ? "File ($fileExtension)" : "File"; + final fileExtension = + p.extension(entity.path).replaceAll('.', '').toUpperCase(); + final fileLabel = + fileExtension.isNotEmpty ? 'File ($fileExtension)' : 'File'; child = Text( - entity.isDirectory ? "Directory" : fileLabel, + entity.isDirectory ? 'Directory' : fileLabel, overflow: TextOverflow.ellipsis, ); - break; case FilesColumnType.size: child = Text( - entity.isDirectory ? "" : filesize(entity.stat.size), + entity.isDirectory ? '' : filesize(entity.stat.size), overflow: TextOverflow.ellipsis, ); - break; } return Container( diff --git a/lib/widgets/timed_inkwell.dart b/lib/widgets/timed_inkwell.dart index 740f18e..110918c 100755 --- a/lib/widgets/timed_inkwell.dart +++ b/lib/widgets/timed_inkwell.dart @@ -3,12 +3,6 @@ import 'dart:async'; import 'package:flutter/material.dart'; class TimedInkwell extends StatefulWidget { - final Widget? child; - final VoidCallback? onTap; - final VoidCallback? onDoubleTap; - final VoidCallback? onLongPress; - final Duration tapDelay; - const TimedInkwell({ this.child, this.onTap, @@ -18,6 +12,12 @@ class TimedInkwell extends StatefulWidget { super.key, }); + final Widget? child; + final VoidCallback? onTap; + final VoidCallback? onDoubleTap; + final VoidCallback? onLongPress; + final Duration tapDelay; + @override State createState() => _TimedInkwellState(); } diff --git a/lib/widgets/workspace.dart b/lib/widgets/workspace.dart index 9d3636c..18444fe 100755 --- a/lib/widgets/workspace.dart +++ b/lib/widgets/workspace.dart @@ -17,19 +17,17 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher_string.dart'; -import 'package:yaru_icons/yaru_icons.dart'; -import 'package:yaru_widgets/yaru_widgets.dart'; +import 'package:yaru/yaru.dart'; class FilesWorkspace extends StatefulWidget { - final WorkspaceController controller; - const FilesWorkspace({ required this.controller, super.key, }); + final WorkspaceController controller; @override - _FilesWorkspaceState createState() => _FilesWorkspaceState(); + State createState() => _FilesWorkspaceState(); } class _FilesWorkspaceState extends State { @@ -85,11 +83,11 @@ class _FilesWorkspaceState extends State { Future _createFolder() async { final folderNameDialog = await promptNewFolder(); - final PathParts currentDir = PathParts.parse(controller.currentDir); + final currentDir = PathParts.parse(controller.currentDir); currentDir.parts.add('$folderNameDialog'); if (folderNameDialog != null) { await Directory(currentDir.toPath()).create(recursive: true); - controller.changeCurrentDir(currentDir.toPath()); + await controller.changeCurrentDir(currentDir.toPath()); } } @@ -112,35 +110,36 @@ class _FilesWorkspaceState extends State { } String get selectedItemsLabel { - if (controller.selectedItems.isEmpty) return ""; + if (controller.selectedItems.isEmpty) return ''; late String itemLabel; if (controller.selectedItems.length == 1) { - itemLabel = "item"; + itemLabel = 'item'; } else { - itemLabel = "items"; + itemLabel = 'items'; } - String baseString = - "${controller.selectedItems.length} selected $itemLabel"; + var baseString = '${controller.selectedItems.length} selected $itemLabel'; if (controller.selectedItems.every((element) => element.isFile)) { - final int totalSize = controller.selectedItems.fold( + final totalSize = controller.selectedItems.fold( 0, (previousValue, element) => previousValue + element.stat.size, ); - baseString += " ${filesize(totalSize)}"; + baseString += ' ${filesize(totalSize)}'; } return baseString; } void _onEntityTap(EntityInfo entity) { - final bool selected = controller.selectedItems.contains(entity); - final Set keysPressed = + final selected = controller.selectedItems.contains(entity); + final keysPressed = + // TODO: remove ignore + // ignore: deprecated_member_use RawKeyboard.instance.keysPressed; - final bool multiSelect = keysPressed.contains( + final multiSelect = keysPressed.contains( LogicalKeyboardKey.controlLeft, ) || keysPressed.contains( @@ -170,7 +169,7 @@ class _FilesWorkspaceState extends State { // To move more than one file void _onDropAccepted(String path) { - for (final EntityInfo entity in controller.selectedItems) { + for (final entity in controller.selectedItems) { Utils.moveFileToDest(entity.entity, path); } } @@ -265,12 +264,12 @@ class _FilesWorkspaceState extends State { SizedBox( height: 32, child: Material( - color: Theme.of(context).colorScheme.background, + color: Theme.of(context).colorScheme.surface, child: Padding( padding: const EdgeInsets.symmetric(horizontal: 8), child: Row( children: [ - Text("${controller.currentInfo?.length ?? 0} items"), + Text('${controller.currentInfo?.length ?? 0} items'), const Spacer(), Text(selectedItemsLabel), ], @@ -299,9 +298,9 @@ class _FilesWorkspaceState extends State { size: 80, ), Text( - "This Folder is Empty", + 'This Folder is Empty', style: TextStyle(fontSize: 17), - ) + ), ], ), ); @@ -377,30 +376,27 @@ class _FilesWorkspaceState extends State { } class _WorkspaceTopbar extends StatelessWidget { - final WorkspaceController controller; - final ValueChanged? onWorkspaceViewChanged; - final List Function(BuildContext context)? popupBuilder; - const _WorkspaceTopbar({ required this.controller, this.onWorkspaceViewChanged, this.popupBuilder, }); + final WorkspaceController controller; + final ValueChanged? onWorkspaceViewChanged; + final List Function(BuildContext context)? popupBuilder; @override Widget build(BuildContext context) { return BreadcrumbsBar( path: PathParts.parse(controller.currentDir), - onBreadcrumbPress: (value) { - controller.changeCurrentDir(value); - }, + onBreadcrumbPress: controller.changeCurrentDir, onPathSubmitted: (path) async { - final bool exists = await Directory(path).exists(); + final exists = await Directory(path).exists(); if (exists) { - controller.changeCurrentDir(path); + await controller.changeCurrentDir(path); } else { - controller.changeCurrentDir(controller.currentDir); + await controller.changeCurrentDir(controller.currentDir); } }, leading: [ @@ -423,7 +419,7 @@ class _WorkspaceTopbar extends StatelessWidget { const SizedBox(width: 8), YaruOptionButton( onPressed: () { - final PathParts backDir = PathParts.parse(controller.currentDir); + final backDir = PathParts.parse(controller.currentDir); controller.changeCurrentDir( backDir.toPath(backDir.parts.length - 1), ); @@ -437,10 +433,8 @@ class _WorkspaceTopbar extends StatelessWidget { switch (controller.view) { case WorkspaceView.table: onWorkspaceViewChanged?.call(WorkspaceView.grid); - break; case WorkspaceView.grid: onWorkspaceViewChanged?.call(WorkspaceView.table); - break; } }, child: Icon(viewIcon), @@ -481,13 +475,6 @@ class _WorkspaceTopbar extends StatelessWidget { enum _HistoryModifierIconButtonType { left, right } class _HistoryModifierIconButton extends StatelessWidget { - final IconData icon; - final VoidCallback onPressed; - final bool enabled; - final ValueChanged? onHistoryOffsetChanged; - final WorkspaceController controller; - final _HistoryModifierIconButtonType type; - const _HistoryModifierIconButton({ required this.icon, required this.onPressed, @@ -496,6 +483,12 @@ class _HistoryModifierIconButton extends StatelessWidget { required this.controller, required this.type, }); + final IconData icon; + final VoidCallback onPressed; + final bool enabled; + final ValueChanged? onHistoryOffsetChanged; + final WorkspaceController controller; + final _HistoryModifierIconButtonType type; @override Widget build(BuildContext context) { @@ -531,7 +524,7 @@ class _HistoryModifierIconButton extends StatelessWidget { ), ), backgroundColor: enabled - ? Theme.of(context).colorScheme.surfaceVariant + ? Theme.of(context).colorScheme.surfaceContainerHighest : Theme.of(context).colorScheme.surface, ), child: Icon(icon, size: 20), @@ -541,13 +534,12 @@ class _HistoryModifierIconButton extends StatelessWidget { } class _WorkspaceErrorWidget extends StatelessWidget { - final OSError error; - final String path; - const _WorkspaceErrorWidget({ required this.error, required this.path, }); + final OSError error; + final String path; @override Widget build(BuildContext context) { @@ -564,13 +556,13 @@ class _WorkspaceErrorWidget extends StatelessWidget { Text.rich( TextSpan( children: [ - const TextSpan(text: "Error while accessing "), + const TextSpan(text: 'Error while accessing '), TextSpan( text: path, style: const TextStyle(fontWeight: FontWeight.bold), ), TextSpan( - text: "\n${error.message}", + text: '\n${error.message}', style: TextStyle( color: Theme.of(context).colorScheme.primary, ), diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index 315fffa..f2bed3a 100755 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include @@ -33,9 +33,9 @@ void fl_register_plugins(FlPluginRegistry* registry) { g_autoptr(FlPluginRegistrar) pasteboard_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "PasteboardPlugin"); pasteboard_plugin_register_with_registrar(pasteboard_registrar); - g_autoptr(FlPluginRegistrar) screen_retriever_registrar = - fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverPlugin"); - screen_retriever_plugin_register_with_registrar(screen_retriever_registrar); + g_autoptr(FlPluginRegistrar) screen_retriever_linux_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverLinuxPlugin"); + screen_retriever_linux_plugin_register_with_registrar(screen_retriever_linux_registrar); g_autoptr(FlPluginRegistrar) super_native_extensions_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "SuperNativeExtensionsPlugin"); super_native_extensions_plugin_register_with_registrar(super_native_extensions_registrar); diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index bb879e6..920502b 100755 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -8,7 +8,7 @@ list(APPEND FLUTTER_PLUGIN_LIST irondash_engine_context isar_flutter_libs pasteboard - screen_retriever + screen_retriever_linux super_native_extensions url_launcher_linux window_manager diff --git a/pubspec.lock b/pubspec.lock index efbf214..f3add74 100755 --- a/pubspec.lock +++ b/pubspec.lock @@ -17,30 +17,62 @@ packages: url: "https://pub.dev" source: hosted version: "5.13.0" + animated_vector: + dependency: transitive + description: + name: animated_vector + sha256: f1beb10e6fcfd8bd15abb788e20345def786d1c7391d7c1426bb2a1f2adf2132 + url: "https://pub.dev" + source: hosted + version: "0.2.2" + animated_vector_annotations: + dependency: transitive + description: + name: animated_vector_annotations + sha256: "07c1ea603a2096f7eb6f1c2b8f16c3c330c680843ea78b7782a3217c3c53f979" + url: "https://pub.dev" + source: hosted + version: "0.2.2" + archive: + dependency: transitive + description: + name: archive + sha256: cb6a278ef2dbb298455e1a713bda08524a175630ec643a242c399c932a0a1f7d + url: "https://pub.dev" + source: hosted + version: "3.6.1" args: dependency: transitive description: name: args - sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" + sha256: bf9f5caeea8d8fe6721a9c358dd8a5c1947b27f1cfaa18b39c301273594919e6 url: "https://pub.dev" source: hosted - version: "2.5.0" + version: "2.6.0" + assorted_layout_widgets: + dependency: transitive + description: + name: assorted_layout_widgets + sha256: "5b7f7c76a1a4c7cf95edfb854c3ed09ce9cb7f25a372f2d9a8d4c1569d42ecfb" + url: "https://pub.dev" + source: hosted + version: "9.0.2" async: dependency: transitive description: name: async - sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63 url: "https://pub.dev" source: hosted - version: "2.11.0" + version: "2.12.0" boolean_selector: dependency: transitive description: name: boolean_selector - sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" build: dependency: transitive description: @@ -61,10 +93,10 @@ packages: dependency: transitive description: name: build_daemon - sha256: "0343061a33da9c5810b2d6cee51945127d8f4c060b7fbdd9d54917f0a3feaaa1" + sha256: "79b2aef6ac2ed00046867ed354c88778c9c0f029df8a20fe10b5436826721ef9" url: "https://pub.dev" source: hosted - version: "4.0.1" + version: "4.0.2" build_resolvers: dependency: transitive description: @@ -77,18 +109,18 @@ packages: dependency: "direct dev" description: name: build_runner - sha256: "3ac61a79bfb6f6cc11f693591063a7f19a7af628dc52f141743edac5c16e8c22" + sha256: "028819cfb90051c6b5440c7e574d1896f8037e3c96cf17aaeb054c9311cfbf4d" url: "https://pub.dev" source: hosted - version: "2.4.9" + version: "2.4.13" build_runner_core: dependency: transitive description: name: build_runner_core - sha256: "4ae8ffe5ac758da294ecf1802f2aff01558d8b1b00616aa7538ea9a8a5d50799" + sha256: f8126682b87a7282a339b871298cc12009cb67109cfa1614d6436fb0289193e0 url: "https://pub.dev" source: hosted - version: "7.3.0" + version: "7.3.2" built_collection: dependency: transitive description: @@ -125,10 +157,10 @@ packages: dependency: transitive description: name: clock - sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.1.2" code_builder: dependency: transitive description: @@ -149,18 +181,18 @@ packages: dependency: transitive description: name: convert - sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "3.1.2" crypto: dependency: transitive description: name: crypto - sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" url: "https://pub.dev" source: hosted - version: "3.0.3" + version: "3.0.6" dart_style: dependency: transitive description: @@ -185,22 +217,38 @@ packages: url: "https://pub.dev" source: hosted version: "0.7.10" + device_info_plus: + dependency: transitive + description: + name: device_info_plus + sha256: a7fd703482b391a87d60b6061d04dfdeab07826b96f9abd8f5ed98068acc0074 + url: "https://pub.dev" + source: hosted + version: "10.1.2" + device_info_plus_platform_interface: + dependency: transitive + description: + name: device_info_plus_platform_interface + sha256: "282d3cf731045a2feb66abfe61bbc40870ae50a3ed10a4d3d217556c35c8c2ba" + url: "https://pub.dev" + source: hosted + version: "7.0.1" ffi: dependency: "direct main" description: name: ffi - sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21" + sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.3" file: dependency: transitive description: name: file - sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 url: "https://pub.dev" source: hosted - version: "7.0.0" + version: "7.0.1" filesize: dependency: "direct main" description: @@ -213,15 +261,23 @@ packages: dependency: transitive description: name: fixnum - sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.1" flutter: dependency: "direct main" description: flutter source: sdk version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1" + url: "https://pub.dev" + source: hosted + version: "5.0.0" flutter_web_plugins: dependency: transitive description: flutter @@ -255,10 +311,18 @@ packages: dependency: transitive description: name: graphs - sha256: aedc5a15e78fc65a6e23bcd927f24c64dd995062bcd1ca6eda65a3cff92a4d19 + sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.3.2" + gsettings: + dependency: transitive + description: + name: gsettings + sha256: "1b0ce661f5436d2db1e51f3c4295a49849f03d304003a7ba177d01e3a858249c" + url: "https://pub.dev" + source: hosted + version: "0.2.8" gtk: dependency: transitive description: @@ -271,10 +335,10 @@ packages: dependency: "direct main" description: name: handy_window - sha256: "458a9f7d4ae23816e8f33c76596f943a04e7eff13d864e0867f3b40f1647d63d" + sha256: "56b813e58a68b0ee2ab22051400b8b1f1b5cfe88b8cd32288623defb3926245a" url: "https://pub.dev" source: hosted - version: "0.3.1" + version: "0.4.0" http_multi_server: dependency: transitive description: @@ -291,6 +355,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.2" + image: + dependency: transitive + description: + name: image + sha256: f31d52537dc417fdcde36088fdf11d191026fd5e4fae742491ebd40e5a8bea7d + url: "https://pub.dev" + source: hosted + version: "4.3.0" intl: dependency: "direct main" description: @@ -311,18 +383,18 @@ packages: dependency: transitive description: name: irondash_engine_context - sha256: "086fbbcaef07b821b304b0371e472c687715f326219b69b18dc5c962dab09b55" + sha256: cd7b769db11a2b5243b037c8a9b1ecaef02e1ae27a2d909ffa78c1dad747bb10 url: "https://pub.dev" source: hosted - version: "0.1.1" + version: "0.5.4" irondash_message_channel: dependency: transitive description: name: irondash_message_channel - sha256: "081ff9631a2c6782a47ef4fdf9c97206053af1bb174e2a25851692b04f3bc126" + sha256: b4101669776509c76133b8917ab8cfc704d3ad92a8c450b92934dd8884a2f060 url: "https://pub.dev" source: hosted - version: "0.1.1" + version: "0.7.0" isar: dependency: "direct main" description: @@ -371,54 +443,70 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.0" + lints: + dependency: transitive + description: + name: lints + sha256: "3315600f3fb3b135be672bf4a178c55f274bebe368325ae18462c89ac1e3b413" + url: "https://pub.dev" + source: hosted + version: "5.0.0" logging: dependency: transitive description: name: logging - sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.0" matcher: dependency: transitive description: name: matcher - sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 url: "https://pub.dev" source: hosted - version: "0.12.16+1" + version: "0.12.17" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec url: "https://pub.dev" source: hosted - version: "0.8.0" + version: "0.11.1" material_design_icons_flutter: dependency: "direct main" description: name: material_design_icons_flutter - sha256: "4c81ebf55b9661d1eb94652884a7b098af63153ea75b9070caedaddfae308e02" + sha256: "6f986b7a51f3ad4c00e33c5c84e8de1bdd140489bbcdc8b66fc1283dad4dea5a" + url: "https://pub.dev" + source: hosted + version: "7.0.7296" + matrix4_transform: + dependency: transitive + description: + name: matrix4_transform + sha256: "42c42610deecc382be2653f4a21358537401bd5b027c168a174c7c6a64959908" url: "https://pub.dev" source: hosted - version: "6.0.7296" + version: "3.0.1" meta: dependency: transitive description: name: meta - sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.15.0" mime: dependency: "direct main" description: name: mime - sha256: "2e123074287cc9fd6c09de8336dae606d1ddb88d9ac47358826db698c176a1f2" + sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" url: "https://pub.dev" source: hosted - version: "1.0.5" + version: "2.0.0" nested: dependency: transitive description: @@ -439,34 +527,42 @@ packages: dependency: "direct main" description: name: pasteboard - sha256: "1c8b6a8b3f1d12e55d4e9404433cda1b4abe66db6b17bc2d2fb5965772c04674" + sha256: "7bf733f3a00c7188ec1f2c6f0612854248b302cf91ef3611a2b7bb141c0f9d55" url: "https://pub.dev" source: hosted - version: "0.2.0" + version: "0.3.0" path: dependency: "direct main" description: name: path - sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.9.1" + path_parsing: + dependency: transitive + description: + name: path_parsing + sha256: "45f7d6bba1128761de5540f39d5ca000ea8a1f22f06b76b61094a60a2997bd0e" + url: "https://pub.dev" + source: hosted + version: "1.0.2" path_provider: dependency: "direct main" description: name: path_provider - sha256: c9e7d3a4cd1410877472158bee69963a4579f78b68c65a2b7d40d1a7a88bb161 + sha256: fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378 url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.4" path_provider_android: dependency: transitive description: name: path_provider_android - sha256: a248d8146ee5983446bf03ed5ea8f6533129a12b11f12057ad1b4a67a2b3b41d + sha256: c464428172cb986b758c6d1724c603097febb8fb855aa265aeecc9280c294d4a url: "https://pub.dev" source: hosted - version: "2.2.4" + version: "2.2.12" path_provider_foundation: dependency: transitive description: @@ -495,10 +591,10 @@ packages: dependency: transitive description: name: path_provider_windows - sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170" + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "2.3.0" petitparser: dependency: transitive description: @@ -507,14 +603,30 @@ packages: url: "https://pub.dev" source: hosted version: "6.0.2" + pixel_snap: + dependency: transitive + description: + name: pixel_snap + sha256: "677410ea37b07cd37ecb6d5e6c0d8d7615a7cf3bd92ba406fd1ac57e937d1fb0" + url: "https://pub.dev" + source: hosted + version: "0.1.5" platform: dependency: transitive description: name: platform - sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" + sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" url: "https://pub.dev" source: hosted - version: "3.1.4" + version: "3.1.6" + platform_linux: + dependency: transitive + description: + name: platform_linux + sha256: "856cfc9871e3ff3df6926991729d24bba9b70d0229ae377fa08b562344baaaa8" + url: "https://pub.dev" + source: hosted + version: "0.1.2" plugin_platform_interface: dependency: transitive description: @@ -551,10 +663,10 @@ packages: dependency: transitive description: name: pubspec_parse - sha256: c63b2876e58e194e4b0828fcb080ad0e06d051cb607a6be51a9e084f47cb9367 + sha256: c799b721d79eb6ee6fa56f00c04b472dcd44a30d258fac2174a6ec57302678f8 url: "https://pub.dev" source: hosted - version: "1.2.3" + version: "1.3.0" recase: dependency: "direct main" description: @@ -567,10 +679,42 @@ packages: dependency: transitive description: name: screen_retriever - sha256: "6ee02c8a1158e6dae7ca430da79436e3b1c9563c8cf02f524af997c201ac2b90" + sha256: "570dbc8e4f70bac451e0efc9c9bb19fa2d6799a11e6ef04f946d7886d2e23d0c" + url: "https://pub.dev" + source: hosted + version: "0.2.0" + screen_retriever_linux: + dependency: transitive + description: + name: screen_retriever_linux + sha256: f7f8120c92ef0784e58491ab664d01efda79a922b025ff286e29aa123ea3dd18 + url: "https://pub.dev" + source: hosted + version: "0.2.0" + screen_retriever_macos: + dependency: transitive + description: + name: screen_retriever_macos + sha256: "71f956e65c97315dd661d71f828708bd97b6d358e776f1a30d5aa7d22d78a149" + url: "https://pub.dev" + source: hosted + version: "0.2.0" + screen_retriever_platform_interface: + dependency: transitive + description: + name: screen_retriever_platform_interface + sha256: ee197f4581ff0d5608587819af40490748e1e39e648d7680ecf95c05197240c0 url: "https://pub.dev" source: hosted - version: "0.1.9" + version: "0.2.0" + screen_retriever_windows: + dependency: transitive + description: + name: screen_retriever_windows + sha256: "449ee257f03ca98a57288ee526a301a430a344a161f9202b4fcc38576716fe13" + url: "https://pub.dev" + source: hosted + version: "0.2.0" shelf: dependency: transitive description: @@ -583,10 +727,10 @@ packages: dependency: transitive description: name: shelf_web_socket - sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" + sha256: "073c147238594ecd0d193f3456a5fe91c4b0abbcc68bf5cd95b36c4e194ac611" url: "https://pub.dev" source: hosted - version: "1.0.4" + version: "2.0.0" sky_engine: dependency: transitive description: flutter @@ -608,14 +752,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.10.0" + sprintf: + dependency: transitive + description: + name: sprintf + sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" + url: "https://pub.dev" + source: hosted + version: "7.0.0" stack_trace: dependency: transitive description: name: stack_trace - sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377" url: "https://pub.dev" source: hosted - version: "1.11.1" + version: "1.12.0" stream_channel: dependency: transitive description: @@ -636,26 +788,26 @@ packages: dependency: transitive description: name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + sha256: "0bd04f5bb74fcd6ff0606a888a30e917af9bd52820b178eaa464beb11dca84b6" url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.4.0" super_clipboard: dependency: "direct main" description: name: super_clipboard - sha256: "6dbc0f90c3a4d09cb54e1f74bc0b0f4f306dfeda609c9fe240f65828a1438426" + sha256: "4a6ae6dfaa282ec1f2bff750976f535517ed8ca842d5deae13985eb11c00ac1f" url: "https://pub.dev" source: hosted - version: "0.2.3+1" + version: "0.8.24" super_native_extensions: dependency: transitive description: name: super_native_extensions - sha256: "6e015f1101e654070d00aba21080e0ed19bdcbd8b286114d8698ef3689c809b7" + sha256: a433bba8186cd6b707560c42535bf284804665231c00bca86faf1aa4968b7637 url: "https://pub.dev" source: hosted - version: "0.2.4" + version: "0.8.24" term_glyph: dependency: transitive description: @@ -668,10 +820,10 @@ packages: dependency: transitive description: name: test_api - sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" + sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" url: "https://pub.dev" source: hosted - version: "0.7.0" + version: "0.7.3" time: dependency: transitive description: @@ -692,18 +844,18 @@ packages: dependency: transitive description: name: typed_data - sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 url: "https://pub.dev" source: hosted - version: "1.3.2" + version: "1.4.0" ubuntu_service: dependency: "direct main" description: name: ubuntu_service - sha256: f6ad4dfb099af41e750c59aad00d67a96e22df00f4962d2e25d56ae3db78be49 + sha256: af850c8927c97ba49749c262654fe84833c8f1d80b641016c8f72a18d2191379 url: "https://pub.dev" source: hosted - version: "0.2.4" + version: "0.4.0" udisks: dependency: "direct main" description: @@ -717,42 +869,42 @@ packages: dependency: "direct main" description: name: url_launcher - sha256: "6ce1e04375be4eed30548f10a315826fd933c1e493206eab82eed01f438c8d2e" + sha256: "9d06212b1362abc2f0f0d78e6f09f726608c74e3b9462e8368bb03314aa8d603" url: "https://pub.dev" source: hosted - version: "6.2.6" + version: "6.3.1" url_launcher_android: dependency: transitive description: name: url_launcher_android - sha256: "17cd5e205ea615e2c6ea7a77323a11712dffa0720a8a90540db57a01347f9ad9" + sha256: "0dea215895a4d254401730ca0ba8204b29109a34a99fb06ae559a2b60988d2de" url: "https://pub.dev" source: hosted - version: "6.3.2" + version: "6.3.13" url_launcher_ios: dependency: transitive description: name: url_launcher_ios - sha256: "7068716403343f6ba4969b4173cbf3b84fc768042124bc2c011e5d782b24fe89" + sha256: e43b677296fadce447e987a2f519dcf5f6d1e527dc35d01ffab4fff5b8a7063e url: "https://pub.dev" source: hosted - version: "6.3.0" + version: "6.3.1" url_launcher_linux: dependency: transitive description: name: url_launcher_linux - sha256: ab360eb661f8879369acac07b6bb3ff09d9471155357da8443fd5d3cf7363811 + sha256: e2b9622b4007f97f504cd64c0128309dfb978ae66adbe944125ed9e1750f06af url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "3.2.0" url_launcher_macos: dependency: transitive description: name: url_launcher_macos - sha256: "9a1a42d5d2d95400c795b2914c36fdcb525870c752569438e4ebb09a2b5d90de" + sha256: "769549c999acdb42b8bcfa7c43d72bf79a382ca7441ab18a808e101149daf672" url: "https://pub.dev" source: hosted - version: "3.2.0" + version: "3.2.1" url_launcher_platform_interface: dependency: transitive description: @@ -765,26 +917,26 @@ packages: dependency: transitive description: name: url_launcher_web - sha256: "8d9e750d8c9338601e709cd0885f95825086bd8b642547f26bda435aade95d8a" + sha256: "772638d3b34c779ede05ba3d38af34657a05ac55b06279ea6edd409e323dca8e" url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.3.3" url_launcher_windows: dependency: transitive description: name: url_launcher_windows - sha256: ecf9725510600aa2bb6d7ddabe16357691b6d2805f66216a97d1b881e21beff7 + sha256: "44cf3aabcedde30f2dba119a9dea3b0f2672fbe6fa96e85536251d678216b3c4" url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "3.1.3" uuid: dependency: transitive description: name: uuid - sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313" + sha256: a5be9ef6618a7ac1e964353ef476418026db906c4facdedaa299b7a2e71690ff url: "https://pub.dev" source: hosted - version: "3.0.7" + version: "4.5.1" vector_math: dependency: transitive description: @@ -805,34 +957,50 @@ packages: dependency: transitive description: name: web - sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" + sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb url: "https://pub.dev" source: hosted - version: "0.5.1" + version: "1.1.0" + web_socket: + dependency: transitive + description: + name: web_socket + sha256: "3c12d96c0c9a4eec095246debcea7b86c0324f22df69893d538fcc6f1b8cce83" + url: "https://pub.dev" + source: hosted + version: "0.1.6" web_socket_channel: dependency: transitive description: name: web_socket_channel - sha256: "58c6666b342a38816b2e7e50ed0f1e261959630becd4c879c4f26bfa14aa5a42" + sha256: "9f187088ed104edd8662ca07af4b124465893caf063ba29758f97af57e61da8f" url: "https://pub.dev" source: hosted - version: "2.4.5" + version: "3.0.1" win32: dependency: transitive description: name: win32 - sha256: "0eaf06e3446824099858367950a813472af675116bf63f008a4c2a75ae13e9cb" + sha256: "10169d3934549017f0ae278ccb07f828f9d6ea21573bab0fb77b0e1ef0fce454" + url: "https://pub.dev" + source: hosted + version: "5.7.2" + win32_registry: + dependency: transitive + description: + name: win32_registry + sha256: "21ec76dfc731550fd3e2ce7a33a9ea90b828fdf19a5c3bcf556fa992cfa99852" url: "https://pub.dev" source: hosted - version: "5.5.0" + version: "1.1.5" window_manager: dependency: transitive description: name: window_manager - sha256: "8699323b30da4cdbe2aa2e7c9de567a6abd8a97d9a5c850a3c86dcd0b34bbfbf" + sha256: "732896e1416297c63c9e3fb95aea72d0355f61390263982a47fd519169dc5059" url: "https://pub.dev" source: hosted - version: "0.3.9" + version: "0.4.3" windows_path_provider: dependency: "direct main" description: @@ -846,10 +1014,10 @@ packages: dependency: "direct main" description: name: xdg_directories - sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d + sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" url: "https://pub.dev" source: hosted - version: "1.0.4" + version: "1.1.0" xml: dependency: transitive description: @@ -862,10 +1030,10 @@ packages: dependency: transitive description: name: xxh3 - sha256: a92b30944a9aeb4e3d4f3c3d4ddb3c7816ca73475cd603682c4f8149690f56d7 + sha256: cbeb0e1d10f4c6bf67b650f395eac0cc689425b5efc2ba0cc3d3e069a0beaeec url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "1.1.0" yaml: dependency: transitive description: @@ -878,82 +1046,50 @@ packages: dependency: "direct main" description: name: yaru - sha256: ca20337f0223a81bcbaaf899677d2f4ebe334b9cae696ce6aa1c4705a3a803ef - url: "https://pub.dev" - source: hosted - version: "0.5.8" - yaru_color_generator: - dependency: transitive - description: - name: yaru_color_generator - sha256: "78b96cefc4eef763e4786f891ce336cdd55ef8edc55494c4bea2bc9d10ef9c96" + sha256: b226f045d3104422d7f4d87572cc57c75b7d5695adf6fa47dbab3bc664714e69 url: "https://pub.dev" source: hosted - version: "0.1.0" - yaru_colors: - dependency: transitive - description: - name: yaru_colors - sha256: "42814cafa3c4a6876962559ae9d8b9ff088a59635e649e4eae86d35905496063" - url: "https://pub.dev" - source: hosted - version: "0.1.7" - yaru_icons: - dependency: "direct main" - description: - name: yaru_icons - sha256: "8ddd40522c882de898a493094f2f41687f7a0faaf3434b9c854a7605a53a2477" - url: "https://pub.dev" - source: hosted - version: "1.0.4" - yaru_widgets: - dependency: "direct main" - description: - name: yaru_widgets - sha256: "091fca04a859897c309a5a20e6dfca3039e7b7b756a31a05110806b61efdc2e8" - url: "https://pub.dev" - source: hosted - version: "2.2.1" + version: "5.3.1" yaru_window: - dependency: "direct main" + dependency: transitive description: name: yaru_window - sha256: "55c8f039d13aaa1b211a8cf0b7731ae2fdcac9b1be1e0994eb14ad1d17fecaf7" + sha256: bc2a1df3c6f33477b47f84bf0a9325df411dbb7bd483ac88e5bc1c019d2f2560 url: "https://pub.dev" source: hosted - version: "0.1.3" + version: "0.2.1+1" yaru_window_linux: dependency: transitive description: name: yaru_window_linux - sha256: c45606cf75880ae6427bbe176dc5313356f16c876c7013a19aeee782882c40c2 + sha256: "46a1a0743dfd45794cdaf8c5b3a48771ab73632b50a693f59c83b07988e96689" url: "https://pub.dev" source: hosted - version: "0.1.3" + version: "0.2.1" yaru_window_manager: dependency: transitive description: name: yaru_window_manager - sha256: "2d358263d19ae6598df21d6d8c0d25e75c79a82f459b63b0013a13e395c48b23" + sha256: b36c909fa082a7cb6e2f259d4357e16f08d3d8ab086685b81d1916e457100d1e url: "https://pub.dev" source: hosted - version: "0.1.2" + version: "0.1.2+1" yaru_window_platform_interface: dependency: transitive description: name: yaru_window_platform_interface - sha256: e9f8cd34e207d7f7b771ae70dee347ed974cee06b981819c4181b3e474e52254 + sha256: "93493d7e17a9e887ffa94c518bc5a4b3eb5425c009446e3294c689cb1a87b7e1" url: "https://pub.dev" source: hosted - version: "0.1.2" + version: "0.1.2+1" yaru_window_web: dependency: transitive description: name: yaru_window_web - sha256: "3ff30758a330d7626d54643df0cca6c179782f401aba7752da9cc0d60c9a6f74" + sha256: "31468aeb515f72d5eeddcd62773094a4f48fee96f7f0494f8ce53ad3b38054f1" url: "https://pub.dev" source: hosted - version: "0.0.3" + version: "0.0.3+1" sdks: - dart: ">=3.3.0 <4.0.0" - flutter: ">=3.19.0" + dart: ">=3.5.0 <4.0.0" + flutter: ">=3.24.3" diff --git a/pubspec.yaml b/pubspec.yaml index 9d597b6..8375426 100755 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,7 +5,8 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: ">=2.17.0 <3.0.0" + sdk: ">=3.0.0 <4.0.0" + flutter: ">=3.24.3" dependencies: collection: ^1.16.0 @@ -15,22 +16,22 @@ dependencies: flutter: sdk: flutter - handy_window: ^0.3.1 + handy_window: ^0.4.0 intl: any isar: ^3.0.2 isar_flutter_libs: ^3.0.2 - material_design_icons_flutter: ^6.0.7096 - mime: ^1.0.0 + material_design_icons_flutter: ^7.0.7296 + mime: ^2.0.0 - pasteboard: ^0.2.0 + pasteboard: ^0.3.0 path: ^1.8.2 path_provider: ^2.0.2 provider: ^6.0.0 recase: ^4.1.0 - super_clipboard: ^0.2.3 - ubuntu_service: ^0.2.0 + super_clipboard: ^0.8.24 + ubuntu_service: ^0.4.0 udisks: git: https://github.com/HrX03/udisks.dart url_launcher: any @@ -38,13 +39,11 @@ dependencies: git: url: https://github.com/HrX03/windows_path_provider.git xdg_directories: ^1.0.0 - yaru: ^0.5.6 - yaru_icons: ^1.0.4 - yaru_widgets: ^2.1.1 - yaru_window: ^0.1.1 + yaru: ^5.3.1 dev_dependencies: build_runner: ^2.3.2 + flutter_lints: ^5.0.0 isar_generator: ^3.0.2 lint: ^2.1.1 diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 4c52a86..5e30d77 100755 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include #include @@ -22,8 +22,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { registry->GetRegistrarForPlugin("IsarFlutterLibsPlugin")); PasteboardPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("PasteboardPlugin")); - ScreenRetrieverPluginRegisterWithRegistrar( - registry->GetRegistrarForPlugin("ScreenRetrieverPlugin")); + ScreenRetrieverWindowsPluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("ScreenRetrieverWindowsPluginCApi")); SuperNativeExtensionsPluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("SuperNativeExtensionsPluginCApi")); UrlLauncherWindowsRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 498154e..4c09aa3 100755 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -6,7 +6,7 @@ list(APPEND FLUTTER_PLUGIN_LIST irondash_engine_context isar_flutter_libs pasteboard - screen_retriever + screen_retriever_windows super_native_extensions url_launcher_windows window_manager