diff --git a/lib/pages/dynamics/widgets/additional_panel.dart b/lib/pages/dynamics/widgets/additional_panel.dart index 0396f219f..d2015aee0 100644 --- a/lib/pages/dynamics/widgets/additional_panel.dart +++ b/lib/pages/dynamics/widgets/additional_panel.dart @@ -23,7 +23,7 @@ Widget addWidget(item, context, type, {floor = 1}) { onTap: () {}, child: Container( padding: - const EdgeInsets.only(left: 15, top: 10, right: 15, bottom: 8), + const EdgeInsets.only(left: 12, top: 8, right: 12, bottom: 8), color: bgColor, child: Row( children: [ @@ -60,90 +60,104 @@ Widget addWidget(item, context, type, {floor = 1}) { ), ); case 'ADDITIONAL_TYPE_RESERVE': - return InkWell( - onTap: () {}, - child: Container( - margin: const EdgeInsets.only(top: 8), - padding: - const EdgeInsets.only(left: 15, top: 12, right: 15, bottom: 10), - color: bgColor, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(dynamicProperty[type].title), - Text.rich(TextSpan( - style: TextStyle( - color: Theme.of(context).colorScheme.outline, - fontSize: Theme.of(context) - .textTheme - .labelMedium! - .fontSize), - children: [ - TextSpan(text: dynamicProperty[type].desc1['text']), - TextSpan(text: dynamicProperty[type].desc2['text']), - ])) - ], - ), - // TextButton(onPressed: () {}, child: Text('123')) - ], + return Padding( + padding: const EdgeInsets.only(top: 8), + child: InkWell( + onTap: () {}, + child: Container( + width: double.infinity, + padding: + const EdgeInsets.only(left: 12, top: 10, right: 12, bottom: 10), + color: bgColor, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + dynamicProperty[type].title, + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + const SizedBox(height: 1), + Text.rich( + TextSpan( + style: TextStyle( + color: Theme.of(context).colorScheme.outline, + fontSize: + Theme.of(context).textTheme.labelMedium!.fontSize), + children: [ + TextSpan(text: dynamicProperty[type].desc1['text']), + const TextSpan(text: ' '), + TextSpan(text: dynamicProperty[type].desc2['text']), + ], + ), + ) + ], + ), + // TextButton(onPressed: () {}, child: Text('123')) ), ), ); case 'ADDITIONAL_TYPE_GOODS': - return Container( - margin: const EdgeInsets.only(top: 6), - padding: const EdgeInsets.only(left: 15, top: 10, right: 15, bottom: 8), - decoration: BoxDecoration( - color: bgColor, - borderRadius: BorderRadius.all(Radius.circular(6)), - ), - child: Row( - children: [ - NetworkImgLayer( - width: 75, - height: 75, - src: dynamicProperty[type].items.first.cover, - ), - const SizedBox(width: 10), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, + return Padding( + padding: const EdgeInsets.only(top: 6), + child: InkWell( + onTap: () {}, + child: Container( + padding: + const EdgeInsets.only(left: 12, top: 8, right: 12, bottom: 8), + decoration: BoxDecoration( + color: bgColor, + borderRadius: const BorderRadius.all(Radius.circular(6)), + ), + child: Row( children: [ - Text( - dynamicProperty[type].items.first.name, - maxLines: 1, - overflow: TextOverflow.ellipsis, + NetworkImgLayer( + width: 75, + height: 75, + src: dynamicProperty[type].items.first.cover, ), - Text( - dynamicProperty[type].items.first.brief, - maxLines: 1, - style: TextStyle( - color: Theme.of(context).colorScheme.outline, - fontSize: - Theme.of(context).textTheme.labelMedium!.fontSize, - ), - ), - const SizedBox(height: 2), - Text( - dynamicProperty[type].items.first.price, - style: TextStyle( - color: Theme.of(context).colorScheme.primary, + const SizedBox(width: 10), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + dynamicProperty[type].items.first.name, + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + Text( + dynamicProperty[type].items.first.brief, + maxLines: 1, + style: TextStyle( + color: Theme.of(context).colorScheme.outline, + fontSize: Theme.of(context) + .textTheme + .labelMedium! + .fontSize, + ), + ), + const SizedBox(height: 2), + Text( + dynamicProperty[type].items.first.price, + style: TextStyle( + color: Theme.of(context).colorScheme.primary, + ), + ), + ], ), ), ], ), ), - ], - ), - ); + )); case 'ADDITIONAL_TYPE_MATCH': return SizedBox(); case 'ADDITIONAL_TYPE_COMMON': return SizedBox(); + case 'ADDITIONAL_TYPE_VOTE': + return SizedBox(); default: return Text('11'); } diff --git a/lib/pages/dynamics/widgets/content_panel.dart b/lib/pages/dynamics/widgets/content_panel.dart index 872be8036..34324d2e3 100644 --- a/lib/pages/dynamics/widgets/content_panel.dart +++ b/lib/pages/dynamics/widgets/content_panel.dart @@ -7,24 +7,34 @@ Widget content(item, context, source) { TextStyle authorStyle = TextStyle(color: Theme.of(context).colorScheme.primary); return Container( - width: double.infinity, - padding: const EdgeInsets.fromLTRB(12, 0, 12, 6), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (item.modules.moduleDynamic.topic != null) ...[ - GestureDetector( - child: Text( - '#${item.modules.moduleDynamic.topic.name}', - style: authorStyle, - ), + width: double.infinity, + padding: const EdgeInsets.fromLTRB(12, 0, 12, 6), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (item.modules.moduleDynamic.topic != null) ...[ + GestureDetector( + child: Text( + '#${item.modules.moduleDynamic.topic.name}', + style: authorStyle, ), - ], - Text.rich( - richNode(item, context), - maxLines: source == 'detail' ? 999 : 3, - overflow: TextOverflow.ellipsis, ), ], - )); + IgnorePointer( + // 禁用SelectableRegion的触摸交互功能 + ignoring: source == 'detail' ? false : true, + child: SelectableRegion( + magnifierConfiguration: const TextMagnifierConfiguration(), + focusNode: FocusNode(), + selectionControls: MaterialTextSelectionControls(), + child: Text.rich( + richNode(item, context), + maxLines: source == 'detail' ? 999 : 3, + overflow: TextOverflow.ellipsis, + ), + ), + ), + ], + ), + ); } diff --git a/lib/pages/dynamics/widgets/rich_node_panel.dart b/lib/pages/dynamics/widgets/rich_node_panel.dart index e617fac21..f13c65483 100644 --- a/lib/pages/dynamics/widgets/rich_node_panel.dart +++ b/lib/pages/dynamics/widgets/rich_node_panel.dart @@ -64,7 +64,12 @@ InlineSpan richNode(item, context) { WidgetSpan( alignment: PlaceholderAlignment.middle, child: GestureDetector( - onTap: () {}, + onTap: () { + Get.toNamed( + '/webview', + parameters: {'url': i.origText, 'type': 'url', 'pageTitle': ''}, + ); + }, child: Text( i.text, style: authorStyle, @@ -79,7 +84,18 @@ InlineSpan richNode(item, context) { WidgetSpan( alignment: PlaceholderAlignment.middle, child: GestureDetector( - onTap: () {}, + onTap: () { + String dynamicId = item.basic['comment_id_str']; + Get.toNamed( + '/webview', + parameters: { + 'url': + 'https://t.bilibili.com/vote/h5/index/#/result?vote_id=${i.rid}&dynamic_id=${dynamicId}&isWeb=1', + 'type': 'vote', + 'pageTitle': '投票' + }, + ); + }, child: Text( '投票:${i.text}', style: authorStyle, diff --git a/lib/pages/dynamics/widgets/up_panel.dart b/lib/pages/dynamics/widgets/up_panel.dart index 40ddfc45f..c4cebc5e8 100644 --- a/lib/pages/dynamics/widgets/up_panel.dart +++ b/lib/pages/dynamics/widgets/up_panel.dart @@ -92,8 +92,10 @@ class _UpPanelState extends State { child: Center( child: Text( '全部', - style: - TextStyle(color: Theme.of(context).primaryColor), + style: TextStyle( + color: Theme.of(context) + .colorScheme + .onSecondaryContainer), ), ), ),