-
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.
- Loading branch information
Showing
2 changed files
with
228 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'flecha.dart'; | ||
|
||
void main() { | ||
runApp(const MainApp()); | ||
} | ||
|
||
class MainApp extends StatelessWidget { | ||
const MainApp({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return MaterialApp( | ||
home: Scaffold( | ||
appBar: _buildAppBar(context), | ||
body: SingleChildScrollView( | ||
child: Center( | ||
child: Column( | ||
children: [ | ||
CustomPaint( | ||
painter: Fundo(), | ||
child: const SizedBox( | ||
height: 100, | ||
width: 200, | ||
), | ||
), | ||
CustomPaint( | ||
painter: Square(), | ||
child: const SizedBox( | ||
height: 100, | ||
width: 200, | ||
), | ||
), | ||
CustomPaint( | ||
painter: Base(), | ||
child: const SizedBox( | ||
height: 50, | ||
width: 200, | ||
), | ||
), | ||
CorpoList(), // Agora os itens da lista são botões! | ||
CustomPaint( | ||
painter: Ponta(), | ||
child: const SizedBox( | ||
height: 250, | ||
width: 225, | ||
), | ||
), | ||
], | ||
), | ||
), | ||
), | ||
), | ||
); | ||
} | ||
|
||
AppBar _buildAppBar(BuildContext context) { | ||
return AppBar( | ||
backgroundColor: Theme.of(context).colorScheme.surface, | ||
elevation: 0, | ||
title: Center( | ||
child: Text( | ||
'Lógica Booleana', | ||
style: TextStyle( | ||
color: Theme.of(context).colorScheme.onSurface, | ||
fontSize: 24, | ||
), | ||
), | ||
), | ||
leading: IconButton( | ||
color: Theme.of(context).colorScheme.primary, | ||
icon: const Icon(Icons.arrow_back), | ||
onPressed: () { | ||
Navigator.of(context).pop(); | ||
}, | ||
), | ||
); | ||
} | ||
} |
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,149 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class Fundo extends CustomPainter { | ||
void paint(Canvas canvas, Size size) { | ||
final paint = Paint()..color = Colors.grey; | ||
|
||
final path = Path() | ||
..moveTo(0, 0) | ||
..lineTo(0, size.height) | ||
..lineTo(size.width / 2, size.height) | ||
..moveTo(size.width, 0) | ||
..lineTo(size.width, size.height) | ||
..lineTo(size.width / 2, size.height); | ||
|
||
canvas.drawPath(path, paint); | ||
} | ||
|
||
bool shouldRepaint(covariant CustomPainter oldDelegate) => false; | ||
} | ||
|
||
class Square extends CustomPainter { | ||
void paint(Canvas canvas, Size size) { | ||
final paint = Paint()..color = Colors.grey; | ||
|
||
final path = Path() | ||
..moveTo(0, 0) | ||
..lineTo(0, size.height) | ||
..lineTo(size.width, size.height) | ||
..lineTo(size.width, 0) | ||
..lineTo(0, 0); | ||
|
||
canvas.drawPath(path, paint); | ||
} | ||
|
||
bool shouldRepaint(covariant CustomPainter oldDelegate) => false; | ||
} | ||
|
||
class Base extends CustomPainter { | ||
void paint(Canvas canvas, Size size) { | ||
final paint = Paint()..color = Colors.grey; | ||
|
||
final path = Path() | ||
..moveTo(0, 0) | ||
..lineTo(size.width * 1 / 4, size.height) | ||
..lineTo(size.width * 3 / 4, size.height) | ||
..lineTo(size.width, 0) | ||
..lineTo(0, 0); | ||
|
||
canvas.drawPath(path, paint); | ||
} | ||
|
||
bool shouldRepaint(covariant CustomPainter oldDelegate) => false; | ||
} | ||
|
||
class Corpo extends CustomPainter { | ||
void paint(Canvas canvas, Size size) { | ||
final paint = Paint()..color = Colors.grey; | ||
|
||
final path = Path() | ||
..moveTo(size.width * 1 / 4, 0) | ||
..lineTo(size.width * 1 / 4, size.height) | ||
..lineTo(size.width * 3 / 4, size.height) | ||
..lineTo(size.width * 3 / 4, 0) | ||
..lineTo(size.width * 1 / 4, 0); | ||
|
||
canvas.drawPath(path, paint); | ||
} | ||
|
||
bool shouldRepaint(covariant CustomPainter oldDelegate) => false; | ||
} | ||
|
||
class Ponta extends CustomPainter { | ||
void paint(Canvas canvas, Size size) { | ||
final paint = Paint()..color = Colors.grey; | ||
|
||
final path = Path() | ||
..moveTo(0, 0) | ||
..lineTo(size.width * 1 / 2, size.height) | ||
..lineTo(size.width, 0) | ||
..lineTo(0, 0); | ||
|
||
canvas.drawPath(path, paint); | ||
} | ||
|
||
bool shouldRepaint(covariant CustomPainter oldDelegate) => false; | ||
} | ||
|
||
class CorpoList extends StatelessWidget { | ||
@override | ||
Widget build(BuildContext context) { | ||
// Lista de dados para os botões | ||
final List<String> items = | ||
List.generate(5, (index) => "Botão ${index + 1}"); | ||
|
||
return Column( | ||
children: List.generate( | ||
items.length, | ||
(index) => CustomPaint( | ||
painter: Corpo(), | ||
child: SizedBox( | ||
height: 100, | ||
width: 200, | ||
child: Stack( | ||
children: [ | ||
Align( | ||
alignment: Alignment.center, | ||
child: Container( | ||
width: 75, | ||
height: 75, | ||
child: ElevatedButton( | ||
onPressed: () { | ||
// Ação ao pressionar o botão | ||
showDialog( | ||
context: context, | ||
builder: (context) => AlertDialog( | ||
actions: [ | ||
TextButton( | ||
onPressed: () => Navigator.of(context).pop(), | ||
child: const Text('OK'), | ||
), | ||
], | ||
), | ||
); | ||
}, | ||
style: ElevatedButton.styleFrom( | ||
backgroundColor: Theme.of(context) | ||
.colorScheme | ||
.primary, // Cor do botão | ||
shape: RoundedRectangleBorder( | ||
borderRadius: | ||
BorderRadius.circular(10), // Cantos arredondados | ||
), | ||
), | ||
child: Text( | ||
'B', // Texto no botão | ||
style: TextStyle( | ||
color: Theme.of(context).colorScheme.onSurface), | ||
), | ||
), | ||
), | ||
), | ||
], | ||
), | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |