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

98 lines
2.9 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';
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
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({
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);
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();
}
class _ApplicationItemState extends State<ApplicationItem> {
2022-09-15 21:19:11 +02:00
@override
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) {
return Container(
margin: const EdgeInsets.only(bottom: 16.0),
child: CustomCard(
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
),
),
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-08-03 23:38:38 +02:00
),
),
],
),
),
Row(
children: [
const SizedBox(width: 8),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
CustomMaterialButton(
label: I18nText('applicationItem.infoButton'),
onPressed: widget.onPressed,
),
],
),
],
),
],
),
),
);
2022-08-01 13:30:06 +02:00
}
}