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.
59 lines
3.0 KiB
Dart
59 lines
3.0 KiB
Dart
|
10 months ago
|
import 'package:easy_localization/easy_localization.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/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/dashboard/menu_entries.dart';
|
||
|
|
import 'package:mohem_flutter_app/models/get_employee_contacts.model.dart';
|
||
|
|
import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart';
|
||
|
|
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
||
|
|
|
||
|
|
class ChildEducationAssistance extends StatelessWidget {
|
||
|
|
ChildEducationAssistance({Key? key}) : super(key: key);
|
||
|
|
|
||
|
|
GetMenuEntriesList? menuEntry;
|
||
|
|
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
menuEntry ??= ModalRoute.of(context)!.settings.arguments as GetMenuEntriesList;
|
||
|
|
return Scaffold(
|
||
|
|
backgroundColor: Colors.white,
|
||
|
|
appBar: AppBarWidget(context, title: menuEntry!.prompt!),
|
||
|
|
body: FutureBuilder(
|
||
|
|
future: ProfileApiClient().getEmployeeContacts(),
|
||
|
|
builder: (BuildContext cxt, AsyncSnapshot<List<GetEmployeeContactsList>> snapshot) {
|
||
|
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
||
|
|
return const Center(child: CircularProgressIndicator());
|
||
|
|
} else if (snapshot.hasData) {
|
||
|
|
List<GetEmployeeContactsList> empContactList = snapshot.data!;
|
||
|
|
return ListView.separated(
|
||
|
|
padding: const EdgeInsets.all(21),
|
||
|
|
separatorBuilder: (BuildContext cxt, int index) => 12.height,
|
||
|
|
itemCount: empContactList.length,
|
||
|
|
itemBuilder: (BuildContext context, int index) {
|
||
|
|
return Column(
|
||
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
|
mainAxisSize: MainAxisSize.min,
|
||
|
|
children: [
|
||
|
|
"${empContactList[index].cONTACTNAME}".toText16(color: MyColors.grey3AColor),
|
||
|
|
"${LocaleKeys.dateOfBirth.tr()}: ${empContactList[index].dATEOFBIRTH?.split(" ").first ?? ""}".toText14(color: MyColors.grey3AColor, weight: FontWeight.w400),
|
||
|
|
"${empContactList[index].rELATIONSHIP}".toText11(color: MyColors.textMixColor),
|
||
|
|
],
|
||
|
|
).objectContainerView(disablePadding: false, center: false).onPress(() {
|
||
|
|
Navigator.pushNamed(context, AppRoutes.dynamicScreen,
|
||
|
|
arguments: DynamicListViewParams(empContactList[index].cONTACTNAME!, menuEntry!.functionName!, pContactRelationshipId: empContactList[index].cONTACTRELATIONSHIPID));
|
||
|
|
});
|
||
|
|
});
|
||
|
|
} else {
|
||
|
|
return LocaleKeys.noDataAvailable.tr().toText16().center;
|
||
|
|
}
|
||
|
|
},
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|