mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2024-11-10 09:07:47 +01:00
51 lines
2 KiB
Dart
51 lines
2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:revanced_manager/app/app.locator.dart';
|
|
import 'package:revanced_manager/models/patched_application.dart';
|
|
import 'package:revanced_manager/services/github_api.dart';
|
|
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
|
|
import 'package:revanced_manager/ui/widgets/application_item.dart';
|
|
|
|
class AvailableUpdatesCard extends StatelessWidget {
|
|
AvailableUpdatesCard({
|
|
Key? key,
|
|
}) : super(key: key);
|
|
|
|
final GithubAPI githubAPI = GithubAPI();
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
FutureBuilder<List<PatchedApplication>>(
|
|
future: locator<HomeViewModel>().getPatchedApps(true),
|
|
builder: (context, snapshot) =>
|
|
snapshot.hasData && snapshot.data!.isNotEmpty
|
|
? ListView.builder(
|
|
shrinkWrap: true,
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
itemCount: snapshot.data!.length,
|
|
itemBuilder: (context, index) => FutureBuilder<String>(
|
|
future: githubAPI.getChangelog(
|
|
snapshot.data![index],
|
|
'revanced',
|
|
'revanced-patches',
|
|
),
|
|
initialData: '',
|
|
builder: (context, snapshot2) => ApplicationItem(
|
|
icon: snapshot.data![index].icon,
|
|
name: snapshot.data![index].name,
|
|
patchDate: snapshot.data![index].patchDate,
|
|
changelog: snapshot2.data!,
|
|
isUpdatableApp: true,
|
|
onPressed: () => {},
|
|
),
|
|
),
|
|
)
|
|
: Container(),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|