diff --git a/lib/common/widgets/http_error.dart b/lib/common/widgets/http_error.dart index bec2cf4f..e31c9260 100644 --- a/lib/common/widgets/http_error.dart +++ b/lib/common/widgets/http_error.dart @@ -7,6 +7,7 @@ class HttpError extends StatelessWidget { this.errMsg, this.callback, this.btnText, + this.extraWidget, super.key, }); @@ -14,6 +15,7 @@ class HttpError extends StatelessWidget { final String? errMsg; final Function()? callback; final String? btnText; + final Widget? extraWidget; @override Widget build(BuildContext context) { @@ -44,8 +46,13 @@ class HttpError extends StatelessWidget { style: Theme.of(context).textTheme.titleSmall, ), ), + if (extraWidget != null) ...[ + const SizedBox(height: 10), + extraWidget!, + const SizedBox(height: 5), + ], if (callback != null) ...[ - const SizedBox(height: 20), + if (extraWidget == null) const SizedBox(height: 20), FilledButton.tonal( onPressed: callback, style: ButtonStyle( diff --git a/lib/pages/dynamics/detail/view.dart b/lib/pages/dynamics/detail/view.dart index 962b49da..855bce8d 100644 --- a/lib/pages/dynamics/detail/view.dart +++ b/lib/pages/dynamics/detail/view.dart @@ -527,6 +527,26 @@ class _DynamicDetailPageState extends State Error() => HttpError( errMsg: loadingState.errMsg, 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(), }; diff --git a/lib/pages/html/view.dart b/lib/pages/html/view.dart index f8555458..da81c386 100644 --- a/lib/pages/html/view.dart +++ b/lib/pages/html/view.dart @@ -468,6 +468,26 @@ class _HtmlRenderPageState extends State Error() => HttpError( errMsg: loadingState.errMsg, 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(), }; diff --git a/lib/pages/video/detail/reply/view.dart b/lib/pages/video/detail/reply/view.dart index fea5df57..8d1df953 100644 --- a/lib/pages/video/detail/reply/view.dart +++ b/lib/pages/video/detail/reply/view.dart @@ -295,6 +295,26 @@ class _VideoReplyPanelState extends State Error() => HttpError( errMsg: loadingState.errMsg, 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(), }; diff --git a/lib/pages/video/detail/reply_reply/view.dart b/lib/pages/video/detail/reply_reply/view.dart index 5c5116b2..1bdc9c2f 100644 --- a/lib/pages/video/detail/reply_reply/view.dart +++ b/lib/pages/video/detail/reply_reply/view.dart @@ -394,6 +394,27 @@ class _VideoReplyReplyPanelState extends State { HttpError( errMsg: loadingState.errMsg, 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, ) ], ),