optimierung
parent
c91f3901dd
commit
a989878cca
|
@ -14,7 +14,7 @@ class AndroidApp extends StatelessWidget {
|
|||
return MaterialApp(
|
||||
title: 'Flutter Demo',
|
||||
theme: ThemeData(
|
||||
scaffoldBackgroundColor: Colors.grey.shade100, //<-- SEE
|
||||
scaffoldBackgroundColor: Colors.grey.shade200, //<-- SEE
|
||||
),
|
||||
home: box.get("USER") == null ? const OnboardingPage() : const MainPage(),
|
||||
routes: {
|
||||
|
|
|
@ -45,12 +45,9 @@ class CardComponent extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: 300,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF6E7BFB),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
||||
border: Border.all(
|
||||
color: Colors.black,
|
||||
),
|
||||
decoration: const BoxDecoration(
|
||||
color: Color(0xFF6E7BFB),
|
||||
borderRadius: BorderRadius.all(Radius.circular(16)),
|
||||
),
|
||||
margin: const EdgeInsets.fromLTRB(0, 16, 0, 16),
|
||||
child: Column(
|
||||
|
|
|
@ -11,7 +11,10 @@ class CardComponent extends StatefulWidget {
|
|||
final bool addButtonVisible;
|
||||
|
||||
const CardComponent(
|
||||
{Key? key, required this.eatingMealName, required this.selectedMeal, this.addButtonVisible = true})
|
||||
{Key? key,
|
||||
required this.eatingMealName,
|
||||
required this.selectedMeal,
|
||||
this.addButtonVisible = true})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
|
@ -40,11 +43,14 @@ class _CardComponentState extends State<CardComponent> {
|
|||
}
|
||||
|
||||
getImageOfMeal() {
|
||||
if (widget.eatingMealName.toLowerCase() == dotenv.env['BREAKFAST_FIELD']!.toLowerCase()) {
|
||||
if (widget.eatingMealName.toLowerCase() ==
|
||||
dotenv.env['BREAKFAST_FIELD']!.toLowerCase()) {
|
||||
return const Image(image: AssetImage('assets/images/tea.png'));
|
||||
} else if (widget.eatingMealName.toLowerCase() == dotenv.env['LUNCH_FIELD']!.toLowerCase()) {
|
||||
} else if (widget.eatingMealName.toLowerCase() ==
|
||||
dotenv.env['LUNCH_FIELD']!.toLowerCase()) {
|
||||
return const Image(image: AssetImage('assets/images/fries.png'));
|
||||
} else if (widget.eatingMealName.toLowerCase() == dotenv.env['DINNER_FIELD']!.toLowerCase()) {
|
||||
} else if (widget.eatingMealName.toLowerCase() ==
|
||||
dotenv.env['DINNER_FIELD']!.toLowerCase()) {
|
||||
return const Image(image: AssetImage('assets/images/ice.png'));
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +66,7 @@ class _CardComponentState extends State<CardComponent> {
|
|||
}
|
||||
|
||||
Widget getElevatedButton() {
|
||||
if(widget.addButtonVisible){
|
||||
if (widget.addButtonVisible) {
|
||||
return ElevatedButton(
|
||||
onPressed: () async {
|
||||
Navigator.of(context).push(createRoute(widget.eatingMealName));
|
||||
|
@ -74,18 +80,17 @@ class _CardComponentState extends State<CardComponent> {
|
|||
style: TextStyle(fontSize: 28),
|
||||
),
|
||||
);
|
||||
}else{
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int getCountedCalories() {
|
||||
double calories = 0;
|
||||
for (Food food in widget.selectedMeal) {
|
||||
if (food.calories is int){
|
||||
if (food.calories is int) {
|
||||
calories += food.calories as int;
|
||||
}else if(food.calories is double){
|
||||
} else if (food.calories is double) {
|
||||
calories += food.calories as double;
|
||||
}
|
||||
}
|
||||
|
@ -94,60 +99,52 @@ class _CardComponentState extends State<CardComponent> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
margin: const EdgeInsets.fromLTRB(0, 24, 0, 0),
|
||||
return Container(
|
||||
margin: const EdgeInsets.fromLTRB(0, 16, 0, 0),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
getImageOfMeal(),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.6,
|
||||
child: Text(
|
||||
StringUtils.capitalize(widget.eatingMealName),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
softWrap: false,
|
||||
style: const TextStyle(
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 14),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
getImageOfMeal(),
|
||||
Text(
|
||||
StringUtils.capitalize(widget.eatingMealName),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
softWrap: false,
|
||||
style: const TextStyle(
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 14),
|
||||
),
|
||||
getElevatedButton(),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.8,
|
||||
child:ListView.builder(
|
||||
width: MediaQuery.of(context).size.width * 1,
|
||||
child: ListView.builder(
|
||||
primary: false,
|
||||
shrinkWrap: true,
|
||||
itemCount: getMapOfDistinctElementsWithCounterAndCalories(widget.selectedMeal).keys.length,
|
||||
itemCount: getMapOfDistinctElementsWithCounterAndCalories(
|
||||
widget.selectedMeal)
|
||||
.keys
|
||||
.length,
|
||||
itemBuilder: (context, i) {
|
||||
Map<String,List<int>> map = getMapOfDistinctElementsWithCounterAndCalories(widget.selectedMeal);
|
||||
Map<String, List<int>> map =
|
||||
getMapOfDistinctElementsWithCounterAndCalories(
|
||||
widget.selectedMeal);
|
||||
String foodName = map.keys.elementAt(i);
|
||||
List<int> values = map.values.elementAt(i);
|
||||
return Text(
|
||||
getFoodListStringByFood(foodName, values[0], values[1])
|
||||
);
|
||||
}
|
||||
),
|
||||
return Text(getFoodListStringByFood(
|
||||
foodName, values[0], values[1]));
|
||||
}),
|
||||
),
|
||||
widget.selectedMeal.isNotEmpty
|
||||
? const Divider()
|
||||
: const SizedBox.shrink(),
|
||||
widget.selectedMeal.isNotEmpty
|
||||
? Text("${getCountedCalories()} kcal")
|
||||
? Column(
|
||||
children: [
|
||||
const Divider(),
|
||||
Text("${getCountedCalories()} kcal")
|
||||
],
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
],
|
||||
));
|
||||
|
|
|
@ -10,17 +10,18 @@ class MealPageStatisticsFoodComponent extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.fromLTRB(0, 16, 0, 0),
|
||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white
|
||||
),
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(8))),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(
|
||||
height: 24,
|
||||
),
|
||||
const TitleComponent("Nahrung"),
|
||||
FoodComponent(box: Hive.box(StatisticsService.instance.todayStatisticsBoxName),)
|
||||
FoodComponent(
|
||||
box: Hive.box(StatisticsService.instance.todayStatisticsBoxName),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
|
@ -34,9 +34,7 @@ class _DaysMealPageState extends State<DaysMealPageComponent> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 0),
|
||||
child: Row(
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
DaysTextComponent(
|
||||
|
@ -65,7 +63,6 @@ class _DaysMealPageState extends State<DaysMealPageComponent> {
|
|||
index: 2
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,8 +15,6 @@ class StatisticsPercentage extends StatelessWidget {
|
|||
valueListenable: StatisticsService.instance.ingredients,
|
||||
builder: (context, value, child) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(width: 2.0, color: Colors.black)),
|
||||
height: heightStatisticsContainer,
|
||||
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 0),
|
||||
child: Row(
|
||||
|
|
|
@ -36,9 +36,12 @@ class MainPageState extends State<MainPage> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
extendBodyBehindAppBar: false,
|
||||
appBar: AppBar(
|
||||
title: Text(pages[currentIndex].title),
|
||||
backgroundColor: Colors.grey.shade100,
|
||||
backgroundColor: Colors.transparent,
|
||||
foregroundColor: Colors.grey.shade400,
|
||||
elevation: 0,
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 0, horizontal: 8),
|
||||
|
|
|
@ -24,16 +24,28 @@ class _MealPlanState extends State<MealPlanPage> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Container(
|
||||
margin: const EdgeInsets.all(8),
|
||||
body: SizedBox(
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: const [
|
||||
DaysMealPageComponent(),
|
||||
StatisticsPercentage(),
|
||||
MealPageStatisticsFoodComponent(),
|
||||
children: [
|
||||
Container(
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(8))),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 8, horizontal: 16),
|
||||
child: Column(
|
||||
children: const [
|
||||
DaysMealPageComponent(),
|
||||
StatisticsPercentage(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const MealPageStatisticsFoodComponent(),
|
||||
],
|
||||
),
|
||||
)));
|
||||
|
|
|
@ -20,160 +20,204 @@ class ProgressPage extends StatelessWidget {
|
|||
return getTitle;
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO: in versch. Dateien auslagern, damit der Code nicht voll gemüllt wird
|
||||
* */
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 8),
|
||||
child: Column(
|
||||
children: [
|
||||
ValueListenableBuilder(
|
||||
valueListenable: StatisticsService.instance.dailyAverageForCurrentWeek,
|
||||
builder: (context, value, child) {
|
||||
return SizedBox(
|
||||
height: 100,
|
||||
width: 400,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const TitleComponent("Täglicher Durchschnitt (in kcal)"),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
const SecondaryTextComponent("Durchschnittlich"),
|
||||
SecondaryBigTextComponent("${value.toString()} kcal/Tag"),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
ValueListenableBuilder(
|
||||
valueListenable: StatisticsService.instance.barChartData,
|
||||
builder: (context, value, child) {
|
||||
return SizedBox(
|
||||
height: 325,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 15, // Adjust the height of the legend as needed
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 8.0), // Adjust the spacing between legend items
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(8))),
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
||||
child: Column(
|
||||
children: [
|
||||
ValueListenableBuilder(
|
||||
valueListenable: StatisticsService
|
||||
.instance.dailyAverageForCurrentWeek,
|
||||
builder: (context, value, child) {
|
||||
return SizedBox(
|
||||
height: 100,
|
||||
width: 400,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const TitleComponent("Kalorien"),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
const SecondaryTextComponent(
|
||||
"Durchschnittlich"),
|
||||
SecondaryBigTextComponent(
|
||||
"${value.toString()} kcal/Tag"),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
ValueListenableBuilder(
|
||||
valueListenable:
|
||||
StatisticsService.instance.barChartData,
|
||||
builder: (context, value, child) {
|
||||
return SizedBox(
|
||||
height: 300,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 15,
|
||||
// Adjust the height of the legend as needed
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: 12,
|
||||
height: 12,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.red, // Use the color of the first bar rod for the legend item
|
||||
shape: BoxShape.circle,
|
||||
margin: const EdgeInsets.symmetric(
|
||||
horizontal: 8.0),
|
||||
// Adjust the spacing between legend items
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 12,
|
||||
height: 12,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.red,
|
||||
// Use the color of the first bar rod for the legend item
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4.0),
|
||||
// Adjust the spacing between the color indicator and the legend label
|
||||
const Text(
|
||||
'Frühstück',
|
||||
// Replace with your desired legend label
|
||||
style: TextStyle(
|
||||
fontSize:
|
||||
12), // Adjust the font size of the legend labels
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4.0), // Adjust the spacing between the color indicator and the legend label
|
||||
const Text(
|
||||
'Frühstück', // Replace with your desired legend label
|
||||
style: TextStyle(fontSize: 12), // Adjust the font size of the legend labels
|
||||
Container(
|
||||
margin: const EdgeInsets.symmetric(
|
||||
horizontal: 8.0),
|
||||
// Adjust the spacing between legend items
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 12,
|
||||
height: 12,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.green,
|
||||
// Use the color of the first bar rod for the legend item
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4.0),
|
||||
// Adjust the spacing between the color indicator and the legend label
|
||||
const Text(
|
||||
'Mittagessen',
|
||||
// Replace with your desired legend label
|
||||
style: TextStyle(
|
||||
fontSize:
|
||||
12), // Adjust the font size of the legend labels
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: const EdgeInsets.symmetric(
|
||||
horizontal: 8.0),
|
||||
// Adjust the spacing between legend items
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 12,
|
||||
height: 12,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.yellow,
|
||||
// Use the color of the first bar rod for the legend item
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4.0),
|
||||
// Adjust the spacing between the color indicator and the legend label
|
||||
const Text(
|
||||
'Abendessen',
|
||||
// Replace with your desired legend label
|
||||
style: TextStyle(
|
||||
fontSize:
|
||||
12), // Adjust the font size of the legend labels
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 8.0), // Adjust the spacing between legend items
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 12,
|
||||
height: 12,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.green, // Use the color of the first bar rod for the legend item
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
Container(
|
||||
margin:
|
||||
const EdgeInsets.fromLTRB(0, 24, 0, 0),
|
||||
height: 250,
|
||||
child: BarChart(
|
||||
BarChartData(
|
||||
barTouchData: barTouchData,
|
||||
titlesData: titlesData,
|
||||
borderData: borderData,
|
||||
barGroups: value,
|
||||
gridData: FlGridData(show: false),
|
||||
alignment: BarChartAlignment.spaceAround,
|
||||
),
|
||||
const SizedBox(width: 4.0), // Adjust the spacing between the color indicator and the legend label
|
||||
const Text(
|
||||
'Mittagessen', // Replace with your desired legend label
|
||||
style: TextStyle(fontSize: 12), // Adjust the font size of the legend labels
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 8.0), // Adjust the spacing between legend items
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 12,
|
||||
height: 12,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.yellow, // Use the color of the first bar rod for the legend item
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4.0), // Adjust the spacing between the color indicator and the legend label
|
||||
const Text(
|
||||
'Abendessen', // Replace with your desired legend label
|
||||
style: TextStyle(fontSize: 12), // Adjust the font size of the legend labels
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top:50.0), // Adjust the margin value as needed
|
||||
child: SizedBox(
|
||||
height: 250,
|
||||
child: BarChart(
|
||||
BarChartData(
|
||||
barTouchData: barTouchData,
|
||||
titlesData: titlesData,
|
||||
borderData: borderData,
|
||||
barGroups: value,
|
||||
gridData: FlGridData(show: false),
|
||||
alignment: BarChartAlignment.spaceAround,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
ValueListenableBuilder(
|
||||
valueListenable: StatisticsService.instance.weeklyCaloryRanking,
|
||||
builder: (context, value, child) {
|
||||
return Column(
|
||||
//TODO: Loop through the values and display them dynamically
|
||||
children: [
|
||||
const TitleComponent("Lebensmittel mit dem höchsten Kaloriengehalt"),
|
||||
const SizedBox(height: 24,),
|
||||
for (var item in value.toSet())
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
SecondaryTextComponent(getWeeklyRankingString(item.name)),
|
||||
SecondaryTextComponent(item.calories.toString()),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)),
|
||||
Container(
|
||||
margin: const EdgeInsets.fromLTRB(0, 16, 0, 0),
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(8))),
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
||||
child: ValueListenableBuilder(
|
||||
valueListenable:
|
||||
StatisticsService.instance.weeklyCaloryRanking,
|
||||
builder: (context, value, child) {
|
||||
return Column(
|
||||
children: [
|
||||
const TitleComponent(
|
||||
"Lebensmittel mit dem höchsten Kaloriengehalt"),
|
||||
const SizedBox(
|
||||
height: 24,
|
||||
),
|
||||
for (var item in value.toSet())
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
SecondaryTextComponent(
|
||||
getWeeklyRankingString(item.name)),
|
||||
SecondaryTextComponent(
|
||||
item.calories.toString()),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
BarTouchData get barTouchData => BarTouchData(
|
||||
|
@ -240,56 +284,56 @@ class ProgressPage extends StatelessWidget {
|
|||
}
|
||||
|
||||
FlTitlesData get titlesData => FlTitlesData(
|
||||
show: true,
|
||||
bottomTitles: AxisTitles(
|
||||
sideTitles: SideTitles(
|
||||
showTitles: true,
|
||||
reservedSize: 30,
|
||||
getTitlesWidget: getTitles,
|
||||
),
|
||||
show: true,
|
||||
bottomTitles: AxisTitles(
|
||||
sideTitles: SideTitles(
|
||||
showTitles: true,
|
||||
reservedSize: 30,
|
||||
getTitlesWidget: getTitles,
|
||||
),
|
||||
topTitles: AxisTitles(
|
||||
sideTitles: SideTitles(showTitles: false),
|
||||
),
|
||||
topTitles: AxisTitles(
|
||||
sideTitles: SideTitles(showTitles: false),
|
||||
),
|
||||
rightTitles: AxisTitles(
|
||||
sideTitles: SideTitles(
|
||||
showTitles: false,
|
||||
),
|
||||
rightTitles: AxisTitles(
|
||||
sideTitles: SideTitles(
|
||||
showTitles: false,
|
||||
),
|
||||
),
|
||||
leftTitles: AxisTitles(
|
||||
sideTitles: SideTitles(
|
||||
showTitles: true,
|
||||
getTitlesWidget: (value, _) {
|
||||
// Return a custom widget for each axis value
|
||||
return Container(
|
||||
constraints: const BoxConstraints.tightFor(width: double.infinity),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(right: 3.0), // Adjust the margin value as needed
|
||||
child: FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
value.toInt().toString(),
|
||||
style: const TextStyle(
|
||||
color: Colors.orange,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
leftTitles: AxisTitles(
|
||||
sideTitles: SideTitles(
|
||||
showTitles: true,
|
||||
getTitlesWidget: (value, _) {
|
||||
// Return a custom widget for each axis value
|
||||
return Container(
|
||||
constraints:
|
||||
const BoxConstraints.tightFor(width: double.infinity),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(right: 3.0),
|
||||
// Adjust the margin value as needed
|
||||
child: FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
value.toInt().toString(),
|
||||
style: const TextStyle(
|
||||
color: Colors.orange,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
);
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
));
|
||||
|
||||
FlBorderData get borderData => FlBorderData(
|
||||
show: true, // Set to true to display the chart border
|
||||
border: const Border(
|
||||
bottom: BorderSide(color: Colors.black, width: 1),
|
||||
left: BorderSide(color: Colors.black, width: 1),// Hide the left border
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
show: true, // Set to true to display the chart border
|
||||
border: const Border(
|
||||
bottom: BorderSide(color: Colors.black, width: 1),
|
||||
left:
|
||||
BorderSide(color: Colors.black, width: 1), // Hide the left border
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -23,9 +23,7 @@ void main() async {
|
|||
await Hive.openBox(dotenv.env['STATISTICS_MAIN_BOX'] ?? 'STATISTICS_MAIN_BOX');
|
||||
await Hive.openBox(dotenv.env['MEALPLAN_BOX'] ?? 'MEALPLAN');
|
||||
await Hive.openBox<User>('USER_BOX');
|
||||
//Hive.deleteFromDisk();
|
||||
setupTodayBox();
|
||||
//mockDataForWholeWeek();
|
||||
|
||||
if (defaultTargetPlatform == TargetPlatform.android) {
|
||||
runApp(const AndroidApp());
|
||||
|
|
Loading…
Reference in New Issue