update datepicker widget that it can be reused with different name
This commit is contained in:
@@ -48,7 +48,11 @@ class _ExcursionMainState extends State<ExcursionMain> {
|
|||||||
content: Column(
|
content: Column(
|
||||||
children: [
|
children: [
|
||||||
// TODO onDateChanged
|
// TODO onDateChanged
|
||||||
Datum(initDatum: DateTime.now(), onDateChanged: (date) {}),
|
Datum(
|
||||||
|
initDatum: DateTime.now(),
|
||||||
|
onDateChanged: (date) {},
|
||||||
|
name: AppLocalizations.of(context)!.date,
|
||||||
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
@@ -82,8 +86,8 @@ class _ExcursionMainState extends State<ExcursionMain> {
|
|||||||
getTextFields()["MHund"]!.text = mHund;
|
getTextFields()["MHund"]!.text = mHund;
|
||||||
getTextFields()["MLeine"]!.text = mLeine;
|
getTextFields()["MLeine"]!.text = mLeine;
|
||||||
|
|
||||||
print(mHund);
|
// print(mHund);
|
||||||
print(mLeine);
|
// print(mLeine);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
|
|||||||
@@ -701,6 +701,7 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
onDateChanged: (value) {
|
onDateChanged: (value) {
|
||||||
datum = value;
|
datum = value;
|
||||||
},
|
},
|
||||||
|
name: AppLocalizations.of(context)!.pickDate,
|
||||||
),
|
),
|
||||||
KontDat(
|
KontDat(
|
||||||
initKontDat: kontDat,
|
initKontDat: kontDat,
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
|
||||||
|
|
||||||
|
|
||||||
class Datum extends StatefulWidget {
|
class Datum extends StatefulWidget {
|
||||||
final DateTime? initDatum;
|
final DateTime? initDatum;
|
||||||
final Function(DateTime) onDateChanged;
|
final Function(DateTime) onDateChanged;
|
||||||
|
final String name;
|
||||||
|
|
||||||
const Datum({super.key, required this.initDatum, required this.onDateChanged});
|
const Datum(
|
||||||
|
{super.key, required this.initDatum, required this.onDateChanged, required this.name});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<Datum> createState() => _DatumState();
|
State<Datum> createState() => _DatumState();
|
||||||
@@ -19,7 +19,7 @@ class _DatumState extends State<Datum> {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
datum = widget.initDatum;
|
datum = widget.initDatum;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -35,7 +35,7 @@ class _DatumState extends State<Datum> {
|
|||||||
setState(() => datum = date);
|
setState(() => datum = date);
|
||||||
widget.onDateChanged(date);
|
widget.onDateChanged(date);
|
||||||
},
|
},
|
||||||
child: Text(AppLocalizations.of(context)!.pickDate)),
|
child: Text(widget.name)),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 10,
|
width: 10,
|
||||||
|
|||||||
Reference in New Issue
Block a user