2023-12-29 23:45:33 +00:00
|
|
|
import 'package:aurcache/components/dashboard/chart_card.dart';
|
2023-12-27 15:45:55 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
2023-12-29 23:45:33 +00:00
|
|
|
import '../../constants/color_constants.dart';
|
|
|
|
import 'builds_chart.dart';
|
2023-12-27 15:45:55 +00:00
|
|
|
|
2023-12-29 23:45:33 +00:00
|
|
|
class SidePanel extends StatelessWidget {
|
|
|
|
const SidePanel({
|
2023-12-27 15:45:55 +00:00
|
|
|
Key? key,
|
2023-12-29 23:45:33 +00:00
|
|
|
required this.nrbuilds,
|
|
|
|
required this.nrfailedbuilds,
|
2024-02-24 22:35:16 +00:00
|
|
|
required this.nrEnqueuedBuilds,
|
2023-12-27 15:45:55 +00:00
|
|
|
}) : super(key: key);
|
|
|
|
|
2023-12-29 23:45:33 +00:00
|
|
|
final int nrbuilds;
|
|
|
|
final int nrfailedbuilds;
|
2024-02-24 22:35:16 +00:00
|
|
|
final int nrEnqueuedBuilds;
|
2023-12-29 23:45:33 +00:00
|
|
|
|
2023-12-27 15:45:55 +00:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Container(
|
|
|
|
padding: EdgeInsets.all(defaultPadding),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: secondaryColor,
|
|
|
|
borderRadius: const BorderRadius.all(Radius.circular(10)),
|
|
|
|
),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
2023-12-29 23:45:33 +00:00
|
|
|
const Text(
|
2023-12-27 15:45:55 +00:00
|
|
|
"Package build success",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 18,
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
),
|
|
|
|
),
|
2023-12-29 23:45:33 +00:00
|
|
|
const SizedBox(height: defaultPadding),
|
2024-02-25 18:40:21 +00:00
|
|
|
nrbuilds > 0
|
|
|
|
? BuildsChart(
|
|
|
|
nrbuilds: nrbuilds,
|
|
|
|
nrfailedbuilds: nrfailedbuilds,
|
|
|
|
nrEnqueuedBuilds: nrEnqueuedBuilds)
|
|
|
|
: const SizedBox(
|
|
|
|
width: double.infinity,
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
SizedBox(
|
|
|
|
height: 15,
|
|
|
|
),
|
|
|
|
Icon(
|
|
|
|
Icons.info_outline_rounded,
|
|
|
|
size: 42,
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 15,
|
|
|
|
),
|
|
|
|
Text("Add Packages to view Graph"),
|
|
|
|
SizedBox(
|
|
|
|
height: 30,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
2024-02-16 16:37:26 +00:00
|
|
|
SideCard(
|
2023-12-27 15:45:55 +00:00
|
|
|
color: const Color(0xff0a7005),
|
|
|
|
title: "Successful Builds",
|
2023-12-29 23:45:33 +00:00
|
|
|
textRight:
|
|
|
|
"${((nrbuilds - nrfailedbuilds) * 100 / nrbuilds).toStringAsFixed(2)}%",
|
|
|
|
subtitle: (nrbuilds - nrfailedbuilds).toString(),
|
2023-12-27 15:45:55 +00:00
|
|
|
),
|
2024-02-16 16:37:26 +00:00
|
|
|
SideCard(
|
2023-12-27 15:45:55 +00:00
|
|
|
color: const Color(0xff760707),
|
|
|
|
title: "Failed Builds",
|
2023-12-29 23:45:33 +00:00
|
|
|
textRight:
|
|
|
|
"${(nrfailedbuilds * 100 / nrbuilds).toStringAsFixed(2)}%",
|
|
|
|
subtitle: nrfailedbuilds.toString(),
|
2023-12-27 15:45:55 +00:00
|
|
|
),
|
2024-02-16 16:37:26 +00:00
|
|
|
SideCard(
|
2024-02-24 22:35:16 +00:00
|
|
|
color: const Color(0xFF0044AA),
|
|
|
|
title: "Enqueued Builds",
|
2023-12-30 09:43:46 +00:00
|
|
|
textRight:
|
2024-02-24 22:35:16 +00:00
|
|
|
"${(nrEnqueuedBuilds * 100 / nrbuilds).toStringAsFixed(2)}%",
|
|
|
|
subtitle: nrEnqueuedBuilds.toString(),
|
2023-12-30 09:43:46 +00:00
|
|
|
),
|
2023-12-27 15:45:55 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|