fix: Add a SliverAppBar to Contributors view and increase app bars bottom padding

This commit is contained in:
Alberto Ponces 2022-09-12 17:30:44 +01:00
parent f67425cde3
commit 779b659108
9 changed files with 108 additions and 93 deletions

View File

@ -128,5 +128,13 @@
"patchedDateHint": "{date} at {time}",
"appliedPatchesLabel": "Applied Patches",
"appliedPatchesHint": "{quantity} applied patches"
},
"contributorsView": {
"widgetTitle": "Contributors",
"patcherContributors": "Patcher Contributors",
"patchesContributors": "Patches Contributors",
"integrationsContributors": "Integrations Contributors",
"cliContributors": "CLI Contributors",
"managerContributors": "Manager Contributors"
}
}

View File

@ -1,6 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:revanced_manager/ui/views/contributors/contributors_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/contributorsView/contributors_card.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart';
import 'package:stacked/stacked.dart';
class ContributorsView extends StatelessWidget {
@ -12,38 +15,53 @@ class ContributorsView extends StatelessWidget {
viewModelBuilder: () => ContributorsViewModel(),
onModelReady: (model) => model.getContributors(),
builder: (context, model, child) => Scaffold(
body: SafeArea(
child: SingleChildScrollView(
child: Column(
children: <Widget>[
ContributorsCard(
title: 'Patcher Contributors',
contributors: model.patcherContributors,
height: 60,
body: CustomScrollView(
slivers: <Widget>[
CustomSliverAppBar(
title: I18nText(
'contributorsView.widgetTitle',
child: Text(
'',
style: GoogleFonts.inter(
color: Theme.of(context).textTheme.headline6!.color,
),
),
ContributorsCard(
title: 'Patches Contributors',
contributors: model.patchesContributors,
height: 230,
),
ContributorsCard(
title: 'Integrations Contributors',
contributors: model.integrationsContributors,
height: 230,
),
ContributorsCard(
title: 'CLI Contributors',
contributors: model.cliContributors,
height: 180,
),
ContributorsCard(
title: 'Manager Contributors',
contributors: model.managerContributors,
height: 130,
),
],
),
),
),
SliverPadding(
padding: const EdgeInsets.all(20.0),
sliver: SliverList(
delegate: SliverChildListDelegate.fixed(
<Widget>[
ContributorsCard(
title: 'contributorsView.patcherContributors',
contributors: model.patcherContributors,
),
const SizedBox(height: 20),
ContributorsCard(
title: 'contributorsView.patchesContributors',
contributors: model.patchesContributors,
),
const SizedBox(height: 20),
ContributorsCard(
title: 'contributorsView.integrationsContributors',
contributors: model.integrationsContributors,
),
const SizedBox(height: 20),
ContributorsCard(
title: 'contributorsView.cliContributors',
contributors: model.cliContributors,
),
const SizedBox(height: 20),
ContributorsCard(
title: 'contributorsView.managerContributors',
contributors: model.managerContributors,
),
],
),
),
),
],
),
),
);

View File

@ -38,7 +38,7 @@ class HomeView extends StatelessWidget {
),
),
SliverPadding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
padding: const EdgeInsets.all(20.0),
sliver: SliverList(
delegate: SliverChildListDelegate.fixed(
<Widget>[

View File

@ -67,7 +67,7 @@ class InstallerView extends StatelessWidget {
),
),
SliverPadding(
padding: const EdgeInsets.all(20.0).copyWith(bottom: 20.0),
padding: const EdgeInsets.all(20.0),
sliver: SliverList(
delegate: SliverChildListDelegate.fixed(
<Widget>[

View File

@ -39,7 +39,7 @@ class PatcherView extends StatelessWidget {
),
),
SliverPadding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
padding: const EdgeInsets.all(20.0),
sliver: SliverList(
delegate: SliverChildListDelegate.fixed(
<Widget>[

View File

@ -140,16 +140,16 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
child: Column(
children: <Widget>[
Text(
"Patch options",
'Patch options',
style: GoogleFonts.inter(
fontSize: 18,
fontWeight: FontWeight.w600,
),
),
const OptionsTextField(
hint: "App name"),
hint: 'App name'),
const OptionsFilePicker(
optionName: "Choose a logo",
optionName: 'Choose a logo',
),
],
),

View File

@ -17,7 +17,7 @@ class SettingsView extends StatelessWidget {
Widget build(BuildContext context) {
return ViewModelBuilder<SettingsViewModel>.reactive(
viewModelBuilder: () => SettingsViewModel(),
builder: (context, SettingsViewModel model, child) => Scaffold(
builder: (context, model, child) => Scaffold(
body: CustomScrollView(
slivers: <Widget>[
CustomSliverAppBar(
@ -32,10 +32,7 @@ class SettingsView extends StatelessWidget {
),
),
SliverPadding(
padding: const EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 20.0,
),
padding: const EdgeInsets.all(20.0),
sliver: SliverList(
delegate: SliverChildListDelegate.fixed(
<Widget>[

View File

@ -58,7 +58,7 @@ class AppSkeletonLoader extends StatelessWidget {
),
),
child: const Center(
child: Text("Content"),
child: Text('Content'),
),
);
}

View File

@ -1,19 +1,18 @@
import 'package:flutter/material.dart';
import 'package:flutter_cache_manager/file.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
import 'package:url_launcher/url_launcher.dart';
class ContributorsCard extends StatefulWidget {
final String title;
final List<dynamic> contributors;
final double height;
const ContributorsCard({
Key? key,
required this.title,
required this.contributors,
this.height = 200,
}) : super(key: key);
@override
@ -23,63 +22,56 @@ class ContributorsCard extends StatefulWidget {
class _ContributorsCardState extends State<ContributorsCard> {
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(bottom: 8.0),
child: Text(
widget.title,
style: const TextStyle(
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(bottom: 8.0),
child: I18nText(
widget.title,
child: const Text(
'',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w600,
),
),
),
CustomCard(
child: GridView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 7,
mainAxisSpacing: 8,
crossAxisSpacing: 8,
),
itemCount: widget.contributors.length,
itemBuilder: (context, index) {
return ClipRRect(
borderRadius: BorderRadius.circular(100),
child: GestureDetector(
onTap: () => launchUrl(
Uri.parse(
widget.contributors[index]['html_url'],
),
),
child: FutureBuilder<File?>(
future: DefaultCacheManager().getSingleFile(
widget.contributors[index]['avatar_url'],
),
builder: (context, snapshot) => snapshot.hasData
? Image.file(
snapshot.data!,
height: 40,
width: 40,
)
: Image.network(
widget.contributors[index]['avatar_url'],
height: 40,
width: 40,
),
),
),
CustomCard(
child: GridView.builder(
shrinkWrap: true,
padding: EdgeInsets.zero,
physics: const NeverScrollableScrollPhysics(),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 6,
mainAxisSpacing: 8,
crossAxisSpacing: 8,
),
itemCount: widget.contributors.length,
itemBuilder: (context, index) => ClipRRect(
borderRadius: BorderRadius.circular(100),
child: GestureDetector(
onTap: () => launchUrl(
Uri.parse(
widget.contributors[index]['html_url'],
),
);
},
),
child: FutureBuilder<File?>(
future: DefaultCacheManager().getSingleFile(
widget.contributors[index]['avatar_url'],
),
builder: (context, snapshot) => snapshot.hasData
? Image.file(snapshot.data!)
: Image.network(
widget.contributors[index]['avatar_url'],
),
),
),
),
),
],
),
),
],
);
}
}