Skip to content

Commit 43902a3

Browse files
committed
Clipboard incredible
1 parent ecc858e commit 43902a3

File tree

141 files changed

+1344
-212
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+1344
-212
lines changed

CODE_OF_CONDUCT.md

100644100755
File mode changed.

CONTRIBUTING.md

100644100755
File mode changed.

LICENSE

100644100755
File mode changed.

README.md

100644100755
File mode changed.

analysis_options.yaml

100644100755
File mode changed.

android/.gitignore

100644100755
File mode changed.

android/app/build.gradle

100644100755
File mode changed.

android/app/src/debug/AndroidManifest.xml

100644100755
File mode changed.

android/app/src/main/AndroidManifest.xml

100644100755
File mode changed.

android/app/src/main/kotlin/com/example/files/MainActivity.kt

100644100755
File mode changed.

android/app/src/main/res/drawable-v21/launch_background.xml

100644100755
File mode changed.

android/app/src/main/res/drawable/launch_background.xml

100644100755
File mode changed.

android/app/src/main/res/mipmap-hdpi/ic_launcher.png

100644100755
File mode changed.

android/app/src/main/res/mipmap-mdpi/ic_launcher.png

100644100755
File mode changed.

android/app/src/main/res/mipmap-xhdpi/ic_launcher.png

100644100755
File mode changed.

android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png

100644100755
File mode changed.

android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png

100644100755
File mode changed.

android/app/src/main/res/values-night/styles.xml

100644100755
File mode changed.

android/app/src/main/res/values/styles.xml

100644100755
File mode changed.

android/app/src/profile/AndroidManifest.xml

100644100755
File mode changed.

android/build.gradle

100644100755
File mode changed.

android/gradle.properties

100644100755
File mode changed.

android/gradle/wrapper/gradle-wrapper.properties

100644100755
File mode changed.

android/settings.gradle

100644100755
File mode changed.

clipboard_viewer/.gitignore

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
6+
.DS_Store
7+
.atom/
8+
.buildlog/
9+
.history
10+
.svn/
11+
migrate_working_dir/
12+
13+
# IntelliJ related
14+
*.iml
15+
*.ipr
16+
*.iws
17+
.idea/
18+
19+
# The .vscode folder contains launch configuration and tasks you configure in
20+
# VS Code which you may wish to be included in version control, so this line
21+
# is commented out by default.
22+
#.vscode/
23+
24+
# Flutter/Dart/Pub related
25+
**/doc/api/
26+
**/ios/Flutter/.last_build_id
27+
.dart_tool/
28+
.flutter-plugins
29+
.flutter-plugins-dependencies
30+
.packages
31+
.pub-cache/
32+
.pub/
33+
/build/
34+
35+
# Symbolication related
36+
app.*.symbols
37+
38+
# Obfuscation related
39+
app.*.map.json
40+
41+
# Android Studio will place build artifacts here
42+
/android/app/debug
43+
/android/app/profile
44+
/android/app/release

clipboard_viewer/.metadata

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This file tracks properties of this Flutter project.
2+
# Used by Flutter tool to assess capabilities and perform upgrades etc.
3+
#
4+
# This file should be version controlled.
5+
6+
version:
7+
revision: f9ad42a32d7e116f321569ec118416f981806151
8+
channel: master
9+
10+
project_type: app
11+
12+
# Tracks metadata for the flutter migrate command
13+
migration:
14+
platforms:
15+
- platform: root
16+
create_revision: f9ad42a32d7e116f321569ec118416f981806151
17+
base_revision: f9ad42a32d7e116f321569ec118416f981806151
18+
- platform: linux
19+
create_revision: f9ad42a32d7e116f321569ec118416f981806151
20+
base_revision: f9ad42a32d7e116f321569ec118416f981806151
21+
22+
# User provided section
23+
24+
# List of Local paths (relative to this file) that should be
25+
# ignored by the migrate tool.
26+
#
27+
# Files that are not part of the templates will be ignored by default.
28+
unmanaged_files:
29+
- 'lib/main.dart'
30+
- 'ios/Runner.xcodeproj/project.pbxproj'

