Ejemplo n.º 1
0
 public _DatePickerDialog(
     DateTime initialDate,
     DateTime firstDate,
     DateTime lastDate,
     SelectableDayPredicate selectableDayPredicate,
     DatePickerMode initialDatePickerMode,
     Key key = null
     ) : base(key: key)
 {
     this.initialDate            = initialDate;
     this.firstDate              = firstDate;
     this.lastDate               = lastDate;
     this.selectableDayPredicate = selectableDayPredicate;
     this.initialDatePickerMode  = initialDatePickerMode;
 }
Ejemplo n.º 2
0
        public static IPromise <object> showDatePicker(
            BuildContext context,
            DateTime initialDate,
            DateTime firstDate,
            DateTime lastDate,
            SelectableDayPredicate selectableDayPredicate = null,
            DatePickerMode initialDatePickerMode          = DatePickerMode.day,
            Locale locale             = null,
            TransitionBuilder builder = null
            )
        {
            D.assert(initialDate >= firstDate, () => "initialDate must be on or after firstDate");
            D.assert(initialDate <= lastDate, () => "initialDate must be on or before lastDate");
            D.assert(firstDate <= lastDate, () => "lastDate must be on or after firstDate");
            D.assert(
                selectableDayPredicate == null || selectableDayPredicate(initialDate),
                () => "Provided initialDate must satisfy provided selectableDayPredicate"
                );
            D.assert(context != null);
            D.assert(MaterialD.debugCheckHasMaterialLocalizations(context));

            Widget child = new _DatePickerDialog(
                initialDate: initialDate,
                firstDate: firstDate,
                lastDate: lastDate,
                selectableDayPredicate: selectableDayPredicate,
                initialDatePickerMode: initialDatePickerMode
                );

            if (locale != null)
            {
                child = Localizations.overrides(
                    context: context,
                    locale: locale,
                    child: child
                    );
            }

            return(DialogUtils.showDialog(
                       context: context,
                       builder: (BuildContext _context) => { return builder == null ? child : builder(_context, child); }
                       ));
        }
Ejemplo n.º 3
0
 public MonthPicker(
     DateTime selectedDate,
     ValueChanged <DateTime> onChanged,
     DateTime firstDate,
     DateTime lastDate,
     SelectableDayPredicate selectableDayPredicate,
     DragStartBehavior dragStartBehavior = DragStartBehavior.start,
     Key key = null
     ) : base(key: key)
 {
     D.assert(selectedDate != null);
     D.assert(onChanged != null);
     D.assert(firstDate <= lastDate);
     D.assert(selectedDate >= firstDate);
     this.selectedDate           = selectedDate;
     this.onChanged              = onChanged;
     this.firstDate              = firstDate;
     this.lastDate               = lastDate;
     this.selectableDayPredicate = selectableDayPredicate;
     this.dragStartBehavior      = dragStartBehavior;
 }