mod: 图标修改

This commit is contained in:
guozhigq
2023-07-22 15:51:16 +08:00
45 changed files with 1302 additions and 551 deletions

View File

@ -0,0 +1,129 @@
import 'dart:math';
import 'dart:ui' as ui show Image;
import 'package:extended_image/extended_image.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:pull_to_refresh_notification/pull_to_refresh_notification.dart';
double get maxDragOffset => 100;
double hideHeight = maxDragOffset / 2.3;
double refreshHeight = maxDragOffset / 1.5;
class PullToRefreshHeader extends StatelessWidget {
const PullToRefreshHeader(
this.info,
this.lastRefreshTime, {
this.color,
});
final PullToRefreshScrollNotificationInfo? info;
final DateTime? lastRefreshTime;
final Color? color;
@override
Widget build(BuildContext context) {
final PullToRefreshScrollNotificationInfo? _info = info;
if (_info == null) {
return Container();
}
String text = '';
if (_info.mode == PullToRefreshIndicatorMode.armed) {
text = 'Release to refresh';
} else if (_info.mode == PullToRefreshIndicatorMode.refresh ||
_info.mode == PullToRefreshIndicatorMode.snap) {
text = 'Loading...';
} else if (_info.mode == PullToRefreshIndicatorMode.done) {
text = 'Refresh completed.';
} else if (_info.mode == PullToRefreshIndicatorMode.drag) {
text = 'Pull to refresh';
} else if (_info.mode == PullToRefreshIndicatorMode.canceled) {
text = 'Cancel refresh';
}
final TextStyle ts = const TextStyle(
color: Colors.grey,
).copyWith(fontSize: 14);
final double dragOffset = info?.dragOffset ?? 0.0;
final DateTime time = lastRefreshTime ?? DateTime.now();
final double top = -hideHeight + dragOffset;
return Container(
height: dragOffset,
color: color ?? Colors.transparent,
// padding: EdgeInsets.only(top: dragOffset / 3),
// padding: EdgeInsets.only(bottom: 5.0),
child: Stack(
children: <Widget>[
Positioned(
left: 0.0,
right: 0.0,
top: top,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Expanded(
child: Container(
alignment: Alignment.centerRight,
child: RefreshImage(top),
margin: const EdgeInsets.only(right: 12.0),
),
),
Column(
children: <Widget>[
Text(text, style: ts),
Text(
'Last updated:' +
DateFormat('yyyy-MM-dd hh:mm').format(time),
style: ts.copyWith(fontSize: 14),
)
],
),
const Spacer(),
],
),
)
],
),
);
}
}
class RefreshImage extends StatelessWidget {
const RefreshImage(this.top);
final double top;
@override
Widget build(BuildContext context) {
const double imageSize = 30;
return ExtendedImage.asset(
'assets/flutterCandies_grey.png',
width: imageSize,
height: imageSize,
afterPaintImage: (Canvas canvas, Rect rect, ui.Image image, Paint paint) {
final double imageHeight = image.height.toDouble();
final double imageWidth = image.width.toDouble();
final Size size = rect.size;
final double y =
(1 - min(top / (refreshHeight - hideHeight), 1)) * imageHeight;
canvas.drawImageRect(
image,
Rect.fromLTWH(0.0, y, imageWidth, imageHeight - y),
Rect.fromLTWH(rect.left, rect.top + y / imageHeight * size.height,
size.width, (imageHeight - y) / imageHeight * size.height),
Paint()
..colorFilter =
const ColorFilter.mode(Color(0xFFea5504), BlendMode.srcIn)
..isAntiAlias = false
..filterQuality = FilterQuality.low,
);
//canvas.restore();
},
);
}
}

View File

