add endpoint for general stats

load build data to graph
redesign top info tiles
place add button on header
folder restructure
This commit is contained in:
2023-12-30 00:45:33 +01:00
parent ce7a260760
commit 600c2057fe
38 changed files with 563 additions and 886 deletions

View File

@ -0,0 +1,22 @@
import 'dart:ui';
import 'package:flutter/material.dart';
Color getRoleColor(String? role) {
if (role == "Doctor") {
return Colors.green;
} else if (role == "Software Architect") {
return Colors.red;
} else if (role == "Software Engineer") {
return Colors.blueAccent;
} else if (role == "Solution Architect") {
return Colors.amberAccent;
} else if (role == "Project Manager") {
return Colors.cyanAccent;
} else if (role == "Business Analyst") {
return Colors.deepPurpleAccent;
} else if (role == "UI/UX Designer") {
return Colors.indigoAccent;
}
return Colors.black38;
}

View File

@ -0,0 +1,15 @@
import 'dart:math';
double _log10(num x) => log(x) / ln10;
extension FileFormatter on num {
String readableFileSize({bool base1024 = true}) {
if (this <= 0) return '0';
final base = base1024 ? 1024 : 1000;
final units = base1024
? ['Bi', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB']
: ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'];
final digitGroups = (_log10(this) / _log10(base)).floor();
return '${(this / pow(base, digitGroups)).toStringAsFixed(2)} ${units[digitGroups]}';
}
}

View File

@ -0,0 +1,44 @@
import 'package:flutter/material.dart';
class Responsive extends StatelessWidget {
final Widget mobile;
final Widget tablet;
final Widget desktop;
const Responsive({
Key? key,
required this.mobile,
required this.tablet,
required this.desktop,
}) : super(key: key);
// This size work fine on my design, maybe you need some customization depends on your design
// This isMobile, isTablet, isDesktop helep us later
static bool isMobile(BuildContext context) =>
MediaQuery.of(context).size.width < 850;
static bool isTablet(BuildContext context) =>
MediaQuery.of(context).size.width < 1100 &&
MediaQuery.of(context).size.width >= 850;
static bool isDesktop(BuildContext context) =>
MediaQuery.of(context).size.width >= 1100;
@override
Widget build(BuildContext context) {
final Size _size = MediaQuery.of(context).size;
// If our width is more than 1100 then we consider it a desktop
if (_size.width >= 1100) {
return desktop;
}
// If width it less then 1100 and more then 850 we consider it as tablet
else if (_size.width >= 850) {
return tablet;
}
// Or less then that we called it mobile
else {
return mobile;
}
}
}