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.
59 lines
2.0 KiB
Dart
59 lines
2.0 KiB
Dart
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.modelDefinition.manufacturerName}",
|
|
style: Theme.of(context).textTheme.subtitle1.copyWith(
|
|
color: AColors.white
|
|
),
|
|
),
|
|
Divider(color: Theme.of(context).scaffoldBackgroundColor,),
|
|
Text("${_subtitle.model} : ${device.modelDefinition.modelName}",
|
|
style: Theme.of(context).textTheme.subtitle1.copyWith(
|
|
color: AColors.white
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|