add frontend and put backend in seperate folder

This commit is contained in:
2023-12-27 16:45:55 +01:00
parent d409d08572
commit 6faa995b19
88 changed files with 2993 additions and 12 deletions

View File

@ -0,0 +1,22 @@
import 'package:flutter/material.dart';
const primaryColor = Color(0xFF2697FF);
//const secondaryColor = Color(0xFF2A2D3E);
//const bgColor = Color(0xFF212132);
const secondaryColor = Color(0xFF292929);
const bgColor = Color(0xFF212121);
const darkgreenColor = Color(0xFF2c614f);
const greenColor = Color(0xFF6bab58);
const defaultPadding = 16.0;
const double defaultBorderRadius = 15;
class ColorConstants {
static Color blue = Color(0xFF0D46BB);
}
class Palette {
static const Color background = Color(0xFFEDEEF2);
static const Color wrapperBg = Color(0xFF212121);
}

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,63 @@
import 'package:flutter/material.dart';
enum ButtonType { PRIMARY, PLAIN }
class AppButton extends StatelessWidget {
final ButtonType? type;
final VoidCallback? onPressed;
final String? text;
AppButton({this.type, this.onPressed, this.text});
@override
Widget build(BuildContext context) {
return InkWell(
onTap: this.onPressed,
child: Container(
width: double.infinity,
height: 45,
decoration: BoxDecoration(
color: getButtonColor(context, type!),
borderRadius: BorderRadius.circular(4.0),
boxShadow: [
BoxShadow(
//color: Color.fromRGBO(169, 176, 185, 0.42),
//spreadRadius: 0,
//blurRadius: 3.0,
//offset: Offset(0, 2),
)
],
),
child: Center(
child: Text(this.text!,
style: Theme.of(context)
.textTheme
.subtitle1!
.copyWith(color: getTextColor(context, type!))),
),
),
);
}
}
Color getButtonColor(context, ButtonType type) {
switch (type) {
case ButtonType.PRIMARY:
return Theme.of(context).buttonTheme.colorScheme!.background;
case ButtonType.PLAIN:
return Colors.white;
default:
return Theme.of(context).primaryColor;
}
}
Color getTextColor(context, ButtonType type) {
switch (type) {
case ButtonType.PLAIN:
return Theme.of(context).primaryColor;
case ButtonType.PRIMARY:
return Colors.white;
default:
return Theme.of(context).buttonTheme.colorScheme!.background;
}
}

View File

@ -0,0 +1,94 @@
import 'package:flutter/material.dart';
import '../constants/color_constants.dart';
class InputWidget extends StatelessWidget {
final String? hintText;
final String? errorText;
final Widget? prefixIcon;
final double? height;
final String? topLabel;
final bool? obscureText;
final FormFieldSetter<String>? onSaved;
final ValueChanged<String>? onChanged;
final FormFieldValidator<String>? validator;
final TextInputType? keyboardType;
final Key? kKey;
final TextEditingController? kController;
final String? kInitialValue;
InputWidget({
this.hintText,
this.prefixIcon,
this.height = 48.0,
this.topLabel = "",
this.obscureText = false,
required this.onSaved,
this.keyboardType,
this.errorText,
this.onChanged,
this.validator,
this.kKey,
this.kController,
this.kInitialValue,
});
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(this.topLabel!),
SizedBox(height: 4.0),
Container(
height: 50,
decoration: BoxDecoration(
color: secondaryColor,
//color: Theme.of(context).buttonColor,
borderRadius: BorderRadius.circular(4.0),
),
child: TextFormField(
initialValue: this.kInitialValue,
controller: this.kController,
key: this.kKey,
keyboardType: this.keyboardType,
onSaved: this.onSaved,
onChanged: this.onChanged,
validator: this.validator,
obscureText: this.obscureText!,
decoration: InputDecoration(
prefixIcon: this.prefixIcon,
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color.fromRGBO(74, 77, 84, 0.2),
),
),
focusedBorder: OutlineInputBorder(
//gapPadding: 16,
borderSide: BorderSide(
color: Theme.of(context).primaryColor,
),
),
errorStyle: TextStyle(height: 0, color: Colors.transparent),
errorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).errorColor,
),
),
focusedErrorBorder: OutlineInputBorder(
//gapPaddings: 16,
borderSide: BorderSide(
color: Theme.of(context).errorColor,
),
),
hintText: this.hintText,
hintStyle: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(color: Colors.white54),
errorText: this.errorText),
),
)
],
);
}
}

