Skip to content

Commit e2c647a

Browse files
committed
- CenterPlayButton UI bug fixed when using Material 3
1 parent 030cea1 commit e2c647a

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

lib/src/center_play_button.dart

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,29 @@ class CenterPlayButton extends StatelessWidget {
2424
return Container(
2525
color: Colors.transparent,
2626
child: Center(
27-
child: AnimatedOpacity(
28-
opacity: show ? 1.0 : 0.0,
29-
duration: const Duration(milliseconds: 300),
30-
child: Container(
31-
decoration: BoxDecoration(
32-
color: backgroundColor,
33-
shape: BoxShape.circle,
34-
),
35-
child: Padding(
36-
padding: const EdgeInsets.all(12.0),
37-
// Always set the iconSize on the IconButton, not on the Icon itself:
38-
// https://github.com/flutter/flutter/issues/52980
39-
child: IconButton(
40-
iconSize: 32,
41-
icon: isFinished
42-
? Icon(Icons.replay, color: iconColor)
43-
: AnimatedPlayPause(
44-
color: iconColor,
45-
playing: isPlaying,
46-
),
47-
onPressed: onPressed,
27+
child: UnconstrainedBox(
28+
child: AnimatedOpacity(
29+
opacity: show ? 1.0 : 0.0,
30+
duration: const Duration(milliseconds: 300),
31+
child: Container(
32+
decoration: BoxDecoration(
33+
color: backgroundColor,
34+
shape: BoxShape.circle,
35+
),
36+
child: Padding(
37+
padding: const EdgeInsets.all(12.0),
38+
// Always set the iconSize on the IconButton, not on the Icon itself:
39+
// https://github.com/flutter/flutter/issues/52980
40+
child: IconButton(
41+
iconSize: 32,
42+
icon: isFinished
43+
? Icon(Icons.replay, color: iconColor)
44+
: AnimatedPlayPause(
45+
color: iconColor,
46+
playing: isPlaying,
47+
),
48+
onPressed: onPressed,
49+
),
4850
),
4951
),
5052
),

0 commit comments

Comments
 (0)