|
|
|
|
@ -13,6 +13,8 @@ import 'package:test_sa/views/widgets/loaders/failed_loading.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/loaders/lazy_loading.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/loaders/loading_manager.dart';
|
|
|
|
|
|
|
|
|
|
import '../../../new_views/app_style/app_color.dart';
|
|
|
|
|
|
|
|
|
|
class AssetDetailPage extends StatefulWidget {
|
|
|
|
|
static const String id = "/asset-details";
|
|
|
|
|
|
|
|
|
|
@ -62,111 +64,94 @@ class _AssetDetailPageState extends State<AssetDetailPage> {
|
|
|
|
|
if (snapshot.hasData) {
|
|
|
|
|
return SingleChildScrollView(
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
decoration: ShapeDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(20),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
AspectRatio(
|
|
|
|
|
aspectRatio: 159 / 94,
|
|
|
|
|
child: Container(
|
|
|
|
|
width: 95,
|
|
|
|
|
height: 95,
|
|
|
|
|
decoration: ShapeDecoration(
|
|
|
|
|
color: const Color(0xFFEAF1F4),
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
|
),
|
|
|
|
|
image: DecorationImage(
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
image: NetworkImage(
|
|
|
|
|
_assetProvider.assetById?.assetPhoto != null ? URLs.getFileUrl(_assetProvider.assetById.assetPhoto) : "https://www.lasteelcraft.com/images/no-image-available.png"),
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
shadows: const [BoxShadow(color: Color(0x07000000), blurRadius: 14, offset: Offset(0, 0), spreadRadius: 0)],
|
|
|
|
|
),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
AspectRatio(
|
|
|
|
|
aspectRatio: 159 / 94,
|
|
|
|
|
child: Container(
|
|
|
|
|
width: 95,
|
|
|
|
|
height: 95,
|
|
|
|
|
decoration: ShapeDecoration(
|
|
|
|
|
color: const Color(0xFFEAF1F4),
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
|
),
|
|
|
|
|
image: DecorationImage(
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
image: NetworkImage(
|
|
|
|
|
_assetProvider.assetById?.assetPhoto != null ? URLs.getFileUrl(_assetProvider.assetById.assetPhoto) : "https://www.lasteelcraft.com/images/no-image-available.png"),
|
|
|
|
|
)),
|
|
|
|
|
6.height,
|
|
|
|
|
Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
_assetProvider.assetById?.modelDefinition?.assetName ?? "-".heading5(context),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
6.height,
|
|
|
|
|
Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
_assetProvider.assetById?.modelDefinition?.assetName ?? "-",
|
|
|
|
|
style: AppTextStyles.heading5.copyWith(color: Color(0xFF3B3D4A)),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(
|
|
|
|
|
"${context.translation.assetNumber}: ${_assetProvider.assetById.multiAssets.first.assetNumber}",
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"${context.translation.model}: ${_assetProvider.assetById.modelDefinition.modelDefCode}",
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"${context.translation.serialNo}: ${_assetProvider.assetById.multiAssets.first.assetSerialNo}",
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"MD: ${_assetProvider.assetById.department.departmentName ?? "-"}",
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"Supplier: ${_assetProvider.assetById.supplier?.suppliername ?? "-"}",
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"Manufacturer: ${_assetProvider.assetById.modelDefinition.manufacturerName}",
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"Location: ${_assetProvider.assetById.site.custName}",
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
"${context.translation.assetNumber}: ${_assetProvider.assetById.multiAssets.first.assetNumber}".bodyText(context),
|
|
|
|
|
"${context.translation.model}: ${_assetProvider.assetById.modelDefinition.modelDefCode}".bodyText(context),
|
|
|
|
|
Text(
|
|
|
|
|
"${context.translation.serialNo}: ${_assetProvider.assetById.multiAssets.first.assetSerialNo}",
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark? AppColor.neutral10:Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"MD: ${_assetProvider.assetById.department.departmentName ?? "-"}",
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark? AppColor.neutral10: Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"Supplier: ${_assetProvider.assetById.supplier?.suppliername ?? "-"}",
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark? AppColor.neutral10: Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"Manufacturer: ${_assetProvider.assetById.modelDefinition.manufacturerName}",
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark? AppColor.neutral10: Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"Location: ${_assetProvider.assetById.site.custName}",
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark? AppColor.neutral10: Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(
|
|
|
|
|
"Installation Date: ${_assetProvider.assetById.installationDate ?? "-"}",
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark? AppColor.neutral10: Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"Next PM Date: ${_assetProvider.assetById.installationDate ?? "-"}",
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark? AppColor.neutral10: Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"Last PM Date: ${_assetProvider.assetById.installationDate ?? "-"}",
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark? AppColor.neutral10: Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
if ((_assetProvider.assetById.modelDefinition.assetDescription ?? "").isNotEmpty) ...[
|
|
|
|
|
8.height,
|
|
|
|
|
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(
|
|
|
|
|
"Installation Date: ${_assetProvider.assetById.installationDate ?? "-"}",
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"Next PM Date: ${_assetProvider.assetById.installationDate ?? "-"}",
|
|
|
|
|
_assetProvider.assetById.modelDefinition.assetDescription ?? "-",
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark? AppColor.neutral10: Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"Last PM Date: ${_assetProvider.assetById.installationDate ?? "-"}",
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
if ((_assetProvider.assetById.modelDefinition.assetDescription ?? "").isNotEmpty) ...[
|
|
|
|
|
8.height,
|
|
|
|
|
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(
|
|
|
|
|
_assetProvider.assetById.modelDefinition.assetDescription ?? "-",
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
).toShadowContainer(context),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
return Center(child: ALoading());
|
|
|
|
|
|