import 'package:flutter/material.dart'; import 'package:test_sa/controllers/localization/localization.dart'; import 'package:test_sa/extensions/context_extension.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 DeviceItem extends StatelessWidget { final Device device; final Function(Device) onPressed; const DeviceItem({Key key, this.device, this.onPressed}) : super(key: key); @override Widget build(BuildContext context) { return Padding( padding: EdgeInsets.symmetric(horizontal: 16, vertical: 6), child: ElevatedButton( style: ElevatedButton.styleFrom( primary: AColors.primaryColor, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(AppStyle.getBorderRadius(context)), ), ), onPressed: () { onPressed(device); }, child: ListTile( title: Text( "${context.translation.assetName} : \n${device.modelDefinition.assetName}", style: Theme.of(context).textTheme.headline6.copyWith(color: AColors.white), ), subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Divider( color: Theme.of(context).scaffoldBackgroundColor, ), Text( "${context.translation.assetNumber} : ${device.assetNumber}", style: Theme.of(context).textTheme.subtitle1.copyWith(color: AColors.white), ), Divider( color: Theme.of(context).scaffoldBackgroundColor, ), Text( "${context.translation.brand} : ${device.modelDefinition.manufacturerName}", style: Theme.of(context).textTheme.subtitle1.copyWith(color: AColors.white), ), Divider( color: Theme.of(context).scaffoldBackgroundColor, ), Text( "${context.translation.model} : ${device.modelDefinition.modelName}", style: Theme.of(context).textTheme.subtitle1.copyWith(color: AColors.white), ), ], ), ), ), ); } }