feat: add Sliver App Bar to Home, Patcher, Installer and Settings views

This commit is contained in:
Alberto Ponces 2022-08-24 13:22:36 +01:00
parent e6b540d32b
commit 5041a30fb5
6 changed files with 444 additions and 364 deletions

View File

@ -59,8 +59,8 @@
},
"installerView": {
"widgetTitle": "Installer",
"fabInstallButton": "Install",
"fabOpenButton": "Open",
"installButton": "Install",
"openButton": "Open",
"notificationTitle": "ReVanced Manager is patching",
"notificationText": "Tap to return to the installer"
},

View File

@ -21,25 +21,43 @@ class HomeView extends StatelessWidget {
onModelReady: (model) => model.initialize(),
viewModelBuilder: () => locator<HomeViewModel>(),
builder: (context, model, child) => Scaffold(
body: SafeArea(
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 60),
I18nText(
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(
'homeView.widgetTitle',
child: Text(
'',
style: GoogleFonts.inter(
fontSize: 28,
color: Theme.of(context).textTheme.headline5!.color,
fontWeight: FontWeight.w500,
),
),
),
const SizedBox(height: 23),
),
),
SliverPadding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
sliver: SliverList(
delegate: SliverChildListDelegate.fixed(
<Widget>[
I18nText(
'homeView.updatesSubtitle',
child: Text(
@ -99,6 +117,7 @@ class HomeView extends StatelessWidget {
),
),
),
],
),
),
);

View File

@ -15,31 +15,49 @@ class InstallerView extends StatelessWidget {
viewModelBuilder: () => InstallerViewModel(),
builder: (context, model, child) => WillPopScope(
child: Scaffold(
body: SafeArea(
child: SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 20),
body: CustomScrollView(
controller: model.scrollController,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const SizedBox(height: 60),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
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: Text(
model.headerLogs,
style: GoogleFonts.inter(
fontSize: 28,
color: Theme.of(context).textTheme.headline5!.color,
fontWeight: FontWeight.w500,
),
),
],
),
),
SliverPadding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
sliver: SliverList(
delegate: SliverChildListDelegate.fixed(
<Widget>[
Padding(
padding: const EdgeInsets.symmetric(
vertical: 16.0,
horizontal: 4.0,
padding: const EdgeInsets.only(
left: 4.0,
top: 0.0,
right: 4.0,
bottom: 16.0,
),
child: LinearProgressIndicator(
color: Theme.of(context).colorScheme.secondary,
@ -63,8 +81,8 @@ class InstallerView extends StatelessWidget {
),
),
Padding(
padding:
const EdgeInsets.symmetric(vertical: 16, horizontal: 0),
padding: const EdgeInsets.symmetric(
vertical: 16, horizontal: 0),
child: Visibility(
visible: !model.isPatching,
child: Row(
@ -84,8 +102,9 @@ class InstallerView extends StatelessWidget {
borderRadius: BorderRadius.circular(100),
side: BorderSide(
width: 1,
color:
Theme.of(context).colorScheme.secondary,
color: Theme.of(context)
.colorScheme
.secondary,
),
),
),
@ -100,7 +119,9 @@ class InstallerView extends StatelessWidget {
),
backgroundColor: MaterialStateProperty.all(
isDark
? Theme.of(context).colorScheme.background
? Theme.of(context)
.colorScheme
.background
: Colors.white,
),
foregroundColor: MaterialStateProperty.all(
@ -132,8 +153,9 @@ class InstallerView extends StatelessWidget {
borderRadius: BorderRadius.circular(100),
side: BorderSide(
width: 1,
color:
Theme.of(context).colorScheme.secondary,
color: Theme.of(context)
.colorScheme
.secondary,
),
),
),
@ -145,8 +167,8 @@ class InstallerView extends StatelessWidget {
),
),
child: I18nText(model.isInstalled
? 'installerView.fabOpenButton'
: 'installerView.fabInstallButton'),
? 'installerView.openButton'
: 'installerView.installButton'),
),
],
),
@ -156,6 +178,8 @@ class InstallerView extends StatelessWidget {
),
),
),
],
),
),
onWillPop: () async {
if (!model.isPatching) {

View File

@ -122,7 +122,7 @@ class InstallerViewModel extends BaseViewModel {
resourcePatching = true;
}
await _patcherAPI.mergeIntegrations(mergeIntegrations);
headerLogs = "Merging integrations";
headerLogs = 'Merging integrations';
await _patcherAPI.runPatcher(
apkFilePath,
_patches,

View File

@ -27,24 +27,43 @@ class PatcherView extends StatelessWidget {
foregroundColor: Colors.white,
),
),
body: SafeArea(
child: SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 60),
I18nText(
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(
'patcherView.widgetTitle',
child: Text(
'',
style: GoogleFonts.inter(
fontSize: 28,
color: Theme.of(context).textTheme.headline5!.color,
fontWeight: FontWeight.w500,
),
),
),
const SizedBox(height: 23),
),
),
SliverPadding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
sliver: SliverList(
delegate: SliverChildListDelegate.fixed(
<Widget>[
AppSelectorCard(
onPressed: model.navigateToAppSelector,
color: Theme.of(context).colorScheme.primary,
@ -65,6 +84,8 @@ class PatcherView extends StatelessWidget {
),
),
),
],
),
),
);
}

View File

@ -26,28 +26,43 @@ class SettingsView extends StatelessWidget {
viewModelBuilder: () => SettingsViewModel(),
onModelReady: (model) => model.initialize(),
builder: (context, SettingsViewModel model, child) => Scaffold(
body: SingleChildScrollView(
child: SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const SizedBox(height: 60),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: I18nText(
'settingsView.widgetTitle',
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(
'homeView.widgetTitle',
child: Text(
'',
style: GoogleFonts.inter(
fontSize: 28,
color: Theme.of(context).textTheme.headline5!.color,
fontWeight: FontWeight.w500,
),
),
),
),
const SizedBox(height: 12),
),
SliverPadding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
sliver: SliverList(
delegate: SliverChildListDelegate.fixed(
<Widget>[
SettingsSwitchItem(
title: 'settingsView.themeLabel',
subtitle: 'settingsView.themeHint',
@ -154,6 +169,7 @@ class SettingsView extends StatelessWidget {
),
),
),
],
),
),
);