clipboard_viewer/.vscode/launch.json

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "clipboard_viewer",
9+
"request": "launch",
10+
"type": "dart",
11+
"args": ["--enable-experiment=records"]
12+
},
13+
{
14+
"name": "clipboard_viewer (profile mode)",
15+
"request": "launch",
16+
"type": "dart",
17+
"flutterMode": "profile"
18+
},
19+
{
20+
"name": "clipboard_viewer (release mode)",
21+
"request": "launch",
22+
"type": "dart",
23+
"flutterMode": "release"
24+
}
25+
]
26+
}

clipboard_viewer/README.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# clipboard_viewer
2+
3+
A new Flutter project.
4+
5+
## Getting Started
6+
7+
This project is a starting point for a Flutter application.
8+
9+
A few resources to get you started if this is your first Flutter project:
10+
11+
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
12+
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
13+
14+
For help getting started with Flutter development, view the
15+
[online documentation](https://docs.flutter.dev/), which offers tutorials,
16+
samples, guidance on mobile development, and a full API reference.
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
include: package:flutter_lints/flutter.yaml
2+
3+
analyzer:
4+
enable-experiment:
5+
- records
6+
7+
linter:
8+
rules:

clipboard_viewer/lib/main.dart

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:pasteboard/pasteboard.dart';
3+
import 'package:super_clipboard/super_clipboard.dart';
4+
// ignore: implementation_imports
5+
import 'package:super_clipboard/src/format_conversions.dart';
6+
7+
void main() {
8+
runApp(const MyApp());
9+
}
10+
11+
class MyApp extends StatelessWidget {
12+
const MyApp({super.key});
13+
14+
@override
15+
Widget build(BuildContext context) {
16+
return MaterialApp(
17+
title: 'Flutter Demo',
18+
theme: ThemeData(
19+
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
20+
useMaterial3: true,
21+
),
22+
home: const MyHomePage(title: 'Flutter Demo Home Page'),
23+
);
24+
}
25+
}
26+
27+
class MyHomePage extends StatefulWidget {
28+
const MyHomePage({super.key, required this.title});
29+
30+
final String title;
31+
32+
@override
33+
State<MyHomePage> createState() => _MyHomePageState();
34+
}
35+
36+
class _MyHomePageState extends State<MyHomePage> {
37+
final List<(ClipboardDataReader, Object?)> items = [];
38+
39+
@override
40+
Widget build(BuildContext context) {
41+
return Scaffold(
42+
appBar: AppBar(
43+
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
44+
title: Text(widget.title),
45+
),
46+
body: ListView.builder(
47+
itemCount: items.length,
48+
itemBuilder: (context, index) {
49+
final item = items[index];
50+
final rawReader = item.$1.rawReader;
51+
52+
return ListTile(
53+
title: SelectableText(item.$2.toString()),
54+
subtitle: SelectableText(
55+
item.$1.platformFormats.map((e) => "'$e'").join(", ")),
56+
);
57+
},
58+
),
59+
floatingActionButton: FloatingActionButton(
60+
onPressed: () async {
61+
await Pasteboard.writeFiles(["/home/davide"]);
62+
return;
63+
final data = await ClipboardReader.readClipboard();
64+
final value = await data.readValue(linuxFileUri);
65+
66+
setState(() {
67+
items.add((data, value));
68+
});
69+
},
70+
tooltip: 'Increment',
71+
child: const Icon(Icons.add),
72+
),
73+
);
74+
}
75+
}
76+
77+
final linuxFileUri = SimpleValueFormat(
78+
android: Formats.fileUri.android,
79+
ios: Formats.fileUri.ios,
80+
linux: const SimplePlatformCodec(
81+
formats: ['application/vnd.portal.files'],
82+
decodingFormats: ['application/vnd.portal.files'],
83+
encodingFormats: ['application/vnd.portal.files'],
84+
onDecode: fileUriFromString,
85+
onEncode: fileUriToString,
86+
),
87+
macos: Formats.fileUri.macos,
88+
windows: Formats.fileUri.windows,
89+
web: Formats.fileUri.web,
90+
fallback: Formats.fileUri.fallback,
91+
);

clipboard_viewer/linux/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
flutter/ephemeral

clipboard_viewer/linux/CMakeLists.txt

+139
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# Project-level configuration.
2+
cmake_minimum_required(VERSION 3.10)
3+
project(runner LANGUAGES CXX)
4+
5+
# The name of the executable created for the application. Change this to change
6+
# the on-disk name of your application.
7+
set(BINARY_NAME "clipboard_viewer")
8+
# The unique GTK application identifier for this application. See:
9+
# https://wiki.gnome.org/HowDoI/ChooseApplicationID
10+
set(APPLICATION_ID "io.hrx.clipboard_viewer")
11+
12+
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
13+
# versions of CMake.
14+
cmake_policy(SET CMP0063 NEW)
15+
16+
# Load bundled libraries from the lib/ directory relative to the binary.
17+
set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
18+
19+
# Root filesystem for cross-building.
20+
if(FLUTTER_TARGET_PLATFORM_SYSROOT)
21+
set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT})
22+
set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT})
23+
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
24+
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
25+
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
26+
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
27+
endif()
28+
29+
# Define build configuration options.
30+
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
31+
set(CMAKE_BUILD_TYPE "Debug" CACHE
32+
STRING "Flutter build mode" FORCE)
33+
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
34+
"Debug" "Profile" "Release")
35+
endif()
36+
37+
# Compilation settings that should be applied to most targets.
38+
#
39+
# Be cautious about adding new options here, as plugins use this function by
40+
# default. In most cases, you should add new options to specific targets instead
41+
# of modifying this function.
42+
function(APPLY_STANDARD_SETTINGS TARGET)
43+
target_compile_features(${TARGET} PUBLIC cxx_std_14)
44+
target_compile_options(${TARGET} PRIVATE -Wall -Werror)
45+
target_compile_options(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O3>")
46+
target_compile_definitions(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:NDEBUG>")
47+
endfunction()
48+
49+
# Flutter library and tool build rules.
50+
set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
51+
add_subdirectory(${FLUTTER_MANAGED_DIR})
52+
53+
# System-level dependencies.
54+
find_package(PkgConfig REQUIRED)
55+
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
56+
57+
add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
58+
59+
# Define the application target. To change its name, change BINARY_NAME above,
60+
# not the value here, or `flutter run` will no longer work.
61+
#
62+
# Any new source files that you add to the application should be added here.
63+
add_executable(${BINARY_NAME}
64+
"main.cc"
65+
"my_application.cc"
66+
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
67+
)
68+
69+
# Apply the standard set of build settings. This can be removed for applications
70+
# that need different build settings.
71+
apply_standard_settings(${BINARY_NAME})
72+
73+
# Add dependency libraries. Add any application-specific dependencies here.
74+
target_link_libraries(${BINARY_NAME} PRIVATE flutter)
75+
target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
76+
77+
# Run the Flutter tool portions of the build. This must not be removed.
78+
add_dependencies(${BINARY_NAME} flutter_assemble)
79+
80+
# Only the install-generated bundle's copy of the executable will launch
81+
# correctly, since the resources must in the right relative locations. To avoid
82+
# people trying to run the unbundled copy, put it in a subdirectory instead of
83+
# the default top-level location.
84+
set_target_properties(${BINARY_NAME}
85+
PROPERTIES
86+
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run"
87+
)
88+
89+
90+
# Generated plugin build rules, which manage building the plugins and adding
91+
# them to the application.
92+
include(flutter/generated_plugins.cmake)
93+
94+
95+
# === Installation ===
96+
# By default, "installing" just makes a relocatable bundle in the build
97+
# directory.
98+
set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
99+
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
100+
set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
101+
endif()
102+
103+
# Start with a clean build bundle directory every time.
104+
install(CODE "
105+
file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\")
106+
" COMPONENT Runtime)
107+
108+
set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
109+
set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
110+
111+
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
112+
COMPONENT Runtime)
113+
114+
install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
115+
COMPONENT Runtime)
116+
117+
install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
118+
COMPONENT Runtime)
119+
120+
foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES})
121+
install(FILES "${bundled_library}"
122+
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
123+
COMPONENT Runtime)
124+
endforeach(bundled_library)
125+
126+
# Fully re-copy the assets directory on each build to avoid having stale files
127+
# from a previous install.
128+
set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
129+
install(CODE "
130+
file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
131+
" COMPONENT Runtime)
132+
install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
133+
DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
134+
135+
# Install the AOT library on non-Debug builds only.
136+
if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
137+
install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
138+
COMPONENT Runtime)
139+
endif()

0 commit comments

Comments
 (0)