dynamic list screen items grid view improvements

merge-requests/109/head
Sikander Saleem 3 years ago
parent 31c24a54ec
commit 86d6b57cbc

@ -2,9 +2,9 @@ import 'package:mohem_flutter_app/ui/marathon/widgets/question_card.dart';
class ApiConsts { class ApiConsts {
//static String baseUrl = "http://10.200.204.20:2801/"; // Local server //static String baseUrl = "http://10.200.204.20:2801/"; // Local server
// static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server
// static String baseUrl = "https://erptstapp.srca.org.sa"; // SRCA server // static String baseUrl = "https://erptstapp.srca.org.sa"; // SRCA server
static String baseUrl = "https://hmgwebservices.com"; // Live server // static String baseUrl = "https://hmgwebservices.com"; // Live server
static String baseUrlServices = baseUrl + "/Services/"; // server static String baseUrlServices = baseUrl + "/Services/"; // server
// static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server // static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server
static String utilitiesRest = baseUrlServices + "Utilities.svc/REST/"; static String utilitiesRest = baseUrlServices + "Utilities.svc/REST/";

@ -102,13 +102,14 @@ extension EmailValidator on String {
decoration: isUnderLine ? TextDecoration.underline : null), decoration: isUnderLine ? TextDecoration.underline : null),
); );
Widget toText16({Color? color, bool isUnderLine = false, bool isBold = false, int? maxlines}) => Text( Widget toText16({Color? color, bool isUnderLine = false, bool isBold = false, int? maxlines, double? height}) => Text(
this, this,
maxLines: maxlines, maxLines: maxlines,
style: TextStyle( style: TextStyle(
color: color ?? MyColors.darkTextColor, color: color ?? MyColors.darkTextColor,
fontSize: 16, fontSize: 16,
letterSpacing: -0.64, letterSpacing: -0.64,
height: height,
fontWeight: isBold ? FontWeight.bold : FontWeight.w600, fontWeight: isBold ? FontWeight.bold : FontWeight.w600,
decoration: isUnderLine ? TextDecoration.underline : null, decoration: isUnderLine ? TextDecoration.underline : null,
), ),

@ -289,7 +289,7 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
width: 38, width: 38,
color: isDisable ? MyColors.darkTextColor.withOpacity(0.7) : null, color: isDisable ? MyColors.darkTextColor.withOpacity(0.7) : null,
), ),
_title.toText16() _title.toText16(height: 20/16)
], ],
), ),
), ),

