Browse Source

[path_provider_aurora] First commit, problem with 'registerWith'

merge-requests/1/head
Vitaliy Zarubin 2 years ago
parent
commit
4759b25926
  1. 31
      packages/path_provider/path_provider_aurora/.gitignore
  2. 31
      packages/path_provider/path_provider_aurora/README.md
  3. 4
      packages/path_provider/path_provider_aurora/analysis_options.yaml
  4. 12
      packages/path_provider/path_provider_aurora/aurora/CMakeLists.txt
  5. 44
      packages/path_provider/path_provider_aurora/example/.gitignore
  6. 16
      packages/path_provider/path_provider_aurora/example/README.md
  7. 29
      packages/path_provider/path_provider_aurora/example/analysis_options.yaml
  8. 1
      packages/path_provider/path_provider_aurora/example/aurora/.gitignore
  9. 48
      packages/path_provider/path_provider_aurora/example/aurora/CMakeLists.txt
  10. 12
      packages/path_provider/path_provider_aurora/example/aurora/desktop/com.example.path_provider_aurora_example.desktop
  11. 14
      packages/path_provider/path_provider_aurora/example/aurora/flutter/generated_plugin_registrant.cpp
  12. 12
      packages/path_provider/path_provider_aurora/example/aurora/flutter/generated_plugin_registrant.h
  13. 31
      packages/path_provider/path_provider_aurora/example/aurora/flutter/generated_plugins.cmake
  14. BIN
      packages/path_provider/path_provider_aurora/example/aurora/icons/108x108.png
  15. BIN
      packages/path_provider/path_provider_aurora/example/aurora/icons/128x128.png
  16. BIN
      packages/path_provider/path_provider_aurora/example/aurora/icons/172x172.png
  17. BIN
      packages/path_provider/path_provider_aurora/example/aurora/icons/86x86.png
  18. 10
      packages/path_provider/path_provider_aurora/example/aurora/main.cpp
  19. 31
      packages/path_provider/path_provider_aurora/example/aurora/rpm/com.example.path_provider_aurora_example.spec
  20. 72
      packages/path_provider/path_provider_aurora/example/lib/main.dart
  21. 268
      packages/path_provider/path_provider_aurora/example/pubspec.lock
  22. 23
      packages/path_provider/path_provider_aurora/example/pubspec.yaml
  23. 27
      packages/path_provider/path_provider_aurora/example/test/widget_test.dart
  24. 17
      packages/path_provider/path_provider_aurora/lib/path_provider_aurora.dart
  25. 34
      packages/path_provider/path_provider_aurora/pubspec.yaml
  26. 24
      packages/path_provider/path_provider_aurora/test/path_provider_aurora_method_channel_test.dart
  27. 21
      packages/path_provider/path_provider_aurora/test/path_provider_aurora_test.dart
  28. 2
      packages/xdga_directories/example/lib/main.dart
  29. 2
      script/build_example.sh

31
packages/path_provider/path_provider_aurora/.gitignore vendored

@ -0,0 +1,31 @@
# 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
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
/pubspec.lock
**/doc/api/
.dart_tool/
.packages
build/
/.metadata

31
packages/path_provider/path_provider_aurora/README.md

@ -0,0 +1,31 @@
# path_provider_aurora
The Aurora OS implementation of [`path_provider`](https://pub.dev/packages/path_provider).
## Usage
This package is not an _endorsed_ implementation of `path_provider`.
Therefore, you have to include `path_provider_aurora` alongside `path_provider` as dependencies in your `pubspec.yaml` file.
```yaml
dependencies:
path_provider: ^2.0.14
path_provider_aurora: ^0.0.0 # @todo Not published
```
Then you can import `path_provider` in your Dart code:
```dart
import 'package:path_provider/path_provider.dart';
```
## Supported APIs
- [x] `getTemporaryDirectory`
- [ ] `getApplicationSupportDirectory`
- [ ] `getLibraryDirectory`
- [ ] `getApplicationDocumentsDirectory`
- [ ] `getExternalStorageDirectory`
- [ ] `getExternalCacheDirectories`
- [ ] `getExternalStorageDirectories`
- [ ] `getDownloadsDirectory`

4
packages/path_provider/path_provider_aurora/analysis_options.yaml

@ -0,0 +1,4 @@
include: package:flutter_lints/flutter.yaml
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options

12
packages/path_provider/path_provider_aurora/aurora/CMakeLists.txt

@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 3.10)
set(PLUGIN_NAME xdga_directories)
project(${PLUGIN_NAME} LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "-Wall -Wextra")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../src ${CMAKE_CURRENT_BINARY_DIR}/shared)

