mod: 回复内容回填
This commit is contained in:
@ -102,7 +102,7 @@ class _MainAppState extends State<MainApp> with SingleTickerProviderStateMixin {
|
|||||||
),
|
),
|
||||||
child: PageView(
|
child: PageView(
|
||||||
controller: _pageController,
|
controller: _pageController,
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
// physics: const NeverScrollableScrollPhysics(),
|
||||||
onPageChanged: (index) {
|
onPageChanged: (index) {
|
||||||
selectedIndex = index;
|
selectedIndex = index;
|
||||||
setState(() {});
|
setState(() {});
|
||||||
@ -111,19 +111,17 @@ class _MainAppState extends State<MainApp> with SingleTickerProviderStateMixin {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
bottomNavigationBar: Obx(
|
bottomNavigationBar: NavigationBar(
|
||||||
() => NavigationBar(
|
elevation: 1,
|
||||||
elevation: 1,
|
destinations: _mainController.navigationBars.map((e) {
|
||||||
destinations: _mainController.navigationBars.map((e) {
|
return NavigationDestination(
|
||||||
return NavigationDestination(
|
icon: e['icon'],
|
||||||
icon: e['icon'],
|
selectedIcon: e['selectedIcon'],
|
||||||
selectedIcon: e['selectedIcon'],
|
label: e['label'],
|
||||||
label: e['label'],
|
);
|
||||||
);
|
}).toList(),
|
||||||
}).toList(),
|
selectedIndex: selectedIndex,
|
||||||
selectedIndex: selectedIndex,
|
onDestinationSelected: (value) => setIndex(value),
|
||||||
onDestinationSelected: (value) => setIndex(value),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -163,12 +163,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
|||||||
return ReplyItem(
|
return ReplyItem(
|
||||||
replyItem: _videoReplyController
|
replyItem: _videoReplyController
|
||||||
.replyList[index],
|
.replyList[index],
|
||||||
weakUpReply: (replyItem, replyLevel) =>
|
showReplyRow: true,
|
||||||
_showReply(
|
|
||||||
'floor',
|
|
||||||
replyItem: replyItem,
|
|
||||||
replyLevel: replyLevel,
|
|
||||||
),
|
|
||||||
replyLevel: replyLevel);
|
replyLevel: replyLevel);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -223,7 +218,11 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
|||||||
parent: 0,
|
parent: 0,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
).then((value) => {print('close ModalBottomSheet')});
|
).then((value) => {
|
||||||
|
// 完成评论,数据添加
|
||||||
|
_videoReplyController
|
||||||
|
.replyList.add(value['data'])
|
||||||
|
});
|
||||||
},
|
},
|
||||||
tooltip: '发表评论',
|
tooltip: '发表评论',
|
||||||
child: const Icon(Icons.reply),
|
child: const Icon(Icons.reply),
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
@ -11,10 +13,16 @@ import 'package:pilipala/pages/video/detail/replyReply/index.dart';
|
|||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
|
|
||||||
class ReplyItem extends StatelessWidget {
|
class ReplyItem extends StatelessWidget {
|
||||||
ReplyItem({super.key, this.replyItem, this.weakUpReply, this.replyLevel});
|
ReplyItem(
|
||||||
|
{super.key,
|
||||||
|
this.replyItem,
|
||||||
|
this.addReply,
|
||||||
|
this.replyLevel,
|
||||||
|
this.showReplyRow});
|
||||||
ReplyItemModel? replyItem;
|
ReplyItemModel? replyItem;
|
||||||
Function? weakUpReply;
|
Function? addReply;
|
||||||
String? replyLevel;
|
String? replyLevel;
|
||||||
|
bool? showReplyRow = true;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -179,7 +187,7 @@ class ReplyItem extends StatelessWidget {
|
|||||||
// 操作区域
|
// 操作区域
|
||||||
bottonAction(context, replyItem!.replyControl),
|
bottonAction(context, replyItem!.replyControl),
|
||||||
const SizedBox(height: 3),
|
const SizedBox(height: 3),
|
||||||
if (replyItem!.replies!.isNotEmpty && replyLevel != '2') ...[
|
if (replyItem!.replies!.isNotEmpty && showReplyRow!) ...[
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(top: 2, bottom: 12),
|
padding: const EdgeInsets.only(top: 2, bottom: 12),
|
||||||
child: ReplyItemRow(
|
child: ReplyItemRow(
|
||||||
@ -241,7 +249,6 @@ class ReplyItem extends StatelessWidget {
|
|||||||
context: context,
|
context: context,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
builder: (builder) {
|
builder: (builder) {
|
||||||
print('🌹: ${replyItem!.rpid}');
|
|
||||||
return VideoReplyNewDialog(
|
return VideoReplyNewDialog(
|
||||||
replyLevel: replyLevel,
|
replyLevel: replyLevel,
|
||||||
oid: replyItem!.oid,
|
oid: replyItem!.oid,
|
||||||
@ -249,7 +256,15 @@ class ReplyItem extends StatelessWidget {
|
|||||||
parent: replyItem!.rpid,
|
parent: replyItem!.rpid,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
).then((value) => {print('showModalBottomSheet')});
|
).then((value) => {
|
||||||
|
// 完成评论,数据添加
|
||||||
|
if (value['data'] != null)
|
||||||
|
{
|
||||||
|
print('🌹: ${value['data'].content.message}'),
|
||||||
|
addReply!(value['data'])
|
||||||
|
// replyControl.replies.add(value['data']),
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:developer';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:pilipala/http/video.dart';
|
import 'package:pilipala/http/video.dart';
|
||||||
import 'package:pilipala/models/common/reply_type.dart';
|
import 'package:pilipala/models/common/reply_type.dart';
|
||||||
|
import 'package:pilipala/models/video/reply/item.dart';
|
||||||
|
|
||||||
class VideoReplyNewDialog extends StatefulWidget {
|
class VideoReplyNewDialog extends StatefulWidget {
|
||||||
int? oid;
|
int? oid;
|
||||||
@ -59,7 +61,6 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
|
|||||||
|
|
||||||
Future submitReplyAdd() async {
|
Future submitReplyAdd() async {
|
||||||
String message = _replyContentController.text;
|
String message = _replyContentController.text;
|
||||||
print(widget.oid);
|
|
||||||
var result = await VideoHttp.replyAdd(
|
var result = await VideoHttp.replyAdd(
|
||||||
type: ReplyType.video,
|
type: ReplyType.video,
|
||||||
oid: widget.oid!,
|
oid: widget.oid!,
|
||||||
@ -69,6 +70,9 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
|
|||||||
);
|
);
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
SmartDialog.showToast(result['data']['success_toast']);
|
SmartDialog.showToast(result['data']['success_toast']);
|
||||||
|
Get.back(result: {
|
||||||
|
'data': ReplyItemModel.fromJson(result['data']['reply'], ''),
|
||||||
|
});
|
||||||
} else {}
|
} else {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -104,9 +104,13 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
|
|||||||
const SliverToBoxAdapter(child: SizedBox(height: 10)),
|
const SliverToBoxAdapter(child: SizedBox(height: 10)),
|
||||||
SliverToBoxAdapter(
|
SliverToBoxAdapter(
|
||||||
child: ReplyItem(
|
child: ReplyItem(
|
||||||
replyItem: widget.firstFloor,
|
replyItem: widget.firstFloor,
|
||||||
replyLevel: '2',
|
replyLevel: '1',
|
||||||
),
|
showReplyRow: false,
|
||||||
|
addReply: (replyItem) {
|
||||||
|
_videoReplyReplyController.replyList
|
||||||
|
.add(replyItem);
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
SliverToBoxAdapter(
|
SliverToBoxAdapter(
|
||||||
child: Divider(
|
child: Divider(
|
||||||
@ -151,9 +155,15 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
|
|||||||
} else {
|
} else {
|
||||||
return Material(
|
return Material(
|
||||||
child: ReplyItem(
|
child: ReplyItem(
|
||||||
replyItem: _videoReplyReplyController
|
replyItem: _videoReplyReplyController
|
||||||
.replyList[index],
|
.replyList[index],
|
||||||
),
|
replyLevel: '2',
|
||||||
|
showReplyRow: false,
|
||||||
|
addReply: (replyItem) {
|
||||||
|
_videoReplyReplyController
|
||||||
|
.replyList
|
||||||
|
.add(replyItem);
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user