OpenContacts/lib/widgets/inventory/path_inventory_tile.dart

38 lines
1.2 KiB
Dart
Raw Normal View History

2023-06-17 10:58:32 -04:00
import 'package:contacts_plus_plus/models/records/record.dart';
import 'package:contacts_plus_plus/widgets/formatted_text.dart';
import 'package:flutter/material.dart';
class PathInventoryTile extends StatelessWidget {
2023-06-17 13:28:23 -04:00
const PathInventoryTile({required this.record, this.selected = false, this.onTap, this.onLongPress, super.key});
2023-06-17 10:58:32 -04:00
final Record record;
2023-06-17 13:28:23 -04:00
final Function()? onTap;
final Function()? onLongPress;
final bool selected;
2023-06-17 10:58:32 -04:00
@override
Widget build(BuildContext context) {
return OutlinedButton.icon(
style: TextButton.styleFrom(
2023-06-17 13:28:23 -04:00
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
side: BorderSide(
color: selected ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.outline,
width: 1,
),
2023-06-17 10:58:32 -04:00
foregroundColor: Theme.of(context).colorScheme.onSecondaryContainer,
alignment: Alignment.centerLeft,
),
2023-06-17 13:28:23 -04:00
onLongPress: onLongPress,
onPressed: onTap,
2023-06-17 10:58:32 -04:00
icon: record.recordType == RecordType.directory ? const Icon(Icons.folder) : const Icon(Icons.link),
label: FormattedText(
record.formattedName,
maxLines: 3,
overflow: TextOverflow.ellipsis,
),
);
}
}