View File

@ -0,0 +1,34 @@
import 'package:flutter/material.dart';
import '../constants/color_constants.dart';
class Wrapper extends StatelessWidget {
final Widget? title;
final Widget child;
const Wrapper({Key? key, this.title, required this.child}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(defaultPadding),
decoration: BoxDecoration(
color: Palette.wrapperBg,
borderRadius: BorderRadius.circular(defaultBorderRadius),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (title != null)
Column(
children: [
title!,
const SizedBox(height: defaultPadding),
],
),
child
],
),
);
}
}

31
frontend/lib/main.dart Normal file
View File

@ -0,0 +1,31 @@
import 'package:aurcache/screens/home/home_screen.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'core/constants/color_constants.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Smart Dashboard - Admin Panel v0.1 ',
theme: ThemeData.dark().copyWith(
appBarTheme: const AppBarTheme(backgroundColor: bgColor, elevation: 0),
scaffoldBackgroundColor: bgColor,
primaryColor: greenColor,
dialogBackgroundColor: secondaryColor,
textTheme: GoogleFonts.openSansTextTheme(Theme.of(context).textTheme)
.apply(bodyColor: Colors.white),
canvasColor: secondaryColor,
),
home: const HomeScreen(),
);
}
}

View File

@ -0,0 +1,289 @@
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import '../core/constants/color_constants.dart';
class DailyInfoModel {
IconData? icon;
String? title;
String? totalStorage;
int? volumeData;
int? percentage;
Color? color;
List<Color>? colors;
List<FlSpot>? spots;
DailyInfoModel({
this.icon,
this.title,
this.totalStorage,
this.volumeData,
this.percentage,
this.color,
this.colors,
this.spots,
});
DailyInfoModel.fromJson(Map<String, dynamic> json) {
title = json['title'];
volumeData = json['volumeData'];
icon = json['icon'];
totalStorage = json['totalStorage'];
color = json['color'];
percentage = json['percentage'];
colors = json['colors'];
spots = json['spots'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['title'] = this.title;
data['volumeData'] = this.volumeData;
data['icon'] = this.icon;
data['totalStorage'] = this.totalStorage;
data['color'] = this.color;
data['percentage'] = this.percentage;
data['colors'] = this.colors;
data['spots'] = this.spots;
return data;
}
}
List<DailyInfoModel> dailyDatas =
dailyData.map((item) => DailyInfoModel.fromJson(item)).toList();
//List<FlSpot> spots = yValues.asMap().entries.map((e) {
// return FlSpot(e.key.toDouble(), e.value);
//}).toList();
var dailyData = [
{
"title": "Employee",
"volumeData": 1328,
"icon": Icons.ac_unit,
"totalStorage": "+ %20",
"color": primaryColor,
"percentage": 35,
"colors": [
Color(0xff23b6e6),
Color(0xff02d39a),
],
"spots": [
FlSpot(
1,
2,
),
FlSpot(
2,
1.0,
),
FlSpot(
3,
1.8,
),
FlSpot(
4,
1.5,
),
FlSpot(
5,
1.0,
),
FlSpot(
6,
2.2,
),
FlSpot(
7,
1.8,
),
FlSpot(
8,
1.5,
)
]
},
{
"title": "On Leave",
"volumeData": 1328,
"icon": Icons.ac_unit,
"totalStorage": "+ %5",
"color": Color(0xFFFFA113),
"percentage": 35,
"colors": [Color(0xfff12711), Color(0xfff5af19)],
"spots": [
FlSpot(
1,
1.3,
),
FlSpot(
2,
1.0,
),
FlSpot(
3,
4,
),
FlSpot(
4,
1.5,
),
FlSpot(
5,
1.0,
),
FlSpot(
6,
3,
),
FlSpot(
7,
1.8,
),
FlSpot(
8,
1.5,
)
]
},
{
"title": "Onboarding",
"volumeData": 1328,
"icon": Icons.ac_unit,
"totalStorage": "+ %8",
"color": Color(0xFFA4CDFF),
"percentage": 10,
"colors": [Color(0xff2980B9), Color(0xff6DD5FA)],
"spots": [
FlSpot(
1,
1.3,
),
FlSpot(
2,
5,
),
FlSpot(
3,
1.8,
),
FlSpot(
4,
6,
),
FlSpot(
5,
1.0,
),
FlSpot(
6,
2.2,
),
FlSpot(
7,
1.8,
),
FlSpot(
8,
1,
)
]
},
{
"title": "Open Position",
"volumeData": 1328,
"icon": Icons.ac_unit,
"totalStorage": "+ %8",
"color": Color(0xFFd50000),
"percentage": 10,
"colors": [Color(0xff93291E), Color(0xffED213A)],
"spots": [
FlSpot(
1,
3,
),
FlSpot(
2,
4,
),
FlSpot(
3,
1.8,
),
FlSpot(
4,
1.5,
),
FlSpot(
5,
1.0,
),
FlSpot(
6,
2.2,
),
FlSpot(
7,
1.8,
),
FlSpot(
8,
1.5,
)
]
},
{
"title": "Efficiency",
"volumeData": 5328,
"icon": Icons.ac_unit,
"totalStorage": "- %5",
"color": Color(0xFF00F260),
"percentage": 78,
"colors": [Color(0xff0575E6), Color(0xff00F260)],
"spots": [
FlSpot(
1,
1.3,
),
FlSpot(
2,
1.0,
),
FlSpot(
3,
1.8,
),
FlSpot(
4,
1.5,
),
FlSpot(
5,
1.0,
),
FlSpot(
6,
2.2,
),
FlSpot(
7,
1.8,
),
FlSpot(
8,
1.5,
)
]
}
];
//final List<double> yValues = [
// 2.3,
// 1.8,
// 1.9,
// 1.5,
// 1.0,
// 2.2,
// 1.8,
// 1.5,
//];

View File

@ -0,0 +1,64 @@
class SliderModel {
String? image;
String? text;
String? altText;
String? bAltText;
String? productImage;
int? kBackgroundColor;
SliderModel(this.image, this.text, this.altText, this.bAltText,
this.productImage, this.kBackgroundColor);
SliderModel.fromJson(Map<String, dynamic> json) {
image = json['image'];
kBackgroundColor = json['kBackgroundColor'];
text = json['text'];
altText = json['altText'];
bAltText = json['bAltText'];
productImage = json['productImage'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['image'] = this.image;
data['kBackgroundColor'] = this.kBackgroundColor;
data['text'] = this.text;
data['altText'] = this.altText;
data['bAltText'] = this.bAltText;
data['productImage'] = this.productImage;
return data;
}
}
List<SliderModel> slides =
slideData.map((item) => SliderModel.fromJson(item)).toList();
var slideData = [
{
"image": "assets/slides/background-1.jpeg",
"kBackgroundColor": 0xFF2c614f,
"text": "Welcome to the Smart Smart Admin Dashboard!",
"altText": "You can access & track your services in real-time.",
"bAltText": "Are you ready for the next generation AI supported Dashboard?",
"productImage": "assets/images/mockup.png"
},
{
"image": "assets/slides/background-2.jpeg",
"kBackgroundColor": 0xFF8a1a4c,
"text": "¡Bienvenido al tablero Smart Admin Dashboard!",
"altText": "Puede acceder y rastrear sus servicios en tiempo real.",
"bAltText":
"¿Estás listo para el panel de control impulsado por IA de próxima generación?",
"productImage": "assets/images/mockup-2.png"
},
{
"image": "assets/slides/background-3.jpeg",
"kBackgroundColor": 0xFF0ab3ec,
"text": "Willkommen im Smart Admin Dashboard!",
"altText":
"Sie können in Echtzeit auf Ihre Dienste zugreifen und diese verfolgen.",
"bAltText":
"Sind Sie bereit für das AI-unterstützte Dashboard der nächsten Generation?",
"productImage": "assets/images/mockup-3.png"
}
];

View File

@ -0,0 +1 @@

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;
}
}
}

