2022-08-16 15:06:56 +02:00
|
|
|
import 'dart:typed_data';
|
2023-01-30 13:35:06 +01:00
|
|
|
|
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-09-05 04:32:36 +02:00
|
|
|
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
2022-08-16 15:06:56 +02:00
|
|
|
import 'package:timeago/timeago.dart';
|
2022-08-01 13:30:06 +02:00
|
|
|
|
2022-09-15 21:19:11 +02:00
|
|
|
class ApplicationItem extends StatefulWidget {
|
2022-08-01 20:15:55 +02:00
|
|
|
const ApplicationItem({
|
2023-11-11 13:07:32 +01:00
|
|
|
super.key,
|
2022-08-16 15:06:56 +02:00
|
|
|
required this.icon,
|
2022-08-01 13:30:06 +02:00
|
|
|
required this.name,
|
2022-08-16 15:06:56 +02:00
|
|
|
required this.patchDate,
|
2022-08-01 14:24:05 +02:00
|
|
|
required this.onPressed,
|
2023-11-11 13:07:32 +01:00
|
|
|
});
|
2023-01-30 13:35:06 +01:00
|
|
|
final Uint8List icon;
|
|
|
|
final String name;
|
|
|
|
final DateTime patchDate;
|
|
|
|
final Function() onPressed;
|
2022-08-01 13:30:06 +02:00
|
|
|
|
2022-09-15 21:19:11 +02:00
|
|
|
@override
|
|
|
|
State<ApplicationItem> createState() => _ApplicationItemState();
|
|
|
|
}
|
|
|
|
|
2023-09-29 18:39:07 +02:00
|
|
|
class _ApplicationItemState extends State<ApplicationItem> {
|
2022-09-15 21:19:11 +02:00
|
|
|
@override
|
2023-01-30 13:35:06 +01:00
|
|
|
void initState() {
|
2022-09-15 21:19:11 +02:00
|
|
|
super.initState();
|
|
|
|
}
|
|
|
|
|
2022-08-01 13:30:06 +02:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2022-09-24 20:49:02 +02:00
|
|
|
return Container(
|
2023-01-30 13:35:06 +01:00
|
|
|
margin: const EdgeInsets.only(bottom: 16.0),
|
|
|
|
child: CustomCard(
|
2023-09-29 18:39:07 +02:00
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Flexible(
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
SizedBox(
|
|
|
|
width: 40,
|
|
|
|
child: Image.memory(widget.icon, height: 40, width: 40),
|
|
|
|
),
|
|
|
|
const SizedBox(width: 19),
|
|
|
|
Expanded(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: <Widget>[
|
|
|
|
Text(
|
|
|
|
widget.name,
|
|
|
|
maxLines: 1,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
style: const TextStyle(
|
|
|
|
fontSize: 16,
|
|
|
|
fontWeight: FontWeight.w500,
|
2023-08-03 23:38:38 +02:00
|
|
|
),
|
2023-09-29 18:39:07 +02:00
|
|
|
),
|
|
|
|
Text(
|
|
|
|
format(widget.patchDate),
|
|
|
|
maxLines: 1,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
style: const TextStyle(
|
|
|
|
fontSize: 16,
|
|
|
|
fontWeight: FontWeight.w500,
|
2023-08-03 23:38:38 +02:00
|
|
|
),
|
2023-09-29 18:39:07 +02:00
|
|
|
),
|
|
|
|
],
|
2023-08-03 23:38:38 +02:00
|
|
|
),
|
|
|
|
),
|
2022-10-10 23:02:23 +02:00
|
|
|
],
|
|
|
|
),
|
2023-01-30 13:35:06 +01:00
|
|
|
),
|
2023-09-29 18:39:07 +02:00
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
const SizedBox(width: 8),
|
|
|
|
Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
children: <Widget>[
|
2023-12-22 14:34:03 +01:00
|
|
|
FilledButton(
|
2023-09-29 18:39:07 +02:00
|
|
|
onPressed: widget.onPressed,
|
2023-12-22 14:34:03 +01:00
|
|
|
child: I18nText('applicationItem.infoButton'),
|
2023-09-29 18:39:07 +02:00
|
|
|
),
|
|
|
|
],
|
2023-01-30 13:35:06 +01:00
|
|
|
),
|
|
|
|
],
|
2022-10-10 23:02:23 +02:00
|
|
|
),
|
2023-09-29 18:39:07 +02:00
|
|
|
],
|
2023-01-30 13:35:06 +01:00
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
2022-08-01 13:30:06 +02:00
|
|
|
}
|
|
|
|
}
|