首页 > 解决方案 > 颤振持续时间选择器包

问题描述

我在使用 Flutter Duration Picker Package 时遇到问题。

基本上我只想通过 showDurationPicker 函数显示他们的 Duration Picker。没有像示例中那样使用 Duration Picker 作为孩子。可能的或其他解决方案?我想让用户选择倒数计时器的时间。

包: https ://pub.dev/packages/duration_picker

这是代码:

                       IconButton(
                          icon: Icon(Icons.history_rounded,
                              color: AppTheme.blue,
                              size:
                                  3.23 * SizeConfig.heightMultiplier //30.0,
                              ),
                          onPressed: ()  {
                            Duration _durationResult =
                                await 
                                showDurationPicker(
                                    snapToMins: 5.0,
                                    context: context,
                                    initialTime: Duration(
                                        hours: 2,
                                        minutes: 0,
                                        seconds: 0,
                                        milliseconds: 0));

                                        
                            
                          }),

终端:

Xcode 的输出:

↳ ../../../FlutterDev/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_duration_picker-1.0.4/lib/flutte r_duration_picker.dart:506:44:错误:找不到方法: 'ButtonTheme.bar'。最终小部件操作 = new ButtonTheme.bar( ^^^

Command PhaseScriptExecution failed with a nonzero exit code 
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Analyzing workspace
note: Constructing build description
note: Build preparation complete

无法为模拟器构建应用程序。在 Xs 上启动应用程序时出错。

标签: flutterflutter-dependenciesflutter-widget

解决方案


您应该切换到新的维护版本 - https://github.com/juliansteenbakker/duration_picker


推荐阅读