推荐视频评论和点赞

This commit is contained in:
cuiyouliang 2025-08-22 18:24:52 +08:00
parent a78acc0f5c
commit 6cec14448c
3 changed files with 577 additions and 326 deletions

View File

@ -8,6 +8,9 @@ class VideoApi {
// post
static const String myPublicList = '/app/vlog/myPublicList'; //
static const String myLikedList = '/app/vlog/myLikedList'; //
static const String videoCommentList = '/comment/list'; //
static const String doVideoComment = '/app/comment/publish'; //
static const String unlike = '/app/vlog/unlike'; //
static const String totalLikedCounts = '/app/vlog/totalLikedCounts'; //

View File

@ -1,4 +1,3 @@
///
library;
import 'package:flutter/material.dart';
@ -7,11 +6,15 @@ import 'package:get/get.dart';
class PopupReply extends StatefulWidget {
const PopupReply({
super.key,
this.onChanged
this.onChanged,
this.onSubmitted, // onSubmitted
this.hintText = '说点什么...',
});
//
final ValueChanged? onChanged;
final ValueChanged<String>? onChanged;
final ValueChanged<String>? onSubmitted; // onSubmitted
final String hintText;
@override
State<PopupReply> createState() => _PopupReplyState();
@ -31,6 +34,26 @@ class _PopupReplyState extends State<PopupReply> {
controller.dispose();
}
//
void _handleSubmit() {
final text = controller.text.trim();
if (text.isNotEmpty) {
// onSubmitted
if (widget.onSubmitted != null) {
widget.onSubmitted!(text);
} else if (widget.onChanged != null) {
// onSubmitted使 onChanged
widget.onChanged!(text);
Get.back();
}
}
}
// onSubmitted String
void _onSubmitted(String value) {
_handleSubmit();
}
@override
Widget build(BuildContext context) {
return Scaffold(
@ -62,7 +85,7 @@ class _PopupReplyState extends State<PopupReply> {
),
child: TextField(
decoration: InputDecoration(
hintText: '说点什么...',
hintText: widget.hintText,
isDense: true,
hoverColor: Colors.transparent,
contentPadding: EdgeInsets.all(10.0),
@ -74,11 +97,9 @@ class _PopupReplyState extends State<PopupReply> {
maxLines: null,
controller: controller,
cursorColor: Color(0xFFFF5000),
onEditingComplete: () {
widget.onChanged!(controller.text);
Get.back();
},
onChanged: (value) {},
onEditingComplete: _handleSubmit, // 使
onChanged: widget.onChanged, // onChanged
onSubmitted: _onSubmitted, //
),
),
),
@ -91,10 +112,7 @@ class _PopupReplyState extends State<PopupReply> {
RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0))
)
),
onPressed: () {
widget.onChanged!(controller.text);
Get.back();
},
onPressed: _handleSubmit, // 使
child: Text('发送',),
),
],
@ -105,4 +123,4 @@ class _PopupReplyState extends State<PopupReply> {
),
);
}
}
}

File diff suppressed because it is too large Load Diff