Skip to content

基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。

add general error widget for character page

Prediditb8d318ee6d9e
diff --git a/lib/pages/info/character_page.dart b/lib/pages/info/character_page.dart
index d0f025ad..ec530abb 100644
--- a/lib/pages/info/character_page.dart
+++ b/lib/pages/info/character_page.dart
@@ -5,6 +5,7 @@ import 'package:kazumi/modules/comments/comment_item.dart';
import 'package:kazumi/request/bangumi.dart';
import 'package:kazumi/bean/card/network_img_layer.dart';
import 'package:kazumi/bean/card/character_comments_card.dart';
+import 'package:kazumi/bean/widget/error_widget.dart';
class CharacterPage extends StatefulWidget {
const CharacterPage({super.key, required this.characterID});
@@ -94,104 +95,117 @@ class _CharacterPageState extends State<CharacterPage> {
Expanded(
child: loadingCharacter
? const Center(child: CircularProgressIndicator())
- : SizedBox(
- width: double.infinity,
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- SizedBox(
- width: constraints.maxWidth * 0.3,
- height: constraints.maxHeight,
- child: NetworkImgLayer(
- width: constraints.maxWidth,
- height: constraints.maxHeight,
- src: characterFullItem.image,
+ : (characterFullItem.id == 0
+ ? GeneralErrorWidget(
+ errMsg: '什么都没有找到 (´;ω;`)',
+ actions: [
+ GeneralErrorButton(
+ onPressed: () {
+ loadCharacter();
+ },
+ text: '点击重试',
),
- ),
- Expanded(
- child: SingleChildScrollView(
- child: Padding(
- padding: const EdgeInsets.all(16.0),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- characterFullItem.name,
- style: Theme.of(context)
- .textTheme
- .headlineSmall
- ?.copyWith(
- fontWeight: FontWeight.bold,
- color: Theme.of(context)
- .colorScheme
- .tertiary,
+ ],
+ )
+ : SizedBox(
+ width: double.infinity,
+ child: Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ SizedBox(
+ width: constraints.maxWidth * 0.3,
+ height: constraints.maxHeight,
+ child: NetworkImgLayer(
+ width: constraints.maxWidth,
+ height: constraints.maxHeight,
+ src: characterFullItem.image,
+ ),
+ ),
+ Expanded(
+ child: SingleChildScrollView(
+ child: Padding(
+ padding: const EdgeInsets.all(16.0),
+ child: Column(
+ crossAxisAlignment:
+ CrossAxisAlignment.start,
+ children: [
+ Text(
+ characterFullItem.name,
+ style: Theme.of(context)
+ .textTheme
+ .headlineSmall
+ ?.copyWith(
+ fontWeight: FontWeight.bold,
+ color: Theme.of(context)
+ .colorScheme
+ .tertiary,
+ ),
+ overflow: TextOverflow.ellipsis,
+ maxLines: 2,
+ ),
+ Padding(
+ padding: const EdgeInsets.only(
+ top: 4.0, bottom: 12.0),
+ child: Text(
+ characterFullItem.nameCN,
+ style: Theme.of(context)
+ .textTheme
+ .titleMedium
+ ?.copyWith(
+ color: Colors.grey[700],
+ ),
),
- overflow: TextOverflow.ellipsis,
- maxLines: 2,
- ),
- Padding(
- padding: const EdgeInsets.only(
- top: 4.0, bottom: 12.0),
- child: Text(
- characterFullItem.nameCN,
- style: Theme.of(context)
- .textTheme
- .titleMedium
- ?.copyWith(
- color: Colors.grey[700],
- ),
- ),
- ),
- const Divider(),
- Padding(
- padding: const EdgeInsets.symmetric(
- vertical: 8.0),
- child: Text(
- '基本信息',
- style: Theme.of(context)
- .textTheme
- .titleSmall
- ?.copyWith(
- fontWeight: FontWeight.bold,
- ),
- ),
- ),
- Text(
- characterFullItem.info,
- style: Theme.of(context)
- .textTheme
- .bodyMedium,
- textAlign: TextAlign.justify,
- ),
- const SizedBox(height: 16.0),
- Padding(
- padding: const EdgeInsets.symmetric(
- vertical: 8.0),
- child: Text(
- '角色简介',
- style: Theme.of(context)
- .textTheme
- .titleSmall
- ?.copyWith(
- fontWeight: FontWeight.bold,
- ),
- ),
- ),
- Text(
- characterFullItem.summary,
- style: Theme.of(context)
- .textTheme
- .bodyMedium,
- textAlign: TextAlign.justify,
+ ),
+ const Divider(),
+ Padding(
+ padding: const EdgeInsets.symmetric(
+ vertical: 8.0),
+ child: Text(
+ '基本信息',
+ style: Theme.of(context)
+ .textTheme
+ .titleSmall
+ ?.copyWith(
+ fontWeight: FontWeight.bold,
+ ),
+ ),
+ ),
+ Text(
+ characterFullItem.info,
+ style: Theme.of(context)
+ .textTheme
+ .bodyMedium,
+ textAlign: TextAlign.justify,
+ ),
+ const SizedBox(height: 16.0),
+ Padding(
+ padding: const EdgeInsets.symmetric(
+ vertical: 8.0),
+ child: Text(
+ '角色简介',
+ style: Theme.of(context)
+ .textTheme
+ .titleSmall
+ ?.copyWith(
+ fontWeight: FontWeight.bold,
+ ),
+ ),
+ ),
+ Text(
+ characterFullItem.summary,
+ style: Theme.of(context)
+ .textTheme
+ .bodyMedium,
+ textAlign: TextAlign.justify,
+ ),
+ ],
),
- ],
+ ),
),
),
- ),
+ ],
),
- ],
- ),
- ),
+ )),
),
],
);
@@ -222,9 +236,17 @@ class _CharacterPageState extends State<CharacterPage> {
);
}
if (commentsList.isEmpty) {
- return const SliverFillRemaining(
- child: Center(
- child: Text('空空如也'),
+ return SliverFillRemaining(
+ child: GeneralErrorWidget(
+ errMsg: '什么都没有找到 (´;ω;`)',
+ actions: [
+ GeneralErrorButton(
+ onPressed: () {
+ loadComments();
+ },
+ text: '点击重试',
+ ),
+ ],
),
);
}