mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-01 23:59:50 +08:00
opt pub page
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -107,13 +107,14 @@ abstract class CommonPublishPageState<T extends CommonPublishPage>
|
||||
|
||||
void updatePanelType(PanelType type) {
|
||||
final isSwitchToKeyboard = PanelType.keyboard == type;
|
||||
final isSwitchToEmojiPanel = PanelType.emoji == type;
|
||||
final isSwitchToEmojiPanel =
|
||||
PanelType.emoji == type || PanelType.more == type;
|
||||
bool isUpdated = false;
|
||||
switch (type) {
|
||||
case PanelType.keyboard:
|
||||
updateInputView(isReadOnly: false);
|
||||
break;
|
||||
case PanelType.emoji:
|
||||
case PanelType.emoji || PanelType.more:
|
||||
isUpdated = updateInputView(isReadOnly: true);
|
||||
break;
|
||||
default:
|
||||
@@ -174,7 +175,9 @@ abstract class CommonPublishPageState<T extends CommonPublishPage>
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildPanelContainer([Color? panelBgColor]) {
|
||||
Widget buildMorePanel(ThemeData theme) => throw UnimplementedError();
|
||||
|
||||
Widget buildPanelContainer(ThemeData theme, [Color? panelBgColor]) {
|
||||
return ChatBottomPanelContainer<PanelType>(
|
||||
controller: controller,
|
||||
inputFocusNode: focusNode,
|
||||
@@ -183,12 +186,13 @@ abstract class CommonPublishPageState<T extends CommonPublishPage>
|
||||
switch (type) {
|
||||
case PanelType.emoji:
|
||||
return buildEmojiPickerPanel();
|
||||
case PanelType.more:
|
||||
return buildMorePanel(theme);
|
||||
default:
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
},
|
||||
onPanelTypeChange: (panelType, data) {
|
||||
// if (kDebugMode) debugPrint('panelType: $panelType');
|
||||
switch (panelType) {
|
||||
case ChatBottomPanelType.none:
|
||||
this.panelType.value = PanelType.none;
|
||||
@@ -198,14 +202,7 @@ abstract class CommonPublishPageState<T extends CommonPublishPage>
|
||||
break;
|
||||
case ChatBottomPanelType.other:
|
||||
if (data == null) return;
|
||||
switch (data) {
|
||||
case PanelType.emoji:
|
||||
this.panelType.value = PanelType.emoji;
|
||||
break;
|
||||
default:
|
||||
this.panelType.value = PanelType.none;
|
||||
break;
|
||||
}
|
||||
this.panelType.value = data;
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:PiliPlus/common/widgets/button/icon_button.dart';
|
||||
import 'package:PiliPlus/common/widgets/button/toolbar_icon_button.dart';
|
||||
import 'package:PiliPlus/common/widgets/text_field/controller.dart';
|
||||
import 'package:PiliPlus/common/widgets/text_field/text_field.dart';
|
||||
import 'package:PiliPlus/models/common/image_preview_type.dart';
|
||||
import 'package:PiliPlus/models/common/publish_panel_type.dart';
|
||||
import 'package:PiliPlus/models_new/dynamic/dyn_mention/item.dart';
|
||||
import 'package:PiliPlus/models_new/emote/emote.dart' as e;
|
||||
import 'package:PiliPlus/models_new/live/live_emote/emoticon.dart';
|
||||
@@ -14,6 +16,7 @@ import 'package:easy_debounce/easy_throttle.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:image_cropper/image_cropper.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
|
||||
@@ -200,7 +203,7 @@ abstract class CommonRichTextPubPageState<T extends CommonRichTextPubPage>
|
||||
final list = <Map<String, dynamic>>[];
|
||||
for (var e in editController.items) {
|
||||
switch (e.type) {
|
||||
case RichTextType.text || RichTextType.composing:
|
||||
case RichTextType.text || RichTextType.composing || RichTextType.common:
|
||||
list.add({
|
||||
"raw_text": e.text,
|
||||
"type": 1,
|
||||
@@ -360,4 +363,51 @@ abstract class CommonRichTextPubPageState<T extends CommonRichTextPubPage>
|
||||
void onSave() {
|
||||
widget.onSave?.call(editController.items);
|
||||
}
|
||||
|
||||
Widget get emojiBtn => Obx(
|
||||
() {
|
||||
final isEmoji = panelType.value == PanelType.emoji;
|
||||
return ToolbarIconButton(
|
||||
tooltip: isEmoji ? '输入' : '表情',
|
||||
onPressed: () {
|
||||
if (isEmoji) {
|
||||
updatePanelType(PanelType.keyboard);
|
||||
} else {
|
||||
updatePanelType(PanelType.emoji);
|
||||
}
|
||||
},
|
||||
icon: isEmoji
|
||||
? const Icon(Icons.keyboard, size: 22)
|
||||
: const Icon(Icons.emoji_emotions, size: 22),
|
||||
selected: isEmoji,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
Widget get atBtn => ToolbarIconButton(
|
||||
onPressed: () => onMention(true),
|
||||
icon: const Icon(Icons.alternate_email, size: 22),
|
||||
tooltip: '@',
|
||||
selected: false,
|
||||
);
|
||||
|
||||
Widget get moreBtn => Obx(
|
||||
() {
|
||||
final isMore = panelType.value == PanelType.more;
|
||||
return ToolbarIconButton(
|
||||
tooltip: isMore ? '输入' : '更多',
|
||||
onPressed: () {
|
||||
if (isMore) {
|
||||
updatePanelType(PanelType.keyboard);
|
||||
} else {
|
||||
updatePanelType(PanelType.more);
|
||||
}
|
||||
},
|
||||
icon: isMore
|
||||
? const Icon(Icons.keyboard, size: 22)
|
||||
: const Icon(Icons.add_circle_outline, size: 22),
|
||||
selected: isMore,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -157,6 +157,7 @@ abstract class ReplyController<R> extends CommonListController<R, ReplyInfo> {
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
settings: RouteSettings(arguments: Get.arguments),
|
||||
),
|
||||
)
|
||||
.then(
|
||||
|
||||
Reference in New Issue
Block a user