Commit 0f4ec721 authored by 关振斌's avatar 关振斌

update

parent 24ec97a4
...@@ -109,6 +109,8 @@ PODS: ...@@ -109,6 +109,8 @@ PODS:
- GTMSessionFetcher/Core (3.1.0) - GTMSessionFetcher/Core (3.1.0)
- image_picker_ios (0.0.1): - image_picker_ios (0.0.1):
- Flutter - Flutter
- keyboard_utils (0.0.1):
- Flutter
- open_filex (0.0.2): - open_filex (0.0.2):
- Flutter - Flutter
- OrderedSet (5.0.0) - OrderedSet (5.0.0)
...@@ -131,11 +133,15 @@ PODS: ...@@ -131,11 +133,15 @@ PODS:
- Flutter - Flutter
- smart_auth (0.0.1): - smart_auth (0.0.1):
- Flutter - Flutter
- speech_to_text (0.0.1):
- Flutter
- Try
- sqflite (0.0.2): - sqflite (0.0.2):
- Flutter - Flutter
- FMDB (>= 2.7.5) - FMDB (>= 2.7.5)
- SwiftyGif (5.4.4) - SwiftyGif (5.4.4)
- Toast (4.0.0) - Toast (4.0.0)
- Try (2.1.1)
- url_launcher_ios (0.0.1): - url_launcher_ios (0.0.1):
- Flutter - Flutter
- vibration (1.7.5): - vibration (1.7.5):
...@@ -163,6 +169,7 @@ DEPENDENCIES: ...@@ -163,6 +169,7 @@ DEPENDENCIES:
- fluttercontactpicker (from `.symlinks/plugins/fluttercontactpicker/ios`) - fluttercontactpicker (from `.symlinks/plugins/fluttercontactpicker/ios`)
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`) - fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/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`) - open_filex (from `.symlinks/plugins/open_filex/ios`)
- package_info (from `.symlinks/plugins/package_info/ios`) - package_info (from `.symlinks/plugins/package_info/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`) - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`)
...@@ -170,6 +177,7 @@ DEPENDENCIES: ...@@ -170,6 +177,7 @@ DEPENDENCIES:
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/ios`) - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/ios`)
- sign_in_with_apple (from `.symlinks/plugins/sign_in_with_apple/ios`) - sign_in_with_apple (from `.symlinks/plugins/sign_in_with_apple/ios`)
- smart_auth (from `.symlinks/plugins/smart_auth/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`) - sqflite (from `.symlinks/plugins/sqflite/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- vibration (from `.symlinks/plugins/vibration/ios`) - vibration (from `.symlinks/plugins/vibration/ios`)
...@@ -193,6 +201,7 @@ SPEC REPOS: ...@@ -193,6 +201,7 @@ SPEC REPOS:
- SDWebImage - SDWebImage
- SwiftyGif - SwiftyGif
- Toast - Toast
- Try
EXTERNAL SOURCES: EXTERNAL SOURCES:
app_settings: app_settings:
...@@ -229,6 +238,8 @@ EXTERNAL SOURCES: ...@@ -229,6 +238,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/fluttertoast/ios" :path: ".symlinks/plugins/fluttertoast/ios"
image_picker_ios: image_picker_ios:
:path: ".symlinks/plugins/image_picker_ios/ios" :path: ".symlinks/plugins/image_picker_ios/ios"
keyboard_utils:
:path: ".symlinks/plugins/keyboard_utils/ios"
open_filex: open_filex:
:path: ".symlinks/plugins/open_filex/ios" :path: ".symlinks/plugins/open_filex/ios"
package_info: package_info:
...@@ -243,6 +254,8 @@ EXTERNAL SOURCES: ...@@ -243,6 +254,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/sign_in_with_apple/ios" :path: ".symlinks/plugins/sign_in_with_apple/ios"
smart_auth: smart_auth:
:path: ".symlinks/plugins/smart_auth/ios" :path: ".symlinks/plugins/smart_auth/ios"
speech_to_text:
:path: ".symlinks/plugins/speech_to_text/ios"
sqflite: sqflite:
:path: ".symlinks/plugins/sqflite/ios" :path: ".symlinks/plugins/sqflite/ios"
url_launcher_ios: url_launcher_ios:
...@@ -281,6 +294,7 @@ SPEC CHECKSUMS: ...@@ -281,6 +294,7 @@ SPEC CHECKSUMS:
GoogleUtilities: 9aa0ad5a7bc171f8bae016300bfcfa3fb8425749 GoogleUtilities: 9aa0ad5a7bc171f8bae016300bfcfa3fb8425749
GTMSessionFetcher: c9e714f7eec91a55641e2bab9f45fd83a219b882 GTMSessionFetcher: c9e714f7eec91a55641e2bab9f45fd83a219b882
image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5 image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5
keyboard_utils: ab24bc711be9e91a5937c20489056b8dd650fecc
open_filex: 6e26e659846ec990262224a12ef1c528bb4edbe4 open_filex: 6e26e659846ec990262224a12ef1c528bb4edbe4
OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c
package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62 package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62
...@@ -292,13 +306,15 @@ SPEC CHECKSUMS: ...@@ -292,13 +306,15 @@ SPEC CHECKSUMS:
shared_preferences_foundation: 986fc17f3d3251412d18b0265f9c64113a8c2472 shared_preferences_foundation: 986fc17f3d3251412d18b0265f9c64113a8c2472
sign_in_with_apple: f3bf75217ea4c2c8b91823f225d70230119b8440 sign_in_with_apple: f3bf75217ea4c2c8b91823f225d70230119b8440
smart_auth: 4bedbc118723912d0e45a07e8ab34039c19e04f2 smart_auth: 4bedbc118723912d0e45a07e8ab34039c19e04f2
speech_to_text: b43a7d99aef037bd758ed8e45d79bbac035d2dfe
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196 Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
Try: 5ef669ae832617b3cee58cb2c6f99fb767a4ff96
url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4 url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
vibration: 7d883d141656a1c1a6d8d238616b2042a51a1241 vibration: 7d883d141656a1c1a6d8d238616b2042a51a1241
video_player_avfoundation: 81e49bb3d9fb63dccf9fa0f6d877dc3ddbeac126 video_player_avfoundation: 81e49bb3d9fb63dccf9fa0f6d877dc3ddbeac126
webview_flutter_wkwebview: b7e70ef1ddded7e69c796c7390ee74180182971f webview_flutter_wkwebview: 2e2d318f21a5e036e2c3f26171342e95908bd60a
PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3 PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
......
...@@ -66,7 +66,11 @@ ...@@ -66,7 +66,11 @@
<string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string> <string>UIInterfaceOrientationLandscapeRight</string>
</array> </array>
<key>NSMicrophoneUsageDescription</key>
<string>只有您‘允许使用麦克风’AI写作大师才能听您说话</string>
<key>UIViewControllerBasedStatusBarAppearance</key> <key>UIViewControllerBasedStatusBarAppearance</key>
<false/> <false/>
<key>NSSpeechRecognitionUsageDescription</key>
<string>只有您‘允许使用麦克风’AI写作大师才能听您说话</string>
</dict> </dict>
</plist> </plist>
...@@ -10,6 +10,7 @@ import 'package:chart/common/values/values.dart'; ...@@ -10,6 +10,7 @@ import 'package:chart/common/values/values.dart';
import 'package:chart/entity/login_entity.dart'; import 'package:chart/entity/login_entity.dart';
import 'package:chart/pages/application/index.dart'; import 'package:chart/pages/application/index.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
// import 'package:connectivity_plus/connectivity_plus.dart'; // import 'package:connectivity_plus/connectivity_plus.dart';
// import 'package:highlight/languages/rust.dart'; // import 'package:highlight/languages/rust.dart';
...@@ -44,13 +45,22 @@ class UserStore extends GetxController { ...@@ -44,13 +45,22 @@ class UserStore extends GetxController {
super.onInit(); super.onInit();
subscription = Connectivity() subscription = Connectivity()
.onConnectivityChanged .onConnectivityChanged
.listen((ConnectivityResult result) { .listen((ConnectivityResult result) async {
print("resultresultresultresult$result"); print("resultresultresultresult$result");
if (result == ConnectivityResult.none || if (result == ConnectivityResult.none ||
result == ConnectivityResult.other) { result == ConnectivityResult.other) {
EasyLoading.show(status: '网络连接异常,正在尝试重新连接!');
ApplicationController.to.state.isNetWorkErr = true;
// Get.
// Get.offAndToNamed(AppRoutes.WILL_COME);
} else { } else {
refreshInfo(); ApplicationController.to.state.isNetWorkErr = false;
EasyLoading.dismiss();
await refreshInfo();
// Get.offAndToNamed(AppRoutes.Application);
// AppRoutes.WILL_COME
// asyncLoadBannerData(); // asyncLoadBannerData();
// Get.back(); // Get.back();
} }
...@@ -116,7 +126,7 @@ class UserStore extends GetxController { ...@@ -116,7 +126,7 @@ class UserStore extends GetxController {
_isLogin.value = true; _isLogin.value = true;
} }
await MainController.to.asyncLoadBannerData(); // await MainController.to.asyncLoadBannerData();
} }
} }
......
...@@ -13,7 +13,7 @@ AppBar transparentAppBar({ ...@@ -13,7 +13,7 @@ AppBar transparentAppBar({
// elevation: 2, // elevation: 2,
title: title, title: title,
elevation: 0, elevation: 0,
leadingWidth: 90, leadingWidth: 110,
leading: leading ?? null, leading: leading ?? null,
actions: actions, actions: actions,
centerTitle: true, centerTitle: true,
......
...@@ -8,16 +8,18 @@ import 'package:flutter_easyloading/flutter_easyloading.dart'; ...@@ -8,16 +8,18 @@ import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_tts/flutter_tts.dart'; import 'package:flutter_tts/flutter_tts.dart';
import 'package:flutter_vibrate/flutter_vibrate.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:highlight/highlight.dart' show highlight, Node;
import 'package:animated_text_kit/animated_text_kit.dart'; import 'package:animated_text_kit/animated_text_kit.dart';
import 'package:chart/package/markdown/flutter_markdown.dart'; import 'package:chart/package/markdown/flutter_markdown.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// import 'package:get/get.dart';
import 'package:flutter_parsed_text/flutter_parsed_text.dart'; import 'package:flutter_parsed_text/flutter_parsed_text.dart';
import 'package:get/get_connect/http/src/utils/utils.dart'; import 'package:get/get_connect/http/src/utils/utils.dart';
import 'package:gradient_borders/input_borders/gradient_outline_input_border.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:intl/intl.dart' as intl;
import 'package:loading_animation_widget/loading_animation_widget.dart'; import 'package:loading_animation_widget/loading_animation_widget.dart';
import 'package:share_plus/share_plus.dart'; import 'package:share_plus/share_plus.dart';
......
...@@ -10,6 +10,7 @@ class InputOptions { ...@@ -10,6 +10,7 @@ class InputOptions {
this.onMentionTriggers = const <String>['@'], this.onMentionTriggers = const <String>['@'],
this.onTextChange, this.onTextChange,
this.inputDisabled = false, this.inputDisabled = false,
this.isTextInput = true,
this.inputDecoration, this.inputDecoration,
this.textCapitalization = TextCapitalization.none, this.textCapitalization = TextCapitalization.none,
this.alwaysShowSend = false, this.alwaysShowSend = false,
...@@ -27,8 +28,13 @@ class InputOptions { ...@@ -27,8 +28,13 @@ class InputOptions {
this.inputToolbarMargin = const EdgeInsets.only(top: 8.0), this.inputToolbarMargin = const EdgeInsets.only(top: 8.0),
this.cursorStyle = const CursorStyle(), this.cursorStyle = const CursorStyle(),
this.autocorrect = true, 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, /// Function to call when a mention is triggered in the input,
/// ie: typing ' @' /// ie: typing ' @'
/// You need to return a list of widget that will be shown inside the selection overlay, /// You need to return a list of widget that will be shown inside the selection overlay,
...@@ -65,6 +71,9 @@ class InputOptions { ...@@ -65,6 +71,9 @@ class InputOptions {
/// To make the input disabled /// To make the input disabled
final bool inputDisabled; final bool inputDisabled;
///语音模式
final bool isTextInput;
/// Input decoration to customize the design of the input /// Input decoration to customize the design of the input
/// You can use defaultInputDecoration to only orride some variables /// You can use defaultInputDecoration to only orride some variables
final InputDecoration? inputDecoration; final InputDecoration? inputDecoration;
......
...@@ -2,36 +2,41 @@ part of dash_chat_2; ...@@ -2,36 +2,41 @@ part of dash_chat_2;
/// {@category Customization} /// {@category Customization}
class MessageOptions { class MessageOptions {
const MessageOptions({ const MessageOptions(
this.showCurrentUserAvatar = false, {this.showCurrentUserAvatar = false,
this.showOtherUsersAvatar = true, this.showOtherUsersAvatar = true,
this.showOtherUsersName = true, this.showOtherUsersName = true,
this.userNameBuilder, this.userNameBuilder,
this.avatarBuilder, this.avatarBuilder,
this.onPressAvatar, this.onPressAvatar,
this.onLongPressAvatar, this.onLongPressAvatar,
this.onLongPressMessage, this.onLongPressMessage,
this.onPressMessage, this.onPressMessage,
this.onPressMention, this.onPressMention,
this.currentUserContainerColor, this.currentUserContainerColor,
this.currentUserTextColor, this.currentUserTextColor,
this.containerColor, this.containerColor,
this.textColor, this.textColor,
this.messagePadding, this.messagePadding,
this.maxWidth, this.maxWidth,
this.messageDecorationBuilder, this.messageDecorationBuilder,
this.top, this.top,
this.bottom, this.bottom,
this.messageRowBuilder, this.messageRowBuilder,
this.messageTextBuilder, this.messageTextBuilder,
this.parsePatterns, this.parsePatterns,
this.textBeforeMedia = true, this.textBeforeMedia = true,
this.onTapMedia, this.onTapMedia,
this.showTime = false, this.showTime = false,
this.timeFormat, this.timeFormat,
this.messageTimeBuilder, this.messageTimeBuilder,
this.messageMediaBuilder, this.messageMediaBuilder,
}); this.onLongPressStart,
this.onLongPressEnd});
//长按
// onLongPressEnd
/// Format of the time if [showTime] is true /// Format of the time if [showTime] is true
/// Default to: DateFormat('HH:mm') /// Default to: DateFormat('HH:mm')
...@@ -75,6 +80,9 @@ class MessageOptions { ...@@ -75,6 +80,9 @@ class MessageOptions {
/// Function to call when the user press on a message mention /// Function to call when the user press on a message mention
final Function(Mention)? onPressMention; final Function(Mention)? onPressMention;
final Function(LongPressStartDetails details)? onLongPressStart;
final Function(LongPressStartDetails details)? onLongPressEnd;
/// Color of the current user chat bubbles /// Color of the current user chat bubbles
/// Default to primary color /// Default to primary color
final Color? currentUserContainerColor; final Color? currentUserContainerColor;
......
...@@ -91,52 +91,89 @@ class _InputToolbarState extends State<InputToolbar> ...@@ -91,52 +91,89 @@ class _InputToolbarState extends State<InputToolbar>
if (widget.inputOptions.leading != null) if (widget.inputOptions.leading != null)
...widget.inputOptions.leading!, ...widget.inputOptions.leading!,
Expanded( Expanded(
child: Directionality( child: widget.inputOptions.isTextInput
textDirection: widget.inputOptions.inputTextDirection, ? Directionality(
child: TextField( textDirection: widget.inputOptions.inputTextDirection,
focusNode: focusNode, child: TextField(
controller: textController, focusNode: focusNode,
enabled: !widget.inputOptions.inputDisabled, controller: textController,
textCapitalization: widget.inputOptions.textCapitalization, enabled: !widget.inputOptions.inputDisabled,
textInputAction: widget.inputOptions.textInputAction, textCapitalization:
decoration: widget.inputOptions.inputDecoration ?? widget.inputOptions.textCapitalization,
defaultInputDecoration( textInputAction: widget.inputOptions.textInputAction,
_sendMessage, decoration: widget.inputOptions.inputDecoration ??
hintText: widget.inputOptions.inputDisabled defaultInputDecoration(
? 'AI正在输入中...' _sendMessage,
: '请输入问题...', hintText: widget.inputOptions.inputDisabled
!widget.inputOptions.inputDisabled, ? 'AI正在输入中...'
), : '请输入问题...',
maxLength: widget.inputOptions.maxInputLength, !widget.inputOptions.inputDisabled,
minLines: 1, ),
maxLines: 1, maxLength: widget.inputOptions.maxInputLength,
// maxLines: widget.inputOptions.sendOnEnter minLines: 1,
// ? 1 maxLines: 1,
// : widget.inputOptions.inputMaxLines, // maxLines: widget.inputOptions.sendOnEnter
cursorColor: widget.inputOptions.cursorStyle.color, // ? 1
cursorWidth: widget.inputOptions.cursorStyle.width, // : widget.inputOptions.inputMaxLines,
showCursor: !widget.inputOptions.cursorStyle.hide, cursorColor: widget.inputOptions.cursorStyle.color,
style: widget.inputOptions.inputTextStyle, cursorWidth: widget.inputOptions.cursorStyle.width,
onSubmitted: (String value) { showCursor: !widget.inputOptions.cursorStyle.hide,
if (widget.inputOptions.sendOnEnter) { style: widget.inputOptions.inputTextStyle,
_sendMessage(); onSubmitted: (String value) {
} if (widget.inputOptions.sendOnEnter) {
}, _sendMessage();
onChanged: (String value) async { }
setState(() {}); },
if (widget.inputOptions.onTextChange != null) { onChanged: (String value) async {
widget.inputOptions.onTextChange!(value); setState(() {});
} if (widget.inputOptions.onTextChange != null) {
WidgetsBinding.instance.addPostFrameCallback((_) async { widget.inputOptions.onTextChange!(value);
if (widget.inputOptions.onMention != null) { }
await _checkMentions(value); WidgetsBinding.instance
} .addPostFrameCallback((_) async {
}); if (widget.inputOptions.onMention != null) {
}, await _checkMentions(value);
autocorrect: widget.inputOptions.autocorrect, }
), });
), },
), 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 && if (widget.inputOptions.trailing != null &&
widget.inputOptions.showTraillingBeforeSend) widget.inputOptions.showTraillingBeforeSend)
...widget.inputOptions.trailing!, ...widget.inputOptions.trailing!,
......
...@@ -57,62 +57,112 @@ class TextContainer extends StatelessWidget { ...@@ -57,62 +57,112 @@ class TextContainer extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
margin: EdgeInsets.only(bottom: index == 0 ? 20 : 0), margin: EdgeInsets.only(bottom: index == 0 ? 20 : 0),
// background-image: linear-gradient(180deg, #be6afb, #9c67f6, #7965f8); // background-image: linear-gradient(180deg, #be6afb, #9c67f6, #7965f8);
// background-image: linear-gradient(180deg, #3d3f54, #333450, #2b2b4d); // background-image: linear-gradient(180deg, #3d3f54, #333450, #2b2b4d);
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: !isOwnMessage ? Radius.circular(0) : Radius.circular(20), topLeft:
topRight: Radius.circular(20), !isOwnMessage ? Radius.circular(0) : Radius.circular(20),
bottomLeft: Radius.circular(20), topRight: Radius.circular(20),
bottomRight: bottomLeft: Radius.circular(20),
isOwnMessage ? Radius.circular(0) : Radius.circular(20) bottomRight:
// bottomRight: isOwnMessage ? Radius.circular(0) : Radius.circular(20)
// isOwnMessage ? Radius.circular(20) : Radius.circular(0), // bottomRight:
), // isOwnMessage ? Radius.circular(20) : Radius.circular(0),
gradient: LinearGradient( ),
colors: isOwnMessage gradient: LinearGradient(
? [Color(0xFFbe6afb), Color(0xFF9c67f6), Color(0xFF7965f8)] colors: isOwnMessage
: [Color(0xFF3d3f54), Color(0xFF333450), Color(0xFF2b2b4d)], ? [Color(0xFFbe6afb), Color(0xFF9c67f6), Color(0xFF7965f8)]
begin: Alignment.topCenter, : [Color(0xFF3d3f54), Color(0xFF333450), Color(0xFF2b2b4d)],
end: Alignment.bottomCenter, begin: Alignment.topCenter,
)), end: Alignment.bottomCenter,
// decoration: messageOptions.messageDecorationBuilder != null )),
// ? messageOptions.messageDecorationBuilder!( // decoration: messageOptions.messageDecorationBuilder != null
// message, previousMessage, nextMessage) // ? messageOptions.messageDecorationBuilder!(
// : defaultMessageDecoration( // message, previousMessage, nextMessage)
// color: isOwnMessage // : defaultMessageDecoration(
// ? (messageOptions.currentUserContainerColor ?? // color: isOwnMessage
// Theme.of(context).primaryColor) // ? (messageOptions.currentUserContainerColor ??
// : (messageOptions.containerColor ?? Colors.grey[100])!, // Theme.of(context).primaryColor)
// borderTopLeft: // : (messageOptions.containerColor ?? Colors.grey[100])!,
// isPreviousSameAuthor && !isOwnMessage && !isAfterDateSeparator // borderTopLeft:
// ? 0.0 // isPreviousSameAuthor && !isOwnMessage && !isAfterDateSeparator
// : 18.0, // ? 0.0
// borderTopRight: // : 18.0,
// isPreviousSameAuthor && isOwnMessage && !isAfterDateSeparator // borderTopRight:
// ? 0.0 // isPreviousSameAuthor && isOwnMessage && !isAfterDateSeparator
// : 18.0, // ? 0.0
// borderBottomLeft: // : 18.0,
// !isOwnMessage && !isBeforeDateSeparator && isNextSameAuthor // borderBottomLeft:
// ? 0.0 // !isOwnMessage && !isBeforeDateSeparator && isNextSameAuthor
// : 18.0, // ? 0.0
// borderBottomRight: // : 18.0,
// isOwnMessage && !isBeforeDateSeparator && isNextSameAuthor // borderBottomRight:
// ? 0.0 // isOwnMessage && !isBeforeDateSeparator && isNextSameAuthor
// : 18.0, // ? 0.0
// ), // : 18.0,
padding: messageOptions.messagePadding ?? const EdgeInsets.all(16), // ),
child: DefaultMessageText( padding: messageOptions.messagePadding ?? const EdgeInsets.all(16),
index: index, child: DefaultMessageText(
messageLength: messageLength, index: index,
message: message, messageLength: messageLength,
isOwnMessage: isOwnMessage, message: message,
messageOptions: messageOptions, 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 != null
// ? messageTextBuilder!(message, previousMessage, nextMessage) // ? 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
import 'dart:async'; import 'dart:async';
// import 'package:vibration/vibration.dart'; // import 'package:vibration/vibration.dart';
import 'package:chart/pages/frame/notfound/index.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_vibrate/flutter_vibrate.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
...@@ -9,6 +10,9 @@ import 'package:chart/common/routers/routes.dart'; ...@@ -9,6 +10,9 @@ import 'package:chart/common/routers/routes.dart';
import 'package:chart/common/utils/utils.dart'; import 'package:chart/common/utils/utils.dart';
import 'package:chart/common/values/values.dart'; import 'package:chart/common/values/values.dart';
import 'package:get/get.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:vibrate/vibrate.dart';
// import 'package:uni_links/uni_links.dart'; // import 'package:uni_links/uni_links.dart';
...@@ -29,6 +33,8 @@ import 'index.dart'; ...@@ -29,6 +33,8 @@ import 'index.dart';
class ApplicationController extends GetxController { class ApplicationController extends GetxController {
ApplicationController(); ApplicationController();
static ApplicationController get to => Get.put(ApplicationController());
/// 响应式成员变量 /// 响应式成员变量
final state = ApplicationState(); final state = ApplicationState();
...@@ -38,12 +44,67 @@ class ApplicationController extends GetxController { ...@@ -38,12 +44,67 @@ class ApplicationController extends GetxController {
// tab 页标题 // tab 页标题
late final List<String> tabTitles; late final List<String> tabTitles;
//键盘
// 页控制器 // 页控制器
late final PageController pageController; late final PageController pageController;
final TextEditingController textController = TextEditingController();
// 底部导航项目 // 底部导航项目
late final List<BottomNavigationBarItem> bottomTabs; 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栏动画 // tab栏动画
...@@ -119,9 +180,14 @@ class ApplicationController extends GetxController { ...@@ -119,9 +180,14 @@ class ApplicationController extends GetxController {
/// 生命周期 /// 生命周期
@override @override
void onInit() { void onInit() async {
super.onInit(); super.onInit();
//
//
// // isKeyboardOpen.value = Get.focusScope.hasFocus;
// });
// handleInitialUri(); // handleInitialUri();
// handleIncomingLinks(); // handleIncomingLinks();
...@@ -154,15 +220,9 @@ class ApplicationController extends GetxController { ...@@ -154,15 +220,9 @@ class ApplicationController extends GetxController {
label: '私人助理', label: '私人助理',
backgroundColor: AppColors.primaryBackground, 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); pageController = PageController(initialPage: state.page);
// await _speechToText.initialize();
} }
@override @override
...@@ -179,6 +239,8 @@ class ApplicationController extends GetxController { ...@@ -179,6 +239,8 @@ class ApplicationController extends GetxController {
void dispose() { void dispose() {
uriSub?.cancel(); uriSub?.cancel();
pageController.dispose(); pageController.dispose();
_speechToText.cancel();
// await _speechToText.initialize();
super.dispose(); super.dispose();
} }
} }
...@@ -5,4 +5,16 @@ class ApplicationState { ...@@ -5,4 +5,16 @@ class ApplicationState {
final _page = 0.obs; final _page = 0.obs;
set page(value) => this._page.value = value; set page(value) => this._page.value = value;
get page => this._page.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;
} }
This diff is collapsed.
...@@ -4,6 +4,7 @@ import 'package:chart/common/apis/apis.dart'; ...@@ -4,6 +4,7 @@ import 'package:chart/common/apis/apis.dart';
import 'package:chart/common/entities/detail.dart'; import 'package:chart/common/entities/detail.dart';
import 'package:chart/common/store/user.dart'; import 'package:chart/common/store/user.dart';
import 'package:chart/common/values/server.dart'; import 'package:chart/common/values/server.dart';
import 'package:clipboard/clipboard.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_client_sse/flutter_client_sse.dart'; import 'package:flutter_client_sse/flutter_client_sse.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
...@@ -47,6 +48,11 @@ class CreationDetailController extends GetxController { ...@@ -47,6 +48,11 @@ class CreationDetailController extends GetxController {
state.detailList.addAll(items); state.detailList.addAll(items);
} }
copyText() {
FlutterClipboard.copy(state.genText).then((value) =>
EasyLoading.showToast("复制成功", maskType: EasyLoadingMaskType.none));
}
void hideKeyboard() => FocusManager.instance.primaryFocus?.unfocus(); void hideKeyboard() => FocusManager.instance.primaryFocus?.unfocus();
void genInner() async { void genInner() async {
await initEventSource(); await initEventSource();
......
...@@ -142,24 +142,73 @@ class HelloWidget extends GetView<CreationDetailController> { ...@@ -142,24 +142,73 @@ class HelloWidget extends GetView<CreationDetailController> {
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 10, vertical: 20), horizontal: 10, vertical: 20),
child: Row( child: Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [ children: [
Container( Row(
width: 3, children: [
height: 22, Container(
decoration: BoxDecoration( width: 3,
color: const Color( height: 22,
0xFFb05ddd), decoration: BoxDecoration(
borderRadius: color: const Color(
BorderRadius.circular( 0xFFb05ddd),
20)), borderRadius:
margin: const EdgeInsets.only( BorderRadius
right: 5), .circular(
20)),
margin:
const EdgeInsets.only(
right: 5),
),
const Text('生成结果',
style: TextStyle(
fontSize: 16,
fontWeight:
FontWeight
.w500)),
],
), ),
const Text('生成结果', InkWell(
style: TextStyle( onTap: () {
fontSize: 16, controller.copyText();
fontWeight: },
FontWeight.w500)), 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> { ...@@ -171,6 +220,13 @@ class HelloWidget extends GetView<CreationDetailController> {
padding: padding:
const EdgeInsets.all(20), const EdgeInsets.all(20),
width: Get.width, width: Get.width,
constraints:
const BoxConstraints(
minHeight: 300,
// minWidth: 200,
// maxHeight: 200,
// 设置最小高度为100
),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: borderRadius:
BorderRadius.circular( BorderRadius.circular(
...@@ -180,11 +236,9 @@ class HelloWidget extends GetView<CreationDetailController> { ...@@ -180,11 +236,9 @@ class HelloWidget extends GetView<CreationDetailController> {
colors: [ colors: [
// 61, 63, 84 // 61, 63, 84
Color.fromARGB( Color.fromARGB(
75, 61, 63, 84), 255, 40, 40, 57),
Color.fromARGB(
75, 51, 52, 80),
Color.fromARGB( Color.fromARGB(
75, 43, 43, 77) 255, 40, 40, 57),
], ],
begin: begin:
Alignment.topCenter, Alignment.topCenter,
......
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:webview_flutter/webview_flutter.dart';
import 'index.dart'; import 'index.dart';
...@@ -7,6 +8,22 @@ class UserEulaController extends GetxController { ...@@ -7,6 +8,22 @@ class UserEulaController extends GetxController {
final state = UserEulaState(); 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 // tap
void handleTap(int index) { void handleTap(int index) {
Get.snackbar( Get.snackbar(
...@@ -25,6 +42,7 @@ class UserEulaController extends GetxController { ...@@ -25,6 +42,7 @@ class UserEulaController extends GetxController {
@override @override
void onReady() { void onReady() {
super.onReady(); super.onReady();
webViewController.loadRequest(Uri.parse('https://p.kdocs.cn/s/UODC2BAAYQ'));
} }
/// 在 [onDelete] 方法之前调用。 /// 在 [onDelete] 方法之前调用。
......
...@@ -74,9 +74,13 @@ class UserEulaPage extends GetView<UserEulaController> { ...@@ -74,9 +74,13 @@ class UserEulaPage extends GetView<UserEulaController> {
body: Container( body: Container(
height: double.infinity, height: double.infinity,
width: double.infinity, width: double.infinity,
child: WebView( child: WebViewWidget(controller: controller.webViewController),
initialUrl: "https://p.kdocs.cn/s/UODC2BAAYQ", // child:
), // WebView(
// initialUrl: "https://p.kdocs.cn/s/UODC2BAAYQ",
// onWebResourceError: (error) {
// print(error);
// }),
)); ));
}, },
); );
......
...@@ -90,14 +90,14 @@ class PayItemWidget extends GetView<PayListController> { ...@@ -90,14 +90,14 @@ class PayItemWidget extends GetView<PayListController> {
)), )),
MarqueeView( MarqueeView(
child: Row(children: [ child: Row(children: [
_buildText('手机用户159****0542购买了按订阅套餐'), _buildText('手机用户159****0542购买了按订阅套餐'),
_buildText('手机用户136****1949购买了按年订阅套餐'), _buildText('手机用户136****1949购买了按年订阅套餐'),
_buildText('手机用户159****1252购买了按订阅套餐'), _buildText('手机用户159****1252购买了按订阅套餐'),
_buildText('手机用户176****1429购买了按订阅套餐'), _buildText('手机用户176****1429购买了按订阅套餐'),
_buildText('手机用户158****8953购买了按订阅套餐'), _buildText('手机用户158****8953购买了按订阅套餐'),
_buildText('手机用户139****2752购买了按年订阅套餐'), _buildText('手机用户139****2752购买了按年订阅套餐'),
_buildText('手机用户130****5959购买了按订阅套餐'), _buildText('手机用户130****5959购买了按订阅套餐'),
_buildText('手机用户158****6048购买了按订阅套餐'), _buildText('手机用户158****6048购买了按订阅套餐'),
_buildText('手机用户136****8962购买了按年订阅套餐'), _buildText('手机用户136****8962购买了按年订阅套餐'),
]), ]),
), ),
......
import 'package:chart/common/routers/routes.dart'; import 'package:chart/common/routers/routes.dart';
import 'package:chart/common/store/store.dart'; import 'package:chart/common/store/store.dart';
import 'package:chart/pages/application/controller.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'index.dart'; import 'index.dart';
...@@ -8,7 +9,7 @@ class WelcomeController extends GetxController { ...@@ -8,7 +9,7 @@ class WelcomeController extends GetxController {
final state = WelcomeState(); final state = WelcomeState();
WelcomeController(); WelcomeController();
// WILL_COME
// 跳转 注册界面 // 跳转 注册界面
handleNavSignIn() async { handleNavSignIn() async {
await ConfigStore.to.saveAlreadyOpen(); await ConfigStore.to.saveAlreadyOpen();
...@@ -19,7 +20,9 @@ class WelcomeController extends GetxController { ...@@ -19,7 +20,9 @@ class WelcomeController extends GetxController {
handleHome() async { handleHome() async {
await UserStore.to.refreshInfo(); await UserStore.to.refreshInfo();
await ConfigStore.to.saveAlreadyOpen(); await ConfigStore.to.saveAlreadyOpen();
// ApplicationController.to.state.isNetWorkErr = false;
Get.offAndToNamed(AppRoutes.Application); Get.offAndToNamed(AppRoutes.Application);
// Get.put(ApplicationController());
} }
@override @override
......
...@@ -7,6 +7,7 @@ import 'package:chart/common/values/server.dart'; ...@@ -7,6 +7,7 @@ import 'package:chart/common/values/server.dart';
import 'package:chart/entity/user_entity.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' as Chat;
import 'package:chart/package/chat_dash/dash_chat_2.dart'; 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/category/controller.dart';
import 'package:chart/pages/frame/product/controller.dart'; import 'package:chart/pages/frame/product/controller.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
...@@ -15,6 +16,7 @@ import 'package:flutter/widgets.dart'; ...@@ -15,6 +16,7 @@ import 'package:flutter/widgets.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_vibrate/flutter_vibrate.dart'; import 'package:flutter_vibrate/flutter_vibrate.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:highlight/languages/awk.dart';
import 'package:share_plus/share_plus.dart'; import 'package:share_plus/share_plus.dart';
import 'package:uuid/uuid.dart'; import 'package:uuid/uuid.dart';
import 'package:flutter_chat_types/flutter_chat_types.dart' as types; import 'package:flutter_chat_types/flutter_chat_types.dart' as types;
...@@ -255,6 +257,16 @@ class HomeController extends GetxController with SingleGetTickerProviderMixin { ...@@ -255,6 +257,16 @@ class HomeController extends GetxController with SingleGetTickerProviderMixin {
Get.toNamed("${AppRoutes.CHAT_PAGE}"); 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 { sendMessageByBanner(String message) async {
await createConversionId(); await createConversionId();
...@@ -292,9 +304,8 @@ class HomeController extends GetxController with SingleGetTickerProviderMixin { ...@@ -292,9 +304,8 @@ class HomeController extends GetxController with SingleGetTickerProviderMixin {
return; return;
} }
Map<String, dynamic> jsonMap = jsonDecode("${event.data}"); Map<String, dynamic> jsonMap = jsonDecode("${event.data}");
if (jsonMap['askType'] == 1) {
_updateMessage("${jsonMap['content']}" as String); _updateMessage("${jsonMap['content']}" as String);
}
}); });
// print(sse); // print(sse);
...@@ -308,7 +319,7 @@ class HomeController extends GetxController with SingleGetTickerProviderMixin { ...@@ -308,7 +319,7 @@ class HomeController extends GetxController with SingleGetTickerProviderMixin {
} }
_updateMessage(String text) { _updateMessage(String text) {
print(state.messageList.length); // print(state.messageList.length);
// state.messageList[0].text = state.messageList[0].text + text; // state.messageList[0].text = state.messageList[0].text + text;
// state.messageList.forEach((element) { // state.messageList.forEach((element) {
// print(element.text); // print(element.text);
...@@ -317,19 +328,34 @@ class HomeController extends GetxController with SingleGetTickerProviderMixin { ...@@ -317,19 +328,34 @@ class HomeController extends GetxController with SingleGetTickerProviderMixin {
if (state.messageList.isEmpty) { if (state.messageList.isEmpty) {
return; return;
} }
state.messageList.setRange(0, 1, [ if (text.contains("建议您重新开启一个会话。")) {
ChatMessage( state.messageList.setRange(0, 1, [
user: receiveUser, ChatMessage(
createdAt: DateTime.now(), user: receiveUser,
text: state.messageList.value[0].text == "LOADING" createdAt: DateTime.now(),
? text text: "您关联的上下文超出了我的理解能力范围,请点击右上角刷新按钮重置会话。"
: state.messageList.value[0].text + text // user: receiveUser,
// user: receiveUser, // createdAt: DateTime.now(),
// createdAt: DateTime.now(), // // id: const Uuid().v4(),
// // id: const Uuid().v4(), // text: "",
// 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 = [...state.messageList.value];list.setRange(1, 4, [9, 9, 9]);
// state.messageList.value[0].text = state.messageList.value[0].text + text; // state.messageList.value[0].text = state.messageList.value[0].text + text;
} }
...@@ -427,5 +453,16 @@ class HomeController extends GetxController with SingleGetTickerProviderMixin { ...@@ -427,5 +453,16 @@ class HomeController extends GetxController with SingleGetTickerProviderMixin {
// refreshController.dispose(); // 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) {} // obx(Map map) {}
} }
...@@ -75,5 +75,13 @@ class ChatPageState { ...@@ -75,5 +75,13 @@ class ChatPageState {
set isNext(value) => _isNext.value = value; set isNext(value) => _isNext.value = value;
get isNext => _isNext.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; // RxList<NewsItem> newsList = <NewsItem>[].obs;
} }
This diff is collapsed.
...@@ -180,9 +180,6 @@ class MyPage extends GetView<MyController> { ...@@ -180,9 +180,6 @@ class MyPage extends GetView<MyController> {
), ),
), ),
), ),
Container(
child: Text("12"),
)
// GradientButton(child: Text("321"), callback: () {}) // GradientButton(child: Text("321"), callback: () {})
], ],
); );
......
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:webview_flutter/webview_flutter.dart';
import 'index.dart'; import 'index.dart';
...@@ -7,6 +8,21 @@ class PrivacyController extends GetxController { ...@@ -7,6 +8,21 @@ class PrivacyController extends GetxController {
final state = PrivacyState(); 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 // tap
void handleTap(int index) { void handleTap(int index) {
Get.snackbar( Get.snackbar(
...@@ -24,6 +40,7 @@ class PrivacyController extends GetxController { ...@@ -24,6 +40,7 @@ class PrivacyController extends GetxController {
/// 在 onInit() 之后调用 1 帧。这是进入的理想场所 /// 在 onInit() 之后调用 1 帧。这是进入的理想场所
@override @override
void onReady() { void onReady() {
webViewController.loadRequest(Uri.parse('https://p.kdocs.cn/s/YXFCYBAAYQ'));
super.onReady(); super.onReady();
} }
......
...@@ -75,9 +75,10 @@ class PrivacyPage extends GetView<PrivacyController> { ...@@ -75,9 +75,10 @@ class PrivacyPage extends GetView<PrivacyController> {
body: Container( body: Container(
height: double.infinity, height: double.infinity,
width: double.infinity, width: double.infinity,
child: WebView( child: WebViewWidget(controller: controller.webViewController),
initialUrl: "https://p.kdocs.cn/s/YXFCYBAAYQ", // child: WebViewWidget(
), // initialUrl: "https://p.kdocs.cn/s/YXFCYBAAYQ",
// ),
// 【金山文档】 隐私政策 // 【金山文档】 隐私政策
// decoration: BoxDecoration( // decoration: BoxDecoration(
......
...@@ -571,6 +571,13 @@ packages: ...@@ -571,6 +571,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.2.1" 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: flutter_plugin_android_lifecycle:
dependency: transitive dependency: transitive
description: description:
...@@ -812,6 +819,13 @@ packages: ...@@ -812,6 +819,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.0" version: "1.0.0"
keyboard_utils:
dependency: transitive
description:
name: keyboard_utils
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.4"
linkify: linkify:
dependency: transitive dependency: transitive
description: description:
...@@ -1418,28 +1432,28 @@ packages: ...@@ -1418,28 +1432,28 @@ packages:
name: webview_flutter name: webview_flutter
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.4" version: "4.0.7"
webview_flutter_android: webview_flutter_android:
dependency: transitive dependency: transitive
description: description:
name: webview_flutter_android name: webview_flutter_android
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.10.4" version: "3.4.5"
webview_flutter_platform_interface: webview_flutter_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: webview_flutter_platform_interface name: webview_flutter_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.9.5" version: "2.1.0"
webview_flutter_wkwebview: webview_flutter_wkwebview:
dependency: transitive dependency: transitive
description: description:
name: webview_flutter_wkwebview name: webview_flutter_wkwebview
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.9.5" version: "3.2.4"
win32: win32:
dependency: transitive dependency: transitive
description: description:
......
...@@ -49,7 +49,7 @@ dependencies: ...@@ -49,7 +49,7 @@ dependencies:
dio: ^4.0.6 dio: ^4.0.6
fluro: ^2.0.3 fluro: ^2.0.3
shared_preferences: ^2.0.15 shared_preferences: ^2.0.15
webview_flutter: ^3.0.4 webview_flutter: ^4.0.7
provider: ^6.0.3 provider: ^6.0.3
flutter_screenutil: ^5.5.3+2 flutter_screenutil: ^5.5.3+2
flutter_login: ^3.2.0 flutter_login: ^3.2.0
...@@ -126,6 +126,8 @@ dependencies: ...@@ -126,6 +126,8 @@ dependencies:
flutter_tts: ^3.6.3 flutter_tts: ^3.6.3
custom_pop_up_menu: ^1.2.4 custom_pop_up_menu: ^1.2.4
speech_to_text: ^6.1.1 speech_to_text: ^6.1.1
flutter_persistent_keyboard_height: ^1.0.5
# package:bubble/bubble.dart # package:bubble/bubble.dart
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment