基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。
feat(ui): align character comment cards
Predidit22c8158fee42
diff --git a/lib/bean/card/character_comments_card.dart b/lib/bean/card/character_comments_card.dartindex 187196f1..3421565d 100644--- a/lib/bean/card/character_comments_card.dart+++ b/lib/bean/card/character_comments_card.dart@@ -13,78 +13,126 @@ class CharacterCommentsCard extends StatelessWidget {@overrideWidget build(BuildContext context) {- return Card(- // color: Theme.of(context).colorScheme.secondaryContainer,- child: Padding(- padding: const EdgeInsets.all(8.0),- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Row(- children: [- CircleAvatar(- backgroundImage:- NetworkImage(commentItem.comment.user.avatar.large),- ),- const SizedBox(width: 8),- Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Text(commentItem.comment.user.nickname),- Text(dateFormat(commentItem.comment.createdAt)),- ],- ),+ final colorScheme = Theme.of(context).colorScheme;++ return Padding(+ padding: const EdgeInsets.only(bottom: 12),+ child: Material(+ color: colorScheme.surfaceContainerLow,+ borderRadius: BorderRadius.circular(24),+ clipBehavior: Clip.antiAlias,+ child: Padding(+ padding: const EdgeInsets.all(16),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ _CommentAuthor(+ comment: commentItem.comment,+ avatarRadius: 20,+ ),+ const SizedBox(height: 12),+ BBCodeWidget(bbcode: commentItem.comment.comment),+ if (commentItem.replies.isNotEmpty) ...[+ const SizedBox(height: 16),+ _RepliesContainer(replies: commentItem.replies),],+ ],+ ),+ ),+ ),+ );+ }+}++class _RepliesContainer extends StatelessWidget {+ const _RepliesContainer({required this.replies});++ final List<CharacterComment> replies;++ @override+ Widget build(BuildContext context) {+ final colorScheme = Theme.of(context).colorScheme;++ return Container(+ width: double.infinity,+ padding: const EdgeInsets.fromLTRB(14, 4, 14, 12),+ decoration: BoxDecoration(+ color: colorScheme.surfaceContainer,+ borderRadius: BorderRadius.circular(18),+ ),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ for (var index = 0; index < replies.length; index++) ...[+ if (index > 0)+ Divider(+ height: 25,+ color: colorScheme.outlineVariant,+ )+ else+ const SizedBox(height: 8),+ _CommentAuthor(+ comment: replies[index],+ avatarRadius: 16,),const SizedBox(height: 8),- BBCodeWidget(bbcode: commentItem.comment.comment),- if (commentItem.replies.isNotEmpty)- ListView.builder(- // Don't know why but some device has bottom padding,- // needs to set to 0 manually.- padding: const EdgeInsets.only(bottom: 0),- physics: const NeverScrollableScrollPhysics(),- shrinkWrap: true,- itemCount: commentItem.replies.length,- itemBuilder: (context, index) {- return Padding(- padding: const EdgeInsets.only(left: 48),- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: <Widget>[- Divider(- color: Theme.of(context).dividerColor.withAlpha(60),- ),- Row(- children: [- CircleAvatar(- backgroundImage: NetworkImage(- commentItem.replies[index].user.avatar.large),- ),- const SizedBox(width: 8),- Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Text(commentItem.replies[index].user.nickname),- Text(- dateFormat(- commentItem.replies[index].createdAt),- ),- ],- ),- ],- ),- const SizedBox(height: 8),- BBCodeWidget(- bbcode: commentItem.replies[index].comment),- ],- ),- );- },- ),+ Padding(+ padding: const EdgeInsets.only(left: 40),+ child: BBCodeWidget(bbcode: replies[index].comment),+ ),],- ),+ ],),);}}++class _CommentAuthor extends StatelessWidget {+ const _CommentAuthor({+ required this.comment,+ required this.avatarRadius,+ });++ final CharacterComment comment;+ final double avatarRadius;++ @override+ Widget build(BuildContext context) {+ final theme = Theme.of(context);+ final colorScheme = theme.colorScheme;++ return Row(+ crossAxisAlignment: CrossAxisAlignment.center,+ children: [+ CircleAvatar(+ radius: avatarRadius,+ backgroundImage: NetworkImage(comment.user.avatar.large),+ ),+ const SizedBox(width: 12),+ Expanded(+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text(+ comment.user.nickname,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: theme.textTheme.titleSmall?.copyWith(+ color: colorScheme.onSurface,+ fontWeight: FontWeight.w600,+ ),+ ),+ const SizedBox(height: 2),+ Text(+ dateFormat(comment.createdAt),+ style: theme.textTheme.labelSmall?.copyWith(+ color: colorScheme.onSurfaceVariant,+ ),+ ),+ ],+ ),+ ),+ ],+ );+ }+}diff --git a/lib/pages/info/character_page.dart b/lib/pages/info/character_page.dartindex 32254bb5..e2447c23 100644--- a/lib/pages/info/character_page.dart+++ b/lib/pages/info/character_page.dart@@ -264,7 +264,7 @@ class _CharacterPageState extends State<CharacterPage> {),slivers: [SliverPadding(- padding: const EdgeInsets.fromLTRB(4, 0, 4, 4),+ padding: const EdgeInsets.fromLTRB(16, 8, 16, 12),sliver: Builder(builder: (context) {if (loadingComments) {return const SliverFillRemaining(