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.
153 lines
5.3 KiB
Dart
153 lines
5.3 KiB
Dart
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart';
|
|
import 'package:doctor_app_flutter/screens/home/label.dart';
|
|
import 'package:doctor_app_flutter/util/helpers.dart';
|
|
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class GetOutPatientStack extends StatelessWidget {
|
|
final value;
|
|
|
|
GetOutPatientStack(this.value);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
|
|
double barHeight =
|
|
SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ? 20 : SizeConfig.isHeightLarge?20:17);
|
|
value.summaryoptions.sort((Summaryoptions a, Summaryoptions b) => b.value - a.value);
|
|
|
|
value.summaryoptions
|
|
.sort((Summaryoptions a, Summaryoptions b) => b.value - a.value);
|
|
|
|
var list = new List<Widget>();
|
|
value.summaryoptions.forEach((result) =>
|
|
{list.add(getStack(result, value.summaryoptions.first.value,context,barHeight))});
|
|
return Container(
|
|
margin: EdgeInsets.only(bottom: 20, top: 10, left: 5, right: 5),
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.only(
|
|
topLeft: Radius.circular(20),
|
|
topRight: Radius.circular(20),
|
|
bottomLeft: Radius.circular(20),
|
|
bottomRight: Radius.circular(20)
|
|
),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.grey.withOpacity(0.5),
|
|
spreadRadius: 0,
|
|
blurRadius: 9,
|
|
offset: Offset(0, 0), // changes position of shadow
|
|
),
|
|
],
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(5.0),
|
|
child:Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
children: [
|
|
Container(
|
|
padding: EdgeInsets.symmetric(horizontal: 5, vertical: 5),
|
|
child: Label(
|
|
firstLine: Helpers.getLabelFromKPI(value.kPIName),
|
|
secondLine: Helpers.getNameFromKPI(value.kPIName),
|
|
color: Color(0xFF2B353E),
|
|
firstLineFontSize:
|
|
SizeConfig.getHeightMultiplier(height: barHeight) *
|
|
(SizeConfig.isHeightVeryShort
|
|
? 10
|
|
: SizeConfig.isHeightShort
|
|
? 10
|
|
: 8.5),
|
|
secondLineFontSize:
|
|
SizeConfig.getHeightMultiplier(height: barHeight) *
|
|
(SizeConfig.isHeightVeryShort
|
|
? 15
|
|
: SizeConfig.isHeightShort
|
|
? 15
|
|
: 14.5),
|
|
),
|
|
),
|
|
Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: list)
|
|
],
|
|
)
|
|
|
|
),
|
|
);
|
|
}
|
|
|
|
|
|
|
|
getStack(Summaryoptions value, max, context, barHeight) {
|
|
return Expanded(
|
|
child: Container(
|
|
margin: EdgeInsets.symmetric(horizontal: 2),
|
|
decoration: BoxDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment.topLeft,
|
|
end: Alignment(0.0, 1.0), // 10% of the width, so there are ten blinds.
|
|
colors: <Color>[Color(0x8FF5F6FA), Colors.red[100]], // red to yellow
|
|
tileMode: TileMode.mirror, // repeats the gradient over the canvas
|
|
),
|
|
borderRadius: BorderRadius.circular(4),
|
|
// color: Colors.red[50],
|
|
),
|
|
child: Stack(children: [
|
|
Positioned(
|
|
bottom: 0,
|
|
left: 0,
|
|
right: 0,
|
|
child: Container(
|
|
child: SizedBox(),
|
|
padding: EdgeInsets.all(10),
|
|
height: max != 0 ? ((barHeight) * value.value) / max : 0,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(4),
|
|
color: Color(0xFFD02127).withOpacity(0.39),
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
height: barHeight,
|
|
margin: EdgeInsets.only(left: 5, top: 5),
|
|
padding: EdgeInsets.all(10),
|
|
child: RotatedBox(
|
|
quarterTurns: 3,
|
|
child: Center(
|
|
child: Align(
|
|
child: FittedBox(
|
|
child: Row(
|
|
children: [
|
|
AppText(
|
|
value.kPIParameter,
|
|
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 2.5,
|
|
textAlign: TextAlign.center,
|
|
color: Color(0xFF2B353E),
|
|
fontWeight: FontWeight.w500,
|
|
letterSpacing: -0.3,
|
|
),
|
|
AppText(
|
|
' (' + value.value.toString() + ') ',
|
|
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 2.5,
|
|
textAlign: TextAlign.center,
|
|
color: Color(0xFF2B353E),
|
|
letterSpacing: -0.3,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
],
|
|
),
|
|
)),
|
|
),
|
|
))
|
|
]),
|
|
),
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
|