dividir por zona de pontos
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:playmaker/controllers/placar_controller.dart';
|
||||
import 'package:playmaker/widgets/placar_widgets.dart';
|
||||
import 'dart:math' as math;
|
||||
|
||||
class PlacarPage extends StatefulWidget {
|
||||
final String gameId, myTeam, opponentTeam;
|
||||
@@ -17,7 +18,10 @@ class _PlacarPageState extends State<PlacarPage> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.landscapeRight, DeviceOrientation.landscapeLeft]);
|
||||
SystemChrome.setPreferredOrientations([
|
||||
DeviceOrientation.landscapeRight,
|
||||
DeviceOrientation.landscapeLeft,
|
||||
]);
|
||||
|
||||
_controller = PlacarController(
|
||||
gameId: widget.gameId,
|
||||
@@ -37,7 +41,6 @@ class _PlacarPageState extends State<PlacarPage> {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
// Função auxiliar para criar o botão de arrastar faltas que não está no painel inferior
|
||||
Widget _buildFloatingFoulBtn(String label, Color color, String action, IconData icon, double left, double right, double top, double h) {
|
||||
return Positioned(
|
||||
top: top,
|
||||
@@ -47,7 +50,11 @@ class _PlacarPageState extends State<PlacarPage> {
|
||||
data: action,
|
||||
feedback: Material(
|
||||
color: Colors.transparent,
|
||||
child: CircleAvatar(radius: 30, backgroundColor: color.withOpacity(0.8), child: Icon(icon, color: Colors.white)),
|
||||
child: CircleAvatar(
|
||||
radius: 30,
|
||||
backgroundColor: color.withOpacity(0.8),
|
||||
child: Icon(icon, color: Colors.white)
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
@@ -66,9 +73,54 @@ class _PlacarPageState extends State<PlacarPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (_controller.isLoading) {
|
||||
return const Scaffold(
|
||||
backgroundColor: Color(0xFF266174),
|
||||
body: Center(child: CircularProgressIndicator(color: Colors.white)),
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFF16202C),
|
||||
body: Stack(
|
||||
children: [
|
||||
Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Text(
|
||||
"PREPARANDO O PAVILHÃO",
|
||||
style: TextStyle(color: Colors.white24, fontSize: 28, fontWeight: FontWeight.bold, letterSpacing: 2)
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
StreamBuilder(
|
||||
stream: Stream.periodic(const Duration(seconds: 3)),
|
||||
builder: (context, snapshot) {
|
||||
List<String> frases = [
|
||||
"O Treinador está a desenhar a tática...",
|
||||
"A encher as bolas com ar de campeão...",
|
||||
"O árbitro está a testar o apito...",
|
||||
"A verificar se o cesto está nivelado...",
|
||||
"Os jogadores estão a terminar o aquecimento..."
|
||||
];
|
||||
String frase = frases[DateTime.now().second % frases.length];
|
||||
return Text(
|
||||
frase,
|
||||
style: TextStyle(color: Colors.orange.withOpacity(0.7), fontSize: 18, fontStyle: FontStyle.italic)
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
TweenAnimationBuilder<double>(
|
||||
tween: Tween(begin: 0.0, end: 1.0),
|
||||
duration: const Duration(milliseconds: 1500),
|
||||
builder: (context, value, child) {
|
||||
double bounce = (math.sin(value * math.pi * 4)).abs();
|
||||
return AnimatedAlign(
|
||||
duration: const Duration(milliseconds: 1500),
|
||||
alignment: Alignment(value > 0.5 ? 0.9 : -0.9, 0.7 - (bounce * 0.4)),
|
||||
child: const Icon(Icons.sports_basketball, size: 70, color: Colors.orange),
|
||||
);
|
||||
},
|
||||
onEnd: () => setState(() {}),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -89,7 +141,14 @@ class _PlacarPageState extends State<PlacarPage> {
|
||||
// --- MAPA DO CAMPO ---
|
||||
GestureDetector(
|
||||
onTapDown: (details) {
|
||||
if (_controller.isSelectingShotLocation) _controller.registerShotLocation(details.localPosition);
|
||||
if (_controller.isSelectingShotLocation) {
|
||||
// AQUI É QUE A MAGIA ACONTECE! Passamos o tamanho exato do layout
|
||||
_controller.registerShotLocation(
|
||||
context,
|
||||
details.localPosition,
|
||||
Size(w, h)
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
decoration: const BoxDecoration(
|
||||
@@ -120,7 +179,6 @@ class _PlacarPageState extends State<PlacarPage> {
|
||||
],
|
||||
|
||||
// --- BOTÕES DE FALTA (FLUTUANTES) ---
|
||||
// Estes são os botões que você pediu, posicionados em relação ao centro
|
||||
if (!_controller.isSelectingShotLocation) ...[
|
||||
_buildFloatingFoulBtn("FALTA +", Colors.orange, "add_foul", Icons.sports, w * 0.38, 0, h * 0.30, h),
|
||||
_buildFloatingFoulBtn("FALTA -", Colors.redAccent, "sub_foul", Icons.block, 0, w * 0.38, h * 0.30, h),
|
||||
|
||||
Reference in New Issue
Block a user