@@ -30,20 +30,17 @@ class MainPageIcon extends StatelessWidget with WatchItMixin {
3030 final useMoreAnimations = watchPropertyValue (
3131 (SettingsModel m) => m.useMoreAnimations,
3232 );
33- final isLocalAudioImporting = watchValue (
34- (LocalAudioModel m) => m.initAudiosCommand.isRunning,
35- );
3633
37- if (isLocalAudioImporting && audioType == AudioType .local) {
38- return Padding (
39- padding: mainPageIconPadding,
40- child: const SizedBox (
41- width: 16 ,
42- height: 16 ,
43- child: Progress (strokeWidth: 2 ),
44- ),
34+ if (audioType == AudioType .local) {
35+ return LocalMainPageIcon (
36+ isCurrentlyPlaying: currentAudioType == AudioType .local,
37+ selected: selected,
38+ isPlaying: isPlaying,
39+ useMoreAnimations: useMoreAnimations,
4540 );
46- } else if (currentAudioType == audioType) {
41+ }
42+
43+ if (currentAudioType == audioType) {
4744 if (isPlaying) {
4845 if (useMoreAnimations) {
4946 return const ActiveAudioSignalIndicator (thickness: 2 );
@@ -66,3 +63,48 @@ class MainPageIcon extends StatelessWidget with WatchItMixin {
6663 );
6764 }
6865}
66+
67+ class LocalMainPageIcon extends StatelessWidget with WatchItMixin {
68+ const LocalMainPageIcon ({
69+ super .key,
70+ required this .selected,
71+ required this .isPlaying,
72+ required this .useMoreAnimations,
73+ required this .isCurrentlyPlaying,
74+ });
75+
76+ final bool selected;
77+ final bool isPlaying;
78+ final bool useMoreAnimations;
79+ final bool isCurrentlyPlaying;
80+
81+ @override
82+ Widget build (BuildContext context) {
83+ final isLocalAudioImporting = watchValue (
84+ (LocalAudioModel m) => m.initAudiosCommand.isRunning,
85+ );
86+
87+ if (isLocalAudioImporting)
88+ return Padding (
89+ padding: mainPageIconPadding,
90+ child: const SizedBox (
91+ width: 16 ,
92+ height: 16 ,
93+ child: Progress (strokeWidth: 2 ),
94+ ),
95+ );
96+
97+ if (useMoreAnimations && isCurrentlyPlaying && isPlaying) {
98+ return const ActiveAudioSignalIndicator (thickness: 2 );
99+ }
100+
101+ return Padding (
102+ padding: mainPageIconPadding,
103+ child: Icon (
104+ selected
105+ ? AudioType .local.selectedIconDataMainPage
106+ : AudioType .local.iconDataMainPage,
107+ ),
108+ );
109+ }
110+ }
0 commit comments