OpenContacts/lib/widgets/inventory/path_inventory_tile.dart

49 lines
1.5 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) {
2023-06-23 16:23:46 -04:00
return Card(
elevation: 0,
shape: RoundedRectangleBorder(
2023-06-17 13:28:23 -04:00
side: BorderSide(
color: selected ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.outline,
),
2023-06-23 16:23:46 -04:00
borderRadius: BorderRadius.circular(16),
2023-06-17 10:58:32 -04:00
),
2023-06-23 16:23:46 -04:00
child: InkWell(
borderRadius: BorderRadius.circular(16),
onTap: onTap,
onLongPress: onLongPress,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 0),
child: Row(
children: [
record.recordType == RecordType.directory ? const Icon(Icons.folder) : const Icon(Icons.link),
const SizedBox(
width: 4,
),
Expanded(
child: FormattedText(
record.formattedName,
maxLines: 3,
overflow: TextOverflow.ellipsis,
),
),
],
),
),
2023-06-17 10:58:32 -04:00
),
);
}
}