Commit 5fcf9f32 authored by 关振斌's avatar 关振斌

update

parent 2f7c6604
......@@ -25,17 +25,24 @@ class NewsAPI {
return response['data'];
}
static Future<int> aiAnswerWithStream(Map<String, String> params) async {
var response =
await HttpUtil().post('/openAi/aiAnswerWithStream', data: params);
return response['status'];
}
// /api/openAi/aiAnswerWithStream
static Future<String> doPay(Map<String, String> params) async {
var response = await HttpUtil().post('/pay/doPay', data: params);
return response['data'];
}
// /api/pay/doPay
static Future<String> sendMessageByDetailId(
static Future<int> sendMessageByDetailId(
dynamic params, String detailId) async {
var response =
await HttpUtil().post('/openAi/aiAnswer/${detailId}', data: params);
return response['data'];
return response['status'];
}
static Future<List<GoodEntity>> getGoodsList() async {
......
// baidu yapi
// const SERVER_API_URL = 'https://yapi.baidu.com/mock/41008';
// const SERVER_API_URL = 'https://yapi.ducafecat.tech/mock/11';
// const SERVER_API_URL = 'http://101.34.153.228:8083/api';//线上
// const SERVER_API_URL = 'http://192.168.110.127:8083/api';
const SERVER_API_URL = 'http://101.34.153.228:8083/api';//线上
// http://192.168.110.127:8083/api/doc.html
// http://192.168.110.66:8083/api/doc.html
const SERVER_API_URL = 'http://192.168.110.66:8083/api';
// const SERVER_API_URL = 'http://192.168.110.66:8083/api';
// http://192.168.110.25:8083/
// const SERVER_API_URL = 'http://192.168.2.178:8083/api';
// const SERVER_API_URL = 'http://192.168.110.57:8083/api';
......
......@@ -13,7 +13,7 @@ AppBar transparentAppBar({
// elevation: 2,
title: title,
leading: leading ?? null,
// actions: actions,
actions: actions,
);
}
......
......@@ -5,6 +5,7 @@ import 'dart:math';
import 'package:animated_text_kit/animated_text_kit.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:flutter_parsed_text/flutter_parsed_text.dart';
import 'package:gradient_borders/input_borders/gradient_outline_input_border.dart';
import 'package:intl/intl.dart' as intl;
......
......@@ -60,6 +60,24 @@ class _InputToolbarState extends State<InputToolbar>
super.dispose();
}
// AnimatedTextKit(
// onFinished: () => {},
// totalRepeatCount: 1,
// animatedTexts: identical(message.status, Status.sending)
// ? [
// TypewriterAnimatedText('正在思考中......'),
// TypewriterAnimatedText('正在使劲思考中......'),
// TypewriterAnimatedText('正在拼命思考中......'),
// TypewriterAnimatedText('您的问题太有深度,请稍等......'),
// ]
// : [
// TypewriterAnimatedText(
// message.text,
// speed: const Duration(milliseconds: 100),
// )
// ],
// )
@override
Widget build(BuildContext context) {
return Container(
......@@ -75,47 +93,62 @@ class _InputToolbarState extends State<InputToolbar>
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),
maxLength: widget.inputOptions.maxInputLength,
minLines: 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.inputDisabled
? Center(
child: AnimatedTextKit(
animatedTexts: [
TypewriterAnimatedText('AI正在生成中......',
textStyle: TextStyle(color: Colors.white)),
],
)
// Text("请稍等", style: TextStyle(color: Colors.white)
,
)
: TextField(
focusNode: focusNode,
controller: textController,
enabled: !widget.inputOptions.inputDisabled,
textCapitalization:
widget.inputOptions.textCapitalization,
textInputAction: widget.inputOptions.textInputAction,
decoration: widget.inputOptions.inputDecoration ??
defaultInputDecoration(_sendMessage),
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,
),
),
),
if (widget.inputOptions.trailing != null &&
widget.inputOptions.showTraillingBeforeSend)
...widget.inputOptions.trailing!,
//发送按钮重写
// inputDisabled
// if (widget.inputOptions.alwaysShowSend ||
// textController.text.isNotEmpty)
// widget.inputOptions.sendButtonBuilder != null
......
......@@ -54,23 +54,13 @@ class DefaultAvatar extends StatelessWidget {
ClipOval(
child: Container(
color: Colors.grey[200],
child: getInitials().isNotEmpty
? Center(
child: Text(
getInitials(),
style: TextStyle(
color: Colors.black,
fontSize: size * 0.35,
),
),
)
: Image(
image: fallbackImage ??
const AssetImage(
'assets/profile_placeholder.png',
package: 'dash_chat_2',
),
child: Image(
image: fallbackImage ??
const AssetImage(
'assets/images/logo.png',
// package: 'dash_chat_2',
),
),
),
),
if (user.profileImage != null && user.profileImage!.isNotEmpty)
......
......@@ -97,7 +97,7 @@ class DefaultMessageText extends StatelessWidget {
Widget getPostMessageBuild(String text, List<ChatMessage> messageLength,
bool isOwnMessage, int index) {
var lastMessage = messageLength.first;
// var lastMessage = messageLength.first;
// if(lastMessage.) {
......@@ -107,23 +107,18 @@ class DefaultMessageText extends StatelessWidget {
// if(a.is)
// if()
return index == 0
? AnimatedTextKit(
animatedTexts: [
TypewriterAnimatedText(
text,
textStyle: const TextStyle(
// fontSize: 32.0,
// fontWeight: FontWeight.bold,
),
speed: const Duration(milliseconds: 100),
)
],
totalRepeatCount: 1,
// displayFullTextOnTap: true,
// stopPauseOnTap: true,
)
: Text(text);
// Text(text);
// return Container(
// height: 200,
// child: Markdown(data: text, selectable: true),
// );
return RichText(
text: TextSpan(text: text, style: TextStyle(color: Colors.black)),
// selectionRegistrar: SelectionContainer.maybeOf(context),
selectionColor: const Color(0xAF6694e8),
);
// Markdown(data: text, selectable: true);
}
// {buildPostMessage = getPostMessageBuild}
......
import 'dart:async';
import 'package:chart/common/apis/apis.dart';
import 'package:chart/common/store/store.dart';
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/frame/product/controller.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
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:share_plus/share_plus.dart';
import 'package:uuid/uuid.dart';
import 'package:flutter_chat_types/flutter_chat_types.dart' as types;
import 'index.dart';
import 'package:eventsource/eventsource.dart';
import 'dart:convert';
import 'package:flutter/services.dart';
// EventSource eventSource = EventSource(Uri.parse('http://example.com/events'));
//
class ChatNewController extends GetxController {
ChatNewController();
......@@ -16,6 +30,8 @@ class ChatNewController extends GetxController {
final state = ChatPageState();
late StreamSubscription<Event> eventSource;
/// 成员变量
/// 事件
......@@ -42,6 +58,7 @@ class ChatNewController extends GetxController {
/// 事件
void sendMessage(Chat.ChatMessage message) async {
print("${message.text}321321321");
Vibrate.feedback(FeedbackType.impact);
// if (state.messageList.isNotEmpty) {
// // data = !_messages.every((element) => element.status != Status.sending);
......@@ -78,32 +95,41 @@ class ChatNewController extends GetxController {
_addMessage(textMessage);
// _addMessage(loadingMessage);
EasyLoading.show(status: "正在思考中...");
// ("正在思考中...");
try {
// print("1321312321${UserStore.to.profile.id}");
if (UserStore.to.profile.id != '') {
String? result = await NewsAPI.sendMessage(
{"question": message.text, "id": "${UserStore.to.profile.id}"});
state.isLoading = true;
int? result =
await NewsAPI.aiAnswerWithStream({"question": message.text});
// _cancelLoading();
final receiveMessage = Chat.ChatMessage(
user: receiveUser,
createdAt: DateTime.now(),
// id: const Uuid().v4(),
text: "$result",
);
_addMessage(receiveMessage);
EasyLoading.dismiss();
Vibrate.feedback(FeedbackType.success);
UserAPI.getUserInfo().then((value) async {
await UserStore.to.saveProfile(IntegralEntity(
id: UserStore.to.profile.id,
username: UserStore.to.profile.username,
token: UserStore.to.profile.token,
expireTime: value.expireTime,
integral: value.integral));
});
if (result == 200) {
EasyLoading.dismiss();
Vibrate.feedback(FeedbackType.success);
UserAPI.getUserInfo().then((value) async {
await UserStore.to.saveProfile(IntegralEntity(
id: UserStore.to.profile.id,
username: UserStore.to.profile.username,
token: UserStore.to.profile.token,
expireTime: value.expireTime,
integral: value.integral));
});
final receiveMessage = Chat.ChatMessage(
user: receiveUser,
createdAt: DateTime.now(),
// id: const Uuid().v4(),
text: " ",
);
_addMessage(receiveMessage);
// index.value = state.messageList.length;
} else {
EasyLoading.showError("网络异常");
EasyLoading.dismiss();
state.isLoading = false;
}
} else {
final receiveErrorMessage = Chat.ChatMessage(
user: receiveUser,
......@@ -111,13 +137,14 @@ class ChatNewController extends GetxController {
// id: const Uuid().v4(),
text: "你还未登录,请登录后再体验更多功能。",
);
state.isLoading = false;
_addMessage(receiveErrorMessage);
EasyLoading.dismiss();
Vibrate.feedback(FeedbackType.error);
}
} catch (e) {
print("eeeeeeee$e");
// print("eeeeeeee$e");
state.isLoading = false;
// _cancelLoading();
final receiveErrorMessage = Chat.ChatMessage(
user: receiveUser,
......@@ -172,15 +199,104 @@ class ChatNewController extends GetxController {
// print("${state.newsList.length}");
}
initEventSource() async {
final eventSourceUrl = await EventSource.connect(
"$SERVER_API_URL/openAi/connect/${UserStore.to.profile.id}")
as EventSource;
eventSource = eventSourceUrl.listen(
(Event event) {
// print("New event:");
// print(" event: ${event.event}");
// print(" data: ${event.data}");
// final a = json['event.data'];
if (event.data == "[DONE]") {
state.isLoading = false;
// eventSource.cancel();
return;
}
Map<String, dynamic> jsonMap = jsonDecode("${event.data}");
// if()
if (jsonMap['askType'] == 1) {
_updateMessage("${jsonMap['content']}" as String);
} else {
// print("${jsonMap['content']}}");
print("${jsonMap['content']}");
ProductController.to.state.inderText =
ProductController.to.state.inderText + jsonMap['content'];
// state.genText
}
// list.setRange(1, 4, [9, 9, 9]);
// final receiveMessage = Chat.ChatMessage(
// user: receiveUser,
// createdAt: DateTime.now(),
// // id: const Uuid().v4(),
// text: "${event.data}",
// );
// _addMessage(receiveMessage);
},
);
// eventSource.onOpen.listen();
// eventSource
}
_updateMessage(String text) {
// state.messageList[0].text = state.messageList[0].text + text;
// state.messageList.forEach((element) {
// print(element.text);
// });
if (state.messageList.length == 0) {
return;
}
state.messageList.setRange(0, 1, [
ChatMessage(
user: receiveUser,
createdAt: DateTime.now(),
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;
}
share() async {
final text =
state.messageList.reversed.map((element) => element.text).join('\n\n');
print(text);
// state.messageQueenItemQueen.map((element) => element.text).join("");
if (text.isNotEmpty) {
await Share.share(
text,
// sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
);
}
}
tabMessage(message) {
Clipboard.setData(ClipboardData(text: message?.text));
Get.snackbar("复制成功", "", colorText: Colors.white);
}
/// 生命周期
@override
void onInit() {
print("initttinitttinitttinitttinitttinitttinittt");
void onInit() async {
// connect("http://example.org/events");
// http://192.168.110.127:8083/api/openAi/connect
await initEventSource();
super.onInit();
ever(Get.parameters['question'].obs, (value) {
print("messageListmessageListmessageListmessageList$value");
});
// ever(Get.parameters['question'].obs, (value) {
// print("messageListmessageListmessageListmessageList$value");
// });
}
///dispose 释放内存
......
......@@ -13,5 +13,10 @@ class ChatPageState {
final _page = "AI写作大师".obs;
set page(value) => this._page.value = value;
get page => this._page.value;
RxBool _isLoading = false.obs;
set isLoading(value) => _isLoading.value = value;
get isLoading => _isLoading.value;
// RxList<NewsItem> newsList = <NewsItem>[].obs;
}
......@@ -33,6 +33,23 @@ class ChatNewPage extends GetView<ChatNewController> {
// final c = Get.put(ChatNewController());
return Obx(() => Scaffold(
appBar: transparentAppBar(
actions: [
IconButton(
tooltip: '返回上一页',
icon: const Icon(
Icons.share,
color: AppColors.primaryElementText,
),
onPressed: () {
controller.share();
// Get.offAll(ApplicationPage());
// await Get.off(ApplicationPage());
// Get.toNamed(AppRoutes.Application);
// Navigator.of(context).pop();
//_nextPage(-1);
},
)
],
title: RichText(
text: TextSpan(children: [
TextSpan(
......@@ -74,7 +91,10 @@ class ChatNewPage extends GetView<ChatNewController> {
fit: BoxFit.cover),
),
child: Chat.DashChat(
inputOptions: const Chat.InputOptions(
inputOptions: Chat.InputOptions(
inputDisabled: controller.state.isLoading,
// controller.state.isLoading,
// alwaysShowSend: true,
// sendButtonBuilder: (send) => const Text("data"),
// showTraillingBeforeSend: true,
......@@ -151,8 +171,9 @@ class ChatNewPage extends GetView<ChatNewController> {
// child: Text("footer")),
// ),
messageOptions: Chat.MessageOptions(
// containerColor: Colors.black,
),
onPressMessage: controller.tabMessage,
// containerColor: Colors.black,
),
),
// Column(children: [
......
......@@ -159,7 +159,7 @@ class PayItemWidget extends GetView<PayListController> {
children: [
Icon(Icons.check, color: color),
Text("月卡会员",
Text("月卡(30天)会员",
style: TextStyle(
color: color, fontSize: 16))
],
......@@ -193,7 +193,7 @@ class PayItemWidget extends GetView<PayListController> {
children: [
Icon(Icons.check, color: color),
Text("周卡会员",
Text("周卡7(天)会员",
style: TextStyle(
color: color, fontSize: 16))
],
......@@ -275,7 +275,7 @@ class PayItemWidget extends GetView<PayListController> {
color: Colors.white),
),
Text(
"${item == 0 ? '30次提问卡' : item == 1 ? '月卡' : '周卡'}",
"${item == 0 ? '30次提问卡' : item == 1 ? '月卡(30天)' : '周卡(7天)'}",
maxLines: 2,
overflow: TextOverflow.clip,
style: TextStyle(
......
import 'dart:convert';
import 'package:chart/common/apis/apis.dart';
import 'package:chart/common/store/user.dart';
import 'package:chart/common/values/values.dart';
import 'package:chart/entity/user_entity.dart';
import 'package:eventsource/eventsource.dart';
// import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get_connect/http/src/utils/utils.dart';
import 'package:share_plus/share_plus.dart';
......@@ -10,12 +16,13 @@ import 'package:get/get.dart';
import 'index.dart';
class ProductController extends GetxController {
ProductController();
static ProductController get to => Get.put(ProductController());
// ProductController();
/// 响应式成员变量
final state = ProductState();
late EventSource eventSourceConnect;
late final List<String> initDataList;
TextEditingController controller1 = TextEditingController();
......@@ -42,12 +49,12 @@ class ProductController extends GetxController {
// universalLink: "https://com.eallcn.wasp/");
}
/// 生命周期
///在 widget 内存中分配后立即调用。
///你可以用它来为控制器初始化 initialize 一些东西。
///
///
@override
void onInit() {
void onInit() async {
_initFluwx();
super.onInit();
initDataList = ["321321", '321321'];
......@@ -57,19 +64,26 @@ class ProductController extends GetxController {
}
share() async {
final a =
state.messageQueenItemQueen.map((element) => element.text).join("");
await Share.share(
a,
// sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
);
if (state.inderText?.isNotEmpty) {
await Share.share(
state.inderText,
// sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
);
}
}
clearState() {
state.genText = '';
state.inderText = '';
state.messageQueenItemQueen.clear();
}
handleCopy() {
Clipboard.setData(ClipboardData(text: state.inderText));
Get.snackbar("复制成功", "", colorText: Colors.white);
}
void handleGenText() async {
final params = Get.parameters;
......@@ -105,7 +119,7 @@ class ProductController extends GetxController {
// json.encode(map);
if (UserStore.to.isLogin) {
String result = await NewsAPI.sendMessageByDetailId([
int result = await NewsAPI.sendMessageByDetailId([
{
"label": params['firstLabel'],
"value": controller1.text,
......@@ -120,13 +134,27 @@ class ProductController extends GetxController {
}
], params['detailId']!);
if (result == 200) {
EasyLoading.dismiss();
UserAPI.getUserInfo().then((value) async {
await UserStore.to.saveProfile(IntegralEntity(
id: UserStore.to.profile.id,
username: UserStore.to.profile.username,
token: UserStore.to.profile.token,
expireTime: value.expireTime,
integral: value.integral));
});
} else {
EasyLoading.dismiss();
}
// state.genText = result;
state.messageQueenItemQueen.add(MessageQueenItem(
text: result.replaceAll('\n\n', ''),
isFinish: false,
isWhiteIng: true));
state.isWhite = true;
state.loading = false;
// state.messageQueenItemQueen.add(MessageQueenItem(
// text: result.replaceAll('\n\n', ''),
// isFinish: false,
// isWhiteIng: true));
// state.isWhite = true;
// state.loading = false;
} else {
EasyLoading.showError("你还未登录,请登录后再使用");
state.isWhite = false;
......@@ -158,8 +186,9 @@ class ProductController extends GetxController {
}
showModal() {
print("awaitawaitawaitawaitawaitawaitawait");
// print("awaitawaitawaitawaitawaitawaitawait");
state.inderText = '';
// Share.share('Text I wish to share');
Get.bottomSheet(
FormWidget(),
......@@ -238,7 +267,6 @@ class ProductController extends GetxController {
///dispose 释放内存
@override
void dispose() {
print("disposing");
super.dispose();
// dispose 释放对象
}
......
......@@ -24,6 +24,10 @@ class ProductState {
set isWhite(value) => _isWhite.value = value;
get isWhite => _isWhite.value;
final _inderText = "".obs;
set inderText(value) => _inderText.value = value;
get inderText => _inderText.value;
RxList<MessageQueenItem> messageQueenItemQueen = <MessageQueenItem>[].obs;
}
......
......@@ -39,112 +39,175 @@ class ProductPage extends GetView<ProductController> {
// lastValue: lastValue,
// lastLabel: lastLabel
return Obx(() => Scaffold(
appBar: transparentAppBar(
title: Text(
'${c.state.title}',
style: TextStyle(
color: AppColors.primaryElementText,
fontFamily: 'Montserrat',
fontSize: 18,
fontWeight: FontWeight.w600,
),
),
leading: IconButton(
tooltip: '返回上一页',
icon: const Icon(
Icons.arrow_back,
color: AppColors.primaryElementText,
),
onPressed: () async {
// Get.back();
// Get.offAll(ApplicationPage());
// await Get.off(ApplicationPage());
c.state.genText = '';
Get.back();
// Get.toNamed(AppRoutes.Application);
// Navigator.of(context).pop();
//_nextPage(-1);
},
)),
body: Container(
width: double.infinity,
height: double.infinity,
padding: EdgeInsets.symmetric(horizontal: 16),
decoration: BoxDecoration(
image: DecorationImage(
image: Image.asset("assets/images/bg.png").image,
fit: BoxFit.cover),
),
child: ListView(children: [
Container(
padding: EdgeInsets.only(top: 16),
// color: Colors.white,
child: Obx(
() => c.state.messageQueenItemQueen.isEmpty
? SizedBox.shrink()
: GlassyCard(
child: Container(
padding: EdgeInsets.only(
top: 16, left: 16, right: 16, bottom: 16),
// color: Colors.pink,
child: _genText()),
appBar: transparentAppBar(
actions: [
IconButton(
tooltip: '返回上一页',
icon: const Icon(
Icons.share,
color: AppColors.primaryElementText,
),
),
),
SizedBox(
height: 10,
),
Row(
children: c.state.loading
? []
: [
c.state.isWhite
? SizedBox.shrink()
: Expanded(
child: GlassyButton(
onPressed: c.state.messageQueenItemQueen.isEmpty
? c.showModal
: c.handleNextText,
child: Text(
"${c.state.messageQueenItemQueen.isEmpty ? '编辑模版' : '继续'}"),
onPressed: () {
controller.share();
// Get.offAll(ApplicationPage());
// await Get.off(ApplicationPage());
// Get.toNamed(AppRoutes.Application);
// Navigator.of(context).pop();
//_nextPage(-1);
},
)
],
title: Text(
'${c.state.title}',
style: TextStyle(
color: AppColors.primaryElementText,
fontFamily: 'Montserrat',
fontSize: 18,
fontWeight: FontWeight.w600,
),
),
leading: IconButton(
tooltip: '返回上一页',
icon: const Icon(
Icons.arrow_back,
color: AppColors.primaryElementText,
),
onPressed: () async {
// Get.back();
// Get.offAll(ApplicationPage());
// await Get.off(ApplicationPage());
c.state.genText = '';
Get.back();
// Get.toNamed(AppRoutes.Application);
// Navigator.of(context).pop();
//_nextPage(-1);
},
)),
body: Container(
width: double.infinity,
height: double.infinity,
padding: EdgeInsets.symmetric(horizontal: 16),
decoration: BoxDecoration(
image: DecorationImage(
image: Image.asset("assets/images/bg.png").image,
fit: BoxFit.cover),
),
child: Container(
padding: EdgeInsets.only(top: 16),
// color: Colors.white,
child: Obx(
(() => c.state.inderText.isEmpty
? Container(
width: Get.width,
child: Column(
children: [
Container(
width: Get.width,
child: GlassyButton(
onPressed: c.showModal,
child: Text("编辑模版"),
))
],
),
),
c.state.messageQueenItemQueen.isEmpty || c.state.isWhite
? SizedBox.shrink()
: SizedBox(
width: 18,
),
c.state.messageQueenItemQueen.isEmpty
? SizedBox.shrink()
: Expanded(
// //
child: GlassyButton(
onPressed: () async {
c.share();
// final Uri _url = Uri.parse('weixin://');
// await launchUrl(_url);
},
child: const Text("分享"),
)
: GlassmorphicContainer(
height: Get.height,
width: Get.width,
child: Markdown(
onTapText: c.handleCopy,
data: c.state.inderText,
selectable: true,
styleSheet: MarkdownStyleSheet(
// 支持修改样式
listBullet: TextStyle(color: Colors.white),
p: TextStyle(
color: Colors.white, fontSize: 16),
h1: TextStyle(fontSize: 18)),
),
),
],
)
// ElevatedButton(
// child: Text("继续"),
// onPressed: () {
// flex: 1,
borderRadius: 16,
padding: EdgeInsets.all(16),
blur: 14,
alignment: Alignment.bottomCenter,
border: 2,
linearGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color(0xFF0FFFF).withOpacity(0.2),
Color(0xFF0FFFF).withOpacity(0.2),
],
),
margin: EdgeInsets.only(bottom: 16),
borderGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color(0xFF0FFFF).withOpacity(1),
Color(0xFFFFFFF),
Color(0xFF0FFFF).withOpacity(1),
],
),
)),
)),
// ListView(children: [
// },
// ),
// ElevatedButton(
// child: Text("分享"),
// onPressed: () {
// c.share();
// },
// )
]),
)
// SizedBox(
// height: 10,
// ),
// Row(
// c.state.loading
// ? []
// : [
// c.state.isWhite
// ? SizedBox.shrink()
// : Expanded(
// child: GlassyButton(
// onPressed: c.state.messageQueenItemQueen.isEmpty
// ? c.showModal
// : c.handleNextText,
// child: Text(
// "${c.state.messageQueenItemQueen.isEmpty ? '编辑模版' : '继续'}"),
// ),
// ),
// c.state.messageQueenItemQueen.isEmpty || c.state.isWhite
// ? SizedBox.shrink()
// : SizedBox(
// width: 18,
// ),
// c.state.messageQueenItemQueen.isEmpty
// ? SizedBox.shrink()
// : Expanded(
// // //
// child: GlassyButton(
// onPressed: () async {
// c.share();
// // final Uri _url = Uri.parse('weixin://');
// // await launchUrl(_url);
// },
// child: const Text("分享"),
// ),
// ),
// ],
// )
// ElevatedButton(
// child: Text("继续"),
// onPressed: () {
// },
// ),
// ElevatedButton(
// child: Text("分享"),
// onPressed: () {
// c.share();
// },
// )
// ]
),
)
// body: _buildView(),
));
);
}
_genText() {
......@@ -153,34 +216,36 @@ class ProductPage extends GetView<ProductController> {
return Obx(() => Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
...c.state.messageQueenItemQueen.map((idx) {
final text = idx.isWhiteIng
? AnimatedTextKit(
onFinished: () => {c.handleFinished()},
totalRepeatCount: 1,
animatedTexts: [
TypewriterAnimatedText(
"${idx.text}",
speed: const Duration(milliseconds: 100),
textStyle: TextStyle(
fontSize: 18,
color: Colors.white,
// fontWeight: FontWeight.bold
),
)
],
)
: Text(
"${idx.text}",
style: TextStyle(
fontSize: 18,
color: Colors.white,
// fontWeight: FontWeight.bold
),
);
Text("321321"),
Text(c.state.inderText)
// ...c.state.messageQueenItemQueen.map((idx) {
// final text = idx.isWhiteIng
// ? AnimatedTextKit(
// onFinished: () => {c.handleFinished()},
// totalRepeatCount: 1,
// animatedTexts: [
// TypewriterAnimatedText(
// "${idx.text}",
// speed: const Duration(milliseconds: 100),
// textStyle: TextStyle(
// fontSize: 18,
// color: Colors.white,
// // fontWeight: FontWeight.bold
// ),
// )
// ],
// )
// : Text(
// "${idx.text}",
// style: TextStyle(
// fontSize: 18,
// color: Colors.white,
// // fontWeight: FontWeight.bold
// ),
// );
return text;
}).toList(),
// return text;
// }).toList(),
],
));
}
......
......@@ -267,6 +267,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
eventsource:
dependency: "direct main"
description:
name: eventsource
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.0"
extended_phone_number_input:
dependency: "direct main"
description:
......@@ -721,6 +728,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
logging:
dependency: transitive
description:
name: logging
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
markdown:
dependency: transitive
description:
......@@ -1118,6 +1132,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
sync:
dependency: transitive
description:
name: sync
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.0"
synchronized:
dependency: transitive
description:
......
......@@ -114,6 +114,7 @@ dependencies:
alipay_kit: 5.0.0
alipay_kit_ios: 5.0.0
pointycastle: ^3.1.1
eventsource: ^0.4.0
# 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