merge: 合并 K30-F 简介灰字与透明暂停按钮
This commit is contained in:
commit
ac73bf2208
4 files changed
+38
-25
No files matched your search
@@ -22,13 +22,9 @@ class PlayerCenterToggle extends StatelessWidget {
|
|||||||
label: playing ? 'Pause' : 'Play',
|
label: playing ? 'Pause' : 'Play',
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
child: Container(
|
child: SizedBox(
|
||||||
width: 52,
|
width: 52,
|
||||||
height: 52,
|
height: 52,
|
||||||
decoration: const BoxDecoration(
|
|
||||||
color: AppColors.blue,
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
),
|
|
||||||
child: Icon(
|
child: Icon(
|
||||||
playing ? Icons.pause_rounded : Icons.play_arrow_rounded,
|
playing ? Icons.pause_rounded : Icons.play_arrow_rounded,
|
||||||
color: AppColors.onPrimary,
|
color: AppColors.onPrimary,
|
||||||
|
|||||||
@@ -241,16 +241,11 @@ class _EpisodeSynopsis extends StatefulWidget {
|
|||||||
class _EpisodeSynopsisState extends State<_EpisodeSynopsis> {
|
class _EpisodeSynopsisState extends State<_EpisodeSynopsis> {
|
||||||
bool _expanded = false;
|
bool _expanded = false;
|
||||||
|
|
||||||
static const TextStyle _labelStyle = TextStyle(
|
/// 「第 n 集」、分隔符与简介正文共用同一套灰字规格。
|
||||||
color: AppColors.onPrimary,
|
static const TextStyle _lineStyle = TextStyle(
|
||||||
fontSize: 12,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
shadows: _playerTextShadows,
|
|
||||||
);
|
|
||||||
|
|
||||||
static const TextStyle _synopsisStyle = TextStyle(
|
|
||||||
color: AppColors.playerMuted,
|
color: AppColors.playerMuted,
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
height: 1.35,
|
height: 1.35,
|
||||||
shadows: _playerTextShadows,
|
shadows: _playerTextShadows,
|
||||||
);
|
);
|
||||||
@@ -270,17 +265,15 @@ class _EpisodeSynopsisState extends State<_EpisodeSynopsis> {
|
|||||||
key: const Key('player-episode-label'),
|
key: const Key('player-episode-label'),
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: _labelStyle,
|
style: _lineStyle,
|
||||||
),
|
),
|
||||||
const Padding(
|
Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 6),
|
padding: const EdgeInsets.symmetric(horizontal: 6),
|
||||||
child: Text(
|
child: Text(
|
||||||
'|',
|
'|',
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
style: TextStyle(
|
style: _lineStyle.copyWith(
|
||||||
color: Colors.white54,
|
color: AppColors.playerMuted.withValues(alpha: 0.6),
|
||||||
fontSize: 12,
|
|
||||||
shadows: _playerTextShadows,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -290,7 +283,7 @@ class _EpisodeSynopsisState extends State<_EpisodeSynopsis> {
|
|||||||
key: const Key('player-synopsis'),
|
key: const Key('player-synopsis'),
|
||||||
maxLines: _expanded ? null : 1,
|
maxLines: _expanded ? null : 1,
|
||||||
overflow: _expanded ? TextOverflow.clip : TextOverflow.ellipsis,
|
overflow: _expanded ? TextOverflow.clip : TextOverflow.ellipsis,
|
||||||
style: _synopsisStyle,
|
style: _lineStyle,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (!_expanded) _toggle(widget.l10n.expandSynopsis),
|
if (!_expanded) _toggle(widget.l10n.expandSynopsis),
|
||||||
|
|||||||
@@ -33,16 +33,16 @@ void main() {
|
|||||||
Key('player-play-toggle'),
|
Key('player-play-toggle'),
|
||||||
]) {
|
]) {
|
||||||
expect(tester.getSize(find.byKey(key)), const Size(52, 52));
|
expect(tester.getSize(find.byKey(key)), const Size(52, 52));
|
||||||
final container = tester.widget<Container>(
|
// 暂停按钮改为透明背景,容器已不再绘制任何底色或装饰。
|
||||||
|
expect(
|
||||||
find.descendant(of: find.byKey(key), matching: find.byType(Container)),
|
find.descendant(of: find.byKey(key), matching: find.byType(Container)),
|
||||||
|
findsNothing,
|
||||||
);
|
);
|
||||||
final decoration = container.decoration! as BoxDecoration;
|
|
||||||
expect(decoration.color, AppColors.blue);
|
|
||||||
expect(decoration.shape, BoxShape.circle);
|
|
||||||
final icon = tester.widget<Icon>(
|
final icon = tester.widget<Icon>(
|
||||||
find.descendant(of: find.byKey(key), matching: find.byType(Icon)),
|
find.descendant(of: find.byKey(key), matching: find.byType(Icon)),
|
||||||
);
|
);
|
||||||
expect(icon.size, 26);
|
expect(icon.size, 26);
|
||||||
|
expect(icon.color, AppColors.onPrimary);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -380,6 +380,30 @@ void main() {
|
|||||||
expect(tester.widget<Text>(synopsis).maxLines, 1);
|
expect(tester.widget<Text>(synopsis).maxLines, 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testWidgets('should_share_one_muted_style_across_label_and_synopsis', (
|
||||||
|
tester,
|
||||||
|
) async {
|
||||||
|
await _pumpApp(tester);
|
||||||
|
await _openSeriesPlayer(tester);
|
||||||
|
|
||||||
|
TextStyle styleOf(Finder finder) =>
|
||||||
|
tester.widget<Text>(finder).style ?? const TextStyle();
|
||||||
|
final label = styleOf(find.byKey(const Key('player-episode-label')));
|
||||||
|
final synopsis = styleOf(find.byKey(const Key('player-synopsis')));
|
||||||
|
final separator = styleOf(
|
||||||
|
find.descendant(
|
||||||
|
of: find.byKey(const Key('player-episode-synopsis')),
|
||||||
|
matching: find.text('|'),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
for (final style in [label, synopsis, separator]) {
|
||||||
|
expect(style.fontSize, 12);
|
||||||
|
expect(style.fontWeight, FontWeight.w500);
|
||||||
|
expect(style.color?.withValues(alpha: 1), AppColors.playerMuted);
|
||||||
|
}
|
||||||
|
expect(separator.color, isNot(Colors.white));
|
||||||
|
});
|
||||||
|
|
||||||
testWidgets('should_fit_long_title_and_synopsis_at_320_width', (
|
testWidgets('should_fit_long_title_and_synopsis_at_320_width', (
|
||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
|
|||||||
Reference in new issue
Block a user