Merge branch 'fix'

This commit is contained in:
guozhigq
2024-06-08 15:36:06 +08:00

View File

@ -259,115 +259,114 @@ class ChatItem extends StatelessWidget {
); );
case MsgType.auto_reply_push: case MsgType.auto_reply_push:
return Container( return Container(
constraints: const BoxConstraints( constraints: const BoxConstraints(
maxWidth: 300.0, // 设置最大宽度为200.0 maxWidth: 300.0, // 设置最大宽度为200.0
),
decoration: BoxDecoration(
color: Theme.of(context)
.colorScheme
.secondaryContainer
.withOpacity(0.4),
borderRadius: const BorderRadius.all(
Radius.circular(16),
), ),
decoration: BoxDecoration( ),
color: Theme.of(context) margin: const EdgeInsets.all(12),
.colorScheme padding: const EdgeInsets.all(12),
.secondaryContainer child: Column(
.withOpacity(0.4), crossAxisAlignment: CrossAxisAlignment.start,
borderRadius: const BorderRadius.only( children: [
topLeft: Radius.circular(16), Text(
topRight: Radius.circular(16), content['main_title'],
bottomLeft: Radius.circular(6), style: TextStyle(
bottomRight: Radius.circular(16), letterSpacing: 0.6,
), height: 1.5,
), color: textColor(context),
margin: const EdgeInsets.all(12), fontWeight: FontWeight.bold,
padding: const EdgeInsets.all(12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
content['main_title'],
style: TextStyle(
letterSpacing: 0.6,
height: 1.5,
color: textColor(context),
fontWeight: FontWeight.bold,
),
), ),
for (var i in content['sub_cards']) ...<Widget>[ ),
const SizedBox(height: 6), for (var i in content['sub_cards']) ...<Widget>[
GestureDetector( const SizedBox(height: 6),
onTap: () async { GestureDetector(
RegExp bvRegex = RegExp(r'BV[0-9A-Za-z]{10}', onTap: () async {
caseSensitive: false); RegExp bvRegex =
Iterable<Match> matches = RegExp(r'BV[0-9A-Za-z]{10}', caseSensitive: false);
bvRegex.allMatches(i['jump_url']); Iterable<Match> matches =
if (matches.isNotEmpty) { bvRegex.allMatches(i['jump_url']);
Match match = matches.first; if (matches.isNotEmpty) {
String bvid = match.group(0)!; Match match = matches.first;
try { String bvid = match.group(0)!;
SmartDialog.showLoading(); try {
final int cid = await SearchHttp.ab2c(bvid: bvid); SmartDialog.showLoading();
final String heroTag = Utils.makeHeroTag(bvid); final int cid = await SearchHttp.ab2c(bvid: bvid);
SmartDialog.dismiss<dynamic>().then( final String heroTag = Utils.makeHeroTag(bvid);
(e) => Get.toNamed<dynamic>( SmartDialog.dismiss<dynamic>().then(
'/video?bvid=$bvid&cid=$cid', (e) => Get.toNamed<dynamic>(
arguments: <String, String?>{ '/video?bvid=$bvid&cid=$cid',
'pic': i['cover_url'], arguments: <String, String?>{
'heroTag': heroTag, 'pic': i['cover_url'],
}), 'heroTag': heroTag,
); }),
} catch (err) { );
SmartDialog.dismiss(); } catch (err) {
SmartDialog.showToast(err.toString()); SmartDialog.dismiss();
} SmartDialog.showToast(err.toString());
} else { }
SmartDialog.showToast('未匹配到 BV 号'); } else {
Get.toNamed('/webview', SmartDialog.showToast('未匹配到 BV 号');
arguments: {'url': i['jump_url']}); Get.toNamed('/webview',
} arguments: {'url': i['jump_url']});
}, }
child: Row( },
child: Row(
children: [
NetworkImgLayer(
width: 130,
height: 130 * 9 / 16,
src: i['cover_url'],
),
const SizedBox(width: 6),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
NetworkImgLayer( Text(
width: 130, i['field1'],
height: 130 * 9 / 16, maxLines: 2,
src: i['cover_url'], style: TextStyle(
letterSpacing: 0.6,
height: 1.5,
color: textColor(context),
fontWeight: FontWeight.bold,
),
),
Text(
i['field2'],
style: TextStyle(
letterSpacing: 0.6,
height: 1.5,
color: textColor(context).withOpacity(0.6),
fontSize: 12,
),
),
Text(
i['field3'],
style: TextStyle(
letterSpacing: 0.6,
height: 1.5,
color: textColor(context).withOpacity(0.6),
fontSize: 12,
),
), ),
const SizedBox(width: 6),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
i['field1'],
maxLines: 2,
style: TextStyle(
letterSpacing: 0.6,
height: 1.5,
color: textColor(context),
fontWeight: FontWeight.bold,
),
),
Text(
i['field2'],
style: TextStyle(
letterSpacing: 0.6,
height: 1.5,
color: textColor(context).withOpacity(0.6),
fontSize: 12,
),
),
Text(
Utils.timeFormat(int.parse(i['field3'])),
style: TextStyle(
letterSpacing: 0.6,
height: 1.5,
color: textColor(context).withOpacity(0.6),
fontSize: 12,
),
),
],
)),
], ],
)), )),
], ],
),
),
], ],
)); ],
),
);
default: default:
return Text( return Text(
content != null && content != '' content != null && content != ''