mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-01 23:59:50 +08:00
feat: richtextfield
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,24 +1,24 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:PiliPlus/common/widgets/button/toolbar_icon_button.dart';
|
||||
import 'package:PiliPlus/common/widgets/text_field/text_field.dart';
|
||||
import 'package:PiliPlus/http/live.dart';
|
||||
import 'package:PiliPlus/models/common/publish_panel_type.dart';
|
||||
import 'package:PiliPlus/pages/common/common_publish_page.dart';
|
||||
import 'package:PiliPlus/pages/common/publish/common_rich_text_pub_page.dart';
|
||||
import 'package:PiliPlus/pages/live_emote/controller.dart';
|
||||
import 'package:PiliPlus/pages/live_emote/view.dart';
|
||||
import 'package:PiliPlus/pages/live_room/controller.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart' show LengthLimitingTextInputFormatter;
|
||||
import 'package:flutter/material.dart' hide TextField;
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart' hide MultipartFile;
|
||||
|
||||
class LiveSendDmPanel extends CommonPublishPage {
|
||||
class LiveSendDmPanel extends CommonRichTextPubPage {
|
||||
final bool fromEmote;
|
||||
final LiveRoomController liveRoomController;
|
||||
|
||||
const LiveSendDmPanel({
|
||||
super.key,
|
||||
super.initialValue,
|
||||
super.items,
|
||||
super.onSave,
|
||||
this.fromEmote = false,
|
||||
required this.liveRoomController,
|
||||
@@ -28,7 +28,7 @@ class LiveSendDmPanel extends CommonPublishPage {
|
||||
State<LiveSendDmPanel> createState() => _ReplyPageState();
|
||||
}
|
||||
|
||||
class _ReplyPageState extends CommonPublishPageState<LiveSendDmPanel> {
|
||||
class _ReplyPageState extends CommonRichTextPubPageState<LiveSendDmPanel> {
|
||||
LiveRoomController get liveRoomController => widget.liveRoomController;
|
||||
|
||||
@override
|
||||
@@ -101,7 +101,7 @@ class _ReplyPageState extends CommonPublishPageState<LiveSendDmPanel> {
|
||||
}
|
||||
},
|
||||
child: Obx(
|
||||
() => TextField(
|
||||
() => RichTextField(
|
||||
controller: editController,
|
||||
minLines: 1,
|
||||
maxLines: 2,
|
||||
@@ -115,7 +115,7 @@ class _ReplyPageState extends CommonPublishPageState<LiveSendDmPanel> {
|
||||
hintStyle: TextStyle(fontSize: 14),
|
||||
),
|
||||
style: theme.textTheme.bodyLarge,
|
||||
inputFormatters: [LengthLimitingTextInputFormatter(20)],
|
||||
// inputFormatters: [LengthLimitingTextInputFormatter(20)],
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -176,20 +176,23 @@ class _ReplyPageState extends CommonPublishPageState<LiveSendDmPanel> {
|
||||
|
||||
@override
|
||||
Future<void> onCustomPublish({
|
||||
required String message,
|
||||
String? message,
|
||||
List? pictures,
|
||||
int? dmType,
|
||||
emoticonOptions,
|
||||
}) async {
|
||||
final res = await LiveHttp.sendLiveMsg(
|
||||
roomId: liveRoomController.roomId,
|
||||
msg: message,
|
||||
msg: message ?? editController.rawText,
|
||||
dmType: dmType,
|
||||
emoticonOptions: emoticonOptions,
|
||||
);
|
||||
if (res['status']) {
|
||||
hasPub = true;
|
||||
Get.back();
|
||||
liveRoomController.savedDanmaku = null;
|
||||
liveRoomController
|
||||
..savedDanmaku?.clear()
|
||||
..savedDanmaku = null;
|
||||
SmartDialog.showToast('发送成功');
|
||||
} else {
|
||||
SmartDialog.showToast(res['msg']);
|
||||
|
||||
Reference in New Issue
Block a user