Refactor codebase resolving warnings and remove self-package imports
This commit is contained in:
59
lib/view/pages/more/countdown/addTimerDialog.dart
Normal file
59
lib/view/pages/more/countdown/addTimerDialog.dart
Normal file
@ -0,0 +1,59 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AddTimerDialog extends StatefulWidget {
|
||||
const AddTimerDialog({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<AddTimerDialog> createState() => _AddTimerDialogState();
|
||||
}
|
||||
|
||||
class _AddTimerDialogState extends State<AddTimerDialog> {
|
||||
DateTime selected = DateTime.now().add(const Duration(days: 1));
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: const Text("Timer hinzufügen"),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const TextField(
|
||||
decoration: InputDecoration(
|
||||
labelText: "Timer Name"
|
||||
),
|
||||
),
|
||||
|
||||
TextButton(onPressed: () async {
|
||||
DateTime? selectedDate = await showDatePicker(context: context, initialDate: DateTime.now(), firstDate: DateTime.now(), lastDate: DateTime.now().add(const Duration(days: 365 * 10)));
|
||||
if(selectedDate == null) return;
|
||||
|
||||
setState(() {
|
||||
selected = selectedDate;
|
||||
});
|
||||
|
||||
}, child: const Text("Datum auswählen")),
|
||||
|
||||
TextButton(onPressed: () async {
|
||||
TimeOfDay? selectedTime = await showTimePicker(context: context, initialTime: TimeOfDay.fromDateTime(DateTime.now()));
|
||||
if(selectedTime == null) return;
|
||||
|
||||
setState(() {
|
||||
selected = selected.copyWith(hour: selectedTime.hour, minute: selectedTime.minute);
|
||||
});
|
||||
}, child: const Text("Zeit auswählen")),
|
||||
|
||||
Text(selected.toString())
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
}, child: const Text("Abbrechen")),
|
||||
TextButton(onPressed: () {
|
||||
// TODO add timer
|
||||
}, child: const Text("Hinzufügen")),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user