Files
farolero/lib/pantallas/pantalla_reglas.dart

119 lines
4.3 KiB
Dart

import 'package:flutter/material.dart';
import 'package:farolero/l10n/generated/app_localizations.dart';
import '../tema/componentes_farolero.dart';
import '../tema/tema_app.dart';
class PantallaReglas extends StatelessWidget {
const PantallaReglas({super.key});
@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context)!;
return Scaffold(
appBar: AppBar(title: Text(l10n.rulesTitle)),
body: FondoFarolero(
intenso: true,
child: SafeArea(
top: false,
child: SingleChildScrollView(
padding: const EdgeInsets.fromLTRB(16, 12, 16, 28),
child: Center(
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 620),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
EncabezadoFarolero(
icono: Icons.menu_book_rounded,
titulo: l10n.rulesTitle,
subtitulo: l10n.rulesWhatIsBody,
),
const SizedBox(height: 16),
_seccion(context, 1, Icons.person_search, l10n.rulesWhatIsTitle, l10n.rulesWhatIsBody),
_seccion(context, 2, Icons.chat_bubble, l10n.rulesHowToPlayTitle, l10n.rulesHowToPlayBody),
_seccion(context, 3, Icons.how_to_vote, l10n.rulesWhoWinsTitle, l10n.rulesWhoWinsBody),
_seccion(context, 4, Icons.lightbulb, l10n.rulesTipsPlayersTitle, l10n.rulesTipsPlayersBody),
_seccion(context, 5, Icons.theater_comedy, l10n.rulesTipsImpostorTitle, l10n.rulesTipsImpostorBody),
_seccion(context, 6, Icons.devices, l10n.rulesModesTitle, l10n.rulesModesBody),
_ejemplo(context, l10n.rulesExampleTitle, l10n.rulesExampleBody),
],
),
),
),
),
),
),
);
}
Widget _seccion(BuildContext context, int numero, IconData icono, String titulo, String contenido) {
return Padding(
padding: const EdgeInsets.only(bottom: 14),
child: PanelFarolero(
padding: const EdgeInsets.fromLTRB(14, 14, 14, 16),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 54,
height: 54,
alignment: Alignment.center,
decoration: BoxDecoration(
color: TemaApp.colorNaranja.withValues(alpha: 0.16),
borderRadius: BorderRadius.circular(16),
border: Border.all(color: TemaApp.colorNaranja),
),
child: Icon(icono, color: TemaApp.colorNaranja, size: 30),
),
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'$numero. ${titulo.toUpperCase()}',
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(height: 8),
Text(
contenido,
style: Theme.of(context).textTheme.bodyLarge?.copyWith(height: 1.45),
),
],
),
),
],
),
),
);
}
Widget _ejemplo(BuildContext context, String titulo, String contenido) {
return Padding(
padding: const EdgeInsets.only(bottom: 16),
child: PanelFarolero(
color: TemaApp.colorNaranja.withValues(alpha: 0.15),
borderColor: TemaApp.colorNaranja,
padding: const EdgeInsets.fromLTRB(18, 18, 18, 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
titulo,
style: Theme.of(context).textTheme.titleLarge?.copyWith(color: TemaApp.colorNaranja),
),
const SizedBox(height: 8),
Text(
contenido,
style: Theme.of(context).textTheme.bodyLarge?.copyWith(height: 1.45),
),
],
),
),
);
}
}