|
|
|
|
@ -4,34 +4,72 @@ 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/itg_forms_models/field_goups_model.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/models/itg_forms_models/fields_model.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart';
|
|
|
|
|
|
|
|
|
|
class RequestDetailFragment extends StatelessWidget {
|
|
|
|
|
List<Fields> fields;
|
|
|
|
|
List<FieldGoups>? fieldGoups;
|
|
|
|
|
String taskID;
|
|
|
|
|
|
|
|
|
|
RequestDetailFragment({Key? key, this.fields = const <Fields>[]}) : super(key: key);
|
|
|
|
|
RequestDetailFragment({Key? key, this.fields = const <Fields>[], this.fieldGoups = const <FieldGoups>[], this.taskID = ""}) : super(key: key);
|
|
|
|
|
double itemHeight = 0;
|
|
|
|
|
double itemWidth = 0;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
var size = MediaQuery.of(context).size;
|
|
|
|
|
itemHeight = (size.height - kToolbarHeight - 24) / 9;
|
|
|
|
|
itemWidth = size.width / 2;
|
|
|
|
|
List<Widget> uiList = [detailView()];
|
|
|
|
|
return Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: double.infinity,
|
|
|
|
|
child: fields.isEmpty
|
|
|
|
|
? LocaleKeys.noDataAvailable.tr().toText16().center
|
|
|
|
|
: ListView(
|
|
|
|
|
List<Widget> uiList = [detailView(fields)];
|
|
|
|
|
return Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(21),
|
|
|
|
|
children: uiList,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
// height: double.infinity,
|
|
|
|
|
child: fields.isEmpty
|
|
|
|
|
? LocaleKeys.noDataAvailable.tr().toText16().center
|
|
|
|
|
: ListView(
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
children: uiList,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
12.height,
|
|
|
|
|
if (taskID.toLowerCase().contains("vida"))
|
|
|
|
|
Column(
|
|
|
|
|
children: [
|
|
|
|
|
fieldGoups![2].title!.toText14(),
|
|
|
|
|
6.height,
|
|
|
|
|
detailView(fieldGoups![2].fields!),
|
|
|
|
|
12.height,
|
|
|
|
|
fieldGoups![3].title!.toText14(),
|
|
|
|
|
6.height,
|
|
|
|
|
detailView(fieldGoups![3].fields!),
|
|
|
|
|
12.height,
|
|
|
|
|
fieldGoups![4].title!.toText14(),
|
|
|
|
|
6.height,
|
|
|
|
|
detailView(fieldGoups![4].fields!),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget detailView() {
|
|
|
|
|
Widget detailView(List<Fields> fields) {
|
|
|
|
|
bool isOdd = false;
|
|
|
|
|
if (fields.length % 2 != 0) {
|
|
|
|
|
isOdd = true;
|
|
|
|
|
@ -45,11 +83,12 @@ class RequestDetailFragment extends StatelessWidget {
|
|
|
|
|
if (fields[index].value == null) {
|
|
|
|
|
return ItemDetailViewGridItem(
|
|
|
|
|
index,
|
|
|
|
|
fields[index].title, fields[index].multipleValue?.join(", ") ?? "",
|
|
|
|
|
fields[index].title,
|
|
|
|
|
fields[index].multipleValue?.join(", ") ?? "",
|
|
|
|
|
isNeedToShowEmptyDivider: (fields.length == index + 1)
|
|
|
|
|
? isOdd
|
|
|
|
|
? true
|
|
|
|
|
: false
|
|
|
|
|
? true
|
|
|
|
|
: false
|
|
|
|
|
: false,
|
|
|
|
|
type: fields[index].type,
|
|
|
|
|
);
|
|
|
|
|
@ -60,8 +99,8 @@ class RequestDetailFragment extends StatelessWidget {
|
|
|
|
|
fields[index].value ?? "",
|
|
|
|
|
isNeedToShowEmptyDivider: (fields.length == index + 1)
|
|
|
|
|
? isOdd
|
|
|
|
|
? true
|
|
|
|
|
: false
|
|
|
|
|
? true
|
|
|
|
|
: false
|
|
|
|
|
: false,
|
|
|
|
|
type: fields[index].type,
|
|
|
|
|
);
|
|
|
|
|
|