首页 > 解决方案 > Flutter how to show Time Picker as widget

问题描述

I need to implement time picker as a widget . I don't need it in modal or dialogue . I need it to be shown in container .any resources or guidlines are appreciated.enter image description here

标签: flutterflutter-layout

解决方案


您可以使用CupertinoTimePicker.

return Scaffold(
      body: Center(
        child: Container(
          height: 200,
          child: Card(
            elevation: 4,
            child: Row(
              children: <Widget>[
                SizedBox(
                  width: 100,
                  child: Text("Select a time"),
                ),
                Expanded(
                  child: CupertinoTimerPicker(
                    mode: CupertinoTimerPickerMode.hm,
                    onTimerDurationChanged: (data) {},
                  ),
                ),
              ],
            ),
          ),
        ),
      ),
    );

结果:

在此处输入图像描述


推荐阅读