|
|
|
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:test_sa/extensions/context_extension.dart';
|
|
|
|
|
import 'package:test_sa/extensions/int_extensions.dart';
|
|
|
|
|
import 'package:test_sa/extensions/text_extensions.dart';
|
|
|
|
|
import 'package:test_sa/extensions/widget_extensions.dart';
|
|
|
|
|
import 'package:test_sa/models/pantry/ppm_check_list.dart';
|
|
|
|
|
import 'package:test_sa/new_views/app_style/app_color.dart';
|
|
|
|
|
import 'package:test_sa/new_views/common_widgets/app_text_form_field.dart';
|
|
|
|
|
@ -21,30 +22,32 @@ class _PentryPMChecklistFormState extends State<PentryPMChecklistForm> {
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return ListView.builder(
|
|
|
|
|
padding: EdgeInsets.only(top: 16.toScreenHeight),
|
|
|
|
|
itemCount: widget.models.length,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
final model = widget.models[index];
|
|
|
|
|
return Card(
|
|
|
|
|
child: ExpansionTile(
|
|
|
|
|
shape: const Border(),
|
|
|
|
|
title: (model.title ?? "").heading5(context),
|
|
|
|
|
subtitle: "${context.translation.status} ${model.status?.name}".bodyText(context),
|
|
|
|
|
initiallyExpanded: index == 0,
|
|
|
|
|
iconColor: AppColor.neutral50,
|
|
|
|
|
collapsedIconColor: AppColor.neutral50,
|
|
|
|
|
childrenPadding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 8.toScreenHeight),
|
|
|
|
|
children: [
|
|
|
|
|
AppTextFormField(labelText: context.translation.measuredValue, initialValue: model.measuredValue, enable: false),
|
|
|
|
|
8.height,
|
|
|
|
|
AppTextFormField(labelText: context.translation.comment, initialValue: model.comment, enable: false),
|
|
|
|
|
8.height,
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
final list = widget.models?.where((element) => element.title != null)?.toList();
|
|
|
|
|
return (list?.isEmpty ?? true)
|
|
|
|
|
? context.translation.noDataFound.heading5(context).center
|
|
|
|
|
: ListView.builder(
|
|
|
|
|
padding: EdgeInsets.only(top: 16.toScreenHeight),
|
|
|
|
|
itemCount: list?.length,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
return Card(
|
|
|
|
|
child: ExpansionTile(
|
|
|
|
|
shape: const Border(),
|
|
|
|
|
title: (list[index].title ?? "").heading5(context),
|
|
|
|
|
subtitle: "${context.translation.status} ${list[index].status?.name}".bodyText(context),
|
|
|
|
|
initiallyExpanded: index == 0,
|
|
|
|
|
iconColor: AppColor.neutral50,
|
|
|
|
|
collapsedIconColor: AppColor.neutral50,
|
|
|
|
|
childrenPadding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 8.toScreenHeight),
|
|
|
|
|
children: [
|
|
|
|
|
AppTextFormField(labelText: context.translation.measuredValue, initialValue: list[index].measuredValue, enable: false),
|
|
|
|
|
8.height,
|
|
|
|
|
AppTextFormField(labelText: context.translation.comment, initialValue: list[index].comment, enable: false),
|
|
|
|
|
8.height,
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|