@ -12,13 +12,17 @@ class StatDanMu extends StatelessWidget {
@override
Widget build(BuildContext context) {
Color color =
theme == 'white' ? Colors.white : Theme.of(context).colorScheme.outline;
Map<String, Color> colorObject = {
'white': Colors.white,
'gray': Theme.of(context).colorScheme.outline,
'black': Theme.of(context).colorScheme.onBackground.withOpacity(0.8),
};
Color color = colorObject[theme]!;
return Row(
children: [
Icon(
// CupertinoIcons.ellipses_bubble,
Icons.subtitles_outlined,
Icons.subtitles_sharp,
size: 14,
color: color,
),

View File

@ -12,13 +12,17 @@ class StatView extends StatelessWidget {
@override
Widget build(BuildContext context) {
Color color =
theme == 'white' ? Colors.white : Theme.of(context).colorScheme.outline;
Map<String, Color> colorObject = {
'white': Colors.white,
'gray': Theme.of(context).colorScheme.outline,
'black': Theme.of(context).colorScheme.onBackground.withOpacity(0.8),
};
Color color = colorObject[theme]!;
return Row(
children: [
Icon(
// CupertinoIcons.play_rectangle,
Icons.play_circle_outlined,
Icons.play_circle_fill_outlined,
size: 13,
color: color,
),

View File

@ -80,22 +80,22 @@ class VideoCardV extends StatelessWidget {
height: maxHeight,
),
),
if (videoItem.stat.view is int &&
videoItem.stat.danmaku is int)
Positioned(
left: 0,
right: 0,
bottom: 0,
child: AnimatedOpacity(
opacity: 1,
duration: const Duration(milliseconds: 200),
child: VideoStat(
view: videoItem.stat.view,
danmaku: videoItem.stat.danmaku,
duration: videoItem.duration,
),
),
),
// if (videoItem.stat.view is int &&
// videoItem.stat.danmaku is int)
// Positioned(
// left: 0,
// right: 0,
// bottom: 0,
// child: AnimatedOpacity(
// opacity: 1,
// duration: const Duration(milliseconds: 200),
// child: VideoStat(
// view: videoItem.stat.view,
// danmaku: videoItem.stat.danmaku,
// duration: videoItem.duration,
// ),
// ),
// ),
],
);
}),
@ -118,7 +118,7 @@ class VideoContent extends StatelessWidget {
return Expanded(
child: Padding(
// 多列
padding: const EdgeInsets.fromLTRB(4, 5, 6, 8),
padding: const EdgeInsets.fromLTRB(4, 5, 6, 12),
// 单列
// padding: const EdgeInsets.fromLTRB(14, 10, 4, 8),
child: Column(
@ -136,71 +136,84 @@ class VideoContent extends StatelessWidget {
maxLines: Get.find<RcmdController>().crossAxisCount,
overflow: TextOverflow.ellipsis,
),
SizedBox(
height: 18,
child: Row(
children: [
if (videoItem.rcmdReason != null &&
videoItem.rcmdReason.content != '') ...[
Container(
padding: const EdgeInsets.fromLTRB(3, 1, 3, 1),
decoration: BoxDecoration(
color: Theme.of(context)
.colorScheme
.primaryContainer
.withOpacity(0.6),
borderRadius: BorderRadius.circular(3)),
child: Text(
videoItem.rcmdReason.content,
style: TextStyle(
fontSize:
Theme.of(context).textTheme.labelSmall!.fontSize,
color: Theme.of(context).colorScheme.primary,
),
),
),
const SizedBox(width: 4)
] else if (videoItem.isFollowed == 1) ...[
Container(
padding: const EdgeInsets.fromLTRB(3, 1, 3, 1),
decoration: BoxDecoration(
color: Theme.of(context)
.colorScheme
.primaryContainer
.withOpacity(0.6),
borderRadius: BorderRadius.circular(3)),
child: Text(
'已关注',
style: TextStyle(
fontSize:
Theme.of(context).textTheme.labelSmall!.fontSize,
color: Theme.of(context).colorScheme.primary,
),
),
),
const SizedBox(width: 4)
],
Expanded(
child: LayoutBuilder(builder:
(BuildContext context, BoxConstraints constraints) {
return SizedBox(
width: constraints.maxWidth,
child: Text(
videoItem.owner.name,
maxLines: 1,
style: TextStyle(
fontSize: Theme.of(context)
.textTheme
.labelMedium!
.fontSize,
color: Theme.of(context).colorScheme.outline,
),
),
);
}),
),
],
),
// SizedBox(
// height: 18,
// child: Row(
// children: [
// if (videoItem.rcmdReason != null &&
// videoItem.rcmdReason.content != '') ...[
// Container(
// padding: const EdgeInsets.fromLTRB(3, 1, 3, 1),
// decoration: BoxDecoration(
// color: Theme.of(context)
// .colorScheme
// .primaryContainer
// .withOpacity(0.6),
// borderRadius: BorderRadius.circular(3)),
// child: Text(
// videoItem.rcmdReason.content,
// style: TextStyle(
// fontSize:
// Theme.of(context).textTheme.labelSmall!.fontSize,
// color: Theme.of(context).colorScheme.primary,
// ),
// ),
// ),
// const SizedBox(width: 4)
// ] else if (videoItem.isFollowed == 1) ...[
// Container(
// padding: const EdgeInsets.fromLTRB(3, 1, 3, 1),
// decoration: BoxDecoration(
// color: Theme.of(context)
// .colorScheme
// .primaryContainer
// .withOpacity(0.6),
// borderRadius: BorderRadius.circular(3)),
// child: Text(
// '已关注',
// style: TextStyle(
// fontSize:
// Theme.of(context).textTheme.labelSmall!.fontSize,
// color: Theme.of(context).colorScheme.primary,
// ),
// ),
// ),
// const SizedBox(width: 4)
// ],
// Expanded(
// child: LayoutBuilder(builder:
// (BuildContext context, BoxConstraints constraints) {
// return SizedBox(
// width: constraints.maxWidth,
// child: Text(
// videoItem.owner.name,
// maxLines: 1,
// style: TextStyle(
// fontSize: Theme.of(context)
// .textTheme
// .labelMedium!
// .fontSize,
// color: Theme.of(context).colorScheme.outline,
// ),
// ),
// );
// }),
// ),
// ],
// ),
// ),
Row(
children: [
StatView(
theme: 'black',
view: videoItem.stat.view,
),
const SizedBox(width: 6),
StatDanMu(
theme: 'black',
danmu: videoItem.stat.danmaku,
),
],
),
],
),