Skip to content

Commit

Permalink
Merge pull request #18 from FGA0138-MDS-Ajax/7-tela-administrador
Browse files Browse the repository at this point in the history
7 tela administrador
  • Loading branch information
JAugustoM authored Dec 5, 2024
2 parents c8ce94d + cb0a30a commit a87fe15
Show file tree
Hide file tree
Showing 7 changed files with 354 additions and 159 deletions.
1 change: 0 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,5 @@
"type": "dart",
"flutterMode": "release"
}

]
}
101 changes: 51 additions & 50 deletions catavento/lib/screens/components/confirmDialog.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import 'package:flutter/material.dart';

class ConfirmDialog extends StatelessWidget {
final String title;
final String contente;
final VoidCallback onConfirm;

const ConfirmDialog ({
required this.title,
required this.contente,
required this.onConfirm,
});

@override
Widget build(BuildContext context) {
return AlertDialog(
Expand All @@ -26,55 +29,53 @@ class ConfirmDialog extends StatelessWidget {
color: Colors.black,
),
),
actions: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: 137,
height: 57,
child: ElevatedButton(
onPressed: onConfirm,
style: ElevatedButton.styleFrom(
backgroundColor: Color(0xFF50B432),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(22),
actions: <Widget>[
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: 137,
height: 57,
child: ElevatedButton(
onPressed: onConfirm,
style: ElevatedButton.styleFrom(
backgroundColor: Color(0xFF50B432),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(22))),
child: Text(
"Sim",
style: TextStyle(
fontSize: 20,
color: Colors.white,
),
)),
),
),
child: Text(
"Sim",
style: TextStyle(
fontSize: 20,
color: Colors.white,
SizedBox(
width: 40,
),
),
),
),
SizedBox(width: 40),
SizedBox(
width: 137,
height: 57,
child: TextButton(
onPressed: () {
Navigator.of(context).pop();
},
style: TextButton.styleFrom(
backgroundColor: Color(0xFFD54A3D),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(22),
),
),
child: Text(
"Não",
style: TextStyle(
fontSize: 20,
color: Colors.white,
),
),
),
),
],
),
],
);
}}
SizedBox(
width: 137,
height: 57,
child: TextButton(
onPressed: () {
Navigator.of(context).pop();
},
style: TextButton.styleFrom(
backgroundColor: Color(0xFFD54A3D),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(22))),
child: Text(
"Não",
style: TextStyle(
fontSize: 20,
color: Colors.white,
),
)),
)
],
)),
],
);
}
}
52 changes: 52 additions & 0 deletions catavento/lib/screens/components/graph.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import 'package:flutter/material.dart';
import 'package:fl_chart/fl_chart.dart';

class PizzaChart extends StatelessWidget {
final int completas;
final int restantes;
final List<Color> colors;

const PizzaChart({
required this.completas,
required this.restantes,
required this.colors,
});

@override
Widget build(BuildContext context) {
final total = completas + restantes;
final completasPercent = completas / total;
final restantesPercent = restantes / total;

return LayoutBuilder(
builder: (context, constraints) {
return SizedBox(
width: constraints.maxWidth, // Largura total disponível
height: constraints.maxHeight, // Altura total disponível
child: PieChart(
PieChartData(
sections: [
PieChartSectionData(
value: completasPercent * 100, // Percentual de completas
title: '${(completasPercent * 100).toStringAsFixed(1)}%',
color: colors[0],
radius:
constraints.maxWidth * 0.3, // Ajusta com base no tamanho
),
PieChartSectionData(
value: restantesPercent * 100, // Percentual de restantes
title: '${(restantesPercent * 100).toStringAsFixed(1)}%',
color: colors[1],
radius:
constraints.maxWidth * 0.3, // Ajusta com base no tamanho
),
],
centerSpaceRadius:
constraints.maxWidth * 0.15, // Espaço no centro
),
),
);
},
);
}
}
69 changes: 69 additions & 0 deletions catavento/lib/screens/components/header.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';

class Header extends StatelessWidget {
final String title;
final bool showHistoricoButton;

const Header({Key? key, required this.title, this.showHistoricoButton = true})
: super(key: key);

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(2.0),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
IconMenu(),
if (showHistoricoButton) // o header mostra o botão somente se showHistoricoButton for true
ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
backgroundColor: Color(0xFF015C98),
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
),
child: Text('Ver histórico',
style: TextStyle(fontSize: 16, color: Colors.white)),
),
],
),
Text(
title,
style: TextStyle(
fontSize: 26,
fontWeight: FontWeight.bold,
color: Color(0xFF015C98),
),
),
],
),
);
}
}

// Icon Menu
class IconMenu extends StatefulWidget {
const IconMenu({super.key});

@override
State<IconMenu> createState() {
return IconMenuState();
}
}

class IconMenuState extends State<IconMenu> {
@override
Widget build(BuildContext context) {
return IconButton(
iconSize: 35,
onPressed: () {
// Lógica do menu
},
icon: Icon(Icons.menu),
color: Color(0xFF015C98),
);
}
}
Loading

0 comments on commit a87fe15

Please sign in to comment.