44
packages/path_provider/path_provider_aurora/example/.gitignore vendored

@ -0,0 +1,44 @@
# 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

16
packages/path_provider/path_provider_aurora/example/README.md

@ -0,0 +1,16 @@
# path_provider_aurora_example
Demonstrates how to use the path_provider_aurora plugin.
## 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.

29
packages/path_provider/path_provider_aurora/example/analysis_options.yaml

@ -0,0 +1,29 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options

1
packages/path_provider/path_provider_aurora/example/aurora/.gitignore vendored

@ -0,0 +1 @@
flutter/ephemeral

48
packages/path_provider/path_provider_aurora/example/aurora/CMakeLists.txt

@ -0,0 +1,48 @@
cmake_minimum_required(VERSION 3.10)
project(com.example.path_provider_aurora_example LANGUAGES CXX)
include(GNUInstallDirs)
set(BINARY_NAME ${CMAKE_PROJECT_NAME})
set(FLUTTER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/flutter)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "-Wall -Wextra")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_SKIP_RPATH OFF)
set(CMAKE_INSTALL_RPATH "\$ORIGIN/../share/${BINARY_NAME}/lib")
find_package(PkgConfig REQUIRED)
find_package(Qt5 COMPONENTS Core REQUIRED)
pkg_check_modules(FlutterEmbedder REQUIRED IMPORTED_TARGET flutter-embedder)
add_executable(${BINARY_NAME} main.cpp ${FLUTTER_DIR}/generated_plugin_registrant.cpp)
target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::FlutterEmbedder Qt5::Core)
target_include_directories(${BINARY_NAME} PRIVATE ${FLUTTER_DIR})
include(flutter/generated_plugins.cmake)
set(PACKAGE_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/${BINARY_NAME})
set(DESKTOP_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/applications)
set(ICONS_INSTALL_ROOT_DIR ${CMAKE_INSTALL_DATADIR}/icons/hicolor)
add_custom_command(TARGET ${BINARY_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libflutter-embedder.so
${PROJECT_BINARY_DIR}/bundle/lib/libflutter-embedder.so)
install(FILES ${PROJECT_BINARY_DIR}/bundle/icudtl.dat DESTINATION ${PACKAGE_INSTALL_DIR})
install(DIRECTORY ${PROJECT_BINARY_DIR}/bundle/flutter_assets DESTINATION ${PACKAGE_INSTALL_DIR})
install(DIRECTORY ${PROJECT_BINARY_DIR}/bundle/lib DESTINATION ${PACKAGE_INSTALL_DIR})
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES desktop/${BINARY_NAME}.desktop DESTINATION ${DESKTOP_INSTALL_DIR})
foreach(ICONS_SIZE 86x86 108x108 128x128 172x172)
install(FILES icons/${ICONS_SIZE}.png
RENAME ${BINARY_NAME}.png
DESTINATION ${ICONS_INSTALL_ROOT_DIR}/${ICONS_SIZE}/apps/)
endforeach(ICONS_SIZE)

12
packages/path_provider/path_provider_aurora/example/aurora/desktop/com.example.path_provider_aurora_example.desktop

@ -0,0 +1,12 @@
[Desktop Entry]
Type=Application
Name=path_provider_aurora_example
Comment=Demonstrates how to use the path_provider_aurora plugin.
Icon=com.example.path_provider_aurora_example
Exec=/usr/bin/com.example.path_provider_aurora_example
X-Nemo-Application-Type=silica-qt5
[X-Application]
Permissions=
OrganizationName=com.example
ApplicationName=path_provider_aurora_example