View File

@ -0,0 +1,95 @@
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
class Chart extends StatefulWidget {
const Chart({
Key? key,
}) : super(key: key);
@override
_ChartState createState() => _ChartState();
}
class _ChartState extends State<Chart> {
int touchedIndex = -1;
@override
Widget build(BuildContext context) {
return SizedBox(
height: 300,
child: AspectRatio(
aspectRatio: 1.3,
child: Row(
children: <Widget>[
const SizedBox(
height: 18,
),
Expanded(
child: AspectRatio(
aspectRatio: 1,
child: PieChart(
PieChartData(
pieTouchData:
PieTouchData(touchCallback: (pieTouchResponse, touchresponse) {
setState(() {
// final desiredTouch = pieTouchResponse.touchInput
// is! PointerExitEvent &&
// pieTouchResponse.touchInput is! PointerUpEvent;
if ( touchresponse?.touchedSection != null) {
touchedIndex = touchresponse!.touchedSection!.touchedSectionIndex;
} else {
touchedIndex = -1;
}
});
}),
borderData: FlBorderData(
show: false,
),
sectionsSpace: 0,
centerSpaceRadius: 40,
sections: showingSections()),
),
),
),
const SizedBox(
width: 28,
),
],
),
),
);
}
List<PieChartSectionData> showingSections() {
return List.generate(2, (i) {
final isTouched = i == touchedIndex;
final fontSize = isTouched ? 25.0 : 16.0;
final radius = isTouched ? 60.0 : 50.0;
switch (i) {
case 0:
return PieChartSectionData(
color: const Color(0xff760707),
value: 40,
title: '28.3%',
radius: radius,
titleStyle: TextStyle(
fontSize: fontSize,
fontWeight: FontWeight.bold,
color: const Color(0xffffffff)),
);
case 1:
return PieChartSectionData(
color: const Color(0xff0a7005),
value: 30,
title: '16.7%',
radius: radius,
titleStyle: TextStyle(
fontSize: fontSize,
fontWeight: FontWeight.bold,
color: const Color(0xffffffff)),
);
default:
throw Error();
}
});
}
}

