Time/Calendar view added

This commit is contained in:
Niklas 2024-01-07 15:31:14 +01:00
parent c934384114
commit 8798b73b15
1 changed files with 260 additions and 6 deletions

View File

@ -42,8 +42,8 @@ class MyApp extends StatelessWidget {
routes: <String, WidgetBuilder>{
UIData.homeRoute: (BuildContext context) =>
MyFormPage(title: 'SecondPage'), //title=AbsorbPointer()'Start'),
UIData.citiesRoute: (BuildContext context) => TypePage(title: 'Type'),
UIData.twitter: (BuildContext context) =>
UIData.typeRoute: (BuildContext context) => TypePage(title: 'Type'),
UIData.categorieRoute: (BuildContext context) =>
CategoriePage(), //title='Kategorie'),
//UIData.teamRoute: (BuildContext context) =>TeamsPage(),
//UIData.planRoute: (BuildContext context) =>PlanPage(),
@ -56,10 +56,10 @@ class MyApp extends StatelessWidget {
class UIData {
//routes
static const String homeRoute = "/home";
static const String teamRoute = "/teams";
static const String planRoute = "/plan";
static const String citiesRoute = "/cities";
static const String twitter = "/twitter";
static const String typeRoute = "/teams";
static const String categorieRoute = "/categorie";
static const String timeRoute = "/time";
static const String resoultRoute = "/list";
static const String quizRoute = "/quiz";
static const String impressionRoute = "/impression";
}
@ -604,6 +604,260 @@ class CategoriePage extends StatelessWidget {
),
),
child: Text('Snack'),
onPressed: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) {
return TimePage();
}));
},
),
),
],
),
),
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.grey,
textStyle: const TextStyle(color: Colors.white)),
onPressed: () {
// reset() setzt alle Felder wieder auf den Initalwert zurück.
},
child: const Text('Zurücksetzen'),
),
const SizedBox(width: 25),
ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.grey,
textStyle: const TextStyle(color: Colors.white)),
onPressed: () {
// reset() setzt alle Felder wieder auf den Initalwert zurück.
},
child: const Text('Skip'),
),
const SizedBox(width: 25),
ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.blue,
textStyle: const TextStyle(color: Colors.white)),
onPressed: () {
// Wenn alle Validatoren der Felder des Formulars gültig sind.
Navigator.push(context, MaterialPageRoute(builder: (context) {
return TimePage();
}));
},
child: const Text('Weiter'),
)
],
)),
]),
),
);
}
}
class TimePage extends StatelessWidget {
DateTime selectedDate = DateTime.now();
TimeOfDay selectedTime = TimeOfDay.now();
Future<void> _selectDate(BuildContext context) async {
final DateTime? picked = await showDatePicker(
context: context,
initialDate: selectedDate,
firstDate: DateTime(2015, 8),
lastDate: DateTime(2101));
if (picked != null && picked != selectedDate) {
selectedDate = picked;
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Wann"),
),
body: Center(
child:
Column(crossAxisAlignment: CrossAxisAlignment.stretch, children: [
Expanded(
child: Row(
children: [
SizedBox(
height: 100, //height of button
width: (MediaQuery.of(context).size.width - 30) *
(2 / 3), //width of button
child: TextButton(
style: ElevatedButton.styleFrom(
elevation: 5,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
),
child: Text('Datum von bis'),
onPressed: () {},
),
),
SizedBox(
height: 100, //height of button
width: (MediaQuery.of(context).size.width - 30) /
3, //width of button
child: ElevatedButton.icon(
icon: Icon(
Icons.calendar_month,
/*color: Colors.green,*/
size: 30.0,
),
style: ElevatedButton.styleFrom(
elevation: 5,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
),
label: Text('Select'),
onPressed: () => _selectDate(context),
),
),
],
),
),
Expanded(
child: Row(
children: [
const SizedBox(width: 5),
SizedBox(
height: 100, //height of button
width: (MediaQuery.of(context).size.width - 50) /
3, //width of button
child: ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: 5,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
),
child: Text('Heute'),
onPressed: () {},
),
),
const SizedBox(width: 15),
SizedBox(
height: 100, //height of button
width: (MediaQuery.of(context).size.width - 50) /
3, //width of button
child: ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: 5,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
),
child: Text('Morgen'),
onPressed: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) {
return CategoriePage();
}));
},
),
),
const SizedBox(width: 15),
SizedBox(
height: 100, //height of button
width: (MediaQuery.of(context).size.width - 30) /
3, //width of button
child: ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: 5,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
),
child: Text('Dieses Wochenende'),
onPressed: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) {
return CategoriePage();
}));
},
),
),
],
),
),
Expanded(
child: SizedBox(
height: 100, //height of button
width: (MediaQuery.of(context).size.width - 30) /
3, //width of button
child: TextButton(
child: Text('Ab wann soll es losgehen?'),
onPressed: () {},
),
),
),
Expanded(
child: Row(
children: [
const SizedBox(width: 5),
SizedBox(
height: 100, //height of button
width: (MediaQuery.of(context).size.width - 50) /
3, //width of button
child: ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: 5,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
),
child: Text('Jetzt'),
onPressed: () {},
),
),
const SizedBox(width: 15),
SizedBox(
height: 100, //height of button
width: (MediaQuery.of(context).size.width - 50) /
3, //width of button
child: ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: 5,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
),
child: Text('+ 1 Std'),
onPressed: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) {
return CategoriePage();
}));
},
),
),
const SizedBox(width: 15),
SizedBox(
height: 100, //height of button
width: (MediaQuery.of(context).size.width - 30) /
3, //width of button
child: ElevatedButton.icon(
icon: Icon(
Icons.timer,
/*color: Colors.green,*/
size: 30.0,
),
style: ElevatedButton.styleFrom(
elevation: 5,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
),
label: Text('Select'),
onPressed: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) {