2022-08-16 18:36:56 +05:30
|
|
|
import 'dart:typed_data';
|
2022-08-01 17:00:06 +05:30
|
|
|
import 'package:flutter/material.dart';
|
2022-08-07 00:37:12 +01:00
|
|
|
import 'package:flutter_i18n/flutter_i18n.dart';
|
2022-09-05 03:32:36 +01:00
|
|
|
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart';
|
|
|
|
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
2022-08-16 18:36:56 +05:30
|
|
|
import 'package:expandable/expandable.dart';
|
|
|
|
import 'package:timeago/timeago.dart';
|
2022-08-01 17:00:06 +05:30
|
|
|
|
2022-08-01 23:45:55 +05:30
|
|
|
class ApplicationItem extends StatelessWidget {
|
2022-08-16 18:36:56 +05:30
|
|
|
final Uint8List icon;
|
2022-08-01 17:00:06 +05:30
|
|
|
final String name;
|
2022-08-16 18:36:56 +05:30
|
|
|
final DateTime patchDate;
|
2022-08-29 15:01:51 +01:00
|
|
|
final List<String> changelog;
|
2022-08-16 18:36:56 +05:30
|
|
|
final bool isUpdatableApp;
|
2022-08-18 15:33:33 +01:00
|
|
|
final Function() onPressed;
|
2022-08-01 17:00:06 +05:30
|
|
|
|
2022-08-01 23:45:55 +05:30
|
|
|
const ApplicationItem({
|
2022-08-01 17:00:06 +05:30
|
|
|
Key? key,
|
2022-08-16 18:36:56 +05:30
|
|
|
required this.icon,
|
2022-08-01 17:00:06 +05:30
|
|
|
required this.name,
|
2022-08-16 18:36:56 +05:30
|
|
|
required this.patchDate,
|
2022-08-17 17:07:00 +01:00
|
|
|
required this.changelog,
|
2022-08-16 18:36:56 +05:30
|
|
|
required this.isUpdatableApp,
|
2022-08-01 17:54:05 +05:30
|
|
|
required this.onPressed,
|
2022-08-01 17:00:06 +05:30
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2022-08-16 18:36:56 +05:30
|
|
|
return ExpandablePanel(
|
|
|
|
theme: const ExpandableThemeData(
|
|
|
|
hasIcon: false,
|
|
|
|
animationDuration: Duration(milliseconds: 450),
|
|
|
|
),
|
2022-09-05 03:32:36 +01:00
|
|
|
header: CustomCard(
|
2022-08-16 18:36:56 +05:30
|
|
|
child: Row(
|
2022-09-02 14:35:25 +01:00
|
|
|
children: <Widget>[
|
2022-08-16 18:36:56 +05:30
|
|
|
SizedBox(
|
|
|
|
width: 60,
|
2022-09-05 03:32:36 +01:00
|
|
|
child: Image.memory(icon, height: 39, width: 39),
|
2022-08-16 18:36:56 +05:30
|
|
|
),
|
|
|
|
const SizedBox(width: 4),
|
2022-09-05 03:32:36 +01:00
|
|
|
Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: <Widget>[
|
|
|
|
Text(
|
|
|
|
name,
|
|
|
|
style: const TextStyle(
|
|
|
|
fontSize: 16,
|
|
|
|
fontWeight: FontWeight.w500,
|
2022-08-16 18:36:56 +05:30
|
|
|
),
|
2022-09-05 03:32:36 +01:00
|
|
|
),
|
2022-09-11 02:01:06 +01:00
|
|
|
Text(format(patchDate)),
|
2022-09-05 03:32:36 +01:00
|
|
|
],
|
2022-08-16 12:12:10 +01:00
|
|
|
),
|
2022-08-16 18:36:56 +05:30
|
|
|
const Spacer(),
|
2022-09-05 13:43:13 +01:00
|
|
|
Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
children: <Widget>[
|
|
|
|
CustomMaterialButton(
|
|
|
|
label: isUpdatableApp
|
|
|
|
? I18nText('applicationItem.patchButton')
|
|
|
|
: I18nText('applicationItem.infoButton'),
|
|
|
|
onPressed: onPressed,
|
|
|
|
),
|
|
|
|
],
|
2022-08-22 00:55:54 +01:00
|
|
|
),
|
2022-08-16 18:36:56 +05:30
|
|
|
],
|
2022-08-01 17:00:06 +05:30
|
|
|
),
|
|
|
|
),
|
2022-08-31 09:36:36 +01:00
|
|
|
collapsed: const Text(''),
|
2022-08-16 18:36:56 +05:30
|
|
|
expanded: Padding(
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
2022-09-02 14:35:25 +01:00
|
|
|
children: <Widget>[
|
2022-08-16 18:36:56 +05:30
|
|
|
I18nText(
|
|
|
|
'applicationItem.changelogLabel',
|
2022-09-05 03:32:36 +01:00
|
|
|
child: const Text(
|
2022-08-16 18:36:56 +05:30
|
|
|
'',
|
2022-09-05 03:32:36 +01:00
|
|
|
style: TextStyle(fontWeight: FontWeight.w700),
|
2022-08-16 18:36:56 +05:30
|
|
|
),
|
|
|
|
),
|
2022-08-29 15:01:51 +01:00
|
|
|
const SizedBox(height: 4),
|
2022-09-05 03:32:36 +01:00
|
|
|
Text('\u2022 ${changelog.join('\n\u2022 ')}'),
|
2022-08-16 18:36:56 +05:30
|
|
|
],
|
2022-08-07 00:37:12 +01:00
|
|
|
),
|
2022-08-01 17:00:06 +05:30
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|