import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; extension FikoTarih on DateTime { String? string(String pattern) { try { return DateFormat(pattern).format(this); } catch (e) { return null; } } String formatla(String format) { DateFormat dateFormat = DateFormat(format); return dateFormat.format(this); } DateTime formattan(String format, String tarih) { DateFormat dateFormat = DateFormat(format); return dateFormat.parse(tarih); } String farkToString(DateTime? tarih) { tarih = tarih ?? DateTime.now(); return toIso8601String(); } TimeOfDay gununSaati() { TimeOfDay time = TimeOfDay(hour: hour, minute: minute); return time; } DateTime ayarlaGununSaati(TimeOfDay saat) { TimeOfDay time = TimeOfDay(hour: saat.hour, minute: saat.minute); DateTime currentDateTime = DateTime(year, month, month, time.hour, time.minute); return currentDateTime; } saatSec(BuildContext context, {TimeOfDay gecerliSaat = const TimeOfDay(hour: 17, minute: 30)}) { showTimePicker(context: context, initialTime: gununSaati() ?? gecerliSaat) .then( (value) { if (value != null) { print(value); kayit?.value.cikis = DateTime.now().ayarlaGununSaati(value); kayit?.refresh(); } }, ); } }