View File

@ -0,0 +1,117 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import '../../../core/constants/color_constants.dart';
import '../../../responsive.dart';
class Header extends StatelessWidget {
const Header({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Row(
children: [
if (!Responsive.isDesktop(context))
IconButton(
icon: Icon(Icons.menu),
onPressed: () {},
),
if (!Responsive.isMobile(context))
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Hello, Arch User 👋",
style: Theme.of(context).textTheme.headline6,
),
SizedBox(
height: 8,
),
Text(
"Welcome to AURCentral",
style: Theme.of(context).textTheme.subtitle2,
),
],
),
if (!Responsive.isMobile(context))
Spacer(flex: Responsive.isDesktop(context) ? 2 : 1),
Expanded(child: SearchField()),
//ProfileCard()
],
);
}
}
class ProfileCard extends StatelessWidget {
const ProfileCard({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(left: defaultPadding),
padding: EdgeInsets.symmetric(
horizontal: defaultPadding,
vertical: defaultPadding / 2,
),
decoration: BoxDecoration(
color: secondaryColor,
borderRadius: const BorderRadius.all(Radius.circular(10)),
border: Border.all(color: Colors.white10),
),
child: Row(
children: [
CircleAvatar(
backgroundImage: AssetImage("assets/images/profile_pic.png"),
),
if (!Responsive.isMobile(context))
Padding(
padding:
const EdgeInsets.symmetric(horizontal: defaultPadding / 2),
child: Text("Deniz Çolak"),
),
Icon(Icons.keyboard_arrow_down),
],
),
);
}
}
class SearchField extends StatelessWidget {
const SearchField({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return TextField(
decoration: InputDecoration(
hintText: "Search",
fillColor: secondaryColor,
filled: true,
border: OutlineInputBorder(
borderSide: BorderSide.none,
borderRadius: const BorderRadius.all(Radius.circular(10)),
),
suffixIcon: InkWell(
onTap: () {},
child: Container(
padding: EdgeInsets.all(defaultPadding * 0.75),
margin: EdgeInsets.symmetric(horizontal: defaultPadding / 2),
decoration: BoxDecoration(
color: greenColor,
borderRadius: const BorderRadius.all(Radius.circular(10)),
),
child: SvgPicture.asset(
"assets/icons/Search.svg",
),
),
),
),
);
}
}

View File

@ -0,0 +1,84 @@
import 'package:flutter/material.dart';
import '../../../core/constants/color_constants.dart';
import '../../../models/daily_info_model.dart';
import '../../../responsive.dart';
import 'mini_information_widget.dart';
class MiniInformation extends StatelessWidget {
const MiniInformation({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
final Size _size = MediaQuery.of(context).size;
return Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
width: 10,
),
ElevatedButton.icon(
style: TextButton.styleFrom(
backgroundColor: Colors.green,
padding: EdgeInsets.symmetric(
horizontal: defaultPadding * 1.5,
vertical:
defaultPadding / (Responsive.isMobile(context) ? 2 : 1),
),
),
onPressed: () {
},
icon: Icon(Icons.add),
label: Text(
"Add New",
),
),
],
),
SizedBox(height: defaultPadding),
Responsive(
mobile: InformationCard(
crossAxisCount: _size.width < 650 ? 2 : 4,
childAspectRatio: _size.width < 650 ? 1.2 : 1,
),
tablet: InformationCard(),
desktop: InformationCard(
childAspectRatio: _size.width < 1400 ? 1.2 : 1.4,
),
),
],
);
}
}
class InformationCard extends StatelessWidget {
const InformationCard({
Key? key,
this.crossAxisCount = 5,
this.childAspectRatio = 1,
}) : super(key: key);
final int crossAxisCount;
final double childAspectRatio;
@override
Widget build(BuildContext context) {
return GridView.builder(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: dailyDatas.length,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: crossAxisCount,
crossAxisSpacing: defaultPadding,
mainAxisSpacing: defaultPadding,
childAspectRatio: childAspectRatio,
),
itemBuilder: (context, index) =>
MiniInformationWidget(dailyData: dailyDatas[index]),
);
}
}

