mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: handle grpc error
This commit is contained in:
@@ -12,8 +12,6 @@ class HttpError extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SliverToBoxAdapter(
|
||||
child: SizedBox(
|
||||
height: 400,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@@ -34,7 +32,7 @@ class HttpError extends StatelessWidget {
|
||||
fn!();
|
||||
},
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateProperty.resolveWith((states) {
|
||||
backgroundColor: WidgetStateProperty.resolveWith((states) {
|
||||
return Theme.of(context).colorScheme.primary.withAlpha(20);
|
||||
}),
|
||||
),
|
||||
@@ -45,7 +43,6 @@ class HttpError extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,6 +102,11 @@ class GrpcRepo {
|
||||
try {
|
||||
return await request();
|
||||
} catch (e) {
|
||||
if (e is GrpcError) {
|
||||
if (e.message == '12061') {
|
||||
return {'status': false, 'msg': 'UP主已关闭评论区'}; // to be comfirm
|
||||
}
|
||||
}
|
||||
return {'status': false, 'msg': e.toString()};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ class VideoReplyReplyController extends CommonController
|
||||
|
||||
@override
|
||||
Future queryData([bool isRefresh = true]) {
|
||||
if (noMore.value == '没有更多了') return Future.value();
|
||||
if (['没有更多了', '还没有评论'].contains(noMore.value)) return Future.value();
|
||||
return super.queryData(isRefresh);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user