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.
118 lines
4.2 KiB
Dart
118 lines
4.2 KiB
Dart
import 'dart:io';
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:mohem_flutter_app/api/profile_api_client.dart';
|
|
import 'package:mohem_flutter_app/classes/colors.dart';
|
|
import 'package:mohem_flutter_app/classes/utils.dart';
|
|
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
|
|
import 'package:mohem_flutter_app/models/performance.dart';
|
|
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
|
|
|
class PerformanceAppraisal extends StatefulWidget {
|
|
const PerformanceAppraisal({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
_PerformanceAppraisalState createState() => _PerformanceAppraisalState();
|
|
}
|
|
|
|
class _PerformanceAppraisalState extends State<PerformanceAppraisal> {
|
|
List<GetPerformanceAppraisalList> performance = [];
|
|
@override
|
|
void initState() {
|
|
getPerformanceAppraisal();
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: MyColors.backgroundColor,
|
|
appBar: AppBarWidget(
|
|
context,
|
|
title: LocaleKeys.performance.tr(),
|
|
),
|
|
body: performance.isNotEmpty
|
|
? SingleChildScrollView(
|
|
child: Container(
|
|
width: double.infinity,
|
|
padding: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10),
|
|
// margin: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10),
|
|
child: Column(children: [
|
|
Row(children: [Expanded(flex: 1, child: getPerformanceCard(performance.first))]),
|
|
GridView.count(
|
|
crossAxisCount: 2,
|
|
shrinkWrap: true,
|
|
// padding: EdgeInsets.all(4.0),
|
|
// //childAspectRatio: 8.0 / 9.0,
|
|
children: performance
|
|
.where((el) => performance.indexOf(el) != 0)
|
|
.map(
|
|
(item) => getPerformanceCard(item),
|
|
)
|
|
.toList(),
|
|
)
|
|
])))
|
|
: Utils.getNoDataWidget(context),
|
|
);
|
|
}
|
|
|
|
Widget getPerformanceCard(GetPerformanceAppraisalList performance) {
|
|
return Card(
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
),
|
|
child: Padding(
|
|
padding: EdgeInsets.all(15),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Container(
|
|
child: Text(
|
|
"Performance evaluation in " + performance.aPPRAISALYEAR.toString(),
|
|
style: const TextStyle(fontWeight: FontWeight.bold),
|
|
)),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
SliderTheme(
|
|
data: SliderThemeData(trackHeight: 3, thumbShape: SliderComponentShape.noThumb, overlayShape: SliderComponentShape.noOverlay),
|
|
child: Slider(
|
|
max: 100,
|
|
min: 0,
|
|
inactiveColor: Colors.grey.withOpacity(.4),
|
|
activeColor: Colors.green,
|
|
value: double.parse(performance.aPPRAISALSCORE!),
|
|
onChanged: (value) {},
|
|
semanticFormatterCallback: (double newValue) {
|
|
return '${newValue.round()}';
|
|
})),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
Text(
|
|
performance.aPPRAISALSCORE.toString() + '%',
|
|
style: const TextStyle(
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: 18,
|
|
color: Colors.green,
|
|
),
|
|
),
|
|
],
|
|
)));
|
|
}
|
|
|
|
void getPerformanceAppraisal() async {
|
|
try {
|
|
Utils.showLoading(context);
|
|
performance = (await ProfileApiClient().getPerformanceAppraisal())!;
|
|
setState(() {});
|
|
Utils.hideLoading(context);
|
|
} catch (ex) {
|
|
Utils.hideLoading(context);
|
|
Utils.handleException(ex, context, null);
|
|
}
|
|
}
|
|
}
|