View File

@ -0,0 +1,206 @@
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import '../../../core/constants/color_constants.dart';
import '../../../models/daily_info_model.dart';
class MiniInformationWidget extends StatefulWidget {
const MiniInformationWidget({
Key? key,
required this.dailyData,
}) : super(key: key);
final DailyInfoModel dailyData;
@override
_MiniInformationWidgetState createState() => _MiniInformationWidgetState();
}
int _value = 1;
class _MiniInformationWidgetState extends State<MiniInformationWidget> {
@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,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
padding: EdgeInsets.all(defaultPadding * 0.75),
height: 40,
width: 40,
decoration: BoxDecoration(
color: widget.dailyData.color!.withOpacity(0.1),
borderRadius: const BorderRadius.all(Radius.circular(10)),
),
child: Icon(
widget.dailyData.icon,
color: widget.dailyData.color,
size: 18,
),
),
Padding(
padding: EdgeInsets.only(right: 12.0),
child: DropdownButton(
icon: Icon(Icons.more_vert, size: 18),
underline: SizedBox(),
style: Theme.of(context).textTheme.button,
value: _value,
items: [
DropdownMenuItem(
child: Text("Daily"),
value: 1,
),
DropdownMenuItem(
child: Text("Weekly"),
value: 2,
),
DropdownMenuItem(
child: Text("Monthly"),
value: 3,
),
],
onChanged: (int? value) {
setState(() {
_value = value!;
});
},
),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
widget.dailyData.title!,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
SizedBox(
height: 8,
),
Container(
child: LineChartWidget(
colors: widget.dailyData.colors,
spotsData: widget.dailyData.spots,
),
)
],
),
SizedBox(
height: 8,
),
ProgressLine(
color: widget.dailyData.color!,
percentage: widget.dailyData.percentage!,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"${widget.dailyData.volumeData}",
style: Theme.of(context)
.textTheme
.caption!
.copyWith(color: Colors.white70),
),
Text(
widget.dailyData.totalStorage!,
style: Theme.of(context)
.textTheme
.caption!
.copyWith(color: Colors.white),
),
],
)
],
),
);
}
}
class LineChartWidget extends StatelessWidget {
const LineChartWidget({
Key? key,
required this.colors,
required this.spotsData,
}) : super(key: key);
final List<Color>? colors;
final List<FlSpot>? spotsData;
@override
Widget build(BuildContext context) {
return Stack(
children: [
Container(
width: 80,
height: 30,
child: LineChart(
LineChartData(
lineBarsData: [
LineChartBarData(
spots: spotsData!,
belowBarData: BarAreaData(show: false),
aboveBarData: BarAreaData(show: false),
isCurved: true,
dotData: FlDotData(show: false),
//colors: colors,
barWidth: 3),
],
lineTouchData: LineTouchData(enabled: false),
titlesData: FlTitlesData(show: false),
//axisTitleData: FlAxisTitleData(show: false),
gridData: FlGridData(show: false),
borderData: FlBorderData(show: false)),
),
),
],
);
}
}
class ProgressLine extends StatelessWidget {
const ProgressLine({
Key? key,
this.color = primaryColor,
required this.percentage,
}) : super(key: key);
final Color color;
final int percentage;
@override
Widget build(BuildContext context) {
return Stack(
children: [
Container(
width: double.infinity,
height: 5,
decoration: BoxDecoration(
color: color.withOpacity(0.1),
borderRadius: BorderRadius.all(Radius.circular(10)),
),
),
LayoutBuilder(
builder: (context, constraints) => Container(
width: constraints.maxWidth * (percentage / 100),
height: 5,
decoration: BoxDecoration(
color: color,
borderRadius: BorderRadius.all(Radius.circular(10)),
),
),
),
],
);
}
}

