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.
92 lines
3.9 KiB
Dart
92 lines
3.9 KiB
Dart
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/string_extensions.dart';
|
|
import 'package:test_sa/extensions/text_extensions.dart';
|
|
import 'package:test_sa/extensions/widget_extensions.dart';
|
|
import 'package:test_sa/models/all_requests_and_count_model.dart';
|
|
import 'package:test_sa/models/new_models/dashboard_detail.dart';
|
|
import 'package:test_sa/modules/asset_delivery_module/pages/asset_delivery_page.dart';
|
|
import 'package:test_sa/modules/asset_inventory_module/pages/asset_inventory_page.dart';
|
|
import 'package:test_sa/modules/demo_module/demo_detail_view_page.dart';
|
|
import 'package:test_sa/new_views/app_style/app_color.dart';
|
|
import 'package:test_sa/views/widgets/requests/request_status.dart';
|
|
|
|
class DemoRequestItemView extends StatelessWidget {
|
|
final Data? requestData;
|
|
final RequestsDetails? requestDetails;
|
|
final bool showShadow;
|
|
|
|
const DemoRequestItemView({Key? key, this.requestData, this.requestDetails, this.showShadow = true}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
if (requestData != null) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
8.height,
|
|
// (requestData?.typeTransaction ?? 'Demo Request').heading5(context),
|
|
('Demo Request').heading5(context),
|
|
//TODO need to replace this with exact values need to show here..
|
|
infoWidget(label: 'PO Internal'.addTranslation, value: requestData?.poInternal ?? '-', context: context),
|
|
infoWidget(label: 'PO External'.addTranslation, value: requestData?.poExternal ?? '-', context: context),
|
|
// infoWidget(label: 'No of Sites'.addTranslation, value: requestData?.numberOfSites != null ? requestData?.numberOfSites.toString() : '-', context: context),
|
|
8.height,
|
|
Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Text(
|
|
context.translation.viewDetails,
|
|
style: AppTextStyles.bodyText.copyWith(color: AppColor.blueStatus(context)),
|
|
),
|
|
4.width,
|
|
Icon(Icons.arrow_forward, color: AppColor.blueStatus(context), size: 14)
|
|
],
|
|
),
|
|
],
|
|
).toShadowContainer(context, withShadow: showShadow).onPress(() async {
|
|
Navigator.of(context).push(MaterialPageRoute(
|
|
builder: (_) => DemoDetailViewPage(
|
|
demoId: requestData!.id!,
|
|
)));
|
|
});
|
|
}
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
8.height,
|
|
('Demo Request').heading5(context),
|
|
// (requestDetails?.nameOfType ?? 'Demo Request').heading5(context),
|
|
//TODO need to replace this with exact values need to show here..
|
|
infoWidget(label: 'PO Internal'.addTranslation, value: requestDetails?.poInternal ?? '-', context: context),
|
|
infoWidget(label: 'PO External'.addTranslation, value: requestDetails?.poExternal ?? '-', context: context),
|
|
8.height,
|
|
Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Text(
|
|
context.translation.viewDetails,
|
|
style: AppTextStyles.bodyText.copyWith(color: AppColor.blueStatus(context)),
|
|
),
|
|
4.width,
|
|
Icon(Icons.arrow_forward, color: AppColor.blueStatus(context), size: 14)
|
|
],
|
|
),
|
|
],
|
|
).toShadowContainer(context, withShadow: showShadow).onPress(() async {
|
|
Navigator.of(context).push(MaterialPageRoute(
|
|
builder: (_) => DemoDetailViewPage(
|
|
demoId: requestDetails!.id!,
|
|
)));
|
|
});
|
|
}
|
|
|
|
Widget infoWidget({required String label, String? value, required BuildContext context}) {
|
|
if (value != null && value.isNotEmpty) {
|
|
return '$label: $value'.bodyText(context);
|
|
}
|
|
return const SizedBox();
|
|
}
|
|
}
|