revanced-manager/lib/ui/views/patcher/patcher_view.dart

80 lines
2.9 KiB
Dart
Raw Normal View History

import 'package:flutter/material.dart';
2022-08-07 01:37:12 +02:00
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:google_fonts/google_fonts.dart';
2022-08-09 01:01:06 +02:00
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/patcherView/app_selector_card.dart';
import 'package:revanced_manager/ui/widgets/patcherView/patch_selector_card.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart';
import 'package:revanced_manager/ui/widgets/shared/haptics/haptic_floating_action_button_extended.dart';
import 'package:stacked/stacked.dart';
class PatcherView extends StatelessWidget {
2023-11-11 13:07:32 +01:00
const PatcherView({super.key});
@override
Widget build(BuildContext context) {
2022-08-09 01:01:06 +02:00
return ViewModelBuilder<PatcherViewModel>.reactive(
disposeViewModel: false,
viewModelBuilder: () => locator<PatcherViewModel>(),
2022-08-09 01:01:06 +02:00
builder: (context, model, child) => Scaffold(
2022-08-09 03:30:12 +02:00
floatingActionButton: Visibility(
visible: model.showPatchButton(),
child: HapticFloatingActionButtonExtended(
2022-09-05 16:30:26 +02:00
label: I18nText('patcherView.patchButton'),
icon: const Icon(Icons.build),
onPressed: () async {
2023-10-12 02:00:39 +02:00
if (model.checkRequiredPatchOption(context)) {
final bool proceed = model.showRemovedPatchesDialog(context);
if (proceed && context.mounted) {
model.showArmv7WarningDialog(context);
}
}
},
2022-08-09 03:30:12 +02:00
),
),
body: CustomScrollView(
slivers: <Widget>[
CustomSliverAppBar(
isMainView: true,
title: I18nText(
'patcherView.widgetTitle',
child: Text(
'',
style: GoogleFonts.inter(
color: Theme.of(context).textTheme.titleLarge!.color,
),
),
),
),
SliverPadding(
padding: const EdgeInsets.all(20.0),
sliver: SliverList(
delegate: SliverChildListDelegate.fixed(
<Widget>[
2022-09-05 16:30:26 +02:00
AppSelectorCard(
2023-10-12 02:00:39 +02:00
onPressed: () => {
model.navigateToAppSelector(),
model.ctx = context,
},
),
const SizedBox(height: 16),
Opacity(
opacity: model.dimPatchesCard() ? 0.5 : 1,
2022-09-05 16:30:26 +02:00
child: PatchSelectorCard(
onPressed: model.dimPatchesCard()
? () => {}
: () => model.navigateToPatchesSelector(),
),
),
],
2022-08-07 21:15:52 +02:00
),
),
),
],
),
),
);
}
}