View File

@ -0,0 +1,65 @@
import 'package:flutter/material.dart';
import '../../../core/constants/color_constants.dart';
class RecentBuilds extends StatelessWidget {
const RecentBuilds({
Key? key,
}) : super(key: key);
@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: [
Text(
"Recent Builds",
style: Theme.of(context).textTheme.subtitle1,
),
SizedBox(
width: double.infinity,
child: DataTable(
horizontalMargin: 0,
columnSpacing: defaultPadding,
columns: [
DataColumn(
label: Text("Build ID"),
),
DataColumn(
label: Text("Package Name"),
),
DataColumn(
label: Text("Version"),
),
DataColumn(
label: Text("Status"),
),
],
rows: List.generate(
7,
(index) => recentUserDataRow(),
),
),
),
],
),
);
}
DataRow recentUserDataRow() {
return DataRow(
cells: [
DataCell(Text("1")),
DataCell(Text("Resources")),
DataCell(Text("v1.2.3")),
DataCell(Icon(Icons.watch_later_outlined, color: Color(0xFF9D8D00),)),
],
);
}
}

View File

@ -0,0 +1,91 @@
import 'package:flutter/material.dart';
import '../../../core/constants/color_constants.dart';
class RecentUsers extends StatelessWidget {
const RecentUsers({
Key? key,
}) : super(key: key);
@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: [
Text(
"Your Packages",
style: Theme.of(context).textTheme.subtitle1,
),
SingleChildScrollView(
//scrollDirection: Axis.horizontal,
child: SizedBox(
width: double.infinity,
child: DataTable(
horizontalMargin: 0,
columnSpacing: defaultPadding,
columns: [
DataColumn(
label: Text("Package ID"),
),
DataColumn(
label: Text("Package Name"),
),
DataColumn(
label: Text("Number of versions"),
),
DataColumn(
label: Text("Status"),
),
DataColumn(
label: Text("Action"),
),
],
rows: List.generate(
7,
(index) => recentUserDataRow(context),
),
),
),
),
],
),
);
}
}
DataRow recentUserDataRow(BuildContext context) {
return DataRow(
cells: [
DataCell(Text("1")),
DataCell(Text("Resources")),
DataCell(Text("2")),
DataCell(Icon(Icons.watch_later_outlined, color: Color(0xFF9D8D00),)),
DataCell(
Row(
children: [
TextButton(
child: Text('View', style: TextStyle(color: greenColor)),
onPressed: () {},
),
SizedBox(
width: 6,
),
TextButton(
child: Text("Delete", style: TextStyle(color: Colors.redAccent)),
onPressed: () {
},
// Delete
),
],
),
),
],
);
}

View File

@ -0,0 +1,64 @@
import 'package:flutter/material.dart';
import '../../../core/constants/color_constants.dart';
class UserDetailsMiniCard extends StatelessWidget {
const UserDetailsMiniCard({
Key? key,
required this.title,
required this.color,
required this.amountOfFiles,
required this.numberOfIncrease,
}) : super(key: key);
final Color color;
final String title, amountOfFiles;
final int numberOfIncrease;
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(top: defaultPadding),
padding: EdgeInsets.all(defaultPadding),
decoration: BoxDecoration(
border: Border.all(width: 2, color: primaryColor.withOpacity(0.15)),
borderRadius: const BorderRadius.all(
Radius.circular(defaultPadding),
),
),
child: Row(
children: [
SizedBox(
height: 20,
width: 20,
child: Container(
color: color,
)),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: defaultPadding),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
Text(
"$numberOfIncrease",
style: Theme.of(context)
.textTheme
.caption!
.copyWith(color: Colors.white70),
),
],
),
),
),
Text(amountOfFiles)
],
),
);
}
}

