2022-08-15 19:42:09 +02:00
|
|
|
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';
|
2022-08-15 19:42:09 +02:00
|
|
|
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 {
|
2022-08-15 19:42:09 +02:00
|
|
|
final Uint8List icon;
|
2022-08-01 13:30:06 +02:00
|
|
|
final String name;
|
2022-08-15 19:42:09 +02:00
|
|
|
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,
|
2022-08-15 19:42:09 +02:00
|
|
|
required this.icon,
|
2022-08-01 13:30:06 +02:00
|
|
|
required this.name,
|
2022-08-15 19:42:09 +02:00
|
|
|
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,
|
2022-08-15 19:42:09 +02:00
|
|
|
leading: Image.memory(icon),
|
2022-08-01 13:30:06 +02:00
|
|
|
title: Text(
|
|
|
|
name,
|
|
|
|
style: GoogleFonts.roboto(
|
2022-08-12 11:42:43 +02:00
|
|
|
color: Theme.of(context).colorScheme.secondary,
|
|
|
|
fontWeight: FontWeight.w600,
|
2022-08-01 13:30:06 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
subtitle: Text(
|
2022-08-15 19:42:09 +02:00
|
|
|
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
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|