Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
ChatGPT
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
关振斌
ChatGPT
Commits
1d049ed6
Commit
1d049ed6
authored
May 19, 2023
by
netyouli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加分享功能
parent
b99145b8
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
107 additions
and
9 deletions
+107
-9
.vscode/launch.json
.vscode/launch.json
+5
-0
assets/images/wx_favorite.png
assets/images/wx_favorite.png
+0
-0
assets/images/wx_other.png
assets/images/wx_other.png
+0
-0
assets/images/wx_session.png
assets/images/wx_session.png
+0
-0
assets/images/wx_timeline.png
assets/images/wx_timeline.png
+0
-0
ios/Runner/AppDelegate.swift
ios/Runner/AppDelegate.swift
+24
-1
ios/Runner/Info.plist
ios/Runner/Info.plist
+7
-5
ios/Runner/Runner-Bridging-Header.h
ios/Runner/Runner-Bridging-Header.h
+1
-0
lib/common/widgets/wx_share.dart
lib/common/widgets/wx_share.dart
+61
-0
lib/main.dart
lib/main.dart
+6
-0
lib/pages/home/controller.dart
lib/pages/home/controller.dart
+3
-3
No files found.
.vscode/launch.json
View file @
1d049ed6
...
...
@@ -4,6 +4,11 @@
//
欲了解更多信息,请访问:
https://go.microsoft.com/fwlink/?linkid=
830387
"version"
:
"0.2.0"
,
"configurations"
:
[
{
"name"
:
"Flutter: Attach to Device"
,
"type"
:
"dart"
,
"request"
:
"attach"
},
{
"name"
:
"chart"
,
"request"
:
"launch"
,
...
...
assets/images/wx_favorite.png
0 → 100644
View file @
1d049ed6
6.8 KB
assets/images/wx_other.png
0 → 100644
View file @
1d049ed6
5.98 KB
assets/images/wx_session.png
0 → 100644
View file @
1d049ed6
8.92 KB
assets/images/wx_timeline.png
0 → 100644
View file @
1d049ed6
10.6 KB
ios/Runner/AppDelegate.swift
View file @
1d049ed6
...
...
@@ -2,12 +2,35 @@ import UIKit
import
Flutter
@UIApplicationMain
@objc
class
AppDelegate
:
FlutterAppDelegate
{
@objc
class
AppDelegate
:
FlutterAppDelegate
,
WXApiDelegate
{
override
func
application
(
_
application
:
UIApplication
,
didFinishLaunchingWithOptions
launchOptions
:
[
UIApplication
.
LaunchOptionsKey
:
Any
]?
)
->
Bool
{
let
ksj
=
WXApi
.
registerApp
(
"wxac6457d4b052cc48"
,
universalLink
:
"https://order.1clickpass.com/app/"
)
GeneratedPluginRegistrant
.
register
(
with
:
self
)
return
super
.
application
(
application
,
didFinishLaunchingWithOptions
:
launchOptions
)
}
override
func
application
(
_
application
:
UIApplication
,
handleOpen
url
:
URL
)
->
Bool
{
return
WXApi
.
handleOpen
(
url
,
delegate
:
self
)
}
override
func
application
(
_
application
:
UIApplication
,
open
url
:
URL
,
sourceApplication
:
String
?,
annotation
:
Any
)
->
Bool
{
return
WXApi
.
handleOpen
(
url
,
delegate
:
self
)
}
override
func
application
(
_
application
:
UIApplication
,
continue
userActivity
:
NSUserActivity
,
restorationHandler
:
@escaping
([
UIUserActivityRestoring
]?)
->
Void
)
->
Bool
{
WXApi
.
handleOpenUniversalLink
(
userActivity
,
delegate
:
self
)
}
func
onReq
(
_
req
:
BaseReq
)
{
}
func
onResp
(
_
resp
:
BaseResp
)
{
}
}
ios/Runner/Info.plist
View file @
1d049ed6
...
...
@@ -32,9 +32,11 @@
<key>
CFBundleTypeRole
</key>
<string>
Editor
</string>
<key>
CFBundleURLName
</key>
<string>
w
xac6457d4b052cc48
</string>
<string>
w
eixin
</string>
<key>
CFBundleURLSchemes
</key>
<array/>
<array>
<string>
wxac6457d4b052cc48
</string>
</array>
</dict>
</array>
<key>
CFBundleVersion
</key>
...
...
@@ -49,9 +51,9 @@
<true/>
<key>
NSAppTransportSecurity
</key>
<dict>
<key>
NSAllowsArbitraryLoads
</key>
<true/>
</dict>
<key>
NSAllowsArbitraryLoads
</key>
<true/>
</dict>
<key>
NSMicrophoneUsageDescription
</key>
<string>
只有您‘允许使用麦克风’AI写作大师才能听您说话
</string>
<key>
NSPhotoLibraryUsageDescription
</key>
...
...
ios/Runner/Runner-Bridging-Header.h
View file @
1d049ed6
#import "GeneratedPluginRegistrant.h"
#import <WXApi.h>
lib/common/widgets/wx_share.dart
0 → 100644
View file @
1d049ed6
import
'package:flutter/material.dart'
;
import
'package:fluwx/fluwx.dart'
;
import
'package:get/get.dart'
;
import
'package:share_plus/share_plus.dart'
;
class
WXShare
{
static
const
_dataMap
=
{
"微信好友"
:
"assets/images/wx_session.png"
,
"微信朋友圈"
:
"assets/images/wx_timeline.png"
,
"微信收藏"
:
"assets/images/wx_favorite.png"
,
"其他分享"
:
"assets/images/wx_other.png"
};
static
shareText
(
String
content
)
{
final
items
=
<
Widget
>[];
_dataMap
.
forEach
((
title
,
image
)
{
items
.
add
(
InkWell
(
onTap:
()
{
if
(
title
.
contains
(
"微信"
))
{
final
WeChatShareBaseModel
model
;
if
(
title
==
"微信好友"
)
{
model
=
WeChatShareTextModel
(
content
,
scene:
WeChatScene
.
SESSION
);
}
else
if
(
title
==
"微信朋友圈"
)
{
model
=
WeChatShareTextModel
(
content
,
scene:
WeChatScene
.
TIMELINE
);
}
else
{
model
=
WeChatShareTextModel
(
content
,
scene:
WeChatScene
.
FAVORITE
);
}
shareToWeChat
(
model
);
}
else
{
Share
.
shareWithResult
(
content
);
}
Get
.
back
();
},
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
<
Widget
>[
Image
.
asset
(
image
,
width:
60
,
height:
60
,),
const
SizedBox
(
height:
8
),
Text
(
title
,
style:
const
TextStyle
(
fontSize:
14
,
color:
Colors
.
black
)),
],
),
)
);
});
Get
.
bottomSheet
(
Container
(
decoration:
const
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
20
))
),
padding:
const
EdgeInsets
.
fromLTRB
(
20
,
20
,
20
,
100
),
child:
Wrap
(
spacing:
30
,
children:
items
,
),
));
}
}
\ No newline at end of file
lib/main.dart
View file @
1d049ed6
...
...
@@ -17,6 +17,7 @@ import 'package:get/get.dart';
import
'package:glassy/glassy.dart'
;
import
'package:glassy/glassy_config.dart'
;
import
'package:pull_to_refresh/pull_to_refresh.dart'
;
import
'package:fluwx/fluwx.dart'
;
void
main
(
)
async
{
// WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
...
...
@@ -35,6 +36,11 @@ void main() async {
const
SystemUiOverlayStyle
(
systemNavigationBarColor:
Colors
.
black
);
SystemChrome
.
setSystemUIOverlayStyle
(
systemUiOverlayStyle
);
}
registerWxApi
(
appId:
"wxac6457d4b052cc48"
,
doOnAndroid:
true
,
doOnIOS:
true
,
universalLink:
"https://order.1clickpass.com/app/"
);
}
class
ChatApp
extends
StatelessWidget
{
...
...
lib/pages/home/controller.dart
View file @
1d049ed6
...
...
@@ -23,11 +23,13 @@ import 'package:highlight/languages/awk.dart';
import
'package:share_plus/share_plus.dart'
;
import
'package:uuid/uuid.dart'
;
import
'package:flutter_chat_types/flutter_chat_types.dart'
as
types
;
import
'../../common/widgets/wx_share.dart'
;
import
'index.dart'
;
import
'package:eventsource/eventsource.dart'
;
import
'dart:convert'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_client_sse/flutter_client_sse.dart'
;
import
'package:fluwx/fluwx.dart'
;
// EventSource eventSource = EventSource(Uri.parse('http://example.com/events'));
//
...
...
@@ -502,9 +504,7 @@ class HomeController extends GetxController with SingleGetTickerProviderMixin {
Icons
.
share
,
(
ChatMessage
message
,
CustomPopupMenuController
controller
)
async
{
if
(
message
.
text
.
isNotEmpty
)
{
await
Share
.
share
(
"
${message.text}
\n\n
"
,
);
WXShare
.
shareText
(
"
${message.text}
\n\n
"
);
controller
.
hideMenu
();
}
else
{
EasyLoading
.
showToast
(
"分享内容不能为空"
,
...
...
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