Commit 24ec97a4 authored by 关振斌's avatar 关振斌

update

parent d66f0f4f
......@@ -4,7 +4,7 @@
<dict>
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:www.fusiontech.cn/</string>
<string>applinks:www.hahagpt.com/app/</string>
</array>
</dict>
</plist>
......@@ -3,14 +3,17 @@ part of dash_chat_2;
/// {@category Default widgets}
InputDecoration defaultInputDecoration(
void Function() sendMessage, {
void Function() sendMessage,
bool bool, {
String hintText = '请输入问题...',
TextStyle hintStyle = const TextStyle(color: Colors.grey),
Color? fillColor,
bool inputDisabled = true,
}) =>
InputDecoration(
isDense: true,
hintText: hintText,
hintText: !inputDisabled ? 'AI正在输入中...' : hintText,
hintStyle: hintStyle,
filled: true,
// fillColor: fillColor ?? Colors.grey[100],
......
......@@ -100,7 +100,13 @@ class _InputToolbarState extends State<InputToolbar>
textCapitalization: widget.inputOptions.textCapitalization,
textInputAction: widget.inputOptions.textInputAction,
decoration: widget.inputOptions.inputDecoration ??
defaultInputDecoration(_sendMessage),
defaultInputDecoration(
_sendMessage,
hintText: widget.inputOptions.inputDisabled
? 'AI正在输入中...'
: '请输入问题...',
!widget.inputOptions.inputDisabled,
),
maxLength: widget.inputOptions.maxInputLength,
minLines: 1,
maxLines: 1,
......
......@@ -77,7 +77,9 @@ class AssistantItemController extends GetxController {
"question": message.text,
"sceneId": state.selectItem['sceneId'],
});
} catch (e) {}
} catch (e) {
state.isLoading = false;
}
// final loadingMessage = types.TextMessage(
// author: receiveUser,
......@@ -93,15 +95,16 @@ class AssistantItemController extends GetxController {
SSEClient.subscribeToSSE(
url: "$SERVER_API_URL/openAi/connect/${UserStore.to.profile.id}",
header: {}).listen((event) async {
print(event);
if (event.data!.trim().isEmpty) {
return;
} else if (event.id == "[DONE]") {
print('event.id${event.id}');
state.isLoading = false;
await UserAPI.saveResp({
"conversionId": state.actId,
"content": state.messageList[0].text,
});
state.isLoading = false;
return;
}
Map<String, dynamic> jsonMap = jsonDecode("${event.data}");
......
......@@ -49,36 +49,36 @@ class AssistantItemPage extends GetView<AssistantItemController> {
])),
),
body: KeyboardVisibilityBuilder(builder: (context, visible) {
return Chat.DashChat(
inputOptions: Chat.InputOptions(
textInputAction: TextInputAction.send,
sendOnEnter: true,
// showTraillingBeforeSend: true,
// inputDisabled: cc.state.isLoading,
inputTextStyle: TextStyle(color: Colors.white),
inputToolbarStyle: BoxDecoration(
color: Color.fromARGB(120, 0, 0, 0),
// Color.fromARGB(0, 54, 59, 72),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(16),
topRight: Radius.circular(16)),
),
inputToolbarMargin: EdgeInsets.all(0),
sendButtonBuilder: null,
inputToolbarPadding: EdgeInsets.only(
top: 15,
right: 15,
left: 15,
bottom: visible ? 15 : 50),
),
currentUser: _user,
onSend: cc.sendMessage,
messages: cc.state.messageList,
messageOptions: Chat.MessageOptions(
onPressMessage: cc.tabMessage,
// containerColor: Colors.black,
),
);
return Obx(() => Chat.DashChat(
inputOptions: Chat.InputOptions(
textInputAction: TextInputAction.send,
sendOnEnter: true,
// showTraillingBeforeSend: true,
inputDisabled: cc.state.isLoading,
inputTextStyle: TextStyle(color: Colors.white),
inputToolbarStyle: BoxDecoration(
color: Color.fromARGB(120, 0, 0, 0),
// Color.fromARGB(0, 54, 59, 72),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(16),
topRight: Radius.circular(16)),
),
inputToolbarMargin: EdgeInsets.all(0),
sendButtonBuilder: null,
inputToolbarPadding: EdgeInsets.only(
top: 15,
right: 15,
left: 15,
bottom: visible ? 15 : 50),
),
currentUser: _user,
onSend: cc.sendMessage,
messages: cc.state.messageList,
messageOptions: Chat.MessageOptions(
onPressMessage: cc.tabMessage,
// containerColor: Colors.black,
),
));
})),
));
}
......
......@@ -38,6 +38,7 @@ class AssistantController extends GetxController {
'sceneId': item.id
};
AssistantItemController.to.state.messageList.clear();
AssistantItemController.to.state.isLoading = false;
// CreationDetailController.to
// .updateState('${item.id}', item.detailName, res.data!);
Get.toNamed(AppRoutes.ASSISTANT_ITEM);
......
......@@ -60,29 +60,22 @@ class GridWidget extends GetView<AssistantController> {
delegate: SliverChildBuilderDelegate(
(context, index) {
return Container(
padding: const EdgeInsets.only(
left: 10,
right: 10,
),
margin: const EdgeInsets.only(
top: 10,
bottom: 20,
),
child: Obx(() => StaggeredGrid.count(
crossAxisCount: 1,
mainAxisSpacing: 20,
crossAxisSpacing: 10,
children: List.generate(controller.sceneList.length, (index) {
return StaggeredGridTile.count(
crossAxisCellCount: 1,
mainAxisCellCount: 0.31,
child: Container(
// margin: EdgeInsets.only(bottom: 20),
child: InkWell(
padding: const EdgeInsets.only(
left: 10,
right: 10,
),
margin: const EdgeInsets.only(
top: 10,
bottom: 20,
),
child: Obx(() => Column(
children: controller.sceneList.map((element) {
return Container(
margin: EdgeInsets.only(bottom: 20),
child: InkWell(
borderRadius: BorderRadius.circular(10),
onTap: () {
controller.onTap(controller.sceneList[index]);
controller.onTap(element);
},
child: Ink(
padding: EdgeInsets.all(10),
......@@ -101,6 +94,8 @@ class GridWidget extends GetView<AssistantController> {
]),
),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
ClipRRect(
borderRadius: BorderRadius.circular(40),
......@@ -111,8 +106,7 @@ class GridWidget extends GetView<AssistantController> {
Duration(milliseconds: 500),
placeholder: const AssetImage(
'assets/images/loading.gif'), // 加载指示器
image: NetworkImage(
'${controller.sceneList[index].icon}'),
image: NetworkImage('${element.icon}'),
// image: NetworkImage(
// 'https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.pinterest.com%2Fpin%2Fai-visualization-design-fui-artificial-intelligence-siri-filter-ai-loading-logo-flow-light--400538960609301125%2F&psig=AOvVaw0X4iFGabqA_JwUiW9zEG4u&ust=1680859399497000&source=images&cd=vfe&ved=0CA8QjRxqFwoTCLiAnK33lP4CFQAAAAAdAAAAABAb'), // 图像URL
fit: BoxFit.cover, // 图像适应方式
......@@ -120,7 +114,7 @@ class GridWidget extends GetView<AssistantController> {
),
),
// Image.network(
// controller.sceneList[index].icon),
// element.icon),
Expanded(
child: Container(
// color: Colors.red,
......@@ -128,6 +122,8 @@ class GridWidget extends GetView<AssistantController> {
left: 10,
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.spaceAround,
children: [
......@@ -136,9 +132,7 @@ class GridWidget extends GetView<AssistantController> {
MainAxisAlignment
.spaceBetween,
children: [
Text(controller
.sceneList[index]
.sceneName),
Text(element.sceneName),
GradientButton(
child: Text('咨询',
style: TextStyle(
......@@ -146,9 +140,7 @@ class GridWidget extends GetView<AssistantController> {
increaseHeightBy: -5.00,
increaseWidthBy: -10.00,
callback: () {
controller.onTap(
controller.sceneList[
index]);
controller.onTap(element);
},
// controller.requestPurchase,
gradient:
......@@ -174,8 +166,7 @@ class GridWidget extends GetView<AssistantController> {
// .withOpacity(0.25),
)
]),
Text(
"${controller.sceneList[index].sceneDesc}",
Text("${element.sceneDesc}",
maxLines: 2,
textAlign: TextAlign.left,
overflow: TextOverflow.ellipsis,
......@@ -185,11 +176,50 @@ class GridWidget extends GetView<AssistantController> {
)
],
),
)),
),
);
}).toList())),
);
),
),
);
}).toList(),
))
// Obx(() => StaggeredGrid.count(
// crossAxisCount: 1,
// mainAxisSpacing: 20,
// crossAxisSpacing: 10,
// children: List.generate(controller.sceneList.length, (index) {
// return StaggeredGridTile.count(
// crossAxisCellCount: 1,
// mainAxisCellCount: 0.31,
// child: Container(
// // margin: EdgeInsets.only(bottom: 20),
// child: InkWell(
// borderRadius: BorderRadius.circular(10),
// onTap: () {
// controller.onTap(element);
// },
// child: Ink(
// padding: EdgeInsets.all(10),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(10),
// // ignore: prefer_const_constructors
// gradient: LinearGradient(
// begin: Alignment.topCenter,
// end: Alignment.bottomCenter,
// // background-image: linear-gradient(180deg, #3d3f54, #333450, #2b2b4d);
// colors: const [
// Color(0xFF3d3f54),
// Color(0xFF333450),
// Color(0xFF2b2b4d)
// ]),
// ),
// child: ,
// )),
// ),
// );
// }).toList())),
);
},
childCount: 1,
))
......
......@@ -96,7 +96,7 @@ class GridWidget extends GetView<CreationController> {
},
child: Column(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceEvenly,
children: [
Padding(
padding:
......
......@@ -60,10 +60,16 @@ class PayListController extends GetxController {
@override
void onInit() async {
super.onInit();
await initializedPlugins();
EasyLoading.show(status: "正在获取套餐中...");
await _getProduct();
EasyLoading.dismiss();
try {
await initializedPlugins();
EasyLoading.show(status: "正在获取套餐中...");
state.loadingList = true;
await _getProduct();
state.loadingList = false;
EasyLoading.dismiss();
} catch (e) {
state.loadingList = false;
}
// await initializedPlugins();
// new 对象
// 初始静态数据
......@@ -77,9 +83,7 @@ class PayListController extends GetxController {
// setState to update our non-existent appearance.
_conectionSubscription =
FlutterInappPurchase.connectionUpdated.listen((connected) {
print('connected: $connected');
});
FlutterInappPurchase.connectionUpdated.listen((connected) {});
_purchaseUpdatedSubscription =
FlutterInappPurchase.purchaseUpdated.listen((productItem) async {
......@@ -87,12 +91,14 @@ class PayListController extends GetxController {
'receipt': productItem?.transactionReceipt,
'userId': UserStore.to.profile.id,
'productId': productItem!.productId,
"chooseEnv": false
"chooseEnv": false,
"transactionId": productItem.transactionId,
// "transactionDate": productItem.transactionDate!.toIso8601String(),
});
if (res?.status == 200) {
state.loading = false;
EasyLoading.showSuccess('${res?.message}');
EasyLoading.showSuccess(res.message);
Vibrate.feedback(FeedbackType.success);
EasyLoading.dismiss();
UserAPI.getUserInfo().then((value) async {
......@@ -163,7 +169,7 @@ class PayListController extends GetxController {
// print("${item.productId}");
// 处理以前购买的产品
// 处理以前购买的产2
}
}
......
......@@ -15,5 +15,9 @@ class PayListState {
set loading(value) => _loading.value = value;
get loading => _loading.value;
final _loadingList = false.obs;
set loadingList(value) => _loadingList.value = value;
get loadingList => _loadingList.value;
RxList<IAPItem> items = <IAPItem>[].obs;
}
import 'dart:math';
import 'package:card_swiper/card_swiper.dart';
import 'package:chart/common/routers/names.dart';
import 'package:chart/common/store/user.dart';
import 'package:flutter/material.dart';
......@@ -21,13 +22,13 @@ const color = Color(0xff8AFBFF);
class PayItemWidget extends GetView<PayListController> {
@override
Widget build(BuildContext context) {
Random random = new Random();
// Random random = new Random();
// List<Bullet> bullets = [];
List<Bullet> bullets = List<Bullet>.generate(1000, (i) {
final showTime = random.nextInt(60000); // in 60s
return Bullet(child: Text('$i-$showTime'), showTime: showTime);
});
// List<Bullet> bullets = List<Bullet>.generate(1000, (i) {
// final showTime = random.nextInt(60000); // in 60s
// return Bullet(child: Text('$i-$showTime'), showTime: showTime);
// });
final barrageWallController = BarrageWallController();
final textEditingController = TextEditingController();
// final textEditingController = TextEditingController();
......@@ -38,13 +39,16 @@ class PayItemWidget extends GetView<PayListController> {
child: ListView(
children: [
Obx(() => c.profile.expireTime == null
? const Text(
"您还不是 VIP 会员",
style: TextStyle(
color: Color.fromARGB(255, 160, 165, 184),
fontSize: 14,
? const Center(
child: Text(
"您还不是 VIP 会员",
style: TextStyle(
color: Color.fromARGB(255, 160, 165, 184),
fontSize: 14,
),
),
)
// 那俄语呢 那他的反义词呢
: Align(
alignment: Alignment.center,
child: Container(
......@@ -266,7 +270,7 @@ class PayItemWidget extends GetView<PayListController> {
255, 241, 197, 131)),
),
Text(
${(int.parse(element.price!) * 1.2).toInt()}',
${(double.parse(element.price!) * 1.2).toStringAsFixed(2)}',
style: TextStyle(
color:
Color.fromARGB(255, 140, 145, 151),
......@@ -540,54 +544,45 @@ class PayItemWidget extends GetView<PayListController> {
]))
],
)),
Container(
padding: const EdgeInsets.only(
top: 10,
bottom: 50,
),
decoration: BoxDecoration(
color: const Color(0xFF3d3f54).withOpacity(.8),
// gradient: const LinearGradient(
// colors: [Color(0xFF3d3f54), Color(0xFF333450), Color(0xFF2b2b4d)],
// begin: Alignment.topCenter,
// end: Alignment.bottomCenter,
// )
),
width: Get.width,
child: Obx(
() => GradientButton(
increaseHeightBy: 10.00,
increaseWidthBy: Get.width * .7,
callback: () {
controller.requestPurchase();
},
isEnabled: !controller.state.loading,
// callback: controller.genInner,
shapeRadius: const BorderRadius.all(Radius.circular(5)),
// controller.requestPurchase,
// gradient: Gradients.cosmicFusion,
// background-image: linear-gradient(180deg, #3d3f54, #333450, #2b2b4d);
elevation: 0,
gradient: const LinearGradient(
colors: [
// 61, 63, 84
// 180deg,
// #be6afb,
// #9c67f6,
// #7965f8
Color(0xFFbe6afb),
Color(0xFF9c67f6),
Color(0xFF7965f8)
],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
// loadingList
Obx(() => AnimatedOpacity(
opacity: controller.state.loadingList ? 0 : 1,
duration: const Duration(milliseconds: 500),
child: Container(
padding: const EdgeInsets.only(
top: 10,
bottom: 50,
),
child: const Text('立即解锁',
style:
TextStyle(fontSize: 14, fontWeight: FontWeight.w500)),
),
))
decoration: BoxDecoration(
color: const Color(0xFF3d3f54).withOpacity(.8),
),
width: Get.width,
child: Obx(
() => GradientButton(
increaseHeightBy: 10.00,
increaseWidthBy: Get.width * .7,
callback: () {
controller.requestPurchase();
},
isEnabled: !controller.state.loading,
// callback: controller.genInner,
shapeRadius: const BorderRadius.all(Radius.circular(5)),
elevation: 0,
gradient: const LinearGradient(
colors: [
Color(0xFFbe6afb),
Color(0xFF9c67f6),
Color(0xFF7965f8)
],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
child: const Text('立即解锁',
style: TextStyle(
fontSize: 14, fontWeight: FontWeight.w500)),
),
))))
],
);
}
......
......@@ -335,14 +335,15 @@ class HomeController extends GetxController with SingleGetTickerProviderMixin {
}
reset() async {
rotateIcon();
await rotateIcon();
try {
await UserAPI.resetConversion();
EasyLoading.showToast('重置成功');
EasyLoading.showToast('已将对话上下文重置!', maskType: EasyLoadingMaskType.none);
} catch (e) {}
}
virtualPay(){
virtualPay() {
if (GetPlatform.isAndroid) {
Get.toNamed(AppRoutes.AN_PAY_LIST);
} else {
......@@ -406,14 +407,15 @@ class HomeController extends GetxController with SingleGetTickerProviderMixin {
Animation<double> get animation => _animation;
void rotateIcon() {
Future rotateIcon() {
if (_isRotated) {
_controller.reverse();
_controller.repeat();
} else {
_controller.forward();
_controller.repeat();
}
_isRotated = !_isRotated;
update();
return Future.delayed(Duration(seconds: 2), () => _controller.stop());
}
///dispose 释放内存
......
......@@ -96,7 +96,7 @@ class HomePage extends GetView<HomeController> {
color: Color.fromARGB(255, 95, 54, 0),
fontSize: 16)),
]),
callback:()=> controller.virtualPay()),
callback: () => controller.virtualPay()),
),
body: SizedBox(
width: double.infinity,
......@@ -107,14 +107,16 @@ class HomePage extends GetView<HomeController> {
// color: Color.fromARGB(0, 29, 33, 60),
// color: Color.fromARGB(255, 26, 27, 46),
child: Chat.DashChat(
inputOptions: const Chat.InputOptions(
inputOptions: Chat.InputOptions(
textInputAction: TextInputAction.send,
inputDisabled: cc.state.isLoading,
sendOnEnter: true,
// showTraillingBeforeSend: true,
// inputDisabled: cc.state.isLoading,
inputTextStyle: TextStyle(color: Colors.white),
inputToolbarStyle: BoxDecoration(
color: Color.fromARGB(120, 0, 0, 0),
// Color.fromARGB(0, 54, 59, 72),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(16),
......@@ -130,6 +132,7 @@ class HomePage extends GetView<HomeController> {
messages: cc.state.messageList,
messageOptions: Chat.MessageOptions(
onPressMessage: cc.tabMessage,
onLongPressMessage: (mes) => {},
// containerColor: Colors.black,
),
),
......
......@@ -16,11 +16,13 @@ class MyPage extends GetView<MyController> {
padding: EdgeInsets.symmetric(horizontal: 10),
children: [
Obx(() => c.profile.expireTime == null
? const Text(
"您还不是 VIP 会员",
style: TextStyle(
color: Color.fromARGB(255, 160, 165, 184),
fontSize: 14,
? const Center(
child: Text(
"您还不是 VIP 会员",
style: TextStyle(
color: Color.fromARGB(255, 160, 165, 184),
fontSize: 14,
),
),
)
: Align(
......@@ -64,6 +66,7 @@ class MyPage extends GetView<MyController> {
Container(
margin: EdgeInsets.only(top: 20),
child: InkWell(
borderRadius: BorderRadius.circular(10),
onTap: () {
Get.toNamed(AppRoutes.PAY_LIST);
},
......@@ -102,6 +105,7 @@ class MyPage extends GetView<MyController> {
Container(
margin: EdgeInsets.only(top: 20),
child: InkWell(
borderRadius: BorderRadius.circular(10),
onTap: () {
Get.toNamed(AppRoutes.USER_EULA);
},
......@@ -140,6 +144,7 @@ class MyPage extends GetView<MyController> {
Container(
margin: EdgeInsets.only(top: 20),
child: InkWell(
borderRadius: BorderRadius.circular(10),
onTap: () {
Get.toNamed(AppRoutes.PRIVACT);
},
......@@ -174,6 +179,9 @@ class MyPage extends GetView<MyController> {
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 15),
),
),
),
Container(
child: Text("12"),
)
// GradientButton(child: Text("321"), callback: () {})
],
......
......@@ -16,6 +16,7 @@ import share_plus
import shared_preferences_foundation
import sign_in_with_apple
import smart_auth
import speech_to_text_macos
import sqflite
import url_launcher_macos
......@@ -31,6 +32,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
SignInWithApplePlugin.register(with: registry.registrar(forPlugin: "SignInWithApplePlugin"))
SmartAuthPlugin.register(with: registry.registrar(forPlugin: "SmartAuthPlugin"))
SpeechToTextMacosPlugin.register(with: registry.registrar(forPlugin: "SpeechToTextMacosPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
}
......@@ -1202,6 +1202,27 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.0"
speech_to_text:
dependency: "direct main"
description:
name: speech_to_text
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.1"
speech_to_text_macos:
dependency: transitive
description:
name: speech_to_text_macos
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
speech_to_text_platform_interface:
dependency: transitive
description:
name: speech_to_text_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
sqflite:
dependency: transitive
description:
......
......@@ -125,6 +125,7 @@ dependencies:
clipboard: ^0.1.3
flutter_tts: ^3.6.3
custom_pop_up_menu: ^1.2.4
speech_to_text: ^6.1.1
# 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