mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2025-05-11 13:05:37 +02:00
feat(patches-selector): show New
tag for new patches (#1099)
This commit is contained in:
parent
131df28110
commit
1714c3fa86
6 changed files with 108 additions and 17 deletions
|
@ -16,6 +16,7 @@ class PatchItem extends StatefulWidget {
|
|||
required this.packageVersion,
|
||||
required this.supportedPackageVersions,
|
||||
required this.isUnsupported,
|
||||
required this.isNew,
|
||||
required this.isSelected,
|
||||
required this.onChanged,
|
||||
this.child,
|
||||
|
@ -26,6 +27,7 @@ class PatchItem extends StatefulWidget {
|
|||
final String packageVersion;
|
||||
final List<String> supportedPackageVersions;
|
||||
final bool isUnsupported;
|
||||
final bool isNew;
|
||||
bool isSelected;
|
||||
final Function(bool) onChanged;
|
||||
final Widget? child;
|
||||
|
@ -132,12 +134,12 @@ class _PatchItemState extends State<PatchItem> {
|
|||
),
|
||||
],
|
||||
),
|
||||
if (widget.isUnsupported &&
|
||||
widget._managerAPI.areExperimentalPatchesEnabled())
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: [
|
||||
if (widget.isUnsupported &&
|
||||
widget._managerAPI.areExperimentalPatchesEnabled())
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
padding: const EdgeInsets.only(top: 8, right: 8),
|
||||
child: TextButton.icon(
|
||||
label: I18nText('warning'),
|
||||
icon: const Icon(Icons.warning, size: 20.0),
|
||||
|
@ -160,10 +162,33 @@ class _PatchItemState extends State<PatchItem> {
|
|||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
else
|
||||
Container(),
|
||||
if (widget.isNew)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
child: TextButton.icon(
|
||||
label: I18nText('new'),
|
||||
icon: const Icon(Icons.star, size: 20.0),
|
||||
onPressed: () => _showNewPatchDialog(),
|
||||
style: ButtonStyle(
|
||||
shape: MaterialStateProperty.all(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
side: BorderSide(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
),
|
||||
backgroundColor: MaterialStateProperty.all(
|
||||
Colors.transparent,
|
||||
),
|
||||
foregroundColor: MaterialStateProperty.all(
|
||||
Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
widget.child ?? const SizedBox(),
|
||||
],
|
||||
),
|
||||
|
@ -195,4 +220,23 @@ class _PatchItemState extends State<PatchItem> {
|
|||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _showNewPatchDialog() {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: I18nText('patchItem.newPatch'),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
content: I18nText(
|
||||
'patchItem.newPatchDialogText',
|
||||
),
|
||||
actions: <Widget>[
|
||||
CustomMaterialButton(
|
||||
label: I18nText('okButton'),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue