generated from FGA0138-MDS-Ajax/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from FGA0138-MDS-Ajax/7-tela-administrador
7 tela administrador
- Loading branch information
Showing
7 changed files
with
354 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,5 @@ | |
"type": "dart", | ||
"flutterMode": "release" | ||
} | ||
|
||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
), | ||
), | ||
); | ||
}, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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), | ||
); | ||
} | ||
} |
Oops, something went wrong.