You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
HMG_Patient_App/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart

171 lines
5.2 KiB
Dart

import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart';
import 'package:diplomaticquarterapp/core/model/my_trakers/weight/WeightMeasurementResult.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:charts_flutter/flutter.dart' as charts;
import 'package:hexcolor/hexcolor.dart';
class WeightWeeklyPage extends StatelessWidget {
final List<charts.Series<WeekChartDate, DateTime>> data;
final List<WeightMeasurementResult> diabtecPatientResult;
const WeightWeeklyPage({Key key, this.data, this.diabtecPatientResult})
: super(key: key);
@override
Widget build(BuildContext context) {
return AppScaffold(
body: ListView(
children: [
Container(
width: double.maxFinite,
height: 180,
color: Colors.white,
child: charts.TimeSeriesChart(
data,
dateTimeFactory: const charts.LocalDateTimeFactory(),
),
),
SizedBox(height: 12,),
Padding(
padding: const EdgeInsets.all(8.0),
child: Texts('Details'),
),
Container(
padding: EdgeInsets.all(10),
color: Colors.transparent,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Table(
border: TableBorder.symmetric(
inside: BorderSide(width: 2.0, color: Colors.grey[300]),
),
children: fullData(),
),
],
),
)
],
),
);
}
List<TableRow> fullData() {
List<TableRow> tableRow = [];
tableRow.add(
TableRow(
children: [
Container(
decoration: BoxDecoration(
color: Hexcolor('#515B5D'),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(10.0),
),
),
child: Center(
child: Texts(
'Date',
color: Colors.white,
fontSize: 15,
),
),
height: 40,
),
Container(
decoration: BoxDecoration(
color: Hexcolor('#515B5D'),
),
child: Center(
child: Texts('Time', color: Colors.white,fontSize: 15,),
),
height: 40),
Container(
decoration: BoxDecoration(
color: Hexcolor('#515B5D'),
),
child: Center(
child: Texts('Value', color: Colors.white,fontSize: 15,),
),
height: 40),
Container(
child: Container(
decoration: BoxDecoration(
color: Hexcolor('#515B5D'),
borderRadius: BorderRadius.only(
topRight: Radius.circular(10.0),
),
),
child: Center(
child: Texts('Edit', color: Colors.white,fontSize: 15,),
),
height: 40),
),
],
),
);
diabtecPatientResult.forEach((diabtec) {
tableRow.add(
TableRow(
children: [
Container(
child: Container(
height: 70,
padding: EdgeInsets.all(10),
color: Colors.white,
child: Center(
child: Texts(
'${DateUtil.getMonthDayYearDateFormatted(diabtec.weightDate)} ',
textAlign: TextAlign.center,
fontSize: 12,
),
),
),
),
Container(
height: 70,
padding: EdgeInsets.all(10),
color: Colors.white,
child: Center(
child: Texts(
'${diabtec.weightDate.hour}:${diabtec.weightDate.minute}',
textAlign: TextAlign.center,
fontSize: 12,
),
),
),
Container(
child: Container(
height: 70,
padding: EdgeInsets.all(10),
color: Colors.white,
child: Center(
child: Texts(
'${diabtec.weightMeasured}',
textAlign: TextAlign.center,
fontSize: 12,
),
),
),
),
Container(
height: 70,
padding: EdgeInsets.all(10),
color: Colors.white,
child: Center(
child: Icon(Icons.edit),
),
),
],
),
);
},
);
return tableRow;
}
}