推荐视频评论和点赞

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 // post
static const String myPublicList = '/app/vlog/myPublicList'; // static const String myPublicList = '/app/vlog/myPublicList'; //
static const String myLikedList = '/app/vlog/myLikedList'; // 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 unlike = '/app/vlog/unlike'; //
static const String totalLikedCounts = '/app/vlog/totalLikedCounts'; // static const String totalLikedCounts = '/app/vlog/totalLikedCounts'; //

View File

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

File diff suppressed because it is too large Load Diff