import 'package:flutter/material.dart'; import '../../../controllers/localization/localization.dart'; import '../../../models/device/device.dart'; import '../../../models/subtitle.dart'; import '../../app_style/colors.dart'; import '../../app_style/sizing.dart'; class DeviceItem extends StatelessWidget { final Device device; final Function(Device)? onPressed; const DeviceItem({Key? key, required this.device, this.onPressed}) : super(key: key); @override Widget build(BuildContext context) { Subtitle? _subtitle = AppLocalization.of(context)?.subtitle; 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("${_subtitle?.sn} : ${device.serialNumber}", style: Theme.of(context).textTheme.headline6?.copyWith( color: AColors.white ), ), subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Divider(color: Theme.of(context).scaffoldBackgroundColor,), Text("${_subtitle?.brand} : ${device.brand}", style: Theme.of(context).textTheme.subtitle1?.copyWith( color: AColors.white ), ), Divider(color: Theme.of(context).scaffoldBackgroundColor,), Text("${_subtitle?.model} : ${device.model}", style: Theme.of(context).textTheme.subtitle1?.copyWith( color: AColors.white ), ), ], ), ), ), ); } }