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.
129 lines
5.5 KiB
Dart
129 lines
5.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:test_sa/controllers/api_routes/urls.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/device/asset.dart';
|
|
import 'package:test_sa/new_views/app_style/app_color.dart';
|
|
import 'package:test_sa/views/widgets/item_views/info_header_widget.dart';
|
|
import 'package:test_sa/views/widgets/item_views/info_text_widget.dart';
|
|
|
|
class AssetDetailBottomSheet extends StatelessWidget {
|
|
Asset? asset;
|
|
|
|
AssetDetailBottomSheet(this.asset, {Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Padding(
|
|
padding: EdgeInsets.only(
|
|
bottom: MediaQuery.of(context).viewInsets.bottom + MediaQuery.of(context).padding.bottom,
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
// (asset?.modelDefinition?.assetName?.cleanupWhitespace.capitalizeFirstOfEach ?? "-").heading5(context).custom(color: AppColor.textStyleColor(context)),
|
|
InfoHeader16Widget(asset?.modelDefinition?.assetName?.cleanupWhitespace.capitalizeFirstOfEach ?? "-"),
|
|
16.height,
|
|
AspectRatio(
|
|
aspectRatio: 358 / 136,
|
|
child: Container(
|
|
width: 95,
|
|
height: 95,
|
|
decoration: ShapeDecoration(
|
|
color: AppColor.neutral30,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
image: DecorationImage(
|
|
fit: BoxFit.cover,
|
|
image: NetworkImage(asset?.assetPhoto != null ? URLs.getFileUrl(asset!.assetPhoto)! : "https://www.lasteelcraft.com/images/no-image-available.png"),
|
|
)),
|
|
),
|
|
),
|
|
16.height,
|
|
Column(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
InfoTextWidget(
|
|
label: context.translation.assetNo,
|
|
value: asset!.assetNumber,
|
|
showEmptyValue: true,
|
|
),
|
|
InfoTextWidget(
|
|
label: context.translation.modelName,
|
|
value: asset!.modelDefinition?.modelName,
|
|
showEmptyValue: true,
|
|
),
|
|
InfoTextWidget(
|
|
label: context.translation.supplier,
|
|
value: asset!.supplier?.suppliername?.cleanupWhitespace.capitalizeFirstOfEach,
|
|
showEmptyValue: true,
|
|
),
|
|
InfoTextWidget(
|
|
label: context.translation.manufacture,
|
|
value: asset!.modelDefinition?.manufacturerName?.cleanupWhitespace.capitalizeFirstOfEach,
|
|
showEmptyValue: true,
|
|
),
|
|
],
|
|
).expanded,
|
|
8.width,
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
InfoTextWidget(
|
|
label: context.translation.snNo,
|
|
value: asset!.assetSerialNo,
|
|
showEmptyValue: true,
|
|
),
|
|
InfoTextWidget(
|
|
label: context.translation.site,
|
|
value: asset?.site?.custName?.cleanupWhitespace.capitalizeFirstOfEach,
|
|
showEmptyValue: true,
|
|
),
|
|
InfoTextWidget(
|
|
label: context.translation.building,
|
|
value: asset?.building?.name?.cleanupWhitespace.capitalizeFirstOfEach,
|
|
showEmptyValue: true,
|
|
),
|
|
InfoTextWidget(
|
|
label: context.translation.floor,
|
|
value: asset?.floor?.name?.cleanupWhitespace.capitalizeFirstOfEach,
|
|
showEmptyValue: true,
|
|
),
|
|
InfoTextWidget(
|
|
label: context.translation.md,
|
|
value: asset?.department?.departmentName?.cleanupWhitespace.capitalizeFirstOfEach,
|
|
showEmptyValue: true,
|
|
),
|
|
InfoTextWidget(
|
|
label: context.translation.room,
|
|
value: asset?.room?.name,
|
|
showEmptyValue: true,
|
|
),
|
|
],
|
|
).expanded,
|
|
],
|
|
),
|
|
8.height,
|
|
if ((asset?.modelDefinition?.assetDescription ?? "").isNotEmpty) ...[
|
|
const Divider().defaultStyle(context),
|
|
InfoTextWidget(label: asset!.modelDefinition!.assetDescription!, isMsg: true, showEmptyValue: true),
|
|
]
|
|
],
|
|
)
|
|
],
|
|
).paddingAll(16),
|
|
);
|
|
}
|
|
}
|