2022-08-06 14:13:28 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2022-08-07 01:37:12 +02:00
|
|
|
import 'package:flutter_i18n/flutter_i18n.dart';
|
2022-08-06 14:13:28 +02:00
|
|
|
import 'package:google_fonts/google_fonts.dart';
|
2022-08-09 01:01:06 +02:00
|
|
|
import 'package:revanced_manager/app/app.locator.dart';
|
2022-08-12 11:42:43 +02:00
|
|
|
import 'package:revanced_manager/theme.dart';
|
2022-08-13 11:56:30 +02:00
|
|
|
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
2022-08-06 23:35:35 +02:00
|
|
|
import 'package:revanced_manager/ui/widgets/app_selector_card.dart';
|
|
|
|
import 'package:revanced_manager/ui/widgets/patch_selector_card.dart';
|
2022-08-06 14:13:28 +02:00
|
|
|
import 'package:stacked/stacked.dart';
|
|
|
|
|
|
|
|
class PatcherView extends StatelessWidget {
|
|
|
|
const PatcherView({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2022-08-09 01:01:06 +02:00
|
|
|
return ViewModelBuilder<PatcherViewModel>.reactive(
|
2022-08-09 02:16:33 +02:00
|
|
|
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(
|
2022-08-10 01:49:17 +02:00
|
|
|
visible: locator<PatcherViewModel>().showFabButton,
|
2022-08-09 03:30:12 +02:00
|
|
|
child: FloatingActionButton.extended(
|
2022-08-13 11:56:30 +02:00
|
|
|
onPressed: () => model.navigateToInstaller(),
|
2022-08-09 03:30:12 +02:00
|
|
|
label: I18nText('patcherView.fabButton'),
|
|
|
|
icon: const Icon(Icons.build),
|
2022-08-12 11:42:43 +02:00
|
|
|
backgroundColor: Theme.of(context).colorScheme.secondary,
|
2022-08-09 03:30:12 +02:00
|
|
|
foregroundColor: Colors.white,
|
|
|
|
),
|
2022-08-06 14:13:28 +02:00
|
|
|
),
|
|
|
|
body: SafeArea(
|
|
|
|
child: Padding(
|
2022-08-07 02:13:27 +02:00
|
|
|
padding: const EdgeInsets.all(12.0),
|
2022-08-06 14:13:28 +02:00
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
const SizedBox(height: 12),
|
2022-08-07 01:37:12 +02:00
|
|
|
I18nText(
|
|
|
|
'patcherView.widgetTitle',
|
|
|
|
child: Text(
|
|
|
|
'',
|
|
|
|
style: GoogleFonts.inter(
|
|
|
|
fontSize: 28,
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
),
|
2022-08-06 14:13:28 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(height: 23),
|
|
|
|
AppSelectorCard(
|
|
|
|
onPressed: model.navigateToAppSelector,
|
2022-08-12 11:42:43 +02:00
|
|
|
color: Theme.of(context).colorScheme.primary,
|
2022-08-06 14:13:28 +02:00
|
|
|
),
|
|
|
|
const SizedBox(height: 16),
|
2022-08-09 03:30:12 +02:00
|
|
|
Opacity(
|
2022-08-11 22:17:10 +02:00
|
|
|
opacity: isDark
|
|
|
|
? (model.dimPatchCard ? 0.5 : 1)
|
|
|
|
: (model.dimPatchCard ? 0.75 : 1),
|
2022-08-09 03:30:12 +02:00
|
|
|
child: PatchSelectorCard(
|
|
|
|
onPressed: model.navigateToPatchesSelector,
|
2022-08-12 11:42:43 +02:00
|
|
|
color: Theme.of(context).colorScheme.primary,
|
2022-08-09 03:30:12 +02:00
|
|
|
),
|
2022-08-07 21:15:52 +02:00
|
|
|
),
|
2022-08-06 14:13:28 +02:00
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|