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

41 lines
1.1 KiB
Dart
Raw Normal View History

2021-07-19 01:49:18 +02:00
import 'package:flutter/material.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:jisho_study_tool/models/history/kanji_result.dart';
class _KanjiSearchItemHeader extends StatelessWidget {
final KanjiResult result;
2021-07-26 21:39:17 +02:00
const _KanjiSearchItemHeader(this.result, {Key? key}) : super(key: key);
2021-07-19 01:49:18 +02:00
@override
Widget build(BuildContext context) {
return Text("[KANJI] ${result.kanji} - ${result.timestamp.toIso8601String()}");
}
}
class KanjiSearchItem extends StatelessWidget {
final KanjiResult result;
2021-07-26 21:39:17 +02:00
const KanjiSearchItem(this.result,{Key? key}) : super(key: key);
2021-07-19 01:49:18 +02:00
@override
Widget build(BuildContext context) {
return Slidable(
child: ListTile(title: _KanjiSearchItemHeader(result)),
actionPane: SlidableScrollActionPane(),
secondaryActions: [
IconSlideAction(
caption: "Favourite",
color: Colors.yellow,
icon: Icons.star
),
IconSlideAction(
caption: "Delete",
color: Colors.red,
icon: Icons.delete
)
],
);
}
}