View File

@ -0,0 +1,48 @@
import 'package:aurcache/screens/dashboard/components/user_details_mini_card.dart';
import 'package:flutter/material.dart';
import '../../../core/constants/color_constants.dart';
import 'charts.dart';
class UserDetailsWidget extends StatelessWidget {
const UserDetailsWidget({
Key? key,
}) : super(key: key);
@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: [
Text(
"Package build success",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
),
),
SizedBox(height: defaultPadding),
Chart(),
UserDetailsMiniCard(
color: const Color(0xff0a7005),
title: "Successful Builds",
amountOfFiles: "%16.7",
numberOfIncrease: 1328,
),
UserDetailsMiniCard(
color: const Color(0xff760707),
title: "Failed Builds",
amountOfFiles: "%28.3",
numberOfIncrease: 1328,
),
],
),
);
}
}

View File

@ -0,0 +1,57 @@
import 'package:flutter/material.dart';
import '../../core/constants/color_constants.dart';
import '../../responsive.dart';
import 'components/header.dart';
import 'components/mini_information_card.dart';
import 'components/recent_builds.dart';
import 'components/recent_users.dart';
import 'components/user_details_widget.dart';
class DashboardScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SafeArea(
child: SingleChildScrollView(
//padding: EdgeInsets.all(defaultPadding),
child: Container(
padding: EdgeInsets.all(defaultPadding),
child: Column(
children: [
Header(),
SizedBox(height: defaultPadding),
MiniInformation(),
SizedBox(height: defaultPadding),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
flex: 5,
child: Column(
children: [
RecentUsers(),
SizedBox(height: defaultPadding),
RecentBuilds(),
if (Responsive.isMobile(context))
SizedBox(height: defaultPadding),
if (Responsive.isMobile(context)) UserDetailsWidget(),
],
),
),
if (!Responsive.isMobile(context))
SizedBox(width: defaultPadding),
// On Mobile means if the screen is less than 850 we dont want to show it
if (!Responsive.isMobile(context))
Expanded(
flex: 2,
child: UserDetailsWidget(),
),
],
)
],
),
),
),
);
}
}

View File

@ -0,0 +1,90 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import '../../../core/constants/color_constants.dart';
class SideMenu extends StatelessWidget {
const SideMenu({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Drawer(
child: SingleChildScrollView(
// it enables scrolling
child: Column(
children: [
DrawerHeader(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// SizedBox(
// height: defaultPadding * 3,
// ),
// Image.asset(
// "assets/logo/logo_icon.png",
// scale: 5,
// ),
SizedBox(
height: defaultPadding,
),
Text("AUR Build Server")
],
)),
DrawerListTile(
title: "Dashboard",
svgSrc: "assets/icons/menu_dashbord.svg",
press: () {},
),
DrawerListTile(
title: "Builds",
svgSrc: "assets/icons/menu_tran.svg",
press: () {},
),
DrawerListTile(
title: "AUR",
svgSrc: "assets/icons/menu_task.svg",
press: () {},
),
DrawerListTile(
title: "Settings",
svgSrc: "assets/icons/menu_setting.svg",
press: () {},
),
],
),
),
);
}
}
class DrawerListTile extends StatelessWidget {
const DrawerListTile({
Key? key,
// For selecting those three line once press "Command+D"
required this.title,
required this.svgSrc,
required this.press,
}) : super(key: key);
final String title, svgSrc;
final VoidCallback press;
@override
Widget build(BuildContext context) {
return ListTile(
onTap: press,
horizontalTitleGap: 0.0,
leading: SvgPicture.asset(
svgSrc,
color: Colors.white54,
height: 16,
),
title: Text(
title,
style: TextStyle(color: Colors.white54),
),
);
}
}

View File

@ -0,0 +1,35 @@
import 'package:flutter/material.dart';
import '../../responsive.dart';
import '../dashboard/dashboard_screen.dart';
import 'components/side_menu.dart';
class HomeScreen extends StatelessWidget {
const HomeScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
drawer: const SideMenu(),
body: SafeArea(
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// We want this side menu only for large screen
if (Responsive.isDesktop(context))
const Expanded(
// default flex = 1
// and it takes 1/6 part of the screen
child: SideMenu(),
),
Expanded(
// It takes 5/6 part of the screen
flex: 5,
child: DashboardScreen(),
),
],
),
),
);
}
}