Jisho-Study-Tool/lib/view/components/history/phrase_search_item.dart

45 lines
984 B
Dart
Raw Normal View History

2021-08-03 22:02:42 +02:00
import 'package:flutter/material.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import './search_item.dart';
2021-12-01 23:09:53 +01:00
import '../../../models/history/word_query.dart';
2021-08-03 22:02:42 +02:00
class PhraseSearchItem extends StatelessWidget {
final WordQuery search;
final DateTime timestamp;
const PhraseSearchItem({
required this.search,
required this.timestamp,
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Slidable(
2021-12-06 20:26:52 +01:00
endActionPane: ActionPane(
motion: const ScrollMotion(),
children: [
SlidableAction(
label: 'Delete',
backgroundColor: Colors.red,
2021-12-01 23:09:53 +01:00
icon: Icons.delete,
2021-12-06 20:26:52 +01:00
onPressed: (_) {},
2021-12-01 23:09:53 +01:00
),
2021-12-06 20:26:52 +01:00
],
),
2021-08-03 22:02:42 +02:00
child: SearchItem(
2021-12-01 23:09:53 +01:00
onTap: () => Navigator.pushNamed(
context,
'/search',
arguments: search.query,
),
2021-08-03 22:02:42 +02:00
time: timestamp,
search: Text(search.query),
),
);
}
}