@@ -16,10 +16,9 @@ import '../../l10n/l10n.dart';
1616import '../player_model.dart' ;
1717
1818class PlayerLyrics extends StatefulWidget with WatchItStatefulWidgetMixin {
19- const PlayerLyrics ({super .key, required this .audio, required this .width });
19+ const PlayerLyrics ({super .key, required this .audio});
2020
2121 final Audio audio;
22- final double width;
2322
2423 @override
2524 State <PlayerLyrics > createState () => _PlayerLyricsState ();
@@ -100,65 +99,62 @@ class _PlayerLyricsState extends State<PlayerLyrics> {
10099 (PlayerModel m) => m.color ?? context.colorScheme.primary,
101100 );
102101
103- return SizedBox (
104- width: widget.width,
105- child: Column (
106- spacing: kLargestSpace,
107- children: [
108- Expanded (
109- child: ScrollConfiguration (
110- behavior: ScrollConfiguration .of (
111- context,
112- ).copyWith (scrollbars: ! _autoScroll),
113- child: ListView .builder (
102+ return Column (
103+ spacing: kLargestSpace,
104+ children: [
105+ Expanded (
106+ child: ScrollConfiguration (
107+ behavior: ScrollConfiguration .of (
108+ context,
109+ ).copyWith (scrollbars: ! _autoScroll),
110+ child: ListView .builder (
111+ controller: _controller,
112+ itemCount: lrc! .length,
113+ itemBuilder: (context, index) => AutoScrollTag (
114+ index: index,
114115 controller: _controller,
115- itemCount: lrc! .length,
116- itemBuilder: (context, index) => AutoScrollTag (
117- index: index,
118- controller: _controller,
119- key: ValueKey (index),
120- child: AnimatedContainer (
121- duration: const Duration (milliseconds: 300 ),
122- child: ListTile (
123- key: ValueKey ('${index }_tile' ),
124- selected: _selectedIndex == index,
125- selectedTileColor: Colors .transparent,
126- selectedColor: color,
127- title: Text (
128- lrc! .elementAt (index).lyrics,
129- style: context.textTheme.bodyLarge? .copyWith (
130- fontSize: _selectedIndex == index ? 18 : 15 ,
131- fontWeight: _selectedIndex == index
132- ? FontWeight .bold
133- : FontWeight .w300,
134- color: _selectedIndex == index ? color : null ,
135- ),
116+ key: ValueKey (index),
117+ child: AnimatedContainer (
118+ duration: const Duration (milliseconds: 300 ),
119+ child: ListTile (
120+ key: ValueKey ('${index }_tile' ),
121+ selected: _selectedIndex == index,
122+ selectedTileColor: Colors .transparent,
123+ selectedColor: color,
124+ title: Text (
125+ lrc! .elementAt (index).lyrics,
126+ style: context.textTheme.bodyLarge? .copyWith (
127+ fontSize: _selectedIndex == index ? 18 : 15 ,
128+ fontWeight: _selectedIndex == index
129+ ? FontWeight .bold
130+ : FontWeight .w300,
131+ color: _selectedIndex == index ? color : null ,
136132 ),
137133 ),
138134 ),
139135 ),
140136 ),
141137 ),
142138 ),
143- SizedBox (
144- width : 200 ,
145- child : TextButton . icon (
146- style : TextButton .styleFrom (
147- iconColor : _autoScroll ? color : context.colorScheme.onSurface,
148- foregroundColor : _autoScroll
149- ? color
150- : context.colorScheme.onSurface,
151- shape : RoundedRectangleBorder (
152- borderRadius : BorderRadius . circular (kYaruButtonRadius),
153- ),
139+ ),
140+ SizedBox (
141+ width : 200 ,
142+ child : TextButton .icon (
143+ style : TextButton . styleFrom (
144+ iconColor : _autoScroll ? color : context.colorScheme.onSurface,
145+ foregroundColor : _autoScroll
146+ ? color
147+ : context.colorScheme.onSurface,
148+ shape : RoundedRectangleBorder (
149+ borderRadius : BorderRadius . circular (kYaruButtonRadius ),
154150 ),
155- onPressed: () => setState (() => _autoScroll = ! _autoScroll),
156- label: Text (context.l10n.autoScrolling, maxLines: 1 ),
157- icon: const Icon (Icons .auto_awesome),
158151 ),
152+ onPressed: () => setState (() => _autoScroll = ! _autoScroll),
153+ label: Text (context.l10n.autoScrolling, maxLines: 1 ),
154+ icon: const Icon (Icons .auto_awesome),
159155 ),
160- ] ,
161- ) ,
156+ ) ,
157+ ] ,
162158 );
163159 }
164160}
0 commit comments