import 'package:flutter/material.dart'; import 'package:test_sa/controllers/localization/localization.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'; 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) { 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 ), ), ], ), ), ), ); } }