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.
99 lines
3.7 KiB
Dart
99 lines
3.7 KiB
Dart
import 'package:easy_localization/easy_localization.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:mohem_flutter_app/api/my_attendance_api_client.dart';
|
|
import 'package:mohem_flutter_app/classes/colors.dart';
|
|
import 'package:mohem_flutter_app/classes/utils.dart';
|
|
import 'package:mohem_flutter_app/config/routes.dart';
|
|
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
|
|
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
|
|
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
|
|
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
|
|
import 'package:mohem_flutter_app/models/get_eit_transaction_list_model.dart';
|
|
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
|
import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart';
|
|
|
|
class WorkFromHomeScreen extends StatefulWidget {
|
|
WorkFromHomeScreen({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
_WorkFromHomeScreenState createState() {
|
|
return _WorkFromHomeScreenState();
|
|
}
|
|
}
|
|
|
|
class _WorkFromHomeScreenState extends State<WorkFromHomeScreen> {
|
|
List<GetEITTransactionList>? getEITTransactionList;
|
|
String? callingFunction;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
}
|
|
|
|
void getTransactions() async {
|
|
try {
|
|
Utils.showLoading(context);
|
|
getEITTransactionList = await MyAttendanceApiClient().getEitTransaction(callingFunction!);
|
|
Utils.hideLoading(context);
|
|
setState(() {});
|
|
} catch (ex) {
|
|
Utils.hideLoading(context);
|
|
Utils.handleException(ex, context, null);
|
|
}
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
if (callingFunction == null) {
|
|
callingFunction = "HMG_OTL_WFH_EIT_SS"; // ModalRoute.of(context)!.settings.arguments as WorkListResponseModel;
|
|
getTransactions();
|
|
}
|
|
|
|
return Scaffold(
|
|
backgroundColor: Colors.white,
|
|
appBar: AppBarWidget(
|
|
context,
|
|
title: LocaleKeys.workFromHome.tr(),
|
|
),
|
|
body: getEITTransactionList == null
|
|
? const SizedBox()
|
|
: (getEITTransactionList!.isEmpty
|
|
? LocaleKeys.noDataAvailable.tr().toText16().center
|
|
: ListView.separated(
|
|
physics: const BouncingScrollPhysics(),
|
|
padding: EdgeInsets.all(21),
|
|
itemBuilder: (cxt, int parentIndex) => Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
for (int t = 0; t < (getEITTransactionList![parentIndex].collectionTransaction ?? []).length; t++)
|
|
if (getEITTransactionList![parentIndex].collectionTransaction![t].dISPLAYFLAG == "Y")
|
|
ItemDetailView(
|
|
getEITTransactionList![parentIndex].collectionTransaction![t].sEGMENTPROMPT!, getEITTransactionList![parentIndex].collectionTransaction![t].sEGMENTVALUEDSP ?? ""),
|
|
],
|
|
).objectContainerView(),
|
|
separatorBuilder: (cxt, index) => 12.height,
|
|
itemCount: getEITTransactionList!.length)),
|
|
floatingActionButton: Container(
|
|
height: 50,
|
|
width: 50,
|
|
decoration: const BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
gradient: LinearGradient(transform: GradientRotation(.83), begin: Alignment.topRight, end: Alignment.bottomLeft, colors: [
|
|
MyColors.gradiantEndColor,
|
|
MyColors.gradiantStartColor,
|
|
]),
|
|
),
|
|
child: const Icon(Icons.add, color: Colors.white, size: 30),
|
|
).onPress(() {
|
|
Navigator.pushNamed(context, AppRoutes.addWorkFromHome);
|
|
}),
|
|
);
|
|
}
|
|
}
|