{"id":611,"date":"2021-05-05T18:52:15","date_gmt":"2021-05-05T09:52:15","guid":{"rendered":"http:\/\/localhost:8000\/?p=611"},"modified":"2021-05-05T19:06:37","modified_gmt":"2021-05-05T10:06:37","slug":"flutter-hour-minute-second-input","status":"publish","type":"post","link":"http:\/\/localhost:8000\/2021\/05\/flutter-hour-minute-second-input.html","title":{"rendered":"Flutter\u3067\u6642\u9593\uff08\u6642\u5206\u79d2\uff09\u5165\u529b"},"content":{"rendered":"
<\/p>\n
Flutter\u3067\u6642\u9593\uff08\u6642\u5206\u79d2\uff09\u3092\u5165\u529b\u3059\u308b\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u306e\u5b9f\u88c5\u65b9\u6cd5\u3092\u8abf\u3079\u305f\u306e\u3067\u8efd\u304f\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n
\u6642\u9593\u3092\u5165\u529b\u3059\u308b\u65b9\u6cd5\u3068\u3057\u3066\u6700\u3082\u30e1\u30b8\u30e3\u30fc\u306a\u306e\u304c\u3001showTimePicker()<\/a>\u3092\u4f7f\u3046\u65b9\u6cd5\u3060\u3068\u601d\u3044\u307e\u3059\u3002 \u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306aUI\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n <\/p>\n \u500b\u4eba\u7684\u306b\u306f\u3001\u3053\u306e\u30c7\u30d5\u30a9\u30eb\u30c8UI\u306f\u3001<\/p>\n \u3068\u3044\u3046\u30de\u30a4\u30ca\u30b9\u30dd\u30a4\u30f3\u30c8\u304c\u3042\u308b\u3068\u611f\u3058\u3066\u3044\u307e\u3059\u3002<\/p>\n \u8a72\u5f53\u90e8\u5206\u306e\u629c\u7c8b\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\uff08\u5168\u6587\u306f\u3053\u3061\u3089<\/a>\uff09\u3002<\/p>\n \u30dd\u30a4\u30f3\u30c8\u306f\u4ee5\u4e0b\u3067\u3059\u3002<\/p>\n 24\u6642\u9593\u5236\u3067\u5165\u529b\u3055\u305b\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n <\/p>\n \u8a72\u5f53\u90e8\u5206\u306e\u629c\u7c8b\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\uff08\u5168\u6587\u306f\u3053\u3061\u3089<\/a>\uff09\u3002<\/p>\n \u3053\u306e\u4f8b\u3067\u306f\u3001\u6642\u9593\u3092\u76f4\u63a5\u5165\u529b\u3059\u308b\u30e2\u30fc\u30c9\u306b\u5909\u66f4\u3057\u305f\u4e0a\u3067\u300124\u6642\u9593\u5236\u306b\u306a\u308b\u3088\u3046\u306b\u3057\u3066\u307f\u307e\u3057\u305f\u3002 \u79d2\uff08second\uff09\u307e\u3067\u5165\u529b\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u305f\u3044\u5834\u5408\u306f\u3001 Flutter Picker<\/a> \u306f\u3001 <\/p>\n \u4e8b\u524d\u306b\u3001pubspec.yaml \u306b\u4ee5\u4e0b\u306e\u4f9d\u5b58\u95a2\u4fc2\u3092\u8ffd\u52a0\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n \u8a72\u5f53\u90e8\u5206\u306e\u629c\u7c8b\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\uff08\u5168\u6587\u306f\u3053\u3061\u3089<\/a>\uff09\u3002<\/p>\n \u30dd\u30a4\u30f3\u30c8\u306f\u4ee5\u4e0b\u3067\u3059\u3002<\/p>\n Flutter\u3067\u6642\u9593\uff08\u6642\u5206\u79d2\uff09\u3092\u5165\u529b\u3059\u308b\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u306e\u5b9f\u88c5\u65b9\u6cd5\u3092\u8abf\u3079\u305f\u306e\u3067\u8efd\u304f\u7d39\u4ecb\u3057\u307e\u3059\u3002 showTimePicker \u3092\u4f7f\u3046 \u6642\u9593\u3092\u5165\u529b\u3059\u308b\u65b9\u6cd5\u3068\u3057\u3066\u6700\u3082\u30e1\u30b8\u30e3\u30fc\u306a\u306e\u304c\u3001showTimePicker()\u3092\u4f7f\u3046\u65b9\u6cd5\u3060\u3068\u601d\u3044\u307e\u3059\u3002 \u305f\u3060\u3057\u3001showTimePicker()\u306f\u3001\u30e2\u30fc\u30c0\u30eb\u30c0\u30a4\u30a2\u30ed\u30b0\u3067\u6642\uff08hour\uff09\uff0f\u5206\uff08minute\uff09\u3092\u5165\u529b\u3057\u3066TimeOfDay\u3092\u8fd4\u3059\u95a2\u6570\u306a\u306e\u3067\u3001\u79d2\uff08second\uff09\u306f\u5165\u529b\u3067\u304d\u307e\u305b\u3093\u3002 \u30c7\u30d5\u30a9\u30eb\u30c8 \u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306aUI\u306b\u306a\u308a\u307e\u3059\u3002 \u500b\u4eba\u7684\u306b\u306f\u3001\u3053\u306e\u30c7\u30d5\u30a9\u30eb\u30c8UI\u306f\u3001 \u6642\uff08hour\uff09\u3092\u9078\u3093\u3067\u3044\u308b\u306e\u304b\u5206\uff08minute\uff09\u3092\u9078\u3093\u3067\u3044\u308b\u306e\u304b\u5206\u304b\u308a\u306b\u304f\u3044 0\u6642\u3092\u9078\u3079\u306a\u3044 \u3068\u3044\u3046\u30de\u30a4\u30ca\u30b9\u30dd\u30a4\u30f3\u30c8\u304c\u3042\u308b\u3068\u611f\u3058\u3066\u3044\u307e\u3059\u3002 \u8a72\u5f53\u90e8\u5206\u306e\u629c\u7c8b\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\uff08\u5168\u6587\u306f\u3053\u3061\u3089\uff09\u3002 TextButton( child: Text('edit', style: T <\/span>Continue Reading<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[38],"tags":[],"_links":{"self":[{"href":"http:\/\/localhost:8000\/wp-json\/wp\/v2\/posts\/611"}],"collection":[{"href":"http:\/\/localhost:8000\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/localhost:8000\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/localhost:8000\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/localhost:8000\/wp-json\/wp\/v2\/comments?post=611"}],"version-history":[{"count":1,"href":"http:\/\/localhost:8000\/wp-json\/wp\/v2\/posts\/611\/revisions"}],"predecessor-version":[{"id":616,"href":"http:\/\/localhost:8000\/wp-json\/wp\/v2\/posts\/611\/revisions\/616"}],"wp:attachment":[{"href":"http:\/\/localhost:8000\/wp-json\/wp\/v2\/media?parent=611"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/localhost:8000\/wp-json\/wp\/v2\/categories?post=611"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/localhost:8000\/wp-json\/wp\/v2\/tags?post=611"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}
\n\u305f\u3060\u3057\u3001showTimePicker()<\/code>\u306f\u3001\u30e2\u30fc\u30c0\u30eb\u30c0\u30a4\u30a2\u30ed\u30b0\u3067\u6642\uff08hour\uff09\uff0f\u5206\uff08minute\uff09\u3092\u5165\u529b\u3057\u3066
TimeOfDay<\/code>\u3092\u8fd4\u3059\u95a2\u6570\u306a\u306e\u3067\u3001\u79d2\uff08second\uff09\u306f\u5165\u529b\u3067\u304d\u307e\u305b\u3093\u3002<\/strong><\/p>\n
\u30c7\u30d5\u30a9\u30eb\u30c8<\/h3>\n
\n
TextButton(\n child: Text('edit', style: TextStyle(decoration: TextDecoration.underline)),\n onPressed: () async {\n final TimeOfDay timeOfDay = await showTimePicker(context: context, initialTime: _timeOfDay);\n if (timeOfDay != null) setState(() => {_timeOfDay = timeOfDay});\n },\n),<\/code><\/pre>\n
\n
edit<\/code>\u30dc\u30bf\u30f3\u3092\u30bf\u30c3\u30d7\u3057\u305f\u969b\u306b\u3001
showTimePicker<\/code>\u3092\u547c\u3073\u51fa\u3059<\/li>\n
await<\/code>\u3057\u3066\u540c\u671f\u7684\u306b\u7d50\u679c\u3092\u53d7\u3051\u53d6\u308b<\/li>\n
setState()<\/code>\u3067\u5909\u66f4\u3092\u753b\u9762\u306b\u53cd\u6620\u3059\u308b<\/li>\n<\/ul>\n
24\u6642\u9593\u5236<\/h3>\n
TextButton(\n child: Text('edit', style: TextStyle(decoration: TextDecoration.underline)),\n onPressed: () async {\n final timeOfDay = await showTimePicker(\n context: context,\n initialTime: _timeOfDay,\n initialEntryMode: TimePickerEntryMode.input,\n builder: (BuildContext context, Widget child) {\n return MediaQuery(\n data: MediaQuery.of(context).copyWith(alwaysUse24HourFormat: true),\n child: child,\n );\n },\n );\n if (timeOfDay != null) setState(() => {_timeOfDay = timeOfDay});\n },\n),<\/code><\/pre>\n
\n\u4ee5\u4e0b\u4e8c\u70b9\u3092\u30c7\u30d5\u30a9\u30eb\u30c8\u304b\u3089\u5909\u66f4\u3057\u3066\u307e\u3059\u3002<\/p>\n\n
initialEntryMode: TimePickerEntryMode.input<\/code>\u306e\u8a2d\u5b9a\u3092\u8ffd\u52a0<\/li>\n
builder<\/code>\u3067
alwaysUse24HourFormat: true<\/code>\u306e
MediaQuery<\/code>\u3092\u8a2d\u5b9a<\/li>\n<\/ul>\n
showTimePicker()<\/code>\u3067\u306f\u5bfe\u5fdc\u3067\u304d\u306a\u3044\u305f\u3081\u3001\u5225\u306e\u65b9\u6cd5\u304c\u5fc5\u8981\u3067\u3059\u3002\u6642\u5206\u79d2\u3092\u30b7\u30f3\u30d7\u30eb\u306b\u5165\u529b\u3059\u308b\u30d7\u30e9\u30b0\u30a4\u30f3\u306f\u767a\u898b\u3067\u304d\u306a\u304b\u3063\u305f\u306e\u3067\u3001FlutterPicker\u3092\u4f7f\u3046\u65b9\u6cd5\u304c\u826f\u3055\u305d\u3046\u3067\u3059\u3002<\/p>\n
FlutterPicker \u3092\u4f7f\u3046<\/h2>\n
Array<\/code>\u30fb
Number<\/code>\u30fb
Date<\/code>\u30fb
DateTime<\/code>\u306a\u3069\u3092\u3001\u30bb\u30ec\u30af\u30c8\u3059\u308bPicker\u3092\u63d0\u4f9b\u3057\u3066\u304f\u308c\u308b\u30d7\u30e9\u30b0\u30a4\u30f3\u3067\u3059\u3002\u4eca\u56de\u306f
DateTime<\/code>\u578b\u306ePicker\u3092\u5229\u7528\u3057\u307e\u3059\u3002<\/p>\n
dependencies:\n flutter_picker: ^2.0.1<\/code><\/pre>\n
import 'package:flutter_picker\/flutter_picker.dart';<\/code><\/pre>\n
TextButton(\n child: Text('edit', style: TextStyle(decoration: TextDecoration.underline)),\n onPressed: () async {\n Picker(\n adapter: DateTimePickerAdapter(type: PickerDateTimeType.kHMS, value: _datetime, customColumnType: [3, 4, 5]),\n title: Text("Select Time"),\n onConfirm: (Picker picker, List value) {\n setState(() => {_datetime = DateTime.utc(0, 0, 0, value[0], value[1], value[2])});\n },\n ).showModal(context);\n },\n),<\/code><\/pre>\n
\n
adapter<\/code>\u306e
type<\/code>\u306b
PickerDateTimeType.kHMS<\/code>\u3092\u6307\u5b9a\u3057\u3066\u3001
hh:mm:ss<\/code>\u3092\u5165\u529b\u3059\u308b\u3088\u3046\u306b\u3059\u308b<\/li>\n
adapter<\/code>\u306e
customColumnType<\/code>\u306b
3(hour), 4(minute), 5(sec)<\/code>\u3092\u6307\u5b9a\u3059\u308b<\/li>\n
onConfirm<\/code>\u3067\u7d50\u679c\u3092\u53d6\u5f97\u3057\u3066\u3001
_datetime<\/code>\u3068\u3044\u3046\u5909\u6570\u306b\u8a2d\u5b9a\u3059\u308b<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"