14
packages/path_provider/path_provider_aurora/example/aurora/flutter/generated_plugin_registrant.cpp

@ -0,0 +1,14 @@
//
// Generated file. Do not edit.
//
// clang-format off
#include <flutter/application.h>
#include "generated_plugin_registrant.h"
void RegisterPlugins() {
Application::RegisterPlugins({
});
}

12
packages/path_provider/path_provider_aurora/example/aurora/flutter/generated_plugin_registrant.h

@ -0,0 +1,12 @@
//
// Generated file. Do not edit.
//
// clang-format off
#ifndef GENERATED_PLUGIN_REGISTRANT
#define GENERATED_PLUGIN_REGISTRANT
void RegisterPlugins();
#endif /* GENERATED_PLUGIN_REGISTRANT */

31
packages/path_provider/path_provider_aurora/example/aurora/flutter/generated_plugins.cmake

@ -0,0 +1,31 @@
#
# Generated file, do not edit.
#
set(ROOT_PROJECT_BINARY_DIR "${PROJECT_BINARY_DIR}")
function(add_library TARGET)
_add_library(${TARGET} ${ARGN})
if(NOT "${TARGET}" MATCHES "^PkgConfig::.*")
add_custom_command(TARGET ${TARGET} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"$<TARGET_FILE:${TARGET}>"
"${ROOT_PROJECT_BINARY_DIR}/bundle/lib/$<TARGET_FILE_NAME:${TARGET}>")
endif(NOT "${TARGET}" MATCHES "^PkgConfig::.*")
endfunction()
list(APPEND FLUTTER_PLATFORM_PLUGIN_LIST
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST
xdga_directories
)
foreach(PLUGIN ${FLUTTER_PLATFORM_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${PLUGIN}/aurora plugins/${PLUGIN})
target_link_libraries(${BINARY_NAME} PRIVATE ${PLUGIN}_platform_plugin)
endforeach(PLUGIN)
foreach(FFI_PLUGIN ${FLUTTER_FFI_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${FFI_PLUGIN}/aurora plugins/${FFI_PLUGIN})
endforeach(FFI_PLUGIN)

BIN
packages/path_provider/path_provider_aurora/example/aurora/icons/108x108.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

BIN
packages/path_provider/path_provider_aurora/example/aurora/icons/128x128.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
packages/path_provider/path_provider_aurora/example/aurora/icons/172x172.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
packages/path_provider/path_provider_aurora/example/aurora/icons/86x86.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

10
packages/path_provider/path_provider_aurora/example/aurora/main.cpp

@ -0,0 +1,10 @@
#include <flutter/application.h>
#include "generated_plugin_registrant.h"
int main(int argc, char *argv[]) {
Application::Initialize(argc, argv);
Application::SetPixelRatio(1.8);
RegisterPlugins();
Application::Launch();
return 0;
}

31
packages/path_provider/path_provider_aurora/example/aurora/rpm/com.example.path_provider_aurora_example.spec

@ -0,0 +1,31 @@
%global __provides_exclude_from ^%{_datadir}/%{name}/lib/.*$
%global __requires_exclude ^lib(dconf|flutter-embedder|maliit-glib|.+_platform_plugin)\\.so.*$
Name: com.example.path_provider_aurora_example
Summary: Demonstrates how to use the path_provider_aurora plugin.
Version: 0.1.0
Release: 1
License: Proprietary
Source0: %{name}-%{version}.tar.bz2
BuildRequires: cmake
BuildRequires: pkgconfig(flutter-embedder)
%description
%{summary}.
%prep
%autosetup
%build
%cmake -DCMAKE_BUILD_TYPE=%{_flutter_build_type}
%make_build
%install
%make_install
%files
%{_bindir}/%{name}
%{_datadir}/%{name}/*
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.png

72
packages/path_provider/path_provider_aurora/example/lib/main.dart

@ -0,0 +1,72 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:path_provider/path_provider.dart';
import 'package:path_provider_aurora/path_provider_aurora.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
Future<Directory?>? _tempDirectory;
@override
void initState() {
super.initState();
// @todo it's work
// PathProviderAurora.registerWith();
}
void _requestTempDirectory() {
setState(() {
_tempDirectory = getTemporaryDirectory();
});
}
Widget _buildDirectory(
BuildContext context, AsyncSnapshot<Directory?> snapshot) {
Text text = const Text('');
if (snapshot.connectionState == ConnectionState.done) {
if (snapshot.hasError) {
text = Text('Error: ${snapshot.error}');
} else if (snapshot.hasData) {
text = Text('path: ${snapshot.data!.path}');
} else {
text = const Text('path unavailable');
}
}
return Padding(padding: const EdgeInsets.all(16.0), child: text);
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Column(
children: [
FutureBuilder<Directory?>(
future: _tempDirectory,
builder: _buildDirectory,
),
ElevatedButton(
onPressed: _requestTempDirectory,
child: const Text(
'Get Temporary Directory',
),
),
],
)),
);
}
}

268
packages/path_provider/path_provider_aurora/example/pubspec.lock

@ -0,0 +1,268 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.9.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.16.0"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
ffi:
dependency: transitive
description:
name: ffi
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.1"
file:
dependency: transitive
description:
name: file
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.4"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
lints:
dependency: transitive
description:
name: lints
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.12"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.5"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.2"
path_provider:
dependency: "direct main"
description:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.14"
path_provider_android:
dependency: transitive
description:
name: path_provider_android
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.24"
path_provider_aurora:
dependency: "direct main"
description:
path: ".."
relative: true
source: path
version: "0.0.1"
path_provider_foundation:
dependency: transitive
description:
name: path_provider_foundation
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.2"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.10"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.6"
path_provider_windows:
dependency: transitive
description:
name: path_provider_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.7"
platform:
dependency: transitive
description:
name: platform
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.4"
process:
dependency: transitive
description:
name: process
url: "https://pub.dartlang.org"
source: hosted
version: "4.2.4"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
source_span:
dependency: transitive
description:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.1"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.12"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.2"
win32:
dependency: transitive
description:
name: win32
url: "https://pub.dartlang.org"
source: hosted
version: "2.6.1"
xdg_directories:
dependency: transitive
description:
name: xdg_directories
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
xdga_directories:
dependency: transitive
description:
path: "packages/xdga_directories"
ref: xdga_directories
resolved-ref: fb19ee472cac234c924a2f222ecc66a03a808ce2
url: "git@os-git.omprussia.ru:non-oss/flutter/flutter-plugins.git"
source: git
version: "0.0.1"
sdks:
dart: ">=2.18.6 <3.0.0"
flutter: ">=3.3.0"

23
packages/path_provider/path_provider_aurora/example/pubspec.yaml

@ -0,0 +1,23 @@
name: path_provider_aurora_example
description: Demonstrates how to use the path_provider_aurora plugin.
publish_to: 'none'
environment:
sdk: '>=2.18.6 <3.0.0'
dependencies:
flutter:
sdk: flutter
path_provider: ^2.0.7
path_provider_aurora:
path: ../
cupertino_icons: ^1.0.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0
flutter:
uses-material-design: true

27
packages/path_provider/path_provider_aurora/example/test/widget_test.dart

@ -0,0 +1,27 @@
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:path_provider_aurora_example/main.dart';
void main() {
testWidgets('Verify Platform version', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MyApp());
// Verify that platform version is retrieved.
expect(
find.byWidgetPredicate(
(Widget widget) => widget is Text &&
widget.data!.startsWith('Running on:'),
),
findsOneWidget,
);
});
}

17
packages/path_provider/path_provider_aurora/lib/path_provider_aurora.dart

@ -0,0 +1,17 @@
import 'package:path_provider_platform_interface/path_provider_platform_interface.dart';
import 'package:xdga_directories/xdga_directories.dart' as xdga_directories;
/// The aurora implementation of [PathProviderPlatform]
///
/// This class implements the `package:path_provider` functionality for Aurora.
class PathProviderAurora extends PathProviderPlatform {
/// Registers this class as the default instance of [PathProviderPlatform]
// @todo it's not call dartPluginClass
static void registerWith() {
PathProviderPlatform.instance = PathProviderAurora();
}
@override
Future<String> getTemporaryPath() async =>
xdga_directories.getCacheLocation();
}

34
packages/path_provider/path_provider_aurora/pubspec.yaml

@ -0,0 +1,34 @@
name: path_provider_aurora
description: The Aurora OS implementation of path_provider.
version: 0.0.1
homepage: https://os-git.omprussia.ru/non-oss/flutter/flutter-plugins/packages/xdga_directories
environment:
sdk: '>=2.18.6 <3.0.0'
flutter: ">=2.5.0"
flutter:
plugin:
implements: path_provider
platforms:
aurora:
dartPluginClass: PathProviderAurora
dependencies:
flutter:
sdk: flutter
path_provider_platform_interface: ^2.0.6
xdga_directories:
## @todo
## Publishable packages can't have 'git' dependencies
git:
url: git@os-git.omprussia.ru:non-oss/flutter/flutter-plugins.git
ref: xdga_directories
path: packages/xdga_directories
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0

24
packages/path_provider/path_provider_aurora/test/path_provider_aurora_method_channel_test.dart

@ -0,0 +1,24 @@
// import 'package:flutter/services.dart';
// import 'package:flutter_test/flutter_test.dart';
// import 'package:path_provider_aurora/path_provider_aurora_method_channel.dart';
//
// void main() {
// MethodChannelPathProviderAurora platform = MethodChannelPathProviderAurora();
// const MethodChannel channel = MethodChannel('path_provider_aurora');
//
// TestWidgetsFlutterBinding.ensureInitialized();
//
// setUp(() {
// channel.setMockMethodCallHandler((MethodCall methodCall) async {
// return '42';
// });
// });
//
// tearDown(() {
// channel.setMockMethodCallHandler(null);
// });
//
// test('getPlatformVersion', () async {
// expect(await platform.getPlatformVersion(), '42');
// });
// }

21
packages/path_provider/path_provider_aurora/test/path_provider_aurora_test.dart

@ -0,0 +1,21 @@
// import 'package:flutter_test/flutter_test.dart';
// import 'package:path_provider_aurora/path_provider_aurora.dart';
// import 'package:path_provider_aurora/path_provider_aurora_platform_interface.dart';
// import 'package:path_provider_aurora/path_provider_aurora_method_channel.dart';
// import 'package:plugin_platform_interface/plugin_platform_interface.dart';
//
// class MockPathProviderAuroraPlatform
// with MockPlatformInterfaceMixin
// implements PathProviderAuroraPlatform {
//
// @override
// Future<String?> getPlatformVersion() => Future.value('42');
// }
//
// void main() {
// final PathProviderAuroraPlatform initialPlatform = PathProviderAuroraPlatform.instance;
//
// test('$MethodChannelPathProviderAurora is the default instance', () {
// expect(initialPlatform, isInstanceOf<MethodChannelPathProviderAurora>());
// });
// }

2
packages/xdga_directories/example/lib/main.dart

@ -44,7 +44,7 @@ class _MyAppState extends State<MyApp> {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Native Packages'),
title: const Text('Directories Example'),
),
body: SingleChildScrollView(
child: Container(

2
script/build_example.sh

@ -32,7 +32,7 @@ if [ -z "$package" ]; then
exit
else
cd "../packages/$package" 2>/dev/null || eval 'echo "Package \"$package\" not found." && exit'
$FLATTER pub run ffigen --config ffigen.yaml
$FLATTER pub run ffigen --config ffigen.yaml 2>/dev/null
cd "example" || exit
$FLATTER build aurora --release
fi

Loading…
Cancel
Save