mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2025-05-11 13:05:37 +02:00
feat: add unsupported warning in patches selector view
This commit is contained in:
parent
533f22924a
commit
596d4f0def
4 changed files with 101 additions and 4 deletions
|
@ -1,5 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:revanced_manager/theme.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class PatchItem extends StatefulWidget {
|
||||
|
@ -7,6 +9,9 @@ class PatchItem extends StatefulWidget {
|
|||
final String simpleName;
|
||||
final String description;
|
||||
final String version;
|
||||
final String packageVersion;
|
||||
final List<String> supportedPackageVersions;
|
||||
final bool isUnsupported;
|
||||
bool isSelected;
|
||||
final Function(bool) onChanged;
|
||||
|
||||
|
@ -16,6 +21,9 @@ class PatchItem extends StatefulWidget {
|
|||
required this.simpleName,
|
||||
required this.description,
|
||||
required this.version,
|
||||
required this.packageVersion,
|
||||
required this.supportedPackageVersions,
|
||||
required this.isUnsupported,
|
||||
required this.isSelected,
|
||||
required this.onChanged,
|
||||
}) : super(key: key);
|
||||
|
@ -87,10 +95,69 @@ class _PatchItemState extends State<PatchItem> {
|
|||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
),
|
||||
widget.isUnsupported
|
||||
? Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
child: TextButton.icon(
|
||||
label: I18nText('patchItem.unsupportedWarningButton'),
|
||||
icon: const Icon(Icons.warning),
|
||||
onPressed: () => _showUnsupportedWarningDialog(),
|
||||
style: ButtonStyle(
|
||||
shape: MaterialStateProperty.all(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
side: BorderSide(
|
||||
width: 1,
|
||||
color:
|
||||
Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
),
|
||||
backgroundColor: MaterialStateProperty.all(
|
||||
isDark
|
||||
? Theme.of(context).colorScheme.background
|
||||
: Colors.white,
|
||||
),
|
||||
foregroundColor: MaterialStateProperty.all(
|
||||
Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
: Container(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _showUnsupportedWarningDialog() {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: I18nText('patchItem.alertDialogTitle'),
|
||||
content: I18nText(
|
||||
'patchItem.alertDialogText',
|
||||
translationParams: {
|
||||
'packageVersion': widget.packageVersion,
|
||||
'supportedVersions':
|
||||
'\u2022 ${widget.supportedPackageVersions.join('\n\u2022 ')}',
|
||||
},
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: I18nText('okButton'),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
)
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue