let AI comment everything because well... yeah...
This commit is contained in:
@@ -1,8 +1,21 @@
|
||||
// * Shared widget for date selection across the application
|
||||
// * Features:
|
||||
// * - Date picker dialog interface
|
||||
// * - Formatted date display
|
||||
// * - Customizable button label
|
||||
// * - Date range validation
|
||||
// * - Callback for date changes
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Widget for managing date selection
|
||||
/// Provides a button to open date picker and displays selected date
|
||||
class Datum extends StatefulWidget {
|
||||
/// Initial date value
|
||||
final DateTime? initDatum;
|
||||
/// Callback function when date changes
|
||||
final Function(DateTime) onDateChanged;
|
||||
/// Label for the date picker button
|
||||
final String name;
|
||||
|
||||
const Datum(
|
||||
@@ -12,7 +25,9 @@ class Datum extends StatefulWidget {
|
||||
State<Datum> createState() => _DatumState();
|
||||
}
|
||||
|
||||
/// State class for the date selection widget
|
||||
class _DatumState extends State<Datum> {
|
||||
/// Currently selected date
|
||||
DateTime? datum;
|
||||
|
||||
@override
|
||||
@@ -26,6 +41,7 @@ class _DatumState extends State<Datum> {
|
||||
return Row(
|
||||
children: [
|
||||
Row(children: [
|
||||
// Date picker button
|
||||
SizedBox(
|
||||
width: 140,
|
||||
child: ElevatedButton(
|
||||
@@ -40,6 +56,7 @@ class _DatumState extends State<Datum> {
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
// Formatted date display
|
||||
Text(
|
||||
'${datum?.day}. ${datum?.month}. ${datum?.year}',
|
||||
),
|
||||
@@ -48,6 +65,8 @@ class _DatumState extends State<Datum> {
|
||||
);
|
||||
}
|
||||
|
||||
/// Shows date picker dialog and returns selected date
|
||||
/// @return Future<DateTime?> Selected date or null if cancelled
|
||||
Future<DateTime?> pickDate() async {
|
||||
final date = await showDatePicker(
|
||||
context: context,
|
||||
|
||||
Reference in New Issue
Block a user