2023-05-29 22:04:44 +02:00
|
|
|
import 'package:ernaehrung/android/components/card/card_component.dart';
|
2023-05-29 12:08:46 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2023-06-01 12:14:23 +02:00
|
|
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
2023-05-29 22:04:44 +02:00
|
|
|
import 'package:hive_flutter/adapters.dart';
|
2023-05-29 12:08:46 +02:00
|
|
|
|
|
|
|
class TodayPage extends StatefulWidget {
|
|
|
|
final String title;
|
|
|
|
final Color backgroundColor = const Color(0xff47a44b);
|
2023-05-29 22:04:44 +02:00
|
|
|
|
2023-05-29 12:08:46 +02:00
|
|
|
const TodayPage({Key? key, required this.title}) : super(key: key);
|
2023-05-29 22:04:44 +02:00
|
|
|
|
2023-05-29 12:08:46 +02:00
|
|
|
@override
|
|
|
|
State<TodayPage> createState() => _TodayPageState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _TodayPageState extends State<TodayPage> {
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
2023-05-29 22:04:44 +02:00
|
|
|
body: SingleChildScrollView(
|
|
|
|
child: ValueListenableBuilder(
|
2023-06-01 12:14:23 +02:00
|
|
|
valueListenable: Hive.box(dotenv.env['MEALPLAN_BOX'] ?? 'MEALPLAN').listenable(),
|
2023-05-29 22:04:44 +02:00
|
|
|
builder: (context, box, widget) {
|
|
|
|
return ListView.builder(
|
|
|
|
primary: false,
|
|
|
|
shrinkWrap: true,
|
|
|
|
itemCount: box.keys.length,
|
|
|
|
itemBuilder: (context, i) {
|
|
|
|
if (box.keyAt(i).toString() == "DATE") {
|
|
|
|
return const SizedBox.shrink();
|
|
|
|
} else {
|
|
|
|
return CardComponent(
|
2023-05-30 17:10:53 +02:00
|
|
|
box.keyAt(i).toString(),
|
2023-05-29 22:04:44 +02:00
|
|
|
box.getAt(i)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
})));
|
2023-05-29 12:08:46 +02:00
|
|
|
}
|
|
|
|
}
|