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.
		
		
		
		
		
			
		
			
				
	
	
		
			52 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Dart
		
	
			
		
		
	
	
			52 lines
		
	
	
		
			2.1 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/asset.dart';
 | 
						|
import '../../../new_views/app_style/app_color.dart';
 | 
						|
import '../../../new_views/common_widgets/asset_info_card.dart';
 | 
						|
 | 
						|
class PickAsset extends StatelessWidget {
 | 
						|
  final Function(Asset) onPickAsset;
 | 
						|
  final Asset device;
 | 
						|
  final bool editable;
 | 
						|
 | 
						|
  const PickAsset({Key key, this.editable = true, this.device, this.onPickAsset}) : super(key: key);
 | 
						|
 | 
						|
  @override
 | 
						|
  Widget build(BuildContext context) {
 | 
						|
    return Column(
 | 
						|
      children: [
 | 
						|
        if (editable)
 | 
						|
          Container(
 | 
						|
            decoration: BoxDecoration(
 | 
						|
              color: Theme.of(context).cardColor,
 | 
						|
              borderRadius: BorderRadius.circular(10),
 | 
						|
              boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.03), blurRadius: 14)],
 | 
						|
            ),
 | 
						|
            padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 8.toScreenHeight),
 | 
						|
            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 {
 | 
						|
                  Asset device = await Navigator.of(context).pushNamed(SingleDevicePicker.id) as Asset;
 | 
						|
                  onPickAsset(device);
 | 
						|
                }).expanded,
 | 
						|
                "qr".toSvgAsset(height: 24, fit: BoxFit.fitHeight, color: context.isDark ? AppColor.primary40 : AppColor.primary70),
 | 
						|
              ],
 | 
						|
            ),
 | 
						|
          ),
 | 
						|
        if (device != null) AssetInfoCard(asset: device).paddingOnly(top: 8),
 | 
						|
      ],
 | 
						|
    );
 | 
						|
  }
 | 
						|
}
 |