@ -572,7 +572,7 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
width: 38, width: 38,
color: isDisable ? MyColors.darkTextColor.withOpacity(0.7) : null, color: isDisable ? MyColors.darkTextColor.withOpacity(0.7) : null,
), ),
_title.toText16() _title.toText16(height: 20/16)
], ],
), ),
), ),

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_layout_grid/flutter_layout_grid.dart';
import 'package:mohem_flutter_app/api/my_attendance_api_client.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/colors.dart';
import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/classes/utils.dart';
@ -22,7 +23,8 @@ class DynamicListViewParams {
List<CollectionNotificationEit>? collectionNotificationList; List<CollectionNotificationEit>? collectionNotificationList;
final String selectedEmp; final String selectedEmp;
DynamicListViewParams(this.title, this.dynamicId, {this.selectedEmp ='', this.uRL = 'GET_EIT_DFF_STRUCTURE', this.requestID = '', this.colsURL = '', this.isUpdate = false, this.collectionNotificationList}); DynamicListViewParams(this.title, this.dynamicId,
{this.selectedEmp = '', this.uRL = 'GET_EIT_DFF_STRUCTURE', this.requestID = '', this.colsURL = '', this.isUpdate = false, this.collectionNotificationList});
} }
class DynamicListViewScreen extends StatefulWidget { class DynamicListViewScreen extends StatefulWidget {
@ -37,6 +39,7 @@ class DynamicListViewScreen extends StatefulWidget {
class _DynamicListViewScreenState extends State<DynamicListViewScreen> { class _DynamicListViewScreenState extends State<DynamicListViewScreen> {
List<GetEITTransactionList>? getEITTransactionList; List<GetEITTransactionList>? getEITTransactionList;
DynamicListViewParams? dynamicParams; DynamicListViewParams? dynamicParams;
// String? empId; // String? empId;
@override @override
@ -99,47 +102,19 @@ class _DynamicListViewScreenState extends State<DynamicListViewScreen> {
: ListView.separated( : ListView.separated(
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
itemBuilder: (cxt, int parentIndex) => getEITTransactionList![parentIndex].collectionTransaction!.isEmpty itemBuilder: (cxt, int parentIndex) {
? const SizedBox() if (getEITTransactionList![parentIndex].collectionTransaction!.isEmpty) {
: GridView( return const SizedBox();
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, childAspectRatio: 1.0 / 0.75), }
padding: const EdgeInsets.only(left: 12,right: 21,top: 12), int count = getEITTransactionList![parentIndex].collectionTransaction!.length;
shrinkWrap: true, return LayoutGrid(
primary: false, columnSizes: [1.fr, 1.fr],
physics: const ScrollPhysics(), rowSizes: [for (int i = 0; i < (count / 2).round(); i++) auto],
children: getEITWidgetsList(getEITTransactionList![parentIndex].collectionTransaction), columnGap: 8,
).objectContainerView(), rowGap: 12,
// Column( children: getEITWidgetsList(getEITTransactionList![parentIndex].collectionTransaction),
// crossAxisAlignment: CrossAxisAlignment.start, ).objectContainerView();
// 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 ?? ""),
// // GridView(
// // gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2),
// // padding: const EdgeInsets.only(left: 21, right: 21, bottom: 21, top: 12),
// // shrinkWrap: true,
// // primary: false,
// // physics: const ScrollPhysics(),
// // children: getEITWidgetsList(getEITTransactionList![parentIndex].collectionTransaction),
// // )
// // ItemDetailViewCol(getEITTransactionList![parentIndex].collectionTransaction![t].sEGMENTPROMPT!,
// // getEITTransactionList![parentIndex].collectionTransaction![t].sEGMENTVALUEDSP ?? ""),
//
// // GridView(
// // gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2),
// // padding: const EdgeInsets.only(left: 21, right: 21, bottom: 21, top: 12),
// // shrinkWrap: true,
// // primary: false,
// // physics: const ScrollPhysics(),
// // children: getEITWidgetsList(getEITTransactionList![parentIndex].collectionTransaction),
// // )
// // ItemDetailView(getEITTransactionList![parentIndex].collectionTransaction![t].sEGMENTPROMPT!,
// // getEITTransactionList![parentIndex].collectionTransaction![t].sEGMENTVALUEDSP ?? ""),
// ],
// ).objectContainerView(),
separatorBuilder: (cxt, index) => 12.height, separatorBuilder: (cxt, index) => 12.height,
itemCount: getEITTransactionList!.length)), itemCount: getEITTransactionList!.length)),
], ],

@ -533,7 +533,7 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
Utils.hideLoading(context); Utils.hideLoading(context);
Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr()); Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr());
// Navigator.pop(context, "delegate_reload"); // Navigator.pop(context, "delegate_reload");
animationIndex=animationIndex+1; animationIndex = animationIndex + 1;
AppState().requestAllList!.removeAt(AppState().itgWorkListIndex!); AppState().requestAllList!.removeAt(AppState().itgWorkListIndex!);
if (AppState().requestAllList!.isEmpty) { if (AppState().requestAllList!.isEmpty) {
Navigator.pop(context, "delegate_reload"); Navigator.pop(context, "delegate_reload");

@ -215,11 +215,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
appBar: AppBarWidget( appBar: AppBarWidget(context, title: LocaleKeys.workList.tr(), showWorkListSettingButton: true),
context,
title: LocaleKeys.workList.tr(),
showNotificationButton: true,
),
body: SizedBox( body: SizedBox(
width: double.infinity, width: double.infinity,
height: double.infinity, height: double.infinity,
@ -284,31 +280,33 @@ class _WorkListScreenState extends State<WorkListScreen> {
physics: const BouncingScrollPhysics(), physics: const BouncingScrollPhysics(),
child: itgRequestTypeIndex != null child: itgRequestTypeIndex != null
? Column( ? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SizedBox( // todo this is commented for temporary purpose, have issue when selecting any itg category and click any item showing wrong details
height: 40, // SizedBox(
child: ListView.separated( // height: 40,
itemBuilder: (context, index) { // child: ListView.separated(
RequestType type = itgFormsModel!.requestType![index]; // itemBuilder: (context, index) {
return Container( // RequestType type = itgFormsModel!.requestType![index];
padding: const EdgeInsets.only(left: 21, right: 21, top: 8, bottom: 8), // return Container(
alignment: Alignment.center, // padding: const EdgeInsets.only(left: 21, right: 21, top: 8, bottom: 8),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(30), color: itgRequestTypeIndex == index ? MyColors.darkIconColor : MyColors.lightGreyEAColor), // alignment: Alignment.center,
child: ("${type.requestTypeName}").toText12(color: itgRequestTypeIndex == index ? MyColors.white : MyColors.black), // decoration: BoxDecoration(borderRadius: BorderRadius.circular(30), color: itgRequestTypeIndex == index ? MyColors.darkIconColor : MyColors.lightGreyEAColor),
).onPress(() { // child: ("${type.requestTypeName}").toText12(color: itgRequestTypeIndex == index ? MyColors.white : MyColors.black),
if (itgRequestTypeIndex != index) { // ).onPress(() {
itgRequestTypeIndex = index; // if (itgRequestTypeIndex != index) {
setState(() {}); // itgRequestTypeIndex = index;
} // setState(() {});
}); // }
}, // });
separatorBuilder: (context, index) => 8.width, // },
shrinkWrap: true, // separatorBuilder: (context, index) => 8.width,
itemCount: itgFormsModel?.requestType?.length ?? 0, // shrinkWrap: true,
scrollDirection: Axis.horizontal, // itemCount: itgFormsModel?.requestType?.length ?? 0,
padding: const EdgeInsets.only(left: 21, right: 21), // scrollDirection: Axis.horizontal,
), // padding: const EdgeInsets.only(left: 21, right: 21),
).paddingOnly(top: 16, bottom: 16), // ),
// ).paddingOnly(top: 16, bottom: 16),
ListView.separated( ListView.separated(
shrinkWrap: true, shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
@ -429,7 +427,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
void openBottomSheet(BuildContext context) { void openBottomSheet(BuildContext context) {
showMyBottomSheet( showMyBottomSheet(
context, context,
callBackFunc: (){}, callBackFunc: () {},
child: WorkListAdvanceSearch((selectedViewID, selectedItemTypeID, searchByInput, searchByDate) async { child: WorkListAdvanceSearch((selectedViewID, selectedItemTypeID, searchByInput, searchByDate) async {
itgRequestTypeIndex = null; itgRequestTypeIndex = null;
pNotificationType = selectedViewID; pNotificationType = selectedViewID;

@ -12,7 +12,7 @@ import 'package:provider/provider.dart';
AppBar AppBarWidget(BuildContext context, AppBar AppBarWidget(BuildContext context,
{required String title, {required String title,
bool showHomeButton = true, bool showHomeButton = true,
bool showNotificationButton = false, bool showWorkListSettingButton = false,
bool showMemberButton = false, bool showMemberButton = false,
List<Widget>? actions, List<Widget>? actions,
void Function()? onHomeTapped, void Function()? onHomeTapped,
@ -43,12 +43,12 @@ AppBar AppBarWidget(BuildContext context,
}, },
icon: const Icon(Icons.home, color: MyColors.darkIconColor), icon: const Icon(Icons.home, color: MyColors.darkIconColor),
), ),
if (showNotificationButton) if (showWorkListSettingButton)
IconButton( IconButton(
onPressed: () { onPressed: () {
Navigator.pushNamed(context, AppRoutes.worklistSettings); Navigator.pushNamed(context, AppRoutes.worklistSettings);
}, },
icon: const Icon(Icons.notifications, color: MyColors.textMixColor), icon: const Icon(Icons.settings_rounded, color: MyColors.darkIconColor),
), ),
if (showMemberButton) if (showMemberButton)
IconButton( IconButton(

@ -36,6 +36,7 @@ class ItemDetailViewCol extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [ children: [
"$title:".toText12(isBold: true, color: const Color(0xff2BB8A6), maxLine: 2), "$title:".toText12(isBold: true, color: const Color(0xff2BB8A6), maxLine: 2),
4.width, 4.width,

@ -68,7 +68,7 @@ dependencies:
month_picker_dialog_2: 0.5.5 month_picker_dialog_2: 0.5.5
open_file: ^3.2.1 open_file: ^3.2.1
wifi_iot: ^0.3.16 wifi_iot: ^0.3.16
flutter_html: ^2.2.1 flutter_html: ^3.0.0-alpha.6
# flutter_barcode_scanner: ^2.0.0 # flutter_barcode_scanner: ^2.0.0
qr_code_scanner: ^1.0.0 qr_code_scanner: ^1.0.0
qr_flutter: ^4.0.0 qr_flutter: ^4.0.0
@ -100,6 +100,7 @@ dependencies:
video_player: ^2.4.7 video_player: ^2.4.7
just_audio: ^0.9.30 just_audio: ^0.9.30
safe_device: ^1.1.2 safe_device: ^1.1.2
flutter_layout_grid: ^2.0.1
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

Loading…
Cancel
Save