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.
cloudsolutions-atoms/lib/views/widgets/equipment/device_item.dart

58 lines
1.9 KiB
Dart

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';
3 years ago
class DeviceItem extends StatelessWidget {
final Device device;
final Function(Device)? onPressed;
3 years ago
const DeviceItem({Key? key, required this.device, this.onPressed}) : super(key: key);
3 years ago
@override
Widget build(BuildContext context) {
Subtitle? _subtitle = AppLocalization.of(context)?.subtitle;
3 years ago
return Padding(
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 6),
3 years ago
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: AColors.primaryColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(AppStyle.getBorderRadius(context)),
3 years ago
),
),
onPressed: () {
onPressed!(device);
3 years ago
},
child: ListTile(
title: Text(
"${_subtitle?.sn} : ${device.serialNumber}",
style: Theme.of(context).textTheme.headline6?.copyWith(color: AColors.white),
3 years ago
),
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,
3 years ago
),
Text(
"${_subtitle?.model} : ${device.model}",
style: Theme.of(context).textTheme.subtitle1?.copyWith(color: AColors.white),
3 years ago
),
],
),
),
),
);
}
}