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.
cloudsolutions-atoms/lib/views/widgets/equipment/asset_item_listview.dart

103 lines
3.9 KiB
Dart

import 'package:flutter/material.dart';
import 'package:test_sa/controllers/api_routes/urls.dart';
import 'package:test_sa/controllers/localization/localization.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/device.dart';
import 'package:test_sa/models/subtitle.dart';
import 'package:test_sa/views/app_style/colors.dart';
import 'package:test_sa/views/app_style/sizing.dart';
import '../../../models/device/device.dart';
class AssetItemListView extends StatelessWidget {
final Device device;
final Function(Device) onPressed;
const AssetItemListView({Key key, this.device, this.onPressed}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(16),
decoration: ShapeDecoration(
color: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
shadows: const [BoxShadow(color: Color(0x07000000), blurRadius: 14, offset: Offset(0, 0), spreadRadius: 0)],
),
child: Row(
children: [
Container(
width: 95,
height: 95,
decoration: ShapeDecoration(
color: const Color(0xFFEAF1F4),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
image: DecorationImage(
fit: BoxFit.cover,
image: NetworkImage(device.assetPhoto != null ? URLs.getFileUrl(device.assetPhoto) : "https://www.lasteelcraft.com/images/no-image-available.png"),
)),
),
15.width,
Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
device.modelDefinition.assetName,
maxLines: 2,
style: AppTextStyles.heading5.copyWith(color: Color(0xFF3B3D4A)),
),
Text(
"${context.translation.assetNumber} : ${device.assetNumber}",
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
),
Text(
"${context.translation.model} : ${device.modelDefinition.modelDefCode}",
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
),
],
),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
"${context.translation.serialNo} : ${device.assetSerialNo}",
maxLines: 2,
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
).expanded,
Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'View Details',
style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF4A8DB7)),
),
4.width,
const Icon(
Icons.arrow_forward,
color: Color(0xFF4A8DB7),
size: 14,
)
],
),
],
)
],
).expanded
],
),
).onPress(() => onPressed(device));
}
}