Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
fluttet_clipboard
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李增强
fluttet_clipboard
Commits
d93967e8
Commit
d93967e8
authored
Jul 16, 2021
by
汪林玲
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新android的粘贴板
parent
5b180631
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
101 additions
and
82 deletions
+101
-82
android/src/main/java/com/qiaomeng/flutter/fluttet_clipboard/FluttetClipboardPlugin.java
...eng/flutter/fluttet_clipboard/FluttetClipboardPlugin.java
+3
-3
example/ios/Flutter/Debug.xcconfig
example/ios/Flutter/Debug.xcconfig
+1
-0
example/ios/Flutter/Release.xcconfig
example/ios/Flutter/Release.xcconfig
+1
-0
example/ios/Podfile
example/ios/Podfile
+41
-0
example/lib/main.dart
example/lib/main.dart
+20
-7
lib/fluttet_clipboard.dart
lib/fluttet_clipboard.dart
+4
-6
pubspec.lock
pubspec.lock
+31
-66
No files found.
android/src/main/java/com/qiaomeng/flutter/fluttet_clipboard/FluttetClipboardPlugin.java
View file @
d93967e8
...
...
@@ -43,12 +43,12 @@ public class FluttetClipboardPlugin implements FlutterPlugin, MethodCallHandler
@Override
public
void
onMethodCall
(
@NonNull
MethodCall
call
,
@NonNull
Result
result
)
{
if
(
call
.
method
.
equals
(
"get
Text
"
))
{
if
(
call
.
method
.
equals
(
"get
Clipboard
"
))
{
result
.
success
(
handler
.
getText
());
}
else
if
(
call
.
method
.
equals
(
"set
Text
"
))
{
}
else
if
(
call
.
method
.
equals
(
"set
Clipboard
"
))
{
String
text
=
call
.
argument
(
"text"
);
handler
.
setText
(
text
);
result
.
notImplemented
(
);
result
.
success
(
true
);
}
else
{
result
.
notImplemented
();
}
...
...
example/ios/Flutter/Debug.xcconfig
View file @
d93967e8
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
example/ios/Flutter/Release.xcconfig
View file @
d93967e8
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
example/ios/Podfile
0 → 100644
View file @
d93967e8
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV
[
'COCOAPODS_DISABLE_STATS'
]
=
'true'
project
'Runner'
,
{
'Debug'
=>
:debug
,
'Profile'
=>
:release
,
'Release'
=>
:release
,
}
def
flutter_root
generated_xcode_build_settings_path
=
File
.
expand_path
(
File
.
join
(
'..'
,
'Flutter'
,
'Generated.xcconfig'
),
__FILE__
)
unless
File
.
exist?
(
generated_xcode_build_settings_path
)
raise
"
#{
generated_xcode_build_settings_path
}
must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File
.
foreach
(
generated_xcode_build_settings_path
)
do
|
line
|
matches
=
line
.
match
(
/FLUTTER_ROOT\=(.*)/
)
return
matches
[
1
].
strip
if
matches
end
raise
"FLUTTER_ROOT not found in
#{
generated_xcode_build_settings_path
}
. Try deleting Generated.xcconfig, then run flutter pub get"
end
require
File
.
expand_path
(
File
.
join
(
'packages'
,
'flutter_tools'
,
'bin'
,
'podhelper'
),
flutter_root
)
flutter_ios_podfile_setup
target
'Runner'
do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods
File
.
dirname
(
File
.
realpath
(
__FILE__
))
end
post_install
do
|
installer
|
installer
.
pods_project
.
targets
.
each
do
|
target
|
flutter_additional_ios_build_settings
(
target
)
end
end
example/lib/main.dart
View file @
d93967e8
import
'package:flutter/material.dart'
;
import
'dart:async'
;
import
'package:flutter/services.dart'
;
import
'package:fluttet_clipboard/fluttet_clipboard.dart'
;
void
main
(
)
{
...
...
@@ -14,7 +11,6 @@ class MyApp extends StatefulWidget {
}
class
_MyAppState
extends
State
<
MyApp
>
{
String
_platformVersion
=
'Unknown'
;
@override
void
initState
()
{
...
...
@@ -28,9 +24,26 @@ class _MyAppState extends State<MyApp> {
appBar:
AppBar
(
title:
const
Text
(
'Plugin example app'
),
),
body:
Center
(
child:
Text
(
'Running on:
$_platformVersion
\n
'
),
),
body:
Column
(
children:
[
TextButton
(
onPressed:
(){
FluttetClipboard
.
getText
().
then
((
value
)
{
print
(
"获取粘贴板----------->
$value
"
);
});
},
child:
Text
(
'获取粘贴板'
)),
TextButton
(
onPressed:
(){
FluttetClipboard
.
setText
(
'设置粘贴板'
).
then
((
value
){
print
(
"设置粘贴板----------->
$value
"
);
});
},
child:
Text
(
'设置粘贴板'
)),
TextButton
(
onPressed:
(){
FluttetClipboard
.
setText
(
null
).
then
((
value
){
print
(
"清空粘贴板----------->
$value
"
);
});
},
child:
Text
(
'清空粘贴板'
))
],),
),
);
}
...
...
lib/fluttet_clipboard.dart
View file @
d93967e8
import
'dart:async'
;
import
'package:flutter/services.dart'
;
class
FluttetClipboard
{
static
const
MethodChannel
_channel
=
const
MethodChannel
(
'fluttet_clipboard'
);
static
const
MethodChannel
_channel
=
const
MethodChannel
(
'fluttet_clipboard'
);
static
Future
<
String
>
getText
()
async
{
String
text
=
await
_channel
.
invokeMethod
(
'get
Text
'
);
String
text
=
await
_channel
.
invokeMethod
(
'get
Clipboard
'
);
return
text
;
}
static
Future
<
void
>
setText
(
String
text
)
async
{
return
_channel
.
invokeMethod
(
'set
Text
'
,
{
'text'
:
text
});
static
Future
<
bool
>
setText
(
String
text
)
async
{
return
_channel
.
invokeMethod
(
'set
Clipboard
'
,
{
'text'
:
text
});
}
}
pubspec.lock
View file @
d93967e8
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
archive:
dependency: transitive
description:
name: archive
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.13"
args:
dependency: transitive
description:
name: args
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.6.0"
async:
dependency: transitive
description:
name: async
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.
4
.1"
version: "2.
5.0-nullsafety
.1"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.0"
version: "2.1.0-nullsafety.1"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0-nullsafety.3"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.
1.3
"
c
ollection
:
version: "1.
2.0-nullsafety.1
"
c
lock
:
dependency: transitive
description:
name: c
ollection
name: c
lock
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1
4.12
"
co
nvert
:
version: "1.1
.0-nullsafety.1
"
co
llection
:
dependency: transitive
description:
name: co
nvert
name: co
llection
url: "https://pub.flutter-io.cn"
source: hosted
version: "
2.1.1
"
crypto
:
version: "
1.15.0-nullsafety.3
"
fake_async
:
dependency: transitive
description:
name:
crypto
name:
fake_async
url: "https://pub.flutter-io.cn"
source: hosted
version: "
2.1.4
"
version: "
1.2.0-nullsafety.1
"
flutter:
dependency: "direct main"
description: flutter
...
...
@@ -67,48 +60,27 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
image:
dependency: transitive
description:
name: image
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.12"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.12.
6
"
version: "0.12.
10-nullsafety.1
"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.
1.8
"
version: "1.
3.0-nullsafety.3
"
path:
dependency: transitive
description:
name: path
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.6.4"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.4.0"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.3"
version: "1.8.0-nullsafety.1"
sky_engine:
dependency: transitive
description: flutter
...
...
@@ -120,63 +92,56 @@ packages:
name: source_span
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.
7.0
"
version: "1.
8.0-nullsafety.2
"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.
9.3
"
version: "1.
10.0-nullsafety.1
"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.
0.0
"
version: "2.
1.0-nullsafety.1
"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.
0.5
"
version: "1.
1.0-nullsafety.1
"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.
1.0
"
version: "1.
2.0-nullsafety.1
"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.1
5
"
version: "0.2.1
9-nullsafety.2
"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.
1.6
"
version: "1.
3.0-nullsafety.3
"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.8"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.6.1"
version: "2.1.0-nullsafety.3"
sdks:
dart: ">=2.
7.0 <3.0
.0"
dart: ">=2.
10.0-110 <2.11
.0"
flutter: ">=1.10.0"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment