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/pick_asset.dart

49 lines
2.0 KiB
Dart

import 'package:flutter/material.dart';
import 'package:test_sa/extensions/context_extension.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';
import '../../../new_views/common_widgets/asset_info_card.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, color: context.isDark ? AppColor.primary40 : AppColor.primary70),
],
// TODO [Zaid] : if you have container as parent widget, no need to add padding widget separately
).paddingOnly(start: 16, end: 16, top: 8, bottom: 8),
),
if (device != null) AssetInfoCard(asset: device).paddingOnly(top: 8),
],
);
}
}