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
0f4ec721
Commit
0f4ec721
authored
Apr 10, 2023
by
关振斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
24ec97a4
Changes
27
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
1287 additions
and
433 deletions
+1287
-433
ios/Podfile.lock
ios/Podfile.lock
+17
-1
ios/Runner/Info.plist
ios/Runner/Info.plist
+4
-0
lib/common/store/user.dart
lib/common/store/user.dart
+13
-3
lib/common/widgets/app.dart
lib/common/widgets/app.dart
+1
-1
lib/package/chat_dash/dash_chat_2.dart
lib/package/chat_dash/dash_chat_2.dart
+4
-2
lib/package/chat_dash/src/models/input_options.dart
lib/package/chat_dash/src/models/input_options.dart
+9
-0
lib/package/chat_dash/src/models/message_options.dart
lib/package/chat_dash/src/models/message_options.dart
+38
-30
lib/package/chat_dash/src/widgets/input_toolbar/input_toolbar.dart
...ge/chat_dash/src/widgets/input_toolbar/input_toolbar.dart
+83
-46
lib/package/chat_dash/src/widgets/message_row/default_message_text.dart
...at_dash/src/widgets/message_row/default_message_text.dart
+220
-108
lib/package/chat_dash/src/widgets/message_row/text_container.dart
...age/chat_dash/src/widgets/message_row/text_container.dart
+105
-55
lib/pages/application/controller.dart
lib/pages/application/controller.dart
+70
-8
lib/pages/application/state.dart
lib/pages/application/state.dart
+12
-0
lib/pages/application/view.dart
lib/pages/application/view.dart
+314
-21
lib/pages/creation-detail/controller.dart
lib/pages/creation-detail/controller.dart
+6
-0
lib/pages/creation-detail/widgets/hello.dart
lib/pages/creation-detail/widgets/hello.dart
+74
-20
lib/pages/eula/controller.dart
lib/pages/eula/controller.dart
+18
-0
lib/pages/eula/view.dart
lib/pages/eula/view.dart
+7
-3
lib/pages/frame/pay_list/widgets/helloword.dart
lib/pages/frame/pay_list/widgets/helloword.dart
+6
-6
lib/pages/frame/welcome/controller.dart
lib/pages/frame/welcome/controller.dart
+4
-1
lib/pages/home/controller.dart
lib/pages/home/controller.dart
+54
-17
lib/pages/home/state.dart
lib/pages/home/state.dart
+8
-0
lib/pages/home/view.dart
lib/pages/home/view.dart
+178
-100
lib/pages/my/view.dart
lib/pages/my/view.dart
+0
-3
lib/pages/privacy/controller.dart
lib/pages/privacy/controller.dart
+17
-0
lib/pages/privacy/view.dart
lib/pages/privacy/view.dart
+4
-3
pubspec.lock
pubspec.lock
+18
-4
pubspec.yaml
pubspec.yaml
+3
-1
No files found.
ios/Podfile.lock
View file @
0f4ec721
...
...
@@ -109,6 +109,8 @@ PODS:
- GTMSessionFetcher/Core (3.1.0)
- image_picker_ios (0.0.1):
- Flutter
- keyboard_utils (0.0.1):
- Flutter
- open_filex (0.0.2):
- Flutter
- OrderedSet (5.0.0)
...
...
@@ -131,11 +133,15 @@ PODS:
- Flutter
- smart_auth (0.0.1):
- Flutter
- speech_to_text (0.0.1):
- Flutter
- Try
- sqflite (0.0.2):
- Flutter
- FMDB (>= 2.7.5)
- SwiftyGif (5.4.4)
- Toast (4.0.0)
- Try (2.1.1)
- url_launcher_ios (0.0.1):
- Flutter
- vibration (1.7.5):
...
...
@@ -163,6 +169,7 @@ DEPENDENCIES:
- fluttercontactpicker (from `.symlinks/plugins/fluttercontactpicker/ios`)
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
- keyboard_utils (from `.symlinks/plugins/keyboard_utils/ios`)
- open_filex (from `.symlinks/plugins/open_filex/ios`)
- package_info (from `.symlinks/plugins/package_info/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`)
...
...
@@ -170,6 +177,7 @@ DEPENDENCIES:
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/ios`)
- sign_in_with_apple (from `.symlinks/plugins/sign_in_with_apple/ios`)
- smart_auth (from `.symlinks/plugins/smart_auth/ios`)
- speech_to_text (from `.symlinks/plugins/speech_to_text/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- vibration (from `.symlinks/plugins/vibration/ios`)
...
...
@@ -193,6 +201,7 @@ SPEC REPOS:
- SDWebImage
- SwiftyGif
- Toast
- Try
EXTERNAL SOURCES:
app_settings:
...
...
@@ -229,6 +238,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/fluttertoast/ios"
image_picker_ios:
:path: ".symlinks/plugins/image_picker_ios/ios"
keyboard_utils:
:path: ".symlinks/plugins/keyboard_utils/ios"
open_filex:
:path: ".symlinks/plugins/open_filex/ios"
package_info:
...
...
@@ -243,6 +254,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/sign_in_with_apple/ios"
smart_auth:
:path: ".symlinks/plugins/smart_auth/ios"
speech_to_text:
:path: ".symlinks/plugins/speech_to_text/ios"
sqflite:
:path: ".symlinks/plugins/sqflite/ios"
url_launcher_ios:
...
...
@@ -281,6 +294,7 @@ SPEC CHECKSUMS:
GoogleUtilities: 9aa0ad5a7bc171f8bae016300bfcfa3fb8425749
GTMSessionFetcher: c9e714f7eec91a55641e2bab9f45fd83a219b882
image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5
keyboard_utils: ab24bc711be9e91a5937c20489056b8dd650fecc
open_filex: 6e26e659846ec990262224a12ef1c528bb4edbe4
OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c
package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62
...
...
@@ -292,13 +306,15 @@ SPEC CHECKSUMS:
shared_preferences_foundation: 986fc17f3d3251412d18b0265f9c64113a8c2472
sign_in_with_apple: f3bf75217ea4c2c8b91823f225d70230119b8440
smart_auth: 4bedbc118723912d0e45a07e8ab34039c19e04f2
speech_to_text: b43a7d99aef037bd758ed8e45d79bbac035d2dfe
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
Try: 5ef669ae832617b3cee58cb2c6f99fb767a4ff96
url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
vibration: 7d883d141656a1c1a6d8d238616b2042a51a1241
video_player_avfoundation: 81e49bb3d9fb63dccf9fa0f6d877dc3ddbeac126
webview_flutter_wkwebview:
b7e70ef1ddded7e69c796c7390ee74180182971f
webview_flutter_wkwebview:
2e2d318f21a5e036e2c3f26171342e95908bd60a
PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
...
...
ios/Runner/Info.plist
View file @
0f4ec721
...
...
@@ -66,7 +66,11 @@
<string>
UIInterfaceOrientationLandscapeLeft
</string>
<string>
UIInterfaceOrientationLandscapeRight
</string>
</array>
<key>
NSMicrophoneUsageDescription
</key>
<string>
只有您‘允许使用麦克风’AI写作大师才能听您说话
</string>
<key>
UIViewControllerBasedStatusBarAppearance
</key>
<false/>
<key>
NSSpeechRecognitionUsageDescription
</key>
<string>
只有您‘允许使用麦克风’AI写作大师才能听您说话
</string>
</dict>
</plist>
lib/common/store/user.dart
View file @
0f4ec721
...
...
@@ -10,6 +10,7 @@ import 'package:chart/common/values/values.dart';
import
'package:chart/entity/login_entity.dart'
;
import
'package:chart/pages/application/index.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_easyloading/flutter_easyloading.dart'
;
import
'package:get/get.dart'
;
// import 'package:connectivity_plus/connectivity_plus.dart';
// import 'package:highlight/languages/rust.dart';
...
...
@@ -44,13 +45,22 @@ class UserStore extends GetxController {
super
.
onInit
();
subscription
=
Connectivity
()
.
onConnectivityChanged
.
listen
((
ConnectivityResult
result
)
{
.
listen
((
ConnectivityResult
result
)
async
{
print
(
"resultresultresultresult
$result
"
);
if
(
result
==
ConnectivityResult
.
none
||
result
==
ConnectivityResult
.
other
)
{
EasyLoading
.
show
(
status:
'网络连接异常,正在尝试重新连接!'
);
ApplicationController
.
to
.
state
.
isNetWorkErr
=
true
;
// Get.
// Get.offAndToNamed(AppRoutes.WILL_COME);
}
else
{
refreshInfo
();
ApplicationController
.
to
.
state
.
isNetWorkErr
=
false
;
EasyLoading
.
dismiss
();
await
refreshInfo
();
// Get.offAndToNamed(AppRoutes.Application);
// AppRoutes.WILL_COME
// asyncLoadBannerData();
// Get.back();
}
...
...
@@ -116,7 +126,7 @@ class UserStore extends GetxController {
_isLogin
.
value
=
true
;
}
await
MainController
.
to
.
asyncLoadBannerData
();
//
await MainController.to.asyncLoadBannerData();
}
}
...
...
lib/common/widgets/app.dart
View file @
0f4ec721
...
...
@@ -13,7 +13,7 @@ AppBar transparentAppBar({
// elevation: 2,
title:
title
,
elevation:
0
,
leadingWidth:
9
0
,
leadingWidth:
11
0
,
leading:
leading
??
null
,
actions:
actions
,
centerTitle:
true
,
...
...
lib/package/chat_dash/dash_chat_2.dart
View file @
0f4ec721
...
...
@@ -8,16 +8,18 @@ import 'package:flutter_easyloading/flutter_easyloading.dart';
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:flutter_tts/flutter_tts.dart'
;
import
'package:flutter_vibrate/flutter_vibrate.dart'
;
import
'package:gradient_widgets/gradient_widgets.dart'
;
import
'package:highlight/highlight.dart'
show
highlight
,
Node
;
import
'package:animated_text_kit/animated_text_kit.dart'
;
import
'package:chart/package/markdown/flutter_markdown.dart'
;
import
'package:flutter/gestures.dart'
;
import
'package:flutter/material.dart'
;
// import 'package:get/get.dart';
import
'package:flutter_parsed_text/flutter_parsed_text.dart'
;
import
'package:get/get_connect/http/src/utils/utils.dart'
;
import
'package:gradient_borders/input_borders/gradient_outline_input_border.dart'
;
import
'package:highlight/highlight.dart'
;
//
import 'package:highlight/highlight.dart';
import
'package:intl/intl.dart'
as
intl
;
import
'package:loading_animation_widget/loading_animation_widget.dart'
;
import
'package:share_plus/share_plus.dart'
;
...
...
lib/package/chat_dash/src/models/input_options.dart
View file @
0f4ec721
...
...
@@ -10,6 +10,7 @@ class InputOptions {
this
.
onMentionTriggers
=
const
<
String
>[
'@'
],
this
.
onTextChange
,
this
.
inputDisabled
=
false
,
this
.
isTextInput
=
true
,
this
.
inputDecoration
,
this
.
textCapitalization
=
TextCapitalization
.
none
,
this
.
alwaysShowSend
=
false
,
...
...
@@ -27,8 +28,13 @@ class InputOptions {
this
.
inputToolbarMargin
=
const
EdgeInsets
.
only
(
top:
8.0
),
this
.
cursorStyle
=
const
CursorStyle
(),
this
.
autocorrect
=
true
,
this
.
onLongPressStart
,
this
.
onLongPressEnd
,
});
final
void
Function
(
LongPressStartDetails
)?
onLongPressStart
;
final
void
Function
(
LongPressEndDetails
)?
onLongPressEnd
;
/// Function to call when a mention is triggered in the input,
/// ie: typing ' @'
/// You need to return a list of widget that will be shown inside the selection overlay,
...
...
@@ -65,6 +71,9 @@ class InputOptions {
/// To make the input disabled
final
bool
inputDisabled
;
///语音模式
final
bool
isTextInput
;
/// Input decoration to customize the design of the input
/// You can use defaultInputDecoration to only orride some variables
final
InputDecoration
?
inputDecoration
;
...
...
lib/package/chat_dash/src/models/message_options.dart
View file @
0f4ec721
...
...
@@ -2,36 +2,41 @@ part of dash_chat_2;
/// {@category Customization}
class
MessageOptions
{
const
MessageOptions
({
this
.
showCurrentUserAvatar
=
false
,
this
.
showOtherUsersAvatar
=
true
,
this
.
showOtherUsersName
=
true
,
this
.
userNameBuilder
,
this
.
avatarBuilder
,
this
.
onPressAvatar
,
this
.
onLongPressAvatar
,
this
.
onLongPressMessage
,
this
.
onPressMessage
,
this
.
onPressMention
,
this
.
currentUserContainerColor
,
this
.
currentUserTextColor
,
this
.
containerColor
,
this
.
textColor
,
this
.
messagePadding
,
this
.
maxWidth
,
this
.
messageDecorationBuilder
,
this
.
top
,
this
.
bottom
,
this
.
messageRowBuilder
,
this
.
messageTextBuilder
,
this
.
parsePatterns
,
this
.
textBeforeMedia
=
true
,
this
.
onTapMedia
,
this
.
showTime
=
false
,
this
.
timeFormat
,
this
.
messageTimeBuilder
,
this
.
messageMediaBuilder
,
});
const
MessageOptions
(
{
this
.
showCurrentUserAvatar
=
false
,
this
.
showOtherUsersAvatar
=
true
,
this
.
showOtherUsersName
=
true
,
this
.
userNameBuilder
,
this
.
avatarBuilder
,
this
.
onPressAvatar
,
this
.
onLongPressAvatar
,
this
.
onLongPressMessage
,
this
.
onPressMessage
,
this
.
onPressMention
,
this
.
currentUserContainerColor
,
this
.
currentUserTextColor
,
this
.
containerColor
,
this
.
textColor
,
this
.
messagePadding
,
this
.
maxWidth
,
this
.
messageDecorationBuilder
,
this
.
top
,
this
.
bottom
,
this
.
messageRowBuilder
,
this
.
messageTextBuilder
,
this
.
parsePatterns
,
this
.
textBeforeMedia
=
true
,
this
.
onTapMedia
,
this
.
showTime
=
false
,
this
.
timeFormat
,
this
.
messageTimeBuilder
,
this
.
messageMediaBuilder
,
this
.
onLongPressStart
,
this
.
onLongPressEnd
});
//长按
// onLongPressEnd
/// Format of the time if [showTime] is true
/// Default to: DateFormat('HH:mm')
...
...
@@ -75,6 +80,9 @@ class MessageOptions {
/// Function to call when the user press on a message mention
final
Function
(
Mention
)?
onPressMention
;
final
Function
(
LongPressStartDetails
details
)?
onLongPressStart
;
final
Function
(
LongPressStartDetails
details
)?
onLongPressEnd
;
/// Color of the current user chat bubbles
/// Default to primary color
final
Color
?
currentUserContainerColor
;
...
...
lib/package/chat_dash/src/widgets/input_toolbar/input_toolbar.dart
View file @
0f4ec721
...
...
@@ -91,52 +91,89 @@ class _InputToolbarState extends State<InputToolbar>
if
(
widget
.
inputOptions
.
leading
!=
null
)
...
widget
.
inputOptions
.
leading
!,
Expanded
(
child:
Directionality
(
textDirection:
widget
.
inputOptions
.
inputTextDirection
,
child:
TextField
(
focusNode:
focusNode
,
controller:
textController
,
enabled:
!
widget
.
inputOptions
.
inputDisabled
,
textCapitalization:
widget
.
inputOptions
.
textCapitalization
,
textInputAction:
widget
.
inputOptions
.
textInputAction
,
decoration:
widget
.
inputOptions
.
inputDecoration
??
defaultInputDecoration
(
_sendMessage
,
hintText:
widget
.
inputOptions
.
inputDisabled
?
'AI正在输入中...'
:
'请输入问题...'
,
!
widget
.
inputOptions
.
inputDisabled
,
),
maxLength:
widget
.
inputOptions
.
maxInputLength
,
minLines:
1
,
maxLines:
1
,
// maxLines: widget.inputOptions.sendOnEnter
// ? 1
// : widget.inputOptions.inputMaxLines,
cursorColor:
widget
.
inputOptions
.
cursorStyle
.
color
,
cursorWidth:
widget
.
inputOptions
.
cursorStyle
.
width
,
showCursor:
!
widget
.
inputOptions
.
cursorStyle
.
hide
,
style:
widget
.
inputOptions
.
inputTextStyle
,
onSubmitted:
(
String
value
)
{
if
(
widget
.
inputOptions
.
sendOnEnter
)
{
_sendMessage
();
}
},
onChanged:
(
String
value
)
async
{
setState
(()
{});
if
(
widget
.
inputOptions
.
onTextChange
!=
null
)
{
widget
.
inputOptions
.
onTextChange
!(
value
);
}
WidgetsBinding
.
instance
.
addPostFrameCallback
((
_
)
async
{
if
(
widget
.
inputOptions
.
onMention
!=
null
)
{
await
_checkMentions
(
value
);
}
});
},
autocorrect:
widget
.
inputOptions
.
autocorrect
,
),
),
),
child:
widget
.
inputOptions
.
isTextInput
?
Directionality
(
textDirection:
widget
.
inputOptions
.
inputTextDirection
,
child:
TextField
(
focusNode:
focusNode
,
controller:
textController
,
enabled:
!
widget
.
inputOptions
.
inputDisabled
,
textCapitalization:
widget
.
inputOptions
.
textCapitalization
,
textInputAction:
widget
.
inputOptions
.
textInputAction
,
decoration:
widget
.
inputOptions
.
inputDecoration
??
defaultInputDecoration
(
_sendMessage
,
hintText:
widget
.
inputOptions
.
inputDisabled
?
'AI正在输入中...'
:
'请输入问题...'
,
!
widget
.
inputOptions
.
inputDisabled
,
),
maxLength:
widget
.
inputOptions
.
maxInputLength
,
minLines:
1
,
maxLines:
1
,
// maxLines: widget.inputOptions.sendOnEnter
// ? 1
// : widget.inputOptions.inputMaxLines,
cursorColor:
widget
.
inputOptions
.
cursorStyle
.
color
,
cursorWidth:
widget
.
inputOptions
.
cursorStyle
.
width
,
showCursor:
!
widget
.
inputOptions
.
cursorStyle
.
hide
,
style:
widget
.
inputOptions
.
inputTextStyle
,
onSubmitted:
(
String
value
)
{
if
(
widget
.
inputOptions
.
sendOnEnter
)
{
_sendMessage
();
}
},
onChanged:
(
String
value
)
async
{
setState
(()
{});
if
(
widget
.
inputOptions
.
onTextChange
!=
null
)
{
widget
.
inputOptions
.
onTextChange
!(
value
);
}
WidgetsBinding
.
instance
.
addPostFrameCallback
((
_
)
async
{
if
(
widget
.
inputOptions
.
onMention
!=
null
)
{
await
_checkMentions
(
value
);
}
});
},
autocorrect:
widget
.
inputOptions
.
autocorrect
,
))
:
GestureDetector
(
onLongPressStart:
!
widget
.
inputOptions
.
inputDisabled
?
widget
.
inputOptions
.
onLongPressStart
:
null
,
// widget.inputOptions.onLongPressStart,
onLongPressEnd:
!
widget
.
inputOptions
.
inputDisabled
?
widget
.
inputOptions
.
onLongPressEnd
:
null
,
// onLongPressCancel: () {
// print("onLongPressCancel");
// },
child:
Container
(
padding:
EdgeInsets
.
all
(
16.5
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
10
),
gradient:
LinearGradient
(
colors:
!
widget
.
inputOptions
.
inputDisabled
?
[
Color
(
0xFFbe6afb
),
Color
(
0xFF9c67f6
),
Color
(
0xFF7965f8
)
]
:
[
Color
(
0xFFbe6afb
).
withOpacity
(.
7
),
Color
(
0xFF9c67f6
).
withOpacity
(.
7
),
Color
(
0xFF7965f8
).
withOpacity
(.
7
)
],
begin:
Alignment
.
topCenter
,
end:
Alignment
.
bottomCenter
,
)),
child:
const
Text
(
'按住说话'
,
textAlign:
TextAlign
.
center
,
),
),
)),
if
(
widget
.
inputOptions
.
trailing
!=
null
&&
widget
.
inputOptions
.
showTraillingBeforeSend
)
...
widget
.
inputOptions
.
trailing
!,
...
...
lib/package/chat_dash/src/widgets/message_row/default_message_text.dart
View file @
0f4ec721
This diff is collapsed.
Click to expand it.
lib/package/chat_dash/src/widgets/message_row/text_container.dart
View file @
0f4ec721
...
...
@@ -57,62 +57,112 @@ class TextContainer extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
margin:
EdgeInsets
.
only
(
bottom:
index
==
0
?
20
:
0
),
// background-image: linear-gradient(180deg, #be6afb, #9c67f6, #7965f8);
// background-image: linear-gradient(180deg, #3d3f54, #333450, #2b2b4d);
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
only
(
topLeft:
!
isOwnMessage
?
Radius
.
circular
(
0
)
:
Radius
.
circular
(
20
),
topRight:
Radius
.
circular
(
20
),
bottomLeft:
Radius
.
circular
(
20
),
bottomRight:
isOwnMessage
?
Radius
.
circular
(
0
)
:
Radius
.
circular
(
20
)
// bottomRight:
// isOwnMessage ? Radius.circular(20) : Radius.circular(0),
),
gradient:
LinearGradient
(
colors:
isOwnMessage
?
[
Color
(
0xFFbe6afb
),
Color
(
0xFF9c67f6
),
Color
(
0xFF7965f8
)]
:
[
Color
(
0xFF3d3f54
),
Color
(
0xFF333450
),
Color
(
0xFF2b2b4d
)],
begin:
Alignment
.
topCenter
,
end:
Alignment
.
bottomCenter
,
)),
// decoration: messageOptions.messageDecorationBuilder != null
// ? messageOptions.messageDecorationBuilder!(
// message, previousMessage, nextMessage)
// : defaultMessageDecoration(
// color: isOwnMessage
// ? (messageOptions.currentUserContainerColor ??
// Theme.of(context).primaryColor)
// : (messageOptions.containerColor ?? Colors.grey[100])!,
// borderTopLeft:
// isPreviousSameAuthor && !isOwnMessage && !isAfterDateSeparator
// ? 0.0
// : 18.0,
// borderTopRight:
// isPreviousSameAuthor && isOwnMessage && !isAfterDateSeparator
// ? 0.0
// : 18.0,
// borderBottomLeft:
// !isOwnMessage && !isBeforeDateSeparator && isNextSameAuthor
// ? 0.0
// : 18.0,
// borderBottomRight:
// isOwnMessage && !isBeforeDateSeparator && isNextSameAuthor
// ? 0.0
// : 18.0,
// ),
padding:
messageOptions
.
messagePadding
??
const
EdgeInsets
.
all
(
16
),
child:
DefaultMessageText
(
index:
index
,
messageLength:
messageLength
,
message:
message
,
isOwnMessage:
isOwnMessage
,
messageOptions:
messageOptions
,
),
);
margin:
EdgeInsets
.
only
(
bottom:
index
==
0
?
20
:
0
),
// background-image: linear-gradient(180deg, #be6afb, #9c67f6, #7965f8);
// background-image: linear-gradient(180deg, #3d3f54, #333450, #2b2b4d);
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
only
(
topLeft:
!
isOwnMessage
?
Radius
.
circular
(
0
)
:
Radius
.
circular
(
20
),
topRight:
Radius
.
circular
(
20
),
bottomLeft:
Radius
.
circular
(
20
),
bottomRight:
isOwnMessage
?
Radius
.
circular
(
0
)
:
Radius
.
circular
(
20
)
// bottomRight:
// isOwnMessage ? Radius.circular(20) : Radius.circular(0),
),
gradient:
LinearGradient
(
colors:
isOwnMessage
?
[
Color
(
0xFFbe6afb
),
Color
(
0xFF9c67f6
),
Color
(
0xFF7965f8
)]
:
[
Color
(
0xFF3d3f54
),
Color
(
0xFF333450
),
Color
(
0xFF2b2b4d
)],
begin:
Alignment
.
topCenter
,
end:
Alignment
.
bottomCenter
,
)),
// decoration: messageOptions.messageDecorationBuilder != null
// ? messageOptions.messageDecorationBuilder!(
// message, previousMessage, nextMessage)
// : defaultMessageDecoration(
// color: isOwnMessage
// ? (messageOptions.currentUserContainerColor ??
// Theme.of(context).primaryColor)
// : (messageOptions.containerColor ?? Colors.grey[100])!,
// borderTopLeft:
// isPreviousSameAuthor && !isOwnMessage && !isAfterDateSeparator
// ? 0.0
// : 18.0,
// borderTopRight:
// isPreviousSameAuthor && isOwnMessage && !isAfterDateSeparator
// ? 0.0
// : 18.0,
// borderBottomLeft:
// !isOwnMessage && !isBeforeDateSeparator && isNextSameAuthor
// ? 0.0
// : 18.0,
// borderBottomRight:
// isOwnMessage && !isBeforeDateSeparator && isNextSameAuthor
// ? 0.0
// : 18.0,
// ),
padding:
messageOptions
.
messagePadding
??
const
EdgeInsets
.
all
(
16
),
child:
DefaultMessageText
(
index:
index
,
messageLength:
messageLength
,
message:
message
,
isOwnMessage:
isOwnMessage
,
messageOptions:
messageOptions
,
));
// CustomPopupMenu(
// // controller: CustomPopupMenuController().hideMenu(),
// menuBuilder: () => _buildLongPressMenu(message, context),
// barrierColor: Colors.transparent,
// position: PreferredPosition.bottom,
// pressType: PressType.longPress,
// child: ,
// ));
}
// @override
// State<DefaultMessageText> createState() => _DefaultMessageTextState();
}
// messageTextBuilder != null
// ? messageTextBuilder!(message, previousMessage, nextMessage)
// :
\ No newline at end of file
// :
// List<PopupMenuItemBean> topList = List();
// PopupMenuItemBean item = PopupMenuItemBean();
// item.title = "点赞";
// item.id = "点赞value";
// item.icon = "images/business_live_menu_zan.png";
// topList.add(item);
// List<PopupMenuItemBean> bottomList = List();
// List<Map<String, String>> bottomListData = [
// {"title": "复制", "id": "复制id", "icon": "images/business_live_menu_copy.png"},
// {"title": "回复", "id": "回复id", "icon": "images/business_live_menu_reply.png"},
// {"title": "添加表情", "id": "添加表情id", "icon": "images/business_live_menu_emoji.png"},
// {"title": "撤回", "id": "撤回id", "icon": "images/business_live_menu_back.png"},
// {"title": "举报", "id": "举报id", "icon": "images/business_live_menu_report.png"},
// {"title": "屏蔽", "id": "屏蔽id", "icon": "images/business_live_menu_shielding.png"},
// {"title": "封禁", "id": "封禁id", "icon": "images/business_live_menu_forbidden.png"},
// ];
// bottomListData.forEach((Map item) {
// PopupMenuItemBean bottomItem = PopupMenuItemBean();
// bottomItem.title = item["title"];
// bottomItem.id = item["id"];
// bottomItem.icon = item["icon"];
// bottomList.add(bottomItem);
// });
// if (bottomList.length == 0) return;
// PopupMenuUtils.popupPositioned(
// context: context,
// topList: topList,
// bottomList: bottomList,
// tapPos: tapPos,
// onSelected: (PopupMenuItemBean item) {
// print(item.title);
// },
// );
\ No newline at end of file
lib/pages/application/controller.dart
View file @
0f4ec721
import
'dart:async'
;
// import 'package:vibration/vibration.dart';
import
'package:chart/pages/frame/notfound/index.dart'
;
import
'package:chart/pages/home/controller.dart'
;
import
'package:flutter_vibrate/flutter_vibrate.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/material.dart'
;
...
...
@@ -9,6 +10,9 @@ import 'package:chart/common/routers/routes.dart';
import
'package:chart/common/utils/utils.dart'
;
import
'package:chart/common/values/values.dart'
;
import
'package:get/get.dart'
;
import
'package:speech_to_text/speech_recognition_result.dart'
;
import
'package:speech_to_text/speech_to_text.dart'
;
import
'package:chart/package/chat_dash/dash_chat_2.dart'
as
Chat
;
// import 'package:vibrate/vibrate.dart';
// import 'package:uni_links/uni_links.dart';
...
...
@@ -29,6 +33,8 @@ import 'index.dart';
class
ApplicationController
extends
GetxController
{
ApplicationController
();
static
ApplicationController
get
to
=>
Get
.
put
(
ApplicationController
());
/// 响应式成员变量
final
state
=
ApplicationState
();
...
...
@@ -38,12 +44,67 @@ class ApplicationController extends GetxController {
// tab 页标题
late
final
List
<
String
>
tabTitles
;
//键盘
// 页控制器
late
final
PageController
pageController
;
final
TextEditingController
textController
=
TextEditingController
();
// 底部导航项目
late
final
List
<
BottomNavigationBarItem
>
bottomTabs
;
SpeechToText
_speechToText
=
SpeechToText
();
SpeechToText
get
speechToText
=>
_speechToText
;
void
startListening
()
async
{
await
_speechToText
.
listen
(
onResult:
_onSpeechResult
);
}
void
_onSpeechResult
(
SpeechRecognitionResult
result
)
{
textController
.
text
=
result
.
recognizedWords
;
// textController.text = result.recognizedWords;
// textController()
// speakText = result.recognizedWords;
// print('result---$result.');
}
void
stopListening
()
async
{
await
_speechToText
.
stop
();
}
// onLongPressStart: controller.onLongPressStart,
// onLongPressEnd: controller.onLongPressEnd,
onLongPressStart
(
LongPressStartDetails
details
)
async
{
Vibrate
.
feedback
(
FeedbackType
.
impact
);
state
.
showVoc
=
true
;
state
.
isSpeak
=
true
;
startListening
();
}
onLongPressEnd
(
LongPressEndDetails
details
)
{
state
.
isSpeak
=
false
;
stopListening
();
}
sendMessage
()
{
state
.
showVoc
=
false
;
Chat
.
ChatUser
_user
=
Chat
.
ChatUser
(
id:
'1'
,
// firstName: 'Charles',
// lastName: 'Leclerc',
);
HomeController
.
to
.
sendMessage
(
Chat
.
ChatMessage
(
text:
textController
.
text
,
user:
_user
,
createdAt:
DateTime
.
now
(),
));
textController
.
text
=
''
;
// sendMessage
}
/// 事件
// tab栏动画
...
...
@@ -119,9 +180,14 @@ class ApplicationController extends GetxController {
/// 生命周期
@override
void
onInit
()
{
void
onInit
()
async
{
super
.
onInit
();
//
//
// // isKeyboardOpen.value = Get.focusScope.hasFocus;
// });
// handleInitialUri();
// handleIncomingLinks();
...
...
@@ -154,15 +220,9 @@ class ApplicationController extends GetxController {
label:
'私人助理'
,
backgroundColor:
AppColors
.
primaryBackground
,
),
// const BottomNavigationBarItem(
// icon: Image(image: AssetImage("assets/images/my.png"), width: 30.0),
// activeIcon: Image(
// image: AssetImage("assets/images/my-selected.png"), width: 30.0),
// label: '我的',
// backgroundColor: AppColors.primaryBackground,
// ),
];
pageController
=
PageController
(
initialPage:
state
.
page
);
// await _speechToText.initialize();
}
@override
...
...
@@ -179,6 +239,8 @@ class ApplicationController extends GetxController {
void
dispose
()
{
uriSub
?.
cancel
();
pageController
.
dispose
();
_speechToText
.
cancel
();
// await _speechToText.initialize();
super
.
dispose
();
}
}
lib/pages/application/state.dart
View file @
0f4ec721
...
...
@@ -5,4 +5,16 @@ class ApplicationState {
final
_page
=
0
.
obs
;
set
page
(
value
)
=>
this
.
_page
.
value
=
value
;
get
page
=>
this
.
_page
.
value
;
final
_showVoc
=
false
.
obs
;
set
showVoc
(
value
)
=>
_showVoc
.
value
=
value
;
get
showVoc
=>
_showVoc
.
value
;
final
_isSpeak
=
false
.
obs
;
set
isSpeak
(
value
)
=>
_isSpeak
.
value
=
value
;
get
isSpeak
=>
_isSpeak
.
value
;
final
_isNetWorkErr
=
false
.
obs
;
set
isNetWorkErr
(
value
)
=>
_isNetWorkErr
.
value
=
value
;
get
isNetWorkErr
=>
_isNetWorkErr
.
value
;
}
lib/pages/application/view.dart
View file @
0f4ec721
This diff is collapsed.
Click to expand it.
lib/pages/creation-detail/controller.dart
View file @
0f4ec721
...
...
@@ -4,6 +4,7 @@ import 'package:chart/common/apis/apis.dart';
import
'package:chart/common/entities/detail.dart'
;
import
'package:chart/common/store/user.dart'
;
import
'package:chart/common/values/server.dart'
;
import
'package:clipboard/clipboard.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter_client_sse/flutter_client_sse.dart'
;
import
'package:flutter_easyloading/flutter_easyloading.dart'
;
...
...
@@ -47,6 +48,11 @@ class CreationDetailController extends GetxController {
state
.
detailList
.
addAll
(
items
);
}
copyText
()
{
FlutterClipboard
.
copy
(
state
.
genText
).
then
((
value
)
=>
EasyLoading
.
showToast
(
"复制成功"
,
maskType:
EasyLoadingMaskType
.
none
));
}
void
hideKeyboard
()
=>
FocusManager
.
instance
.
primaryFocus
?.
unfocus
();
void
genInner
()
async
{
await
initEventSource
();
...
...
lib/pages/creation-detail/widgets/hello.dart
View file @
0f4ec721
...
...
@@ -142,24 +142,73 @@ class HelloWidget extends GetView<CreationDetailController> {
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
20
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Container
(
width:
3
,
height:
22
,
decoration:
BoxDecoration
(
color:
const
Color
(
0xFFb05ddd
),
borderRadius:
BorderRadius
.
circular
(
20
)),
margin:
const
EdgeInsets
.
only
(
right:
5
),
Row
(
children:
[
Container
(
width:
3
,
height:
22
,
decoration:
BoxDecoration
(
color:
const
Color
(
0xFFb05ddd
),
borderRadius:
BorderRadius
.
circular
(
20
)),
margin:
const
EdgeInsets
.
only
(
right:
5
),
),
const
Text
(
'生成结果'
,
style:
TextStyle
(
fontSize:
16
,
fontWeight:
FontWeight
.
w500
)),
],
),
const
Text
(
'生成结果'
,
style:
TextStyle
(
fontSize:
16
,
fontWeight:
FontWeight
.
w500
)),
InkWell
(
onTap:
()
{
controller
.
copyText
();
},
child:
Row
(
children:
const
[
Icon
(
Icons
.
content_paste_rounded
,
color:
Color
(
0xFFb05ddd
),
size:
18
,
),
SizedBox
(
width:
10
,
),
// Container(
// width: 3,
// height: 22,
// decoration: BoxDecoration(
// color: const Color(
// 0xFFb05ddd),
// borderRadius:
// BorderRadius
// .circular(
// 20)),
// margin:
// const EdgeInsets.only(
// right: 5),
// ),
Text
(
'复制内容'
,
style:
TextStyle
(
fontSize:
16
,
fontWeight:
FontWeight
.
w500
)),
],
),
)
],
),
),
...
...
@@ -171,6 +220,13 @@ class HelloWidget extends GetView<CreationDetailController> {
padding:
const
EdgeInsets
.
all
(
20
),
width:
Get
.
width
,
constraints:
const
BoxConstraints
(
minHeight:
300
,
// minWidth: 200,
// maxHeight: 200,
// 设置最小高度为100
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
...
...
@@ -180,11 +236,9 @@ class HelloWidget extends GetView<CreationDetailController> {
colors:
[
// 61, 63, 84
Color
.
fromARGB
(
75
,
61
,
63
,
84
),
Color
.
fromARGB
(
75
,
51
,
52
,
80
),
255
,
40
,
40
,
57
),
Color
.
fromARGB
(
75
,
43
,
43
,
77
)
255
,
40
,
40
,
57
),
],
begin:
Alignment
.
topCenter
,
...
...
lib/pages/eula/controller.dart
View file @
0f4ec721
import
'package:get/get.dart'
;
import
'package:webview_flutter/webview_flutter.dart'
;
import
'index.dart'
;
...
...
@@ -7,6 +8,22 @@ class UserEulaController extends GetxController {
final
state
=
UserEulaState
();
final
webViewController
=
WebViewController
()
..
setNavigationDelegate
(
NavigationDelegate
(
onProgress:
(
int
progress
)
{
// Update loading bar.
},
onPageStarted:
(
String
url
)
{},
onPageFinished:
(
String
url
)
{},
onWebResourceError:
(
WebResourceError
error
)
{},
// onNavigationRequest: (NavigationRequest request) {
// if (request.url.startsWith('https://www.youtube.com/')) {
// return NavigationDecision.prevent;
// }
// return NavigationDecision.navigate;
// },
));
// tap
void
handleTap
(
int
index
)
{
Get
.
snackbar
(
...
...
@@ -25,6 +42,7 @@ class UserEulaController extends GetxController {
@override
void
onReady
()
{
super
.
onReady
();
webViewController
.
loadRequest
(
Uri
.
parse
(
'https://p.kdocs.cn/s/UODC2BAAYQ'
));
}
/// 在 [onDelete] 方法之前调用。
...
...
lib/pages/eula/view.dart
View file @
0f4ec721
...
...
@@ -74,9 +74,13 @@ class UserEulaPage extends GetView<UserEulaController> {
body:
Container
(
height:
double
.
infinity
,
width:
double
.
infinity
,
child:
WebView
(
initialUrl:
"https://p.kdocs.cn/s/UODC2BAAYQ"
,
),
child:
WebViewWidget
(
controller:
controller
.
webViewController
),
// child:
// WebView(
// initialUrl: "https://p.kdocs.cn/s/UODC2BAAYQ",
// onWebResourceError: (error) {
// print(error);
// }),
));
},
);
...
...
lib/pages/frame/pay_list/widgets/helloword.dart
View file @
0f4ec721
...
...
@@ -90,14 +90,14 @@ class PayItemWidget extends GetView<PayListController> {
)),
MarqueeView
(
child:
Row
(
children:
[
_buildText
(
'手机用户159****0542购买了按
年
订阅套餐'
),
_buildText
(
'手机用户159****0542购买了按
周
订阅套餐'
),
_buildText
(
'手机用户136****1949购买了按年订阅套餐'
),
_buildText
(
'手机用户159****1252购买了按
年
订阅套餐'
),
_buildText
(
'手机用户176****1429购买了按
年
订阅套餐'
),
_buildText
(
'手机用户158****8953购买了按
年
订阅套餐'
),
_buildText
(
'手机用户159****1252购买了按
月
订阅套餐'
),
_buildText
(
'手机用户176****1429购买了按
周
订阅套餐'
),
_buildText
(
'手机用户158****8953购买了按
月
订阅套餐'
),
_buildText
(
'手机用户139****2752购买了按年订阅套餐'
),
_buildText
(
'手机用户130****5959购买了按
年
订阅套餐'
),
_buildText
(
'手机用户158****6048购买了按
年
订阅套餐'
),
_buildText
(
'手机用户130****5959购买了按
季
订阅套餐'
),
_buildText
(
'手机用户158****6048购买了按
月
订阅套餐'
),
_buildText
(
'手机用户136****8962购买了按年订阅套餐'
),
]),
),
...
...
lib/pages/frame/welcome/controller.dart
View file @
0f4ec721
import
'package:chart/common/routers/routes.dart'
;
import
'package:chart/common/store/store.dart'
;
import
'package:chart/pages/application/controller.dart'
;
import
'package:get/get.dart'
;
import
'index.dart'
;
...
...
@@ -8,7 +9,7 @@ class WelcomeController extends GetxController {
final
state
=
WelcomeState
();
WelcomeController
();
// WILL_COME
// 跳转 注册界面
handleNavSignIn
()
async
{
await
ConfigStore
.
to
.
saveAlreadyOpen
();
...
...
@@ -19,7 +20,9 @@ class WelcomeController extends GetxController {
handleHome
()
async
{
await
UserStore
.
to
.
refreshInfo
();
await
ConfigStore
.
to
.
saveAlreadyOpen
();
// ApplicationController.to.state.isNetWorkErr = false;
Get
.
offAndToNamed
(
AppRoutes
.
Application
);
// Get.put(ApplicationController());
}
@override
...
...
lib/pages/home/controller.dart
View file @
0f4ec721
...
...
@@ -7,6 +7,7 @@ import 'package:chart/common/values/server.dart';
import
'package:chart/entity/user_entity.dart'
;
import
'package:chart/package/chat_dash/dash_chat_2.dart'
as
Chat
;
import
'package:chart/package/chat_dash/dash_chat_2.dart'
;
import
'package:chart/pages/application/controller.dart'
;
import
'package:chart/pages/category/controller.dart'
;
import
'package:chart/pages/frame/product/controller.dart'
;
import
'package:flutter/foundation.dart'
;
...
...
@@ -15,6 +16,7 @@ import 'package:flutter/widgets.dart';
import
'package:flutter_easyloading/flutter_easyloading.dart'
;
import
'package:flutter_vibrate/flutter_vibrate.dart'
;
import
'package:get/get.dart'
;
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
;
...
...
@@ -255,6 +257,16 @@ class HomeController extends GetxController with SingleGetTickerProviderMixin {
Get
.
toNamed
(
"
${AppRoutes.CHAT_PAGE}
"
);
}
changeInput
()
async
{
if
(
state
.
isInputText
&&
!
ApplicationController
.
to
.
speechToText
.
isAvailable
)
{
await
ApplicationController
.
to
.
speechToText
.
initialize
();
}
else
{
Vibrate
.
feedback
(
FeedbackType
.
impact
);
state
.
isInputText
=
!
state
.
isInputText
;
}
}
sendMessageByBanner
(
String
message
)
async
{
await
createConversionId
();
...
...
@@ -292,9 +304,8 @@ class HomeController extends GetxController with SingleGetTickerProviderMixin {
return
;
}
Map
<
String
,
dynamic
>
jsonMap
=
jsonDecode
(
"
${event.data}
"
);
if
(
jsonMap
[
'askType'
]
==
1
)
{
_updateMessage
(
"
${jsonMap['content']}
"
as
String
);
}
_updateMessage
(
"
${jsonMap['content']}
"
as
String
);
});
// print(sse);
...
...
@@ -308,7 +319,7 @@ class HomeController extends GetxController with SingleGetTickerProviderMixin {
}
_updateMessage
(
String
text
)
{
print
(
state
.
messageList
.
length
);
//
print(state.messageList.length);
// state.messageList[0].text = state.messageList[0].text + text;
// state.messageList.forEach((element) {
// print(element.text);
...
...
@@ -317,19 +328,34 @@ class HomeController extends GetxController with SingleGetTickerProviderMixin {
if
(
state
.
messageList
.
isEmpty
)
{
return
;
}
state
.
messageList
.
setRange
(
0
,
1
,
[
ChatMessage
(
user:
receiveUser
,
createdAt:
DateTime
.
now
(),
text:
state
.
messageList
.
value
[
0
].
text
==
"LOADING"
?
text
:
state
.
messageList
.
value
[
0
].
text
+
text
// user: receiveUser,
// createdAt: DateTime.now(),
// // id: const Uuid().v4(),
// text: "",
)
]);
if
(
text
.
contains
(
"建议您重新开启一个会话。"
))
{
state
.
messageList
.
setRange
(
0
,
1
,
[
ChatMessage
(
user:
receiveUser
,
createdAt:
DateTime
.
now
(),
text:
"您关联的上下文超出了我的理解能力范围,请点击右上角刷新按钮重置会话。"
// user: receiveUser,
// createdAt: DateTime.now(),
// // id: const Uuid().v4(),
// text: "",
)
]);
}
else
{
state
.
messageList
.
setRange
(
0
,
1
,
[
ChatMessage
(
user:
receiveUser
,
createdAt:
DateTime
.
now
(),
text:
state
.
messageList
.
value
[
0
].
text
==
"LOADING"
?
text
:
state
.
messageList
.
value
[
0
].
text
+
text
// user: receiveUser,
// createdAt: DateTime.now(),
// // id: const Uuid().v4(),
// text: "",
)
]);
}
// state.messageList.value = [...state.messageList.value];list.setRange(1, 4, [9, 9, 9]);
// state.messageList.value[0].text = state.messageList.value[0].text + text;
}
...
...
@@ -427,5 +453,16 @@ class HomeController extends GetxController with SingleGetTickerProviderMixin {
// refreshController.dispose();
}
onLongPressStart
(
LongPressStartDetails
details
)
{
ApplicationController
.
to
.
onLongPressStart
(
details
);
}
onLongPressEnd
(
LongPressEndDetails
details
)
{
ApplicationController
.
to
.
onLongPressEnd
(
details
);
}
// onLongPressStart: cc.onLongPressStart,
// onLongPressEnd: cc.onLongPressEnd
// obx(Map map) {}
}
lib/pages/home/state.dart
View file @
0f4ec721
...
...
@@ -75,5 +75,13 @@ class ChatPageState {
set
isNext
(
value
)
=>
_isNext
.
value
=
value
;
get
isNext
=>
_isNext
.
value
;
final
RxBool
_isInputText
=
true
.
obs
;
set
isInputText
(
value
)
=>
_isInputText
.
value
=
value
;
get
isInputText
=>
_isInputText
.
value
;
final
RxBool
_readOnly
=
false
.
obs
;
set
readOnly
(
value
)
=>
_readOnly
.
value
=
value
;
get
readOnly
=>
_readOnly
.
value
;
// RxList<NewsItem> newsList = <NewsItem>[].obs;
}
lib/pages/home/view.dart
View file @
0f4ec721
This diff is collapsed.
Click to expand it.
lib/pages/my/view.dart
View file @
0f4ec721
...
...
@@ -180,9 +180,6 @@ class MyPage extends GetView<MyController> {
),
),
),
Container
(
child:
Text
(
"12"
),
)
// GradientButton(child: Text("321"), callback: () {})
],
);
...
...
lib/pages/privacy/controller.dart
View file @
0f4ec721
import
'package:get/get.dart'
;
import
'package:webview_flutter/webview_flutter.dart'
;
import
'index.dart'
;
...
...
@@ -7,6 +8,21 @@ class PrivacyController extends GetxController {
final
state
=
PrivacyState
();
final
webViewController
=
WebViewController
()
..
setNavigationDelegate
(
NavigationDelegate
(
onProgress:
(
int
progress
)
{
// Update loading bar.
},
onPageStarted:
(
String
url
)
{},
onPageFinished:
(
String
url
)
{},
onWebResourceError:
(
WebResourceError
error
)
{},
// onNavigationRequest: (NavigationRequest request) {
// if (request.url.startsWith('https://www.youtube.com/')) {
// return NavigationDecision.prevent;
// }
// return NavigationDecision.navigate;
// },
));
// tap
void
handleTap
(
int
index
)
{
Get
.
snackbar
(
...
...
@@ -24,6 +40,7 @@ class PrivacyController extends GetxController {
/// 在 onInit() 之后调用 1 帧。这是进入的理想场所
@override
void
onReady
()
{
webViewController
.
loadRequest
(
Uri
.
parse
(
'https://p.kdocs.cn/s/YXFCYBAAYQ'
));
super
.
onReady
();
}
...
...
lib/pages/privacy/view.dart
View file @
0f4ec721
...
...
@@ -75,9 +75,10 @@ class PrivacyPage extends GetView<PrivacyController> {
body:
Container
(
height:
double
.
infinity
,
width:
double
.
infinity
,
child:
WebView
(
initialUrl:
"https://p.kdocs.cn/s/YXFCYBAAYQ"
,
),
child:
WebViewWidget
(
controller:
controller
.
webViewController
),
// child: WebViewWidget(
// initialUrl: "https://p.kdocs.cn/s/YXFCYBAAYQ",
// ),
// 【金山文档】 隐私政策
// decoration: BoxDecoration(
...
...
pubspec.lock
View file @
0f4ec721
...
...
@@ -571,6 +571,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
flutter_persistent_keyboard_height:
dependency: "direct main"
description:
name: flutter_persistent_keyboard_height
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
flutter_plugin_android_lifecycle:
dependency: transitive
description:
...
...
@@ -812,6 +819,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
keyboard_utils:
dependency: transitive
description:
name: keyboard_utils
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.4"
linkify:
dependency: transitive
description:
...
...
@@ -1418,28 +1432,28 @@ packages:
name: webview_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "
3.0.4
"
version: "
4.0.7
"
webview_flutter_android:
dependency: transitive
description:
name: webview_flutter_android
url: "https://pub.dartlang.org"
source: hosted
version: "
2.10.4
"
version: "
3.4.5
"
webview_flutter_platform_interface:
dependency: transitive
description:
name: webview_flutter_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "
1.9.5
"
version: "
2.1.0
"
webview_flutter_wkwebview:
dependency: transitive
description:
name: webview_flutter_wkwebview
url: "https://pub.dartlang.org"
source: hosted
version: "
2.9.5
"
version: "
3.2.4
"
win32:
dependency: transitive
description:
...
...
pubspec.yaml
View file @
0f4ec721
...
...
@@ -49,7 +49,7 @@ dependencies:
dio
:
^4.0.6
fluro
:
^2.0.3
shared_preferences
:
^2.0.15
webview_flutter
:
^
3.0.4
webview_flutter
:
^
4.0.7
provider
:
^6.0.3
flutter_screenutil
:
^5.5.3+2
flutter_login
:
^3.2.0
...
...
@@ -126,6 +126,8 @@ dependencies:
flutter_tts
:
^3.6.3
custom_pop_up_menu
:
^1.2.4
speech_to_text
:
^6.1.1
flutter_persistent_keyboard_height
:
^1.0.5
# package:bubble/bubble.dart
...
...
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