This repository has been archived on 2026-03-16. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
pblv-demoapp/lib/doctor_page.dart
2026-02-04 11:49:49 +01:00

164 lines
5.1 KiB
Dart

import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_charts/charts.dart';
class DoctorPage extends StatelessWidget {
const DoctorPage({super.key});
@override
Widget build(BuildContext context) {
return Expanded(
child: Column(
children: [
Flexible(
flex: 1,
child: SfCartesianChart(
title: ChartTitle(text: "Trend"),
series: [
StepAreaSeries(
name: "SYS",
dataSource: [
(1, 140),
(2, 137),
(3, 135),
(4, 130),
(5, 125),
],
color: Color(0xFF030070),
xValueMapper: (e, _) => e.$1,
yValueMapper: (e, _) => e.$2,
),
StepAreaSeries(
dataSource: [
(5, 123),
(6, 122),
(7, 121),
(8, 120),
(9, 121),
(10, 120),
],
isVisibleInLegend: false,
enableTooltip: true,
color: Color(0xFF030070).withAlpha(120),
xValueMapper: (e, _) => e.$1,
yValueMapper: (e, _) => e.$2,
),
StepAreaSeries(
name: "DIA",
dataSource: [(1, 88), (2, 76), (3, 70), (4, 72), (5, 68)],
enableTooltip: true,
color: Color(0xFF8ED973),
xValueMapper: (e, _) => e.$1,
yValueMapper: (e, _) => e.$2,
),
StepAreaSeries(
dataSource: [
(5, 70),
(6, 73),
(7, 75),
(8, 78),
(9, 79),
(10, 80),
],
isVisibleInLegend: false,
enableTooltip: true,
color: Color(0xFF8ED973).withAlpha(120),
xValueMapper: (e, _) => e.$1,
yValueMapper: (e, _) => e.$2,
),
],
legend: Legend(isVisible: true, position: LegendPosition.bottom),
),
),
Flexible(
flex: 1,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(height: 16),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.thumb_up),
SizedBox(width: 8),
Text(
"Empfehlungen",
style: Theme.of(context).textTheme.headlineMedium,
),
],
),
SizedBox(height: 8),
Empfehlung(
leading: Icons.local_dining,
text: [TextSpan(text: "Mediterrane Ernährung, Vitamin D, Omega-3")],
),
Empfehlung(
leading: Icons.local_dining,
text: [
TextSpan(text: "Vitamine von <Hier partner einfügen>"),
],
icon: Icons.shopping_cart,
),
Empfehlung(
leading: Icons.directions_run,
text: [TextSpan(text: "Bewegung, leichter Sport")],
),
],
),
),
],
),
);
}
}
class Empfehlung extends StatelessWidget {
final List<TextSpan> text;
final IconData? leading;
final IconData? icon;
const Empfehlung({super.key, required this.text, this.icon, this.leading});
@override
Widget build(BuildContext context) {
return SizedBox(
width: double.infinity,
height: 64,
child: Card.filled(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
children: [
if (leading != null) Icon(leading),
if (leading != null) SizedBox(width: 8),
RichText(
text: TextSpan(
style: DefaultTextStyle.of(context).style,
children: text,
),
),
],
),
if (icon != null)
IconButton(
onPressed: () {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
"Hier öffnet sich ein affiliate-Link, z.B. Amazon",
),
),
);
},
icon: Icon(icon),
),
],
),
),
),
);
}
}