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}", "patchedDateHint": "{date} at {time}",
"appliedPatchesLabel": "Applied Patches", "appliedPatchesLabel": "Applied Patches",
"appliedPatchesHint": "{quantity} 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/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/views/contributors/contributors_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/contributorsView/contributors_card.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'; import 'package:stacked/stacked.dart';
class ContributorsView extends StatelessWidget { class ContributorsView extends StatelessWidget {
@ -12,38 +15,53 @@ class ContributorsView extends StatelessWidget {
viewModelBuilder: () => ContributorsViewModel(), viewModelBuilder: () => ContributorsViewModel(),
onModelReady: (model) => model.getContributors(), onModelReady: (model) => model.getContributors(),
builder: (context, model, child) => Scaffold( builder: (context, model, child) => Scaffold(
body: SafeArea( body: CustomScrollView(
child: SingleChildScrollView( slivers: <Widget>[
child: Column( CustomSliverAppBar(
children: <Widget>[ title: I18nText(
ContributorsCard( 'contributorsView.widgetTitle',
title: 'Patcher Contributors', child: Text(
contributors: model.patcherContributors, '',
height: 60, 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( SliverPadding(
padding: const EdgeInsets.symmetric(horizontal: 20.0), padding: const EdgeInsets.all(20.0),
sliver: SliverList( sliver: SliverList(
delegate: SliverChildListDelegate.fixed( delegate: SliverChildListDelegate.fixed(
<Widget>[ <Widget>[

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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