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.
104 lines
3.8 KiB
Dart
104 lines
3.8 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 AssetItemGridView extends StatelessWidget {
|
|
final Device device;
|
|
final Function(Device) onPressed;
|
|
|
|
const AssetItemGridView({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: Column(
|
|
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(device.assetPhoto != null ? URLs.getFileUrl(device.assetPhoto) : "https://www.lasteelcraft.com/images/no-image-available.png"),
|
|
)),
|
|
),
|
|
),
|
|
6.height,
|
|
Column(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
device.modelDefinition.assetName,
|
|
maxLines: 2,
|
|
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF3B3D4A)),
|
|
),
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Text(
|
|
"${context.translation.assetNumber} : ${device.assetNumber}",
|
|
style: AppTextStyles.bodyText2.copyWith(color: Color(0xFF757575)),
|
|
),
|
|
Text(
|
|
"${context.translation.model} : ${device.modelDefinition.modelDefCode}",
|
|
style: AppTextStyles.bodyText2.copyWith(color: Color(0xFF757575)),
|
|
),
|
|
Text(
|
|
"${context.translation.serialNo} : ${device.assetSerialNo}",
|
|
maxLines: 2,
|
|
overflow: TextOverflow.fade,
|
|
style: AppTextStyles.bodyText2.copyWith(
|
|
color: Color(0xFF757575),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Text(
|
|
'View Details',
|
|
style: AppTextStyles.bodyText2.copyWith(color: const Color(0xFF4A8DB7)),
|
|
),
|
|
4.width,
|
|
const Icon(
|
|
Icons.arrow_forward,
|
|
color: Color(0xFF4A8DB7),
|
|
size: 14,
|
|
)
|
|
],
|
|
),
|
|
],
|
|
).expanded
|
|
],
|
|
),
|
|
).onPress(() => onPressed(device));
|
|
}
|
|
}
|