@@ -161,7 +161,7 @@ class _MaterialControlsState extends State<MaterialControls>
161161 );
162162 }
163163
164- Widget _buildOptionsButton ( ) {
164+ List < OptionItem > _buildOptions ( BuildContext context ) {
165165 final options = < OptionItem > [
166166 OptionItem (
167167 onTap: (context) async {
@@ -178,7 +178,10 @@ class _MaterialControlsState extends State<MaterialControls>
178178 chewieController.additionalOptions !(context).isNotEmpty) {
179179 options.addAll (chewieController.additionalOptions !(context));
180180 }
181+ return options;
182+ }
181183
184+ Widget _buildOptionsButton () {
182185 return AnimatedOpacity (
183186 opacity: notifier.hideStuff ? 0.0 : 1.0 ,
184187 duration: const Duration (milliseconds: 250 ),
@@ -187,14 +190,14 @@ class _MaterialControlsState extends State<MaterialControls>
187190 _hideTimer? .cancel ();
188191
189192 if (chewieController.optionsBuilder != null ) {
190- await chewieController.optionsBuilder !(context, options );
193+ await chewieController.optionsBuilder !(context, _buildOptions (context) );
191194 } else {
192195 await showModalBottomSheet <OptionItem >(
193196 context: context,
194197 isScrollControlled: true ,
195198 useRootNavigator: chewieController.useRootNavigator,
196199 builder: (context) => OptionsDialog (
197- options: options ,
200+ options: _buildOptions (context) ,
198201 cancelButtonText:
199202 chewieController.optionsTranslation? .cancelButtonText,
200203 ),
0 commit comments