mod: tmply disable grpc reply

Closes #114

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-01-07 12:00:11 +08:00
parent da3c087ade
commit a0afbb2615
5 changed files with 89 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ class HttpError extends StatelessWidget {
this.errMsg, this.errMsg,
this.callback, this.callback,
this.btnText, this.btnText,
this.extraWidget,
super.key, super.key,
}); });
@@ -14,6 +15,7 @@ class HttpError extends StatelessWidget {
final String? errMsg; final String? errMsg;
final Function()? callback; final Function()? callback;
final String? btnText; final String? btnText;
final Widget? extraWidget;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -44,8 +46,13 @@ class HttpError extends StatelessWidget {
style: Theme.of(context).textTheme.titleSmall, style: Theme.of(context).textTheme.titleSmall,
), ),
), ),
if (extraWidget != null) ...[
const SizedBox(height: 10),
extraWidget!,
const SizedBox(height: 5),
],
if (callback != null) ...[ if (callback != null) ...[
const SizedBox(height: 20), if (extraWidget == null) const SizedBox(height: 20),
FilledButton.tonal( FilledButton.tonal(
onPressed: callback, onPressed: callback,
style: ButtonStyle( style: ButtonStyle(

View File

@@ -527,6 +527,26 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
Error() => HttpError( Error() => HttpError(
errMsg: loadingState.errMsg, errMsg: loadingState.errMsg,
callback: _dynamicDetailController.onReload, callback: _dynamicDetailController.onReload,
extraWidget: GlobalData().grpcReply
? FilledButton.tonal(
onPressed: () {
GlobalData().grpcReply = false;
},
style: ButtonStyle(
backgroundColor: WidgetStateProperty.resolveWith((states) {
return Theme.of(context)
.colorScheme
.primary
.withAlpha(20);
}),
),
child: Text(
'暂时关闭gRPC加载评论',
style:
TextStyle(color: Theme.of(context).colorScheme.primary),
),
)
: null,
), ),
LoadingState() => throw UnimplementedError(), LoadingState() => throw UnimplementedError(),
}; };

View File

@@ -468,6 +468,26 @@ class _HtmlRenderPageState extends State<HtmlRenderPage>
Error() => HttpError( Error() => HttpError(
errMsg: loadingState.errMsg, errMsg: loadingState.errMsg,
callback: _htmlRenderCtr.onReload, callback: _htmlRenderCtr.onReload,
extraWidget: GlobalData().grpcReply
? FilledButton.tonal(
onPressed: () {
GlobalData().grpcReply = false;
},
style: ButtonStyle(
backgroundColor: WidgetStateProperty.resolveWith((states) {
return Theme.of(context)
.colorScheme
.primary
.withAlpha(20);
}),
),
child: Text(
'暂时关闭gRPC加载评论',
style:
TextStyle(color: Theme.of(context).colorScheme.primary),
),
)
: null,
), ),
LoadingState() => throw UnimplementedError(), LoadingState() => throw UnimplementedError(),
}; };

View File

@@ -295,6 +295,26 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
Error() => HttpError( Error() => HttpError(
errMsg: loadingState.errMsg, errMsg: loadingState.errMsg,
callback: _videoReplyController.onReload, callback: _videoReplyController.onReload,
extraWidget: GlobalData().grpcReply
? FilledButton.tonal(
onPressed: () {
GlobalData().grpcReply = false;
},
style: ButtonStyle(
backgroundColor: WidgetStateProperty.resolveWith((states) {
return Theme.of(context)
.colorScheme
.primary
.withAlpha(20);
}),
),
child: Text(
'暂时关闭gRPC加载评论',
style:
TextStyle(color: Theme.of(context).colorScheme.primary),
),
)
: null,
), ),
LoadingState() => throw UnimplementedError(), LoadingState() => throw UnimplementedError(),
}; };

View File

@@ -394,6 +394,27 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
HttpError( HttpError(
errMsg: loadingState.errMsg, errMsg: loadingState.errMsg,
callback: _videoReplyReplyController.onReload, callback: _videoReplyReplyController.onReload,
extraWidget: GlobalData().grpcReply
? FilledButton.tonal(
onPressed: () {
GlobalData().grpcReply = false;
},
style: ButtonStyle(
backgroundColor:
WidgetStateProperty.resolveWith((states) {
return Theme.of(context)
.colorScheme
.primary
.withAlpha(20);
}),
),
child: Text(
'暂时关闭gRPC加载评论',
style: TextStyle(
color: Theme.of(context).colorScheme.primary),
),
)
: null,
) )
], ],
), ),