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:flutter_svg/flutter_svg.dart';
|
|
|
|
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-01 13:30:06 +02:00
|
|
|
|
2022-08-01 20:15:55 +02:00
|
|
|
class ApplicationItem extends StatelessWidget {
|
2022-08-01 13:30:06 +02:00
|
|
|
final String asset;
|
|
|
|
final String name;
|
|
|
|
final String releaseDate;
|
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.asset,
|
|
|
|
required this.name,
|
|
|
|
required this.releaseDate,
|
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) {
|
2022-08-07 01:37:12 +02:00
|
|
|
final isSVG = asset.endsWith('.svg');
|
2022-08-01 13:30:06 +02:00
|
|
|
return ListTile(
|
|
|
|
horizontalTitleGap: 12.0,
|
|
|
|
leading: isSVG
|
|
|
|
? SvgPicture.asset(
|
|
|
|
asset,
|
2022-08-01 14:24:05 +02:00
|
|
|
height: 26,
|
|
|
|
width: 26,
|
2022-08-01 13:30:06 +02:00
|
|
|
)
|
|
|
|
: Image.asset(
|
|
|
|
asset,
|
|
|
|
height: 39,
|
|
|
|
width: 39,
|
|
|
|
),
|
|
|
|
title: Text(
|
|
|
|
name,
|
|
|
|
style: GoogleFonts.roboto(
|
|
|
|
color: const Color(0xff7792BA),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
subtitle: Text(
|
|
|
|
releaseDate,
|
|
|
|
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
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|