DAPP-100 : renames file
parent
077cad7df5
commit
5ec07bb931
@ -0,0 +1,19 @@
|
|||||||
|
import 'package:charts_flutter/flutter.dart' as charts;
|
||||||
|
import 'package:charts_flutter/flutter.dart';
|
||||||
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/data_display/list/flexible_container.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
class TimeSeriesSales {
|
||||||
|
final DateTime time;
|
||||||
|
final int sales;
|
||||||
|
|
||||||
|
TimeSeriesSales(this.time, this.sales);
|
||||||
|
}
|
||||||
|
|
||||||
|
class TimeSeriesSales2 {
|
||||||
|
final DateTime time;
|
||||||
|
final double sales;
|
||||||
|
|
||||||
|
TimeSeriesSales2(this.time, this.sales);
|
||||||
|
}
|
||||||
@ -1,42 +0,0 @@
|
|||||||
import 'package:charts_flutter/flutter.dart' as charts;
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class AppBarChart extends StatelessWidget {
|
|
||||||
const AppBarChart({
|
|
||||||
Key key,
|
|
||||||
@required this.seriesList,
|
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
final List<charts.Series> seriesList;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Container(
|
|
||||||
height: 400,
|
|
||||||
margin: EdgeInsets.only(top: 60),
|
|
||||||
child: charts.BarChart(
|
|
||||||
seriesList,
|
|
||||||
// animate: animate,
|
|
||||||
|
|
||||||
/// Customize the primary measure axis using a small tick renderer.
|
|
||||||
/// Use String instead of num for ordinal domain axis
|
|
||||||
/// (typically bar charts).
|
|
||||||
primaryMeasureAxis: new charts.NumericAxisSpec(
|
|
||||||
renderSpec: new charts.GridlineRendererSpec(
|
|
||||||
// Display the measure axis labels below the gridline.
|
|
||||||
//
|
|
||||||
// 'Before' & 'after' follow the axis value direction.
|
|
||||||
// Vertical axes draw 'before' below & 'after' above the tick.
|
|
||||||
// Horizontal axes draw 'before' left & 'after' right the tick.
|
|
||||||
labelAnchor: charts.TickLabelAnchor.before,
|
|
||||||
|
|
||||||
// Left justify the text in the axis.
|
|
||||||
//
|
|
||||||
// Note: outside means that the secondary measure axis would right
|
|
||||||
// justify.
|
|
||||||
labelJustification: charts.TickLabelJustification.outside,
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,44 +0,0 @@
|
|||||||
import 'package:charts_flutter/flutter.dart' as charts;
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
/// chart line
|
|
||||||
/// [seriesList] charts series
|
|
||||||
/// [chartTitle] the charts title
|
|
||||||
/// [animate] enable and disable animate on create chart
|
|
||||||
/// [includeArea] chart include Area
|
|
||||||
/// [stacked] stacked chart over the design
|
|
||||||
class AppLineChart extends StatelessWidget {
|
|
||||||
final List<charts.Series> seriesList;
|
|
||||||
final String chartTitle;
|
|
||||||
final bool animate;
|
|
||||||
final bool includeArea;
|
|
||||||
final bool stacked;
|
|
||||||
|
|
||||||
AppLineChart(
|
|
||||||
{Key key,
|
|
||||||
@required this.seriesList,
|
|
||||||
this.chartTitle,
|
|
||||||
this.animate = true,
|
|
||||||
this.includeArea = false,
|
|
||||||
this.stacked = true});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Container(
|
|
||||||
child: Column(
|
|
||||||
children: <Widget>[
|
|
||||||
Text(
|
|
||||||
chartTitle,
|
|
||||||
style: TextStyle(fontSize: 24.0, fontWeight: FontWeight.bold),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: charts.LineChart(seriesList,
|
|
||||||
defaultRenderer: charts.LineRendererConfig(
|
|
||||||
includeArea: false, stacked: true),
|
|
||||||
animate: animate),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,71 +0,0 @@
|
|||||||
import 'package:charts_flutter/flutter.dart' as charts;
|
|
||||||
import 'package:charts_flutter/flutter.dart';
|
|
||||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
||||||
import 'package:doctor_app_flutter/widgets/data_display/list/flexible_container.dart';
|
|
||||||
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
/// App Time Series Chart
|
|
||||||
/// [seriesList] the series list
|
|
||||||
/// [chartName] the name of the chart
|
|
||||||
/// [startDate] the start date
|
|
||||||
/// [endDate] the end date
|
|
||||||
class AppTimeSeriesChart extends StatelessWidget {
|
|
||||||
AppTimeSeriesChart({
|
|
||||||
Key key,
|
|
||||||
@required this.seriesList,
|
|
||||||
this.chartName = '',
|
|
||||||
this.startDate,
|
|
||||||
this.endDate,
|
|
||||||
});
|
|
||||||
|
|
||||||
final String chartName;
|
|
||||||
final List<Series<dynamic, DateTime>> seriesList;
|
|
||||||
final DateTime startDate;
|
|
||||||
final DateTime endDate;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return FlexibleContainer(
|
|
||||||
heightFactor: 0.47,
|
|
||||||
child: Column(
|
|
||||||
children: <Widget>[
|
|
||||||
AppText(chartName, fontSize: SizeConfig.textMultiplier * 3),
|
|
||||||
Container(
|
|
||||||
height: SizeConfig.realScreenHeight * 0.37,
|
|
||||||
child: Center(
|
|
||||||
child: Container(
|
|
||||||
child: charts.TimeSeriesChart(
|
|
||||||
seriesList,
|
|
||||||
animate: true,
|
|
||||||
behaviors: [
|
|
||||||
charts.RangeAnnotation(
|
|
||||||
[
|
|
||||||
charts.RangeAnnotationSegment(startDate, endDate,
|
|
||||||
charts.RangeAnnotationAxisType.domain),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class TimeSeriesSales {
|
|
||||||
final DateTime time;
|
|
||||||
final int sales;
|
|
||||||
|
|
||||||
TimeSeriesSales(this.time, this.sales);
|
|
||||||
}
|
|
||||||
|
|
||||||
class TimeSeriesSales2 {
|
|
||||||
final DateTime time;
|
|
||||||
final double sales;
|
|
||||||
|
|
||||||
TimeSeriesSales2(this.time, this.sales);
|
|
||||||
}
|
|
||||||
@ -1,47 +0,0 @@
|
|||||||
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
|
||||||
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class StarRating extends StatelessWidget {
|
|
||||||
final double totalAverage;
|
|
||||||
final double size;
|
|
||||||
final int totalCount;
|
|
||||||
final bool forceStars;
|
|
||||||
|
|
||||||
StarRating(
|
|
||||||
{Key key,
|
|
||||||
this.totalAverage: 0.0,
|
|
||||||
this.size: 16.0,
|
|
||||||
this.totalCount = 5,
|
|
||||||
this.forceStars = false})
|
|
||||||
: super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Row(mainAxisAlignment: MainAxisAlignment.start, children: <Widget>[
|
|
||||||
if (!forceStars && (totalAverage == null || totalAverage == 0))
|
|
||||||
AppText("New", style: "caption"),
|
|
||||||
if (forceStars || (totalAverage != null && totalAverage > 0))
|
|
||||||
...List.generate(
|
|
||||||
5,
|
|
||||||
(index) => Padding(
|
|
||||||
padding: EdgeInsets.only(right: 1.0),
|
|
||||||
child: Icon(
|
|
||||||
(index + 1) <= (totalAverage ?? 0)
|
|
||||||
? EvaIcons.star
|
|
||||||
: EvaIcons.starOutline,
|
|
||||||
size: size,
|
|
||||||
color: (index + 1) <= (totalAverage ?? 0)
|
|
||||||
? Color.fromRGBO(255, 186, 0, 1.0)
|
|
||||||
: Theme.of(context).hintColor),
|
|
||||||
)),
|
|
||||||
if (totalCount != null) SizedBox(width: 9.0),
|
|
||||||
if (totalCount != null)
|
|
||||||
AppText(
|
|
||||||
"(" + totalCount.toString() + ")",
|
|
||||||
style: "overline",
|
|
||||||
color: Colors.grey[400],
|
|
||||||
)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,41 +0,0 @@
|
|||||||
import 'package:charts_flutter/flutter.dart' as charts;
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
/*
|
|
||||||
*@author: Elham Rababah
|
|
||||||
*@Date:03/6/2020
|
|
||||||
*@param:
|
|
||||||
*@return:
|
|
||||||
*@desc: AppLineChart
|
|
||||||
*/
|
|
||||||
class AppLineChart extends StatelessWidget {
|
|
||||||
const AppLineChart({
|
|
||||||
Key key,
|
|
||||||
@required this.seriesList,
|
|
||||||
this.chartTitle,
|
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
final List<charts.Series> seriesList;
|
|
||||||
|
|
||||||
final String chartTitle;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Container(
|
|
||||||
child: Column(
|
|
||||||
children: <Widget>[
|
|
||||||
Text(
|
|
||||||
'Body Mass Index',
|
|
||||||
style: TextStyle(fontSize: 24.0, fontWeight: FontWeight.bold),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: charts.LineChart(seriesList,
|
|
||||||
defaultRenderer: new charts.LineRendererConfig(
|
|
||||||
includeArea: false, stacked: true),
|
|
||||||
animate: true),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,121 +0,0 @@
|
|||||||
import 'package:charts_flutter/flutter.dart' as charts;
|
|
||||||
import 'package:doctor_app_flutter/core/model/patient/vital_sign/vital_sign_res_model.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
import '../../../config/size_config.dart';
|
|
||||||
import '../../../widgets/shared/rounded_container_widget.dart';
|
|
||||||
|
|
||||||
/*
|
|
||||||
*@author: Elham Rababah
|
|
||||||
*@Date:03/6/2020
|
|
||||||
*@param:
|
|
||||||
*@return:
|
|
||||||
*@desc: AppTimeSeriesChart
|
|
||||||
*/
|
|
||||||
class AppTimeSeriesChart extends StatelessWidget {
|
|
||||||
AppTimeSeriesChart(
|
|
||||||
{Key key,
|
|
||||||
@required this.vitalList,
|
|
||||||
@required this.viewKey,
|
|
||||||
this.chartName = ''});
|
|
||||||
|
|
||||||
final List<VitalSignResModel> vitalList;
|
|
||||||
final String chartName;
|
|
||||||
final String viewKey;
|
|
||||||
List<charts.Series> seriesList;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
seriesList = generateData();
|
|
||||||
return RoundedContainer(
|
|
||||||
height: SizeConfig.realScreenHeight * 0.47,
|
|
||||||
child: Column(
|
|
||||||
children: <Widget>[
|
|
||||||
Text(
|
|
||||||
chartName,
|
|
||||||
style: TextStyle(
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
fontSize: SizeConfig.textMultiplier * 3),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
height: SizeConfig.realScreenHeight * 0.37,
|
|
||||||
child: Center(
|
|
||||||
child: Container(
|
|
||||||
child: charts.TimeSeriesChart(
|
|
||||||
seriesList,
|
|
||||||
animate: true,
|
|
||||||
behaviors: [
|
|
||||||
new charts.RangeAnnotation(
|
|
||||||
[
|
|
||||||
new charts.RangeAnnotationSegment(
|
|
||||||
DateTime(
|
|
||||||
vitalList[vitalList.length - 1]
|
|
||||||
.vitalSignDate
|
|
||||||
.year,
|
|
||||||
vitalList[vitalList.length - 1]
|
|
||||||
.vitalSignDate
|
|
||||||
.month +
|
|
||||||
3,
|
|
||||||
vitalList[vitalList.length - 1]
|
|
||||||
.vitalSignDate
|
|
||||||
.day),
|
|
||||||
vitalList[0].vitalSignDate,
|
|
||||||
charts.RangeAnnotationAxisType.domain),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
*@author: Elham Rababah
|
|
||||||
*@Date:03/6/2020
|
|
||||||
*@param:
|
|
||||||
*@return:
|
|
||||||
*@desc: generateData
|
|
||||||
*/
|
|
||||||
generateData() {
|
|
||||||
final List<TimeSeriesSales> data = [];
|
|
||||||
if (vitalList.length > 0) {
|
|
||||||
vitalList.forEach(
|
|
||||||
(element) {
|
|
||||||
data.add(
|
|
||||||
TimeSeriesSales(
|
|
||||||
new DateTime(element.vitalSignDate.year,
|
|
||||||
element.vitalSignDate.month, element.vitalSignDate.day),
|
|
||||||
element.toJson()[viewKey].toInt(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return [
|
|
||||||
new charts.Series<TimeSeriesSales, DateTime>(
|
|
||||||
id: 'Sales',
|
|
||||||
domainFn: (TimeSeriesSales sales, _) => sales.time,
|
|
||||||
measureFn: (TimeSeriesSales sales, _) => sales.sales,
|
|
||||||
data: data,
|
|
||||||
)
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
*@author: Elham Rababah
|
|
||||||
*@Date:03/6/2020
|
|
||||||
*@param:
|
|
||||||
*@return:
|
|
||||||
*@desc: TimeSeriesSales
|
|
||||||
*/
|
|
||||||
class TimeSeriesSales {
|
|
||||||
final DateTime time;
|
|
||||||
final int sales;
|
|
||||||
|
|
||||||
TimeSeriesSales(this.time, this.sales);
|
|
||||||
}
|
|
||||||
@ -1,31 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
import '../app_texts_widget.dart';
|
|
||||||
|
|
||||||
/*
|
|
||||||
*@author: Elham Rababah
|
|
||||||
*@Date:12/5/2020
|
|
||||||
*@param: error
|
|
||||||
*@return: StatelessWidget
|
|
||||||
*@desc: DrAppEmbeddedError class
|
|
||||||
*/
|
|
||||||
class DrAppEmbeddedError extends StatelessWidget {
|
|
||||||
const DrAppEmbeddedError({
|
|
||||||
Key key,
|
|
||||||
@required this.error,
|
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
final String error;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Center(
|
|
||||||
child: AppText(
|
|
||||||
error,
|
|
||||||
color: Theme.of(context).errorColor,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
margin: 10,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue