final beta Version
This commit is contained in:
parent
fec555991d
commit
c183d84a86
@ -11,6 +11,7 @@ analyzer:
|
|||||||
errors:
|
errors:
|
||||||
unused_field: ignore
|
unused_field: ignore
|
||||||
avoid_print: ignore
|
avoid_print: ignore
|
||||||
|
unnecessary_overrides: ignore
|
||||||
include: package:flutter_lints/flutter.yaml
|
include: package:flutter_lints/flutter.yaml
|
||||||
|
|
||||||
linter:
|
linter:
|
||||||
|
|||||||
264
lib/pages/graph/graph_controller.dart
Normal file
264
lib/pages/graph/graph_controller.dart
Normal file
@ -0,0 +1,264 @@
|
|||||||
|
import 'package:appwrite/appwrite.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:get_storage/get_storage.dart';
|
||||||
|
|
||||||
|
import '../../data/models/chart_model.dart';
|
||||||
|
import '../../data/models/tank_model.dart';
|
||||||
|
import '../../data/repository/appwrite_repository.dart';
|
||||||
|
import '../../utils/extensions/static_helper.dart';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class GraphController extends GetxController {
|
||||||
|
|
||||||
|
//AppWrite API-REST get Data
|
||||||
|
final AppwriteRepository _authRepository = AppwriteRepository();
|
||||||
|
|
||||||
|
final _dataBox = GetStorage('MyUserStorage');
|
||||||
|
final szRxUserId = 'NoUser'.obs;
|
||||||
|
final szBarTitle = ''.obs;
|
||||||
|
final listYearModel = <YearModel>[].obs;
|
||||||
|
late List<AppWriteTankModel> tankListOriginal;
|
||||||
|
final tankList = <AppWriteTankModel>[].obs;
|
||||||
|
final yearValue = DateTime.now().year.obs;
|
||||||
|
final blIsLoading = false.obs;
|
||||||
|
final dataPointsEuro = <double>[].obs;
|
||||||
|
final dataPointsGasoline = <double>[].obs;
|
||||||
|
final pointsEuro = <PricePoints>[].obs;
|
||||||
|
final pointsGasoline = <PricePoints>[].obs;
|
||||||
|
final sumListData = <SumDataModel>[].obs;
|
||||||
|
final mnCurrentAveragePerLiter = 0.00.obs;
|
||||||
|
final pointsPerLiter = <PricePoints>[].obs;
|
||||||
|
final dataPointsPerLiter = <double>[].obs;
|
||||||
|
final mnCurrentSummEuroYear = 0.0.obs;
|
||||||
|
final mnCurrentSummLiterYear = 0.0.obs;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
szRxUserId(_dataBox.read('userId'));
|
||||||
|
_getTankList();
|
||||||
|
super.onInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onReady() {
|
||||||
|
super.onReady();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {}
|
||||||
|
|
||||||
|
void _getTankList() async {
|
||||||
|
blIsLoading(true);
|
||||||
|
bool isErrorByLoading = false;
|
||||||
|
String message = '';
|
||||||
|
try {
|
||||||
|
await _authRepository
|
||||||
|
.listTankStops(szRxUserId.value)
|
||||||
|
.then((tankListData) {
|
||||||
|
if (tankListData.documents.isEmpty) {
|
||||||
|
blIsLoading(false);
|
||||||
|
isErrorByLoading = true;
|
||||||
|
message = 'Leere Liste keine Daten vorhanden';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
tankList.clear();
|
||||||
|
var data = tankListData.toMap();
|
||||||
|
List d = data['documents'].toList();
|
||||||
|
tankList.value = d
|
||||||
|
.map((e) => AppWriteTankModel.fromMap(e['data']))
|
||||||
|
.toList();
|
||||||
|
tankList.sort((a, b) {
|
||||||
|
final DateTime dateA = DateTime.parse(a.date);
|
||||||
|
final DateTime dateB = DateTime.parse(b.date);
|
||||||
|
return dateB.compareTo(dateA);
|
||||||
|
});
|
||||||
|
message = 'Liste wurde erfolgreich geladen';
|
||||||
|
})
|
||||||
|
.catchError((error) {
|
||||||
|
blIsLoading(true);
|
||||||
|
isErrorByLoading = true;
|
||||||
|
if (error is AppwriteException) {
|
||||||
|
message = error.message!;
|
||||||
|
} else {
|
||||||
|
message = 'Uuups da ist was schief gelaufen';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
blIsLoading(true);
|
||||||
|
isErrorByLoading = true;
|
||||||
|
message = 'Fehler beim Laden der Tankliste';
|
||||||
|
print('Error fetching tank list: $e');
|
||||||
|
}
|
||||||
|
String title = isErrorByLoading ? 'Fehler' : 'Erfolg';
|
||||||
|
Get.snackbar(
|
||||||
|
title,
|
||||||
|
message,
|
||||||
|
backgroundColor: isErrorByLoading ? Colors.red : Colors.green,
|
||||||
|
snackPosition: SnackPosition.BOTTOM,
|
||||||
|
duration: const Duration(seconds: 4),
|
||||||
|
);
|
||||||
|
tankListOriginal = tankList;
|
||||||
|
update();
|
||||||
|
setListMapYear();
|
||||||
|
getTankListPerYear();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> getHeadDescription() {
|
||||||
|
List<String> localListString = [];
|
||||||
|
tankList.sort((a, b) {
|
||||||
|
final DateTime dateA = DateTime.parse(a.date);
|
||||||
|
final DateTime dateB = DateTime.parse(b.date);
|
||||||
|
return dateB.compareTo(dateA);
|
||||||
|
});
|
||||||
|
if (tankList.isNotEmpty) {
|
||||||
|
for (var benzinItem in tankList) {
|
||||||
|
String szDay = '';
|
||||||
|
var dateDay = DateTime.parse(benzinItem.date);
|
||||||
|
if (dateDay.day <= 9) {
|
||||||
|
szDay = '0${dateDay.day}';
|
||||||
|
} else {
|
||||||
|
szDay = '${dateDay.day}';
|
||||||
|
}
|
||||||
|
String szMonth = '';
|
||||||
|
if (dateDay.month <= 9) {
|
||||||
|
szMonth = '0${dateDay.month}';
|
||||||
|
} else {
|
||||||
|
szMonth = '${dateDay.month}';
|
||||||
|
}
|
||||||
|
String szData = '$szDay$szMonth';
|
||||||
|
localListString.add(szData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
update();
|
||||||
|
return localListString;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setListMapYear() {
|
||||||
|
int year = 2022;
|
||||||
|
for (var i = year; i <= DateTime.now().year; i++) {
|
||||||
|
listYearModel.add(YearModel('Jahr $year', year));
|
||||||
|
year = year + 1;
|
||||||
|
}
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void getTankListPerYear() {
|
||||||
|
blIsLoading.value = true;
|
||||||
|
tankList
|
||||||
|
.where((e) => DateTime.parse(e.date).year == yearValue.value)
|
||||||
|
.toList();
|
||||||
|
getDataPointsForGraph();
|
||||||
|
getMonthListData();
|
||||||
|
blIsLoading.value = false;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void getDataPointsForGraph() {
|
||||||
|
//daten ermitteln für Jahr xxxx
|
||||||
|
//debugPrint('${yearValue.value}');
|
||||||
|
List<double> mnDataPointsEuro = [];
|
||||||
|
List<double> mnDataPointsGasoline = [];
|
||||||
|
// 08.08.23 Mod. add Price per Liter
|
||||||
|
List<double> mnDataPointsPerLiter = [];
|
||||||
|
var mnSummPerLiter = 0.0;
|
||||||
|
var mnTankListCount = tankList.length;
|
||||||
|
for (var item in tankList) {
|
||||||
|
var mnLiterGesamt = double.parse(item.liters);
|
||||||
|
var mnEuroGesamt =
|
||||||
|
double.parse(item.liters) * double.parse(item.pricePerLiter);
|
||||||
|
var mnPerLiter = double.parse(item.pricePerLiter);
|
||||||
|
mnDataPointsEuro.add(mnEuroGesamt);
|
||||||
|
mnDataPointsGasoline.add(mnLiterGesamt);
|
||||||
|
mnDataPointsPerLiter.add(mnPerLiter.toPrecision(2));
|
||||||
|
mnSummPerLiter += mnPerLiter;
|
||||||
|
}
|
||||||
|
if (mnSummPerLiter > 0 && mnTankListCount > 0) {
|
||||||
|
mnCurrentAveragePerLiter.value = (mnSummPerLiter / mnTankListCount)
|
||||||
|
.toPrecision(2);
|
||||||
|
}
|
||||||
|
dataPointsEuro.value = mnDataPointsEuro;
|
||||||
|
dataPointsGasoline.value = mnDataPointsGasoline;
|
||||||
|
dataPointsPerLiter.value = mnDataPointsPerLiter;
|
||||||
|
getPricePointsEuro();
|
||||||
|
getPricePointsGasoline();
|
||||||
|
getPricePointsPerLiter();
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void getMonthListData() {
|
||||||
|
if (tankList.isNotEmpty) {
|
||||||
|
sumListData.clear();
|
||||||
|
List<AppWriteTankModel> tankListPerYear = tankList;
|
||||||
|
List<dynamic> monthList = StaticHelper.listMonth;
|
||||||
|
for (var monthMap in monthList) {
|
||||||
|
var szMonth = monthMap['month'].toString();
|
||||||
|
var szValueMonth = monthMap['value'];
|
||||||
|
var result = StaticHelper.staticListGetDaysInBetween(
|
||||||
|
tankListPerYear,
|
||||||
|
szValueMonth,
|
||||||
|
yearValue.value,
|
||||||
|
);
|
||||||
|
var tankListPerMon = result as List<AppWriteTankModel>;
|
||||||
|
if (tankListPerMon.isNotEmpty) {
|
||||||
|
SumDataModel sumDataModel = SumDataModel('', '', '', 0);
|
||||||
|
sumDataModel.szMonth = szMonth;
|
||||||
|
sumDataModel.mnTankungen = tankListPerMon.length;
|
||||||
|
double mnSumEuro = 0.0;
|
||||||
|
double mnSumBenzin = 0.0;
|
||||||
|
for (var tankungModel in tankListPerMon) {
|
||||||
|
var mnEuroGesamt =
|
||||||
|
double.parse(tankungModel.liters) *
|
||||||
|
double.parse(tankungModel.pricePerLiter);
|
||||||
|
mnSumBenzin += double.parse(tankungModel.liters);
|
||||||
|
mnSumEuro += mnEuroGesamt;
|
||||||
|
}
|
||||||
|
sumDataModel.szVerbrauch = mnSumBenzin.toStringAsFixed(2);
|
||||||
|
sumDataModel.szSumme = mnSumEuro.toStringAsFixed(2);
|
||||||
|
sumListData.add(sumDataModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_currentSumForYear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void getPricePointsEuro() {
|
||||||
|
var listPoints = dataPointsEuro.indexed
|
||||||
|
.map((e) => PricePoints(x: e.$1.toDouble(), y: e.$2))
|
||||||
|
.toList();
|
||||||
|
pointsEuro.value = listPoints;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void getPricePointsGasoline() {
|
||||||
|
var listPoints = dataPointsGasoline.indexed
|
||||||
|
.map((e) => PricePoints(x: e.$1.toDouble(), y: e.$2))
|
||||||
|
.toList();
|
||||||
|
pointsGasoline.value = listPoints;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void getPricePointsPerLiter() {
|
||||||
|
var listPoints = dataPointsPerLiter.indexed
|
||||||
|
.map((e) => PricePoints(x: e.$1.toDouble(), y: e.$2))
|
||||||
|
.toList();
|
||||||
|
pointsPerLiter.value = listPoints;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _currentSumForYear() {
|
||||||
|
mnCurrentSummEuroYear.value = 0.0;
|
||||||
|
mnCurrentSummLiterYear.value = 0.0;
|
||||||
|
if (sumListData.isNotEmpty) {
|
||||||
|
for (var rxListItem in sumListData) {
|
||||||
|
mnCurrentSummEuroYear.value =
|
||||||
|
mnCurrentSummEuroYear.value + double.parse(rxListItem.szSumme!);
|
||||||
|
mnCurrentSummLiterYear.value =
|
||||||
|
mnCurrentSummLiterYear.value +
|
||||||
|
double.parse(rxListItem.szVerbrauch!);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
148
lib/pages/graph/graph_view.dart
Normal file
148
lib/pages/graph/graph_view.dart
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import '../../utils/extensions/constants.dart';
|
||||||
|
import './graph_controller.dart';
|
||||||
|
import './widgets/chart_desc.dart';
|
||||||
|
import './widgets/chart_lines.dart';
|
||||||
|
import './widgets/chart_single_lines.dart';
|
||||||
|
import './widgets/my_list_tile_card.dart';
|
||||||
|
import '../../pages/tanklist/tanklist_view.dart';
|
||||||
|
|
||||||
|
class GraphPage extends GetView<GraphController> {
|
||||||
|
static const namedRoute = '/graph-statistic-page';
|
||||||
|
const GraphPage({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
Size queryDisplaySize = MediaQuery.of(context).size;
|
||||||
|
var graphCtrl = controller;
|
||||||
|
return PopScope(
|
||||||
|
canPop: false,
|
||||||
|
child: SafeArea(
|
||||||
|
child: Scaffold(
|
||||||
|
body: Column(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 50,
|
||||||
|
child: IconButton(
|
||||||
|
onPressed: () =>
|
||||||
|
Get.offAndToNamed(TanklistPage.namedRoute),
|
||||||
|
icon: const Icon(Icons.list),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: queryDisplaySize.width - 70,
|
||||||
|
child: Obx(() => _displayDropDownMenue(graphCtrl)),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
Obx(
|
||||||
|
() => Container(
|
||||||
|
color: Colors.grey.shade900,
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
ChartDescription(
|
||||||
|
backgroundColor: kColorEuroChart,
|
||||||
|
mnWidth: double.infinity,
|
||||||
|
szDescText: '€ Jahressumme',
|
||||||
|
szCurrentSumData:
|
||||||
|
graphCtrl.mnCurrentSummEuroYear.toStringAsFixed(2),
|
||||||
|
),
|
||||||
|
ChartDescription(
|
||||||
|
backgroundColor: kColorBenzinChart,
|
||||||
|
mnWidth: double.infinity,
|
||||||
|
szDescText: 'L Jahresverbrauch',
|
||||||
|
szCurrentSumData:
|
||||||
|
graphCtrl.mnCurrentSummLiterYear.toStringAsFixed(2),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Divider(),
|
||||||
|
LineChartLines(
|
||||||
|
firstLineColor: kColorEuroChart,
|
||||||
|
secondLineColor: kColorBenzinChart,
|
||||||
|
),
|
||||||
|
Obx(
|
||||||
|
() => graphCtrl.blIsLoading.value
|
||||||
|
? const Center(
|
||||||
|
child: CircularProgressIndicator(color: Colors.cyan),
|
||||||
|
)
|
||||||
|
: const SizedBox.shrink(),
|
||||||
|
),
|
||||||
|
const Divider(),
|
||||||
|
Obx(
|
||||||
|
() => Container(
|
||||||
|
color: Colors.grey.shade900,
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||||
|
child: ChartDescription(
|
||||||
|
backgroundColor: kColorPerLiterChart,
|
||||||
|
mnWidth: queryDisplaySize.width,
|
||||||
|
szDescText: '€/L Durchschnitt',
|
||||||
|
szCurrentSumData: graphCtrl.mnCurrentAveragePerLiter.value
|
||||||
|
.toStringAsFixed(2),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Divider(),
|
||||||
|
LineChartSingleLine(singleLineColor: kColorPerLiterChart),
|
||||||
|
const Divider(),
|
||||||
|
Obx(
|
||||||
|
() => graphCtrl.blIsLoading.value
|
||||||
|
? const Center(
|
||||||
|
child: CircularProgressIndicator(color: Colors.cyan),
|
||||||
|
)
|
||||||
|
: const SizedBox.shrink(),
|
||||||
|
),
|
||||||
|
Obx(
|
||||||
|
() => Expanded(
|
||||||
|
child: ListView.builder(
|
||||||
|
itemCount: graphCtrl.sumListData.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return MyListTileCard(graphCtrl: graphCtrl, index: index);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
DropdownButtonFormField _displayDropDownMenue(GraphController controller) {
|
||||||
|
var graphCtrl = controller;
|
||||||
|
var list = graphCtrl.listYearModel;
|
||||||
|
var valueOfList = graphCtrl.yearValue.value;
|
||||||
|
return DropdownButtonFormField(
|
||||||
|
decoration: kInputDecorationDropDownMenueYear,
|
||||||
|
items: list.map((map) {
|
||||||
|
return DropdownMenuItem(
|
||||||
|
value: map.mnYear,
|
||||||
|
child: Text(map.szDescription),
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
isDense: true,
|
||||||
|
isExpanded: true,
|
||||||
|
value: valueOfList,
|
||||||
|
onChanged: ((value) {
|
||||||
|
valueOfList = value;
|
||||||
|
graphCtrl.yearValue.value = valueOfList;
|
||||||
|
if (graphCtrl.yearValue.value > 0) {
|
||||||
|
graphCtrl.getTankListPerYear();
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
124
lib/pages/graph/widgets/bar_chart_widget.dart
Normal file
124
lib/pages/graph/widgets/bar_chart_widget.dart
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
import 'package:fl_chart/fl_chart.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import '../../../utils/extensions/constants.dart';
|
||||||
|
import '../graph_controller.dart';
|
||||||
|
|
||||||
|
class BarChartWidget extends StatelessWidget {
|
||||||
|
final GraphController graphCtrl;
|
||||||
|
const BarChartWidget({super.key, required this.graphCtrl});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AspectRatio(
|
||||||
|
aspectRatio: 2,
|
||||||
|
child: BarChart(
|
||||||
|
BarChartData(
|
||||||
|
//alignment: BarChartAlignment.center,
|
||||||
|
maxY: 50,
|
||||||
|
baselineY: 0,
|
||||||
|
barTouchData: barTouchData,
|
||||||
|
titlesData: titlesData,
|
||||||
|
borderData: borderData,
|
||||||
|
barGroups: barGroups,
|
||||||
|
gridData: const FlGridData(show: false),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
BarTouchData get barTouchData => BarTouchData(
|
||||||
|
enabled: false,
|
||||||
|
touchTooltipData: BarTouchTooltipData(
|
||||||
|
//tooltipBgColor: Colors.transparent,
|
||||||
|
tooltipPadding: EdgeInsets.zero,
|
||||||
|
tooltipMargin: 8,
|
||||||
|
getTooltipItem:
|
||||||
|
(
|
||||||
|
BarChartGroupData group,
|
||||||
|
int groupIndex,
|
||||||
|
BarChartRodData rod,
|
||||||
|
int rodIndex,
|
||||||
|
) {
|
||||||
|
return BarTooltipItem(
|
||||||
|
rod.toY.round().toString(),
|
||||||
|
const TextStyle(color: Colors.cyan, fontWeight: FontWeight.bold),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
Widget getTitles(double value, TitleMeta meta) {
|
||||||
|
List<String> dayMonListString = graphCtrl.getHeadDescription();
|
||||||
|
for (var i = 0; i < dayMonListString.length; i++) {
|
||||||
|
if (i == value.toInt()) {
|
||||||
|
graphCtrl.szBarTitle.value = dayMonListString[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return SideTitleWidget(
|
||||||
|
fitInside: SideTitleFitInsideData.fromTitleMeta(meta),
|
||||||
|
space: 4,
|
||||||
|
meta: meta,
|
||||||
|
child: Text(graphCtrl.szBarTitle.value, style: kBarTitleStyle),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
FlTitlesData get titlesData => FlTitlesData(
|
||||||
|
show: true,
|
||||||
|
bottomTitles: AxisTitles(
|
||||||
|
sideTitles: SideTitles(
|
||||||
|
showTitles: true,
|
||||||
|
reservedSize: 30,
|
||||||
|
getTitlesWidget: getTitles,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
leftTitles: const AxisTitles(sideTitles: SideTitles(showTitles: false)),
|
||||||
|
topTitles: const AxisTitles(sideTitles: SideTitles(showTitles: false)),
|
||||||
|
rightTitles: const AxisTitles(sideTitles: SideTitles(showTitles: false)),
|
||||||
|
);
|
||||||
|
|
||||||
|
FlBorderData get borderData => FlBorderData(show: false);
|
||||||
|
|
||||||
|
LinearGradient get _barsGradient => LinearGradient(
|
||||||
|
colors: [Colors.blue.shade400, Colors.red.shade300],
|
||||||
|
begin: Alignment.bottomCenter,
|
||||||
|
end: Alignment.topCenter,
|
||||||
|
);
|
||||||
|
|
||||||
|
List<BarChartGroupData> get barGroups => [
|
||||||
|
BarChartGroupData(
|
||||||
|
x: 0,
|
||||||
|
barRods: [BarChartRodData(toY: 8, gradient: _barsGradient)],
|
||||||
|
showingTooltipIndicators: [0],
|
||||||
|
),
|
||||||
|
BarChartGroupData(
|
||||||
|
x: 1,
|
||||||
|
barRods: [BarChartRodData(toY: 10, gradient: _barsGradient)],
|
||||||
|
showingTooltipIndicators: [0],
|
||||||
|
),
|
||||||
|
BarChartGroupData(
|
||||||
|
x: 2,
|
||||||
|
barRods: [BarChartRodData(toY: 14, gradient: _barsGradient)],
|
||||||
|
showingTooltipIndicators: [0],
|
||||||
|
),
|
||||||
|
BarChartGroupData(
|
||||||
|
x: 3,
|
||||||
|
barRods: [BarChartRodData(toY: 15, gradient: _barsGradient)],
|
||||||
|
showingTooltipIndicators: [0],
|
||||||
|
),
|
||||||
|
BarChartGroupData(
|
||||||
|
x: 4,
|
||||||
|
barRods: [BarChartRodData(toY: 13, gradient: _barsGradient)],
|
||||||
|
showingTooltipIndicators: [0],
|
||||||
|
),
|
||||||
|
BarChartGroupData(
|
||||||
|
x: 5,
|
||||||
|
barRods: [BarChartRodData(toY: 10, gradient: _barsGradient)],
|
||||||
|
showingTooltipIndicators: [0],
|
||||||
|
),
|
||||||
|
BarChartGroupData(
|
||||||
|
x: 6,
|
||||||
|
barRods: [BarChartRodData(toY: 16, gradient: _barsGradient)],
|
||||||
|
showingTooltipIndicators: [0],
|
||||||
|
),
|
||||||
|
];
|
||||||
|
}
|
||||||
43
lib/pages/graph/widgets/chart_desc.dart
Normal file
43
lib/pages/graph/widgets/chart_desc.dart
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../../../utils/extensions/constants.dart';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class ChartDescription extends StatelessWidget {
|
||||||
|
final double mnWidth;
|
||||||
|
final Color backgroundColor;
|
||||||
|
final String szDescText;
|
||||||
|
final String szCurrentSumData;
|
||||||
|
const ChartDescription({
|
||||||
|
super.key,
|
||||||
|
required this.mnWidth,
|
||||||
|
required this.backgroundColor,
|
||||||
|
required this.szDescText,
|
||||||
|
required this.szCurrentSumData,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SizedBox(
|
||||||
|
width: mnWidth,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: backgroundColor,
|
||||||
|
borderRadius: BorderRadius.circular(15),
|
||||||
|
),
|
||||||
|
width: 70,
|
||||||
|
height: 20,
|
||||||
|
child: Center(
|
||||||
|
child: Text(szCurrentSumData, style: kChartDescriptionFontStyle),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
Text(szDescText, style: kTextStyle),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
49
lib/pages/graph/widgets/chart_lines.dart
Normal file
49
lib/pages/graph/widgets/chart_lines.dart
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:fl_chart/fl_chart.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import '../graph_controller.dart';
|
||||||
|
|
||||||
|
// 08.08.23 Mod. Line Chart with tree Lines
|
||||||
|
class LineChartLines extends GetView<GraphController> {
|
||||||
|
final Color firstLineColor;
|
||||||
|
final Color secondLineColor;
|
||||||
|
|
||||||
|
const LineChartLines({
|
||||||
|
super.key,
|
||||||
|
required this.firstLineColor,
|
||||||
|
required this.secondLineColor,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final GraphController gCtrl = controller;
|
||||||
|
return AspectRatio(
|
||||||
|
aspectRatio: 3,
|
||||||
|
child: Obx(
|
||||||
|
() => LineChart(
|
||||||
|
LineChartData(
|
||||||
|
lineBarsData: [
|
||||||
|
LineChartBarData(
|
||||||
|
color: firstLineColor,
|
||||||
|
spots: gCtrl.pointsEuro
|
||||||
|
.map((point) => FlSpot(point.x, point.y))
|
||||||
|
.toList(),
|
||||||
|
isCurved: false,
|
||||||
|
dotData: const FlDotData(show: true),
|
||||||
|
),
|
||||||
|
LineChartBarData(
|
||||||
|
isStepLineChart: false,
|
||||||
|
color: secondLineColor,
|
||||||
|
spots: gCtrl.pointsGasoline
|
||||||
|
.map((point) => FlSpot(point.x, point.y))
|
||||||
|
.toList(),
|
||||||
|
isCurved: false,
|
||||||
|
dotData: const FlDotData(show: true),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
36
lib/pages/graph/widgets/chart_single_lines.dart
Normal file
36
lib/pages/graph/widgets/chart_single_lines.dart
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:fl_chart/fl_chart.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../graph_controller.dart';
|
||||||
|
|
||||||
|
// 08.08.23 Mod. Line Chart with tree Lines
|
||||||
|
class LineChartSingleLine extends GetView<GraphController> {
|
||||||
|
final Color singleLineColor;
|
||||||
|
|
||||||
|
const LineChartSingleLine({super.key, required this.singleLineColor});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final GraphController gCtrl = controller;
|
||||||
|
return AspectRatio(
|
||||||
|
aspectRatio: 3.55,
|
||||||
|
child: Obx(
|
||||||
|
() => LineChart(
|
||||||
|
LineChartData(
|
||||||
|
lineBarsData: [
|
||||||
|
LineChartBarData(
|
||||||
|
color: singleLineColor,
|
||||||
|
spots: gCtrl.pointsPerLiter
|
||||||
|
.map((point) => FlSpot(point.x, point.y))
|
||||||
|
.toList(),
|
||||||
|
isCurved: false,
|
||||||
|
dotData: const FlDotData(show: true),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
46
lib/pages/graph/widgets/my_list_tile_card.dart
Normal file
46
lib/pages/graph/widgets/my_list_tile_card.dart
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../../../utils/extensions/constants.dart';
|
||||||
|
import '../graph_controller.dart';
|
||||||
|
|
||||||
|
|
||||||
|
class MyListTileCard extends StatelessWidget {
|
||||||
|
const MyListTileCard({
|
||||||
|
super.key,
|
||||||
|
required this.graphCtrl,
|
||||||
|
required this.index,
|
||||||
|
});
|
||||||
|
|
||||||
|
final GraphController graphCtrl;
|
||||||
|
final int index;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Card(
|
||||||
|
shadowColor: Colors.grey.shade200,
|
||||||
|
child: ListTile(
|
||||||
|
title: Text(
|
||||||
|
'${graphCtrl.sumListData[index].szMonth}',
|
||||||
|
style: kTextStyle,
|
||||||
|
),
|
||||||
|
subtitle: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'Monatsausgaben: ${graphCtrl.sumListData[index].szSumme} €',
|
||||||
|
style: kTextStyleSub,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'Monatsverbrauch: ${graphCtrl.sumListData[index].szVerbrauch} L',
|
||||||
|
style: kTextStyleSub,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'Tankungen: ${graphCtrl.sumListData[index].mnTankungen}',
|
||||||
|
style: kTextStyleSub,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -24,7 +24,7 @@ class TankController extends GetxController {
|
|||||||
final Rx<Position?> currentPosition = Rx<Position?>(null);
|
final Rx<Position?> currentPosition = Rx<Position?>(null);
|
||||||
final Rx<bool> isLoading = false.obs;
|
final Rx<bool> isLoading = false.obs;
|
||||||
final Rx<String?> errorMessage = Rx<String?>(null);
|
final Rx<String?> errorMessage = Rx<String?>(null);
|
||||||
final rxOrtString = '?'.obs;
|
//final rxOrtString = '?'.obs;
|
||||||
final rxSessionIdString = '?'.obs;
|
final rxSessionIdString = '?'.obs;
|
||||||
final rxSummePreisString = '0.00'.obs;
|
final rxSummePreisString = '0.00'.obs;
|
||||||
// TextEditingController für die Formulareingaben
|
// TextEditingController für die Formulareingaben
|
||||||
@ -70,10 +70,10 @@ class TankController extends GetxController {
|
|||||||
// Hier kannst du die Logik hinzufügen, um den Standort zu verwenden, z.B.
|
// Hier kannst du die Logik hinzufügen, um den Standort zu verwenden, z.B.
|
||||||
// den Standort in der UI anzuzeigen oder an einen Server zu senden.
|
// den Standort in der UI anzuzeigen oder an einen Server zu senden.
|
||||||
var map = {'lat': latitude, 'lng': longitude};
|
var map = {'lat': latitude, 'lng': longitude};
|
||||||
rxOrtString.value = await _locationRepository.getNearbyLocation(map);
|
var loc = await _locationRepository.getNearbyLocation(map);
|
||||||
ortController.text = rxOrtString.value;
|
ortController.text = loc;
|
||||||
// Print Standortinformationen in der Konsole
|
// Print Standortinformationen in der Konsole
|
||||||
print('Nearby Location: ${rxOrtString.value}');
|
print('Nearby Location: $loc');
|
||||||
print('Current Position: Latitude: $latitude, Longitude: $longitude');
|
print('Current Position: Latitude: $latitude, Longitude: $longitude');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Hier fängst du die Fehler aus dem Repository auf
|
// Hier fängst du die Fehler aus dem Repository auf
|
||||||
|
|||||||
@ -52,117 +52,112 @@ class TankPage extends GetView<TankController> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Obx(
|
Obx(
|
||||||
() => SingleChildScrollView(
|
() => PopScope(
|
||||||
padding: EdgeInsets.only(
|
canPop: false,
|
||||||
top: MediaQuery.of(context).padding.top + kToolbarHeight + 20,
|
child: SingleChildScrollView(
|
||||||
left: 20,
|
padding: EdgeInsets.only(
|
||||||
right: 20,
|
top: MediaQuery.of(context).padding.top +
|
||||||
bottom: 20,
|
kToolbarHeight +
|
||||||
),
|
20,
|
||||||
child: Column(
|
left: 20,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
right: 20,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
bottom: 20,
|
||||||
children: [
|
),
|
||||||
CircleAvatar(
|
child: Column(
|
||||||
backgroundColor: Colors.blue,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
radius: 40,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
child: Text(
|
children: [
|
||||||
controller.circleAvatarUserChar.value,
|
CircleAvatar(
|
||||||
style: const TextStyle(
|
backgroundColor: Colors.blue,
|
||||||
color: Colors.black,
|
radius: 40,
|
||||||
fontSize: 24,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 5),
|
|
||||||
Text(
|
|
||||||
controller.userNameToDisplay.value,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 20,
|
|
||||||
backgroundColor: Colors.black87,
|
|
||||||
color: Colors.white,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
letterSpacing: 3,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
controller.isLoading.value
|
|
||||||
? Text('Location is loading...')
|
|
||||||
: Text(
|
|
||||||
controller.rxOrtString.value,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 15,
|
|
||||||
backgroundColor: Colors.black87,
|
|
||||||
color: Colors.blue,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 20),
|
|
||||||
inputFields(),
|
|
||||||
const SizedBox(height: 20),
|
|
||||||
Container(
|
|
||||||
padding: const EdgeInsets.all(10),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(10),
|
|
||||||
color: Colors.black.withValues(alpha: 0.9),
|
|
||||||
),
|
|
||||||
child: Text.rich(
|
|
||||||
TextSpan(
|
|
||||||
text: 'Summe: ',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 18,
|
|
||||||
color: Colors.grey.shade300,
|
|
||||||
),
|
|
||||||
children: <TextSpan>[
|
|
||||||
TextSpan(
|
|
||||||
// Hier kommt der Wert als separater TextSpan
|
|
||||||
text: controller.rxSummePreisString.value,
|
|
||||||
// Doppelt so groß wie der Standardtext',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 30, // Doppelt so groß wie 18
|
|
||||||
color: Colors.blue, // Blaue Farbe
|
|
||||||
fontWeight: FontWeight
|
|
||||||
.bold, // Optional: Fetter Text, um ihn hervorzuheben
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 20),
|
|
||||||
SizedBox(
|
|
||||||
width: 350,
|
|
||||||
height: 50,
|
|
||||||
child: ElevatedButton(
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
backgroundColor: Colors.blue.withValues(
|
|
||||||
alpha: 0.9,
|
|
||||||
), // Button-Farbe
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(
|
|
||||||
10,
|
|
||||||
), // Abgerundete Ecken
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
controller.saveTankstopp();
|
|
||||||
},
|
|
||||||
child: Text(
|
child: Text(
|
||||||
'Tankstop erfassen',
|
controller.circleAvatarUserChar.value,
|
||||||
style: TextStyle(color: Colors.white, fontSize: 20),
|
style: const TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: 24,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 5),
|
||||||
Container(
|
Text(
|
||||||
margin: EdgeInsets.only(top: 20, bottom: 50),
|
controller.userNameToDisplay.value,
|
||||||
child: Text(
|
style: const TextStyle(
|
||||||
'Hinweis: Alle Felder sind Pflichtfelder.',
|
fontSize: 20,
|
||||||
style: TextStyle(
|
backgroundColor: Colors.black87,
|
||||||
fontSize: 16,
|
color: Colors.white,
|
||||||
color: Colors.red.shade300,
|
fontWeight: FontWeight.bold,
|
||||||
|
letterSpacing: 3,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 20),
|
||||||
],
|
inputFields(),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.all(10),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
color: Colors.black.withValues(alpha: 0.9),
|
||||||
|
),
|
||||||
|
child: Text.rich(
|
||||||
|
TextSpan(
|
||||||
|
text: 'Summe: ',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18,
|
||||||
|
color: Colors.grey.shade300,
|
||||||
|
),
|
||||||
|
children: <TextSpan>[
|
||||||
|
TextSpan(
|
||||||
|
// Hier kommt der Wert als separater TextSpan
|
||||||
|
text: controller.rxSummePreisString.value,
|
||||||
|
// Doppelt so groß wie der Standardtext',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 30, // Doppelt so groß wie 18
|
||||||
|
color: Colors.blue, // Blaue Farbe
|
||||||
|
fontWeight: FontWeight
|
||||||
|
.bold, // Optional: Fetter Text, um ihn hervorzuheben
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
SizedBox(
|
||||||
|
width: 350,
|
||||||
|
height: 50,
|
||||||
|
child: ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: Colors.blue.withValues(
|
||||||
|
alpha: 0.9,
|
||||||
|
), // Button-Farbe
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(
|
||||||
|
10,
|
||||||
|
), // Abgerundete Ecken
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
controller.saveTankstopp();
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'Tankstop erfassen',
|
||||||
|
style: TextStyle(color: Colors.white, fontSize: 20),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(top: 20, bottom: 50),
|
||||||
|
child: Text(
|
||||||
|
'Hinweis: Alle Felder sind Pflichtfelder.',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
color: Colors.red.shade300,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import 'package:get_storage/get_storage.dart';
|
|||||||
import '../../data/models/tank_model.dart';
|
import '../../data/models/tank_model.dart';
|
||||||
import '../../data/repository/appwrite_repository.dart';
|
import '../../data/repository/appwrite_repository.dart';
|
||||||
import '../../pages/tank/tank_view.dart';
|
import '../../pages/tank/tank_view.dart';
|
||||||
|
import '../graph/graph_view.dart';
|
||||||
import '../login/login_view.dart';
|
import '../login/login_view.dart';
|
||||||
|
|
||||||
class TanklistController extends GetxController {
|
class TanklistController extends GetxController {
|
||||||
@ -68,7 +69,7 @@ class TanklistController extends GetxController {
|
|||||||
message = 'Fehler beim Laden der Tankliste';
|
message = 'Fehler beim Laden der Tankliste';
|
||||||
print('Error fetching tank list: $e');
|
print('Error fetching tank list: $e');
|
||||||
} finally {
|
} finally {
|
||||||
if (!isErrorByLoading){
|
if (!isErrorByLoading) {
|
||||||
isloadingList(false);
|
isloadingList(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -104,10 +105,6 @@ class TanklistController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void goToChartView() {
|
void goToChartView() {
|
||||||
//Get.offAndToNamed(GraphPage.namedRoute);
|
Get.offAndToNamed(GraphPage.namedRoute);
|
||||||
}
|
|
||||||
|
|
||||||
void goToTrackingPage() {
|
|
||||||
//Get.offAndToNamed(TrackingPage.namedRoute);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,94 +10,86 @@ class TanklistPage extends GetView<TanklistController> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var tankListCtrl = controller;
|
var tankListCtrl = controller;
|
||||||
return SafeArea(
|
return PopScope(
|
||||||
child: Scaffold(
|
canPop: false,
|
||||||
appBar: AppBar(
|
child: SafeArea(
|
||||||
title: Text('Tankstops'),
|
child: Scaffold(
|
||||||
centerTitle: true,
|
appBar: AppBar(
|
||||||
//backgroundColor: Colors.grey.shade600,
|
title: Text('Tankstops'),
|
||||||
actions: [
|
centerTitle: true,
|
||||||
IconButton(
|
//backgroundColor: Colors.grey.shade600,
|
||||||
icon: Icon(Icons.add_chart, color: Colors.grey.shade300),
|
actions: [
|
||||||
onPressed: () async {
|
IconButton(
|
||||||
// Handle go to Chart View
|
icon: Icon(Icons.add_chart, color: Colors.grey.shade300),
|
||||||
tankListCtrl.goToChartView();
|
onPressed: () async {
|
||||||
},
|
// Handle go to Chart View
|
||||||
),
|
tankListCtrl.goToChartView();
|
||||||
IconButton(
|
},
|
||||||
icon: Icon(Icons.logout, color: Colors.grey.shade300),
|
),
|
||||||
onPressed: () async {
|
IconButton(
|
||||||
// Handle logout logic here
|
icon: Icon(Icons.logout, color: Colors.grey.shade300),
|
||||||
tankListCtrl.logoutSessionAndGoToLoginPage();
|
onPressed: () async {
|
||||||
},
|
// Handle logout logic here
|
||||||
),
|
tankListCtrl.logoutSessionAndGoToLoginPage();
|
||||||
],
|
},
|
||||||
),
|
),
|
||||||
floatingActionButton: Column(
|
],
|
||||||
mainAxisAlignment:
|
),
|
||||||
MainAxisAlignment.end, // Positioniere die Buttons am unteren Ende
|
floatingActionButton: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.end, // Richte sie rechts aus
|
mainAxisAlignment: MainAxisAlignment
|
||||||
mainAxisSize: MainAxisSize.min, // Nimm nur den benötigten Platz ein
|
.end, // Positioniere die Buttons am unteren Ende
|
||||||
children: [
|
crossAxisAlignment: CrossAxisAlignment.end, // Richte sie rechts aus
|
||||||
FloatingActionButton(
|
mainAxisSize: MainAxisSize.min, // Nimm nur den benötigten Platz ein
|
||||||
onPressed: () => tankListCtrl.goToInputPage(),
|
children: [
|
||||||
backgroundColor: Colors.blue,
|
FloatingActionButton(
|
||||||
child: Icon(Icons.add),
|
onPressed: () => tankListCtrl.goToInputPage(),
|
||||||
),
|
backgroundColor: Colors.blue,
|
||||||
const SizedBox(width: 16),
|
child: Icon(Icons.add),
|
||||||
FloatingActionButton(
|
),
|
||||||
onPressed: () => tankListCtrl.goToTrackingPage(),
|
],
|
||||||
backgroundColor: Colors.green,
|
),
|
||||||
child: Icon(Icons.gps_fixed_rounded),
|
body: Obx(() => tankListCtrl.isloadingList.value == false
|
||||||
),
|
? Padding(
|
||||||
],
|
padding: EdgeInsetsGeometry.only(left: 25, right: 25),
|
||||||
),
|
child: ListView.builder(
|
||||||
body: Obx(()
|
padding: EdgeInsets.only(top: 8, bottom: 8),
|
||||||
=> tankListCtrl.isloadingList.value == false ? Padding(
|
physics: const BouncingScrollPhysics(),
|
||||||
padding: EdgeInsetsGeometry.only(left: 25, right: 25),
|
itemBuilder: ((BuildContext context, int index) {
|
||||||
child: ListView.builder(
|
var item = tankListCtrl.tankList[index];
|
||||||
padding: EdgeInsets.only(top: 8, bottom: 8),
|
return Column(
|
||||||
physics: const BouncingScrollPhysics(),
|
children: [
|
||||||
itemBuilder: ((BuildContext context, int index) {
|
Container(
|
||||||
var item = tankListCtrl.tankList[index];
|
decoration: BoxDecoration(
|
||||||
return Column(
|
boxShadow: [
|
||||||
children: [
|
BoxShadow(
|
||||||
Container(
|
color: Colors.blue.withValues(
|
||||||
decoration: BoxDecoration(
|
alpha: 0.35,
|
||||||
color: Colors.blue.withValues(alpha: 0.2),
|
), // Die Farbe des Schattens
|
||||||
borderRadius: BorderRadius.only(
|
spreadRadius:
|
||||||
bottomLeft: Radius.circular(20),
|
1, // Wie weit sich der Schatten ausbreitet
|
||||||
bottomRight: Radius.circular(20),
|
blurRadius:
|
||||||
),
|
1, // Wie stark der Schatten verschwommen ist
|
||||||
boxShadow: [
|
offset: const Offset(
|
||||||
BoxShadow(
|
0,
|
||||||
color: Colors.grey.withValues(
|
3,
|
||||||
alpha: 0.7,
|
), // Der Versatz des Schattens (x, y)
|
||||||
), // Die Farbe des Schattens
|
),
|
||||||
spreadRadius:
|
],
|
||||||
2, // Wie weit sich der Schatten ausbreitet
|
),
|
||||||
blurRadius:
|
child: MyListTileItem(listItem: item),
|
||||||
3, // Wie stark der Schatten verschwommen ist
|
|
||||||
offset: const Offset(
|
|
||||||
0,
|
|
||||||
3,
|
|
||||||
), // Der Versatz des Schattens (x, y)
|
|
||||||
),
|
),
|
||||||
|
SizedBox(height: 15),
|
||||||
],
|
],
|
||||||
),
|
);
|
||||||
child: MyListTileItem(listItem: item),
|
}),
|
||||||
),
|
itemCount: tankListCtrl.tankList.length,
|
||||||
SizedBox(height: 15),
|
),
|
||||||
],
|
)
|
||||||
);
|
: Center(
|
||||||
}),
|
child: CircularProgressIndicator(
|
||||||
itemCount: tankListCtrl.tankList.length,
|
color: Colors.blue,
|
||||||
),
|
),
|
||||||
):Center(
|
)),
|
||||||
child: CircularProgressIndicator(
|
|
||||||
color: Colors.blue,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../../pages/graph/graph_controller.dart';
|
||||||
import '../../pages/login/login_controller.dart';
|
import '../../pages/login/login_controller.dart';
|
||||||
import '../../pages/tank/tank_controller.dart';
|
import '../../pages/tank/tank_controller.dart';
|
||||||
import '../../pages/tanklist/tanklist_controller.dart';
|
import '../../pages/tanklist/tanklist_controller.dart';
|
||||||
@ -13,7 +14,7 @@ class SampleBindings extends Bindings {
|
|||||||
Get.lazyPut<LoginController>(() => LoginController());
|
Get.lazyPut<LoginController>(() => LoginController());
|
||||||
Get.lazyPut<TankController>(() => TankController());
|
Get.lazyPut<TankController>(() => TankController());
|
||||||
Get.lazyPut<TanklistController>(() => TanklistController());
|
Get.lazyPut<TanklistController>(() => TanklistController());
|
||||||
// Get.lazyPut<GraphController>(() => GraphController(AuthRepository(AppWriteProvider())));
|
Get.lazyPut<GraphController>(() => GraphController());
|
||||||
// Get.lazyPut<TrackingController>(() => TrackingController(AuthRepository(AppWriteProvider())));
|
// Get.lazyPut<TrackingController>(() => TrackingController(AuthRepository(AppWriteProvider())));
|
||||||
// Get.lazyPut<MapController>(() => MapController(AuthRepository(AppWriteProvider()), LocationRepository(LocationProvider())));
|
// Get.lazyPut<MapController>(() => MapController(AuthRepository(AppWriteProvider()), LocationRepository(LocationProvider())));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../../pages/graph/graph_view.dart';
|
||||||
import '../../pages/login/login_view.dart';
|
import '../../pages/login/login_view.dart';
|
||||||
import '../../pages/tank/tank_view.dart';
|
import '../../pages/tank/tank_view.dart';
|
||||||
import '../../pages/tanklist/tanklist_view.dart';
|
import '../../pages/tanklist/tanklist_view.dart';
|
||||||
@ -25,11 +26,11 @@ class SampleRouts {
|
|||||||
page: () => const TanklistPage(),
|
page: () => const TanklistPage(),
|
||||||
binding: sampleBindings,
|
binding: sampleBindings,
|
||||||
),
|
),
|
||||||
// GetPage(
|
GetPage(
|
||||||
// name: GraphPage.namedRoute,
|
name: GraphPage.namedRoute,
|
||||||
// page: () => const GraphPage(),
|
page: () => const GraphPage(),
|
||||||
// binding: sampleBindings,
|
binding: sampleBindings,
|
||||||
// ),
|
),
|
||||||
// GetPage(
|
// GetPage(
|
||||||
// name: TrackingPage.namedRoute,
|
// name: TrackingPage.namedRoute,
|
||||||
// page: () => const TrackingPage(),
|
// page: () => const TrackingPage(),
|
||||||
|
|||||||
18
pubspec.lock
18
pubspec.lock
@ -137,6 +137,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "7.0.2"
|
version: "7.0.2"
|
||||||
|
equatable:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: equatable
|
||||||
|
sha256: "567c64b3cb4cf82397aac55f4f0cbd3ca20d77c6c03bedbc4ceaddc08904aef7"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.7"
|
||||||
ffi:
|
ffi:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -161,6 +169,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.1"
|
version: "1.1.1"
|
||||||
|
fl_chart:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: fl_chart
|
||||||
|
sha256: "577aeac8ca414c25333334d7c4bb246775234c0e44b38b10a82b559dd4d764e7"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
flutter:
|
flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description: flutter
|
description: flutter
|
||||||
@ -730,4 +746,4 @@ packages:
|
|||||||
version: "3.1.3"
|
version: "3.1.3"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=3.7.0-0 <4.0.0"
|
dart: ">=3.7.0-0 <4.0.0"
|
||||||
flutter: ">=3.27.0"
|
flutter: ">=3.27.4"
|
||||||
|
|||||||
@ -22,6 +22,7 @@ dependencies:
|
|||||||
get_storage: ^2.1.1
|
get_storage: ^2.1.1
|
||||||
http: ^1.4.0
|
http: ^1.4.0
|
||||||
latlong2: ^0.9.1
|
latlong2: ^0.9.1
|
||||||
|
fl_chart: ^1.0.0
|
||||||
|
|
||||||
dependency_overrides:
|
dependency_overrides:
|
||||||
flutter_web_auth_2: 4.1.0
|
flutter_web_auth_2: 4.1.0
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user