revanced-manager/lib/ui/widgets/application_item.dart

49 lines
1.2 KiB
Dart
Raw Normal View History

import 'dart:typed_data';
2022-08-01 13:30:06 +02:00
import 'package:flutter/material.dart';
2022-08-07 01:37:12 +02:00
import 'package:flutter_i18n/flutter_i18n.dart';
2022-08-01 13:30:06 +02:00
import 'package:google_fonts/google_fonts.dart';
2022-08-06 23:35:35 +02:00
import 'package:revanced_manager/constants.dart';
import 'package:revanced_manager/ui/widgets/patch_text_button.dart';
import 'package:timeago/timeago.dart';
2022-08-01 13:30:06 +02:00
2022-08-01 20:15:55 +02:00
class ApplicationItem extends StatelessWidget {
final Uint8List icon;
2022-08-01 13:30:06 +02:00
final String name;
final DateTime patchDate;
2022-08-01 14:24:05 +02:00
final Function()? onPressed;
2022-08-01 13:30:06 +02:00
2022-08-01 20:15:55 +02:00
const ApplicationItem({
2022-08-01 13:30:06 +02:00
Key? key,
required this.icon,
2022-08-01 13:30:06 +02:00
required this.name,
required this.patchDate,
2022-08-01 14:24:05 +02:00
required this.onPressed,
2022-08-01 13:30:06 +02:00
}) : super(key: key);
@override
Widget build(BuildContext context) {
return ListTile(
horizontalTitleGap: 12.0,
leading: Image.memory(icon),
2022-08-01 13:30:06 +02:00
title: Text(
name,
style: GoogleFonts.roboto(
color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.w600,
2022-08-01 13:30:06 +02:00
),
),
subtitle: Text(
format(patchDate),
2022-08-01 13:30:06 +02:00
style: robotoTextStyle,
),
trailing: PatchTextButton(
2022-08-07 01:37:12 +02:00
text: FlutterI18n.translate(
context,
'applicationItem.patchButton',
),
2022-08-01 14:24:05 +02:00
onPressed: onPressed,
2022-08-01 13:30:06 +02:00
),
);
}
}