mod: 动态页面长按复制、链接跳转、样式

This commit is contained in:
guozhigq
2023-07-18 18:11:06 +08:00
parent 9eb52933c4
commit 70a35deefc
4 changed files with 133 additions and 91 deletions

View File

@ -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,45 +60,54 @@ Widget addWidget(item, context, type, {floor = 1}) {
),
);
case 'ADDITIONAL_TYPE_RESERVE':
return InkWell(
return Padding(
padding: const EdgeInsets.only(top: 8),
child: InkWell(
onTap: () {},
child: Container(
margin: const EdgeInsets.only(top: 8),
width: double.infinity,
padding:
const EdgeInsets.only(left: 15, top: 12, right: 15, bottom: 10),
const EdgeInsets.only(left: 12, top: 10, right: 12, bottom: 10),
color: bgColor,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(dynamicProperty[type].title),
Text.rich(TextSpan(
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),
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),
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: BorderRadius.all(Radius.circular(6)),
borderRadius: const BorderRadius.all(Radius.circular(6)),
),
child: Row(
children: [
@ -123,8 +132,10 @@ Widget addWidget(item, context, type, {floor = 1}) {
maxLines: 1,
style: TextStyle(
color: Theme.of(context).colorScheme.outline,
fontSize:
Theme.of(context).textTheme.labelMedium!.fontSize,
fontSize: Theme.of(context)
.textTheme
.labelMedium!
.fontSize,
),
),
const SizedBox(height: 2),
@ -139,11 +150,14 @@ Widget addWidget(item, context, type, {floor = 1}) {
),
],
),
);
),
));
case 'ADDITIONAL_TYPE_MATCH':
return SizedBox();
case 'ADDITIONAL_TYPE_COMMON':
return SizedBox();
case 'ADDITIONAL_TYPE_VOTE':
return SizedBox();
default:
return Text('11');
}

View File

@ -20,11 +20,21 @@ Widget content(item, context, source) {
),
),
],
Text.rich(
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,
),
),
),
],
));
),
);
}

View File

@ -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,

View File

@ -92,8 +92,10 @@ class _UpPanelState extends State<UpPanel> {
child: Center(
child: Text(
'全部',
style:
TextStyle(color: Theme.of(context).primaryColor),
style: TextStyle(
color: Theme.of(context)
.colorScheme
.onSecondaryContainer),
),
),
),