2023-12-30 21:23:42 +00:00
|
|
|
import 'package:aurcache/components/builds_table.dart';
|
2023-12-29 23:45:33 +00:00
|
|
|
import 'package:aurcache/models/build.dart';
|
2024-01-01 16:11:05 +00:00
|
|
|
import 'package:aurcache/components/api/APIBuilder.dart';
|
2024-02-16 21:37:35 +00:00
|
|
|
import 'package:aurcache/providers/api/builds_provider.dart';
|
2023-12-27 15:45:55 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2023-12-30 15:46:13 +00:00
|
|
|
import 'package:go_router/go_router.dart';
|
2023-12-29 23:45:33 +00:00
|
|
|
import '../../constants/color_constants.dart';
|
2023-12-27 15:45:55 +00:00
|
|
|
|
2023-12-29 17:13:51 +00:00
|
|
|
class RecentBuilds extends StatefulWidget {
|
2023-12-27 15:45:55 +00:00
|
|
|
const RecentBuilds({
|
|
|
|
Key? key,
|
|
|
|
}) : super(key: key);
|
|
|
|
|
2023-12-29 17:13:51 +00:00
|
|
|
@override
|
|
|
|
State<RecentBuilds> createState() => _RecentBuildsState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _RecentBuildsState extends State<RecentBuilds> {
|
2023-12-27 15:45:55 +00:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Container(
|
2023-12-30 09:43:46 +00:00
|
|
|
padding: const EdgeInsets.all(defaultPadding),
|
|
|
|
decoration: const BoxDecoration(
|
2023-12-27 15:45:55 +00:00
|
|
|
color: secondaryColor,
|
2023-12-30 09:43:46 +00:00
|
|
|
borderRadius: BorderRadius.all(Radius.circular(10)),
|
2023-12-27 15:45:55 +00:00
|
|
|
),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
"Recent Builds",
|
|
|
|
style: Theme.of(context).textTheme.subtitle1,
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: double.infinity,
|
2023-12-30 21:23:42 +00:00
|
|
|
child: APIBuilder<BuildsProvider, List<Build>, BuildsDTO>(
|
2024-01-01 16:11:05 +00:00
|
|
|
key: const Key("Builds on dashboard"),
|
2023-12-30 21:23:42 +00:00
|
|
|
dto: BuildsDTO(limit: 10),
|
|
|
|
interval: const Duration(seconds: 10),
|
|
|
|
onLoad: () => const Text("no data"),
|
|
|
|
onData: (t) {
|
|
|
|
return BuildsTable(data: t);
|
|
|
|
},
|
|
|
|
),
|
2023-12-27 15:45:55 +00:00
|
|
|
),
|
2023-12-30 21:23:42 +00:00
|
|
|
ElevatedButton(
|
|
|
|
onPressed: () {
|
|
|
|
context.push("/builds");
|
|
|
|
},
|
|
|
|
child: Text(
|
|
|
|
"List all Builds",
|
|
|
|
style: TextStyle(color: Colors.white.withOpacity(0.8)),
|
|
|
|
),
|
|
|
|
)
|
2023-12-27 15:45:55 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|