完成动态评论

hmxc
小赖 4 years ago
parent f388fbc376
commit 45a20baf18

@ -199,6 +199,9 @@ class _Community {
/// ///
String get getEventDetail => '/user/gambit/GambitThemeDetail'; String get getEventDetail => '/user/gambit/GambitThemeDetail';
///
String get sendAComment => '/user/gambit/comment';
} }
class _Upload { class _Upload {

@ -1,4 +1,5 @@
// Flutter imports: // Flutter imports:
import 'package:akuCommunity/ui/community/community_views/widgets/send_a_chat.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -147,7 +148,12 @@ class _ChatCardState extends State<ChatCard> {
height: 78.w, height: 78.w,
materialTapTargetSize: materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap, MaterialTapTargetSize.shrinkWrap,
onPressed: () {}, onPressed: () {
SendAChat.send(
parentId: 0,
themeId: widget.model.id,
);
},
child: [ child: [
Icon(CupertinoIcons.bubble_right, size: 30.w), Icon(CupertinoIcons.bubble_right, size: 30.w),
10.wb, 10.wb,
@ -217,40 +223,13 @@ class _ChatCardState extends State<ChatCard> {
return InkWell( return InkWell(
child: buffer.toString().text.make(), child: buffer.toString().text.make(),
onTap: () { onTap: () {
addComment(); SendAChat.send(parentId: e.id, themeId: widget.model.id);
}, },
); );
}).toList(), }).toList(),
); );
} }
addComment() async {
FocusNode node = FocusNode();
node.requestFocus();
Get.bottomSheet(
Row(
children: [
TextField(
focusNode: node,
decoration: InputDecoration(
border: OutlineInputBorder(),
isDense: true,
),
).p(16.w).expand(),
16.wb,
MaterialButton(
color: kPrimaryColor,
onPressed: () {},
minWidth: 64.w,
child: '发送'.text.make(),
),
16.wb,
],
).material(color: Colors.white),
barrierColor: Colors.transparent,
);
}
_renderLikeAndComment() { _renderLikeAndComment() {
return Material( return Material(
borderRadius: BorderRadius.circular(8.w), borderRadius: BorderRadius.circular(8.w),

@ -0,0 +1,75 @@
import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/utils/network/net_util.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
class SendAChat extends StatefulWidget {
final FocusNode node;
SendAChat({Key key, this.node}) : super(key: key);
static Future<bool> send({
@required int parentId,
@required int themeId,
}) async {
FocusNode node = FocusNode();
node.requestFocus();
String result = await Get.bottomSheet(
SendAChat(node: node),
barrierColor: Colors.transparent,
);
if (result != null) {
await NetUtil().post(
API.community.sendAComment,
params: {
'parentId': parentId,
'gambitThemeId': themeId,
'content': result,
},
showMessage: true,
);
return true;
}
return false;
}
@override
_SendAChatState createState() => _SendAChatState();
}
class _SendAChatState extends State<SendAChat> {
TextEditingController _textEditingController = TextEditingController();
@override
void dispose() {
_textEditingController?.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Row(
children: [
TextField(
focusNode: widget.node,
controller: _textEditingController,
decoration: InputDecoration(
border: OutlineInputBorder(),
isDense: true,
),
).p(16.w).expand(),
16.wb,
MaterialButton(
color: kPrimaryColor,
onPressed: () {
Get.back(result: _textEditingController.text);
},
minWidth: 64.w,
child: '发送'.text.make(),
),
16.wb,
],
).material(color: Colors.white);
}
}
Loading…
Cancel
Save