mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-02 00:58:19 +08:00
opt: slide gesture
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -123,6 +123,49 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel>
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GStorage.slideDismissReplyPage
|
||||
? Padding(
|
||||
padding: EdgeInsets.only(top: padding.value),
|
||||
child: _buildPage,
|
||||
)
|
||||
: _buildPage;
|
||||
}
|
||||
|
||||
Widget get _buildPage => Scaffold(
|
||||
key: _key,
|
||||
resizeToAvoidBottomInset: false,
|
||||
body: Column(
|
||||
children: [
|
||||
widget.source == 'videoDetail'
|
||||
? Container(
|
||||
height: 45,
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
width: 1,
|
||||
color:
|
||||
Theme.of(context).dividerColor.withOpacity(0.1),
|
||||
),
|
||||
),
|
||||
),
|
||||
padding: const EdgeInsets.only(left: 12, right: 2),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Text(widget.isDialogue ? '对话列表' : '评论详情'),
|
||||
IconButton(
|
||||
tooltip: '关闭',
|
||||
icon: const Icon(Icons.close, size: 20),
|
||||
onPressed: Get.back,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: Divider(
|
||||
height: 1,
|
||||
color: Theme.of(context).dividerColor.withOpacity(0.1),
|
||||
),
|
||||
Expanded(
|
||||
child: GStorage.slideDismissReplyPage
|
||||
? GestureDetector(
|
||||
onPanDown: (event) {
|
||||
if (event.localPosition.dx > 30) {
|
||||
@@ -136,8 +179,10 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel>
|
||||
return;
|
||||
} else if (_isSliding == null) {
|
||||
if (_downPos != null) {
|
||||
Offset cumulativeDelta = event.localPosition - _downPos!;
|
||||
if (cumulativeDelta.dx.abs() >= cumulativeDelta.dy.abs()) {
|
||||
Offset cumulativeDelta =
|
||||
event.localPosition - _downPos!;
|
||||
if (cumulativeDelta.dx.abs() >=
|
||||
cumulativeDelta.dy.abs()) {
|
||||
_isSliding = true;
|
||||
setState(() {
|
||||
padding.value = event.localPosition.dx;
|
||||
@@ -178,50 +223,15 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel>
|
||||
_downPos = null;
|
||||
_isSliding = null;
|
||||
},
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(top: padding.value),
|
||||
child: _buildPage,
|
||||
),
|
||||
child: _buildList,
|
||||
)
|
||||
: _buildPage;
|
||||
}
|
||||
|
||||
Widget get _buildPage => Scaffold(
|
||||
key: _key,
|
||||
resizeToAvoidBottomInset: false,
|
||||
body: Column(
|
||||
children: [
|
||||
widget.source == 'videoDetail'
|
||||
? Container(
|
||||
height: 45,
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
width: 1,
|
||||
color:
|
||||
Theme.of(context).dividerColor.withOpacity(0.1),
|
||||
),
|
||||
),
|
||||
),
|
||||
padding: const EdgeInsets.only(left: 12, right: 2),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Text(widget.isDialogue ? '对话列表' : '评论详情'),
|
||||
IconButton(
|
||||
tooltip: '关闭',
|
||||
icon: const Icon(Icons.close, size: 20),
|
||||
onPressed: Get.back,
|
||||
: _buildList,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: Divider(
|
||||
height: 1,
|
||||
color: Theme.of(context).dividerColor.withOpacity(0.1),
|
||||
),
|
||||
Expanded(
|
||||
child: ClipRect(
|
||||
);
|
||||
|
||||
Widget get _buildList => ClipRect(
|
||||
child: refreshIndicator(
|
||||
onRefresh: () async {
|
||||
await _videoReplyReplyController.onRefresh();
|
||||
@@ -232,16 +242,15 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel>
|
||||
ScrollablePositionedList.builder(
|
||||
key: _listKey,
|
||||
itemPositionsListener: itemPositionsListener,
|
||||
itemCount: _itemCount(
|
||||
_videoReplyReplyController.loadingState.value),
|
||||
itemCount:
|
||||
_itemCount(_videoReplyReplyController.loadingState.value),
|
||||
itemScrollController:
|
||||
_videoReplyReplyController.itemScrollCtr,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
itemBuilder: (context, index) {
|
||||
if (widget.isDialogue) {
|
||||
return _buildBody(
|
||||
_videoReplyReplyController.loadingState.value,
|
||||
index);
|
||||
_videoReplyReplyController.loadingState.value, index);
|
||||
} else if (firstFloor != null) {
|
||||
if (index == 0) {
|
||||
return GlobalData().grpcReply
|
||||
@@ -276,17 +285,15 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel>
|
||||
} else if (index == 1) {
|
||||
return Divider(
|
||||
height: 20,
|
||||
color: Theme.of(context)
|
||||
.dividerColor
|
||||
.withOpacity(0.1),
|
||||
color:
|
||||
Theme.of(context).dividerColor.withOpacity(0.1),
|
||||
thickness: 6,
|
||||
);
|
||||
} else if (index == 2) {
|
||||
return _sortWidget;
|
||||
} else {
|
||||
return _buildBody(
|
||||
_videoReplyReplyController
|
||||
.loadingState.value,
|
||||
_videoReplyReplyController.loadingState.value,
|
||||
index - 3);
|
||||
}
|
||||
} else {
|
||||
@@ -294,25 +301,19 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel>
|
||||
return _sortWidget;
|
||||
} else {
|
||||
return _buildBody(
|
||||
_videoReplyReplyController
|
||||
.loadingState.value,
|
||||
_videoReplyReplyController.loadingState.value,
|
||||
index - 1);
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
if (!widget.isDialogue &&
|
||||
_videoReplyReplyController.loadingState.value
|
||||
is Success)
|
||||
_videoReplyReplyController.loadingState.value is Success)
|
||||
_header,
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Widget get _sortWidget => Container(
|
||||
|
||||
Reference in New Issue
Block a user