@@ -162,10 +162,10 @@ class _MaterialControlsState extends State<MaterialControls>
162162 );
163163 }
164164
165- Widget _buildOptionsButton ( ) {
165+ List < OptionItem > _buildOptions ( BuildContext context ) {
166166 final options = < OptionItem > [
167167 OptionItem (
168- onTap: () async {
168+ onTap: (context ) async {
169169 Navigator .pop (context);
170170 _onSpeedButtonTap ();
171171 },
@@ -179,7 +179,10 @@ class _MaterialControlsState extends State<MaterialControls>
179179 chewieController.additionalOptions !(context).isNotEmpty) {
180180 options.addAll (chewieController.additionalOptions !(context));
181181 }
182+ return options;
183+ }
182184
185+ Widget _buildOptionsButton () {
183186 return AnimatedOpacity (
184187 opacity: notifier.hideStuff ? 0.0 : 1.0 ,
185188 duration: const Duration (milliseconds: 250 ),
@@ -188,14 +191,15 @@ class _MaterialControlsState extends State<MaterialControls>
188191 _hideTimer? .cancel ();
189192
190193 if (chewieController.optionsBuilder != null ) {
191- await chewieController.optionsBuilder !(context, options);
194+ await chewieController.optionsBuilder !(
195+ context, _buildOptions (context));
192196 } else {
193197 await showModalBottomSheet <OptionItem >(
194198 context: context,
195199 isScrollControlled: true ,
196200 useRootNavigator: chewieController.useRootNavigator,
197201 builder: (context) => OptionsDialog (
198- options: options ,
202+ options: _buildOptions (context) ,
199203 cancelButtonText:
200204 chewieController.optionsTranslation? .cancelButtonText,
201205 ),
0 commit comments