パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v2.1.0

datetime_picker_formfield_new

DateTime を発行する TextFormField で、Material、Cupertino、その他のスタイルのピッカー ダイアログを表示するのに役立ちます。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
8350
いいね数
34
Pub ポイント
140

パッケージをインストール

flutter pub add datetime_picker_formfield_new

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

DateTime 値を発行できる TextFormField を提供し、Material、Cupertino、およびその他のスタイルの日付/時刻ピッカー ダイアログと統合する Flutter パッケージです。複数のプラットフォームで入力フィールドと直感的なピッカー インターフェースを組み合わせることで、フォーム処理を簡素化します。日付または時刻の選択が必要なフォームでのシームレスな使用を目的としており、Android、iOS、Web、macOS、Windows、Linux など複数のプラットフォームをサポートしています。最小限のセットアップで一貫性があり、プラットフォームに適応したピッカーを提供することで、ユーザー体験を向上させます。

用途

  • 日時選択が必要なフォーム入力
  • クロスプラットフォームの日付/時刻入力
  • フォーム検証との統合
  • カスタマイズ可能なピッカーのスタイル
  • 動的フォームフィールドの更新
  • モバイルおよびWebアプリにおける使いやすい時間入力

主な機能

  • Material および Cupertino ピッカーをサポートしています
  • DateTime オブジェクトを発行します
  • クロスプラットフォーム互換性
  • Form ウィジェットとの簡単な統合
  • カスタマイズ可能なダイアログの外観
  • 組み込みの検証サポート

適している対象

  • クロスプラットフォームのフォームを開発する開発者
  • ネイティブな見た目の日付/時刻入力が必要なアプリ
  • デバイス間で一貫したUXを重視するチーム
  • Flutter のフォームアーキテクチャを使用するプロジェクト
  • 日付ピッカーのボイラープレートを最小限に抑えたいユーザー

注意事項

  • Flutter 2.0+ を必要とします
  • 複雑なテーマには追加のスタイル設定が必要になる場合があります
  • 基本的な日付/時刻形式に限定
  • 組み込みのローカライゼーションサポートなし
  • 下位プラットフォームのピッカー動作に依存する
  • 高度カスタマイズされたピッカーUIには適していません

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

DateTimeField

A TextFormField that emits DateTimes and helps show Material, Cupertino, and other style picker dialogs.

Fork with support for flutter >3.0.0

Example

See the example tab (example/lib/main.dart) for more.

screenshot.gif

import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:datetime_picker_formfield/datetime_picker_formfield.dart';

// ...

class BasicDateField extends StatelessWidget {
  final format = DateFormat("yyyy-MM-dd");
  @override
  Widget build(BuildContext context) {
    return Column(children: <Widget>[
      Text('Basic date field (${format.pattern})'),
      DateTimeField(
        format: format,
        onShowPicker: (context, currentValue) {
          return showDatePicker(
            context: context,
            firstDate: DateTime(1900),
            initialDate: currentValue ?? DateTime.now(),
            lastDate: DateTime(2100),
          );
        },
      ),
    ]);
  }
}

class BasicTimeField extends StatelessWidget {
  final format = DateFormat("HH:mm");
  @override
  Widget build(BuildContext context) {
    return Column(children: <Widget>[
      Text('Basic time field (${format.pattern})'),
      DateTimeField(
        format: format,
        onShowPicker: (context, currentValue) async {
          final time = await showTimePicker(
            context: context,
            initialTime: TimeOfDay.fromDateTime(currentValue ?? DateTime.now()),
          );
          return DateTimeField.convert(time);
        },
      ),
    ]);
  }
}

class BasicDateTimeField extends StatelessWidget {
  final format = DateFormat("yyyy-MM-dd HH:mm");
  @override
  Widget build(BuildContext context) {
    return Column(children: <Widget>[
      Text('Basic date & time field (${format.pattern})'),
      DateTimeField(
        format: format,
        onShowPicker: (context, currentValue) async {
          return await showDatePicker(
            context: context,
            firstDate: DateTime(1900),
            initialDate: currentValue ?? DateTime.now(),
            lastDate: DateTime(2100),
          ).then((DateTime? date) async {
            if (date != null) {
              final time = await showTimePicker(
                context: context,
                initialTime:
                    TimeOfDay.fromDateTime(currentValue ?? DateTime.now()),
              );
              return DateTimeField.combine(date, time);
            } else {
              return currentValue;
            }
          });
        },
      ),
    ]);
  }
}

カテゴリー

依存関係

依存関係一覧 1 件

ソースリポジトリ

このパッケージを使用しているプロジェクト