mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-06-12 04:37:37 +02:00
feat: Show a dialog when an update is available (#1654)
This commit is contained in:
@ -55,17 +55,15 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
|
||||
FutureBuilder<bool>(
|
||||
future: model.hasManagerUpdates(),
|
||||
initialData: false,
|
||||
builder: (context, snapshot) => Opacity(
|
||||
opacity: snapshot.hasData && snapshot.data! ? 1.0 : 0.25,
|
||||
child: FilledButton(
|
||||
onPressed: snapshot.hasData && snapshot.data!
|
||||
? () => widget.model.showUpdateConfirmationDialog(
|
||||
widget.parentContext,
|
||||
false,
|
||||
)
|
||||
: () => {},
|
||||
child: I18nText('updateButton'),
|
||||
builder: (context, snapshot) => FilledButton(
|
||||
onPressed: () => widget.model.showUpdateConfirmationDialog(
|
||||
widget.parentContext,
|
||||
false,
|
||||
!snapshot.data!,
|
||||
),
|
||||
child: (snapshot.hasData && !snapshot.data!)
|
||||
? I18nText('showChangelogButton')
|
||||
: I18nText('showUpdateButton'),
|
||||
),
|
||||
),
|
||||
],
|
||||
@ -83,7 +81,7 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
const Text('Patches'),
|
||||
const Text('ReVanced Patches'),
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
@ -108,19 +106,17 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
|
||||
),
|
||||
),
|
||||
FutureBuilder<bool>(
|
||||
future: locator<HomeViewModel>().hasPatchesUpdates(),
|
||||
future: model.hasPatchesUpdates(),
|
||||
initialData: false,
|
||||
builder: (context, snapshot) => Opacity(
|
||||
opacity: snapshot.hasData && snapshot.data! ? 1.0 : 0.25,
|
||||
child: FilledButton(
|
||||
onPressed: snapshot.hasData && snapshot.data!
|
||||
? () => widget.model.showUpdateConfirmationDialog(
|
||||
widget.parentContext,
|
||||
true,
|
||||
)
|
||||
: () => {},
|
||||
child: I18nText('updateButton'),
|
||||
builder: (context, snapshot) => FilledButton(
|
||||
onPressed: () => widget.model.showUpdateConfirmationDialog(
|
||||
widget.parentContext,
|
||||
true,
|
||||
!snapshot.data!,
|
||||
),
|
||||
child: (snapshot.hasData && !snapshot.data!)
|
||||
? I18nText('showChangelogButton')
|
||||
: I18nText('showUpdateButton'),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -4,10 +4,11 @@ import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
import 'package:revanced_manager/app/app.locator.dart';
|
||||
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
|
||||
|
||||
class UpdateConfirmationDialog extends StatelessWidget {
|
||||
const UpdateConfirmationDialog({super.key, required this.isPatches});
|
||||
class UpdateConfirmationSheet extends StatelessWidget {
|
||||
const UpdateConfirmationSheet({super.key, required this.isPatches, this.changelog = false});
|
||||
|
||||
final bool isPatches;
|
||||
final bool changelog;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final HomeViewModel model = locator<HomeViewModel>();
|
||||
@ -36,6 +37,7 @@ class UpdateConfirmationDialog extends StatelessWidget {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (!changelog)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 40.0,
|
||||
@ -51,8 +53,8 @@ class UpdateConfirmationDialog extends StatelessWidget {
|
||||
children: [
|
||||
I18nText(
|
||||
isPatches
|
||||
? 'homeView.updatePatchesDialogTitle'
|
||||
: 'homeView.updateDialogTitle',
|
||||
? 'homeView.updatePatchesSheetTitle'
|
||||
: 'homeView.updateSheetTitle',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(
|
Reference in New Issue
Block a user