2022-07-31 21:46:27 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2022-08-07 01:37:12 +02:00
|
|
|
import 'package:flutter_i18n/flutter_i18n.dart';
|
2022-08-01 10:38:22 +02:00
|
|
|
import 'package:google_fonts/google_fonts.dart';
|
2022-08-06 23:35:35 +02:00
|
|
|
import 'package:revanced_manager/services/github_api.dart';
|
|
|
|
import 'package:revanced_manager/constants.dart';
|
|
|
|
import 'package:revanced_manager/ui/widgets/patch_text_button.dart';
|
2022-07-31 21:46:27 +02:00
|
|
|
|
2022-08-01 20:15:55 +02:00
|
|
|
class LatestCommitCard extends StatefulWidget {
|
|
|
|
const LatestCommitCard({Key? key}) : super(key: key);
|
2022-07-31 21:46:27 +02:00
|
|
|
|
2022-08-01 20:06:27 +02:00
|
|
|
@override
|
2022-08-01 20:15:55 +02:00
|
|
|
State<LatestCommitCard> createState() => _LatestCommitCardState();
|
2022-08-01 20:06:27 +02:00
|
|
|
}
|
|
|
|
|
2022-08-01 20:15:55 +02:00
|
|
|
class _LatestCommitCardState extends State<LatestCommitCard> {
|
2022-08-01 20:06:27 +02:00
|
|
|
GithubAPI githubAPI = GithubAPI();
|
|
|
|
|
2022-07-31 21:46:27 +02:00
|
|
|
@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,
|
2022-08-01 10:38:22 +02:00
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
children: [
|
2022-08-07 01:37:12 +02:00
|
|
|
I18nText(
|
|
|
|
'latestCommitCard.patcherLabel',
|
|
|
|
child: Text(
|
|
|
|
'',
|
|
|
|
style: GoogleFonts.roboto(
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
),
|
2022-08-01 10:38:22 +02:00
|
|
|
),
|
|
|
|
),
|
2022-08-08 00:40:31 +02:00
|
|
|
FutureBuilder<String>(
|
|
|
|
future: githubAPI.latestCommitTime(
|
|
|
|
'revanced',
|
|
|
|
'revanced-patcher',
|
|
|
|
),
|
|
|
|
initialData: FlutterI18n.translate(
|
|
|
|
context,
|
|
|
|
'latestCommitCard.loadingLabel',
|
|
|
|
),
|
|
|
|
builder: (context, snapshot) => Text(
|
|
|
|
snapshot.data!,
|
|
|
|
style: robotoTextStyle,
|
|
|
|
),
|
|
|
|
),
|
2022-08-01 10:38:22 +02:00
|
|
|
],
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
children: [
|
2022-08-07 01:37:12 +02:00
|
|
|
I18nText(
|
|
|
|
'latestCommitCard.managerLabel',
|
|
|
|
child: Text(
|
|
|
|
'',
|
|
|
|
style: GoogleFonts.roboto(
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
),
|
2022-08-01 10:38:22 +02:00
|
|
|
),
|
|
|
|
),
|
2022-08-08 00:40:31 +02:00
|
|
|
FutureBuilder<String>(
|
|
|
|
future: githubAPI.latestCommitTime(
|
|
|
|
'revanced',
|
|
|
|
'revanced-patcher',
|
|
|
|
),
|
|
|
|
initialData: FlutterI18n.translate(
|
|
|
|
context,
|
|
|
|
'latestCommitCard.loadingLabel',
|
|
|
|
),
|
|
|
|
builder: (context, snapshot) => Text(
|
|
|
|
snapshot.data!,
|
|
|
|
style: robotoTextStyle,
|
|
|
|
),
|
|
|
|
),
|
2022-08-01 10:38:22 +02:00
|
|
|
],
|
|
|
|
),
|
2022-07-31 21:46:27 +02:00
|
|
|
],
|
|
|
|
),
|
2022-08-01 10:38:22 +02:00
|
|
|
PatchTextButton(
|
2022-08-07 01:37:12 +02:00
|
|
|
text: FlutterI18n.translate(
|
|
|
|
context,
|
|
|
|
'latestCommitCard.updateButton',
|
|
|
|
),
|
2022-08-09 02:16:33 +02:00
|
|
|
onPressed: () => {},
|
2022-08-01 10:38:22 +02:00
|
|
|
backgroundColor: const Color(0xff7792BA),
|
|
|
|
),
|
2022-07-31 21:46:27 +02:00
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|