fix: code refactoring (#5)

This commit is contained in:
Alberto Ponces 2022-08-18 15:33:33 +01:00 committed by GitHub
parent 6153e1f9e8
commit 389eae1447
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 318 additions and 361 deletions

View file

@ -6,9 +6,11 @@ import 'package:revanced_manager/constants.dart';
import 'package:revanced_manager/ui/widgets/patch_text_button.dart';
class LatestCommitCard extends StatefulWidget {
final Function() onPressed;
final Color? color;
const LatestCommitCard({
Key? key,
required this.onPressed,
this.color = const Color(0xff1B222B),
}) : super(key: key);
@ -17,7 +19,7 @@ class LatestCommitCard extends StatefulWidget {
}
class _LatestCommitCardState extends State<LatestCommitCard> {
final GithubAPI githubAPI = GithubAPI();
final GithubAPI _githubAPI = GithubAPI();
@override
Widget build(BuildContext context) {
@ -45,10 +47,7 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
),
),
FutureBuilder<String>(
future: githubAPI.latestCommitTime(
'revanced',
'revanced-patcher',
),
future: _githubAPI.latestCommitTime(ghOrg, patcherRepo),
builder: (context, snapshot) => Text(
snapshot.hasData && snapshot.data!.isNotEmpty
? FlutterI18n.translate(
@ -78,10 +77,7 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
),
),
FutureBuilder<String>(
future: githubAPI.latestCommitTime(
'revanced',
'revanced-manager',
),
future: _githubAPI.latestCommitTime(ghOrg, managerRepo),
builder: (context, snapshot) => Text(
snapshot.hasData && snapshot.data!.isNotEmpty
? FlutterI18n.translate(
@ -105,7 +101,7 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
context,
'latestCommitCard.updateButton',
),
onPressed: () => {},
onPressed: widget.onPressed,
backgroundColor: Theme.of(context).colorScheme.secondary,
borderColor: Theme.of(context).colorScheme.secondary,
),