revanced-manager/lib/ui/widgets/available_updates_card.dart

37 lines
1.3 KiB
Dart
Raw Normal View History

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/ui/views/home/home_viewmodel.dart';
2022-08-06 23:35:35 +02:00
import 'package:revanced_manager/ui/widgets/application_item.dart';
2022-08-01 20:15:55 +02:00
class AvailableUpdatesCard extends StatelessWidget {
2022-08-11 22:17:10 +02:00
const AvailableUpdatesCard({
Key? key,
}) : super(key: key);
@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!.length > 1
? ListView.builder(
itemBuilder: (context, index) => ApplicationItem(
icon: snapshot.data![index].icon,
name: snapshot.data![index].name,
patchDate: snapshot.data![index].patchDate,
isUpdatableApp: true,
onPressed: () => {},
),
)
: Container(),
),
],
);
}
}