2022-09-01 02:25:19 +02:00
|
|
|
import 'package:animations/animations.dart';
|
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-09-01 02:25:19 +02:00
|
|
|
import 'package:revanced_manager/ui/views/app_selector/app_selector_view.dart';
|
|
|
|
import 'package:revanced_manager/ui/views/installer/installer_view.dart';
|
2022-08-13 11:56:30 +02:00
|
|
|
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
2022-09-01 02:25:19 +02:00
|
|
|
import 'package:revanced_manager/ui/views/patches_selector/patches_selector_view.dart';
|
2022-08-21 12:47:44 +02:00
|
|
|
import 'package:revanced_manager/ui/widgets/patcherView/app_selector_card.dart';
|
|
|
|
import 'package:revanced_manager/ui/widgets/patcherView/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-31 10:32:10 +02:00
|
|
|
visible: model.showPatchButton(),
|
2022-09-01 02:25:19 +02:00
|
|
|
child: OpenContainer(
|
|
|
|
transitionDuration: const Duration(milliseconds: 400),
|
|
|
|
openBuilder: (_, openContainer) => const InstallerView(),
|
|
|
|
openColor: Theme.of(context).colorScheme.primary,
|
|
|
|
closedColor: Colors.transparent,
|
|
|
|
closedShape: RoundedRectangleBorder(
|
|
|
|
borderRadius: BorderRadius.circular(12),
|
|
|
|
),
|
|
|
|
closedBuilder: (_, openContainer) => FloatingActionButton.extended(
|
|
|
|
label: I18nText('patcherView.patchButton'),
|
|
|
|
icon: const Icon(Icons.build),
|
|
|
|
onPressed: openContainer,
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
borderRadius: BorderRadius.circular(12),
|
2022-08-31 10:32:10 +02:00
|
|
|
),
|
2022-09-01 02:25:19 +02:00
|
|
|
backgroundColor: Theme.of(context).colorScheme.secondary,
|
|
|
|
foregroundColor: Theme.of(context).colorScheme.surface,
|
2022-08-31 10:32:10 +02:00
|
|
|
),
|
2022-08-09 03:30:12 +02:00
|
|
|
),
|
2022-08-06 14:13:28 +02:00
|
|
|
),
|
2022-08-24 14:22:36 +02:00
|
|
|
body: CustomScrollView(
|
|
|
|
slivers: <Widget>[
|
|
|
|
SliverAppBar(
|
|
|
|
pinned: true,
|
|
|
|
snap: false,
|
|
|
|
floating: false,
|
|
|
|
expandedHeight: 100.0,
|
|
|
|
automaticallyImplyLeading: false,
|
|
|
|
backgroundColor: MaterialStateColor.resolveWith(
|
|
|
|
(states) => states.contains(MaterialState.scrolledUnder)
|
|
|
|
? isDark
|
|
|
|
? Theme.of(context).colorScheme.primary
|
|
|
|
: Theme.of(context).navigationBarTheme.backgroundColor!
|
|
|
|
: Theme.of(context).scaffoldBackgroundColor,
|
|
|
|
),
|
|
|
|
flexibleSpace: FlexibleSpaceBar(
|
|
|
|
titlePadding: const EdgeInsets.symmetric(
|
|
|
|
vertical: 23.0,
|
|
|
|
horizontal: 20.0,
|
|
|
|
),
|
|
|
|
title: I18nText(
|
2022-08-07 01:37:12 +02:00
|
|
|
'patcherView.widgetTitle',
|
|
|
|
child: Text(
|
|
|
|
'',
|
|
|
|
style: GoogleFonts.inter(
|
2022-08-24 14:22:36 +02:00
|
|
|
color: Theme.of(context).textTheme.headline5!.color,
|
2022-08-07 01:37:12 +02:00
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
),
|
2022-08-06 14:13:28 +02:00
|
|
|
),
|
|
|
|
),
|
2022-08-24 14:22:36 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
SliverPadding(
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
|
|
|
sliver: SliverList(
|
|
|
|
delegate: SliverChildListDelegate.fixed(
|
|
|
|
<Widget>[
|
2022-09-01 02:25:19 +02:00
|
|
|
OpenContainer(
|
|
|
|
transitionDuration: const Duration(milliseconds: 400),
|
|
|
|
openBuilder: (_, openContainer) =>
|
|
|
|
const AppSelectorView(),
|
|
|
|
openColor: Theme.of(context).colorScheme.primary,
|
|
|
|
closedColor: Colors.transparent,
|
|
|
|
closedShape: RoundedRectangleBorder(
|
|
|
|
borderRadius: BorderRadius.circular(12),
|
|
|
|
),
|
|
|
|
closedBuilder: (_, openContainer) => AppSelectorCard(
|
|
|
|
onPressed: openContainer,
|
|
|
|
color: Theme.of(context).colorScheme.primary,
|
|
|
|
),
|
2022-08-24 14:22:36 +02:00
|
|
|
),
|
|
|
|
const SizedBox(height: 16),
|
|
|
|
Opacity(
|
|
|
|
opacity: isDark
|
|
|
|
? (model.dimPatchesCard() ? 0.5 : 1)
|
|
|
|
: (model.dimPatchesCard() ? 0.75 : 1),
|
2022-09-01 02:25:19 +02:00
|
|
|
child: OpenContainer(
|
|
|
|
transitionDuration: const Duration(milliseconds: 400),
|
|
|
|
openBuilder: (_, openContainer) =>
|
|
|
|
const PatchesSelectorView(),
|
|
|
|
openColor: Theme.of(context).colorScheme.primary,
|
|
|
|
closedColor: Colors.transparent,
|
|
|
|
closedShape: RoundedRectangleBorder(
|
|
|
|
borderRadius: BorderRadius.circular(12),
|
|
|
|
),
|
|
|
|
closedBuilder: (_, openContainer) => PatchSelectorCard(
|
|
|
|
onPressed:
|
|
|
|
model.dimPatchesCard() ? () => {} : openContainer,
|
|
|
|
color: Theme.of(context).colorScheme.primary,
|
|
|
|
),
|
2022-08-24 14:22:36 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
2022-08-07 21:15:52 +02:00
|
|
|
),
|
2022-08-24 14:22:36 +02:00
|
|
|
),
|
2022-08-06 14:13:28 +02:00
|
|
|
),
|
2022-08-24 14:22:36 +02:00
|
|
|
],
|
2022-08-06 14:13:28 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|