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.
66 lines
2.8 KiB
Dart
66 lines
2.8 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/text_extensions.dart';
|
|
import 'package:test_sa/extensions/widget_extensions.dart';
|
|
import 'package:test_sa/views/widgets/equipment/single_device_picker.dart';
|
|
|
|
import '../../../models/device/device.dart';
|
|
import '../../../new_views/app_style/app_color.dart';
|
|
|
|
class PickAsset extends StatelessWidget {
|
|
final Function(Device) onPickAsset;
|
|
final Device device;
|
|
|
|
const PickAsset({Key key, this.device, this.onPickAsset}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
children: [
|
|
Container(
|
|
decoration: BoxDecoration(
|
|
color: Theme.of(context).cardColor,
|
|
borderRadius: BorderRadius.circular(10),
|
|
boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.03), blurRadius: 14)],
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
context.translation.device.tinyFont(context).custom(color: context.isDark ? AppColor.neutral40 : AppColor.neutral50),
|
|
context.translation.pickAsset.bodyText(context).custom(color: context.isDark ? AppColor.neutral40 : AppColor.neutral50),
|
|
],
|
|
).onPress(() async {
|
|
Device device = await Navigator.of(context).pushNamed(SingleDevicePicker.id) as Device;
|
|
onPickAsset(device);
|
|
}).expanded,
|
|
"qr".toSvgAsset(height: 24, fit: BoxFit.fitHeight).onPress(() {
|
|
/// TODO [Zaid] : open qr reader
|
|
}),
|
|
],
|
|
).paddingOnly(start: 16, end: 16, top: 8, bottom: 8),
|
|
),
|
|
if (device != null)
|
|
Card(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
device.modelDefinition?.assetName?.heading5(context),
|
|
8.height,
|
|
"${context.translation.assetNo}: ${device.assetNumber}".bodyText(context),
|
|
"${context.translation.manufacture}: ${device.modelDefinition?.manufacturerName}".bodyText(context),
|
|
"${context.translation.model}: ${device.modelDefinition?.modelName}".bodyText(context),
|
|
"${context.translation.serialNumber}: ${device.assetNumber}".bodyText(context),
|
|
const Divider().defaultStyle(context),
|
|
"${context.translation.department}: ${device.department?.departmentName}".bodyText(context),
|
|
"${context.translation.site}: ${device.site?.custName}".bodyText(context),
|
|
],
|
|
).paddingAll(16),
|
|
).paddingOnly(top: 8),
|
|
],
|
|
);
|
|
}
|
|
}
|