mirror of
https://github.com/revanced/revanced-manager
synced 2024-05-14 13:56:57 +02:00
88 lines
2.5 KiB
Dart
88 lines
2.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
import 'package:revanced_manager_flutter/backend/api/github_api.dart';
|
|
import 'package:revanced_manager_flutter/constants.dart';
|
|
import 'package:revanced_manager_flutter/ui/widgets/patch_text_button.dart';
|
|
|
|
class LatestCommitWidget extends StatefulWidget {
|
|
const LatestCommitWidget({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<LatestCommitWidget> createState() => _LatestCommitWidgetState();
|
|
}
|
|
|
|
class _LatestCommitWidgetState extends State<LatestCommitWidget> {
|
|
GithubAPI githubAPI = GithubAPI();
|
|
String lastPatcherCommit = "Loading...";
|
|
String lastManagerCommit = "Loading...";
|
|
|
|
void latestCommit() async {
|
|
lastPatcherCommit =
|
|
await githubAPI.latestCommitTime("revanced", "revanced-patcher");
|
|
lastManagerCommit =
|
|
await githubAPI.latestCommitTime("revanced", "revanced-manager");
|
|
}
|
|
|
|
@override
|
|
void initState() {
|
|
setState(() {
|
|
latestCommit();
|
|
});
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(12),
|
|
color: const Color(0xff1B222B),
|
|
),
|
|
padding: const EdgeInsets.symmetric(vertical: 18, horizontal: 20),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Text(
|
|
"Patcher: ",
|
|
style: GoogleFonts.roboto(
|
|
fontWeight: FontWeight.w700,
|
|
),
|
|
),
|
|
Text(
|
|
"$lastPatcherCommit ago",
|
|
style: robotoTextStyle,
|
|
)
|
|
],
|
|
),
|
|
Row(
|
|
children: [
|
|
Text(
|
|
"Manager: ",
|
|
style: GoogleFonts.roboto(
|
|
fontWeight: FontWeight.w700,
|
|
),
|
|
),
|
|
Text(
|
|
"$lastManagerCommit ago",
|
|
style: robotoTextStyle,
|
|
)
|
|
],
|
|
),
|
|
],
|
|
),
|
|
PatchTextButton(
|
|
text: "Update Manager",
|
|
onPressed: () {},
|
|
backgroundColor: const Color(0xff7792BA),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|