Files
philip b239ae3e5f Initial commit: Flutter app + PHP/MySQL backend on Hostinger
Replaces Firebase with a self-hosted PHP/MySQL API served from
winded.prymsolutions.com. Includes full backend (schema, auth, events,
teams, brackets, suggestions, stats, media, file upload) and updated
Flutter repositories and domain models.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 20:13:57 -07:00

74 lines
2.0 KiB
Dart

import 'package:flutter/material.dart';
/// Toggle button representing the current user's registration state for an
/// event. Local-state only for now — a future revision will wire this to
/// Firestore via the events repository.
class RegistrationButton extends StatefulWidget {
const RegistrationButton({
super.key,
this.initiallyRegistered = false,
this.enabled = true,
this.fullWidth = false,
this.onChanged,
});
final bool initiallyRegistered;
final bool enabled;
final bool fullWidth;
final ValueChanged<bool>? onChanged;
@override
State<RegistrationButton> createState() => _RegistrationButtonState();
}
class _RegistrationButtonState extends State<RegistrationButton> {
late bool _registered;
@override
void initState() {
super.initState();
_registered = widget.initiallyRegistered;
}
void _toggle() {
setState(() => _registered = !_registered);
widget.onChanged?.call(_registered);
}
@override
Widget build(BuildContext context) {
final scheme = Theme.of(context).colorScheme;
final child = _registered
? OutlinedButton.icon(
onPressed: widget.enabled ? _toggle : null,
icon: Icon(Icons.check_circle, color: scheme.primary),
label: const Text('Registered'),
style: OutlinedButton.styleFrom(
foregroundColor: scheme.primary,
side: BorderSide(color: scheme.primary),
padding: const EdgeInsets.symmetric(
horizontal: 20,
vertical: 14,
),
),
)
: FilledButton.icon(
onPressed: widget.enabled ? _toggle : null,
icon: const Icon(Icons.how_to_reg),
label: const Text('Register'),
style: FilledButton.styleFrom(
padding: const EdgeInsets.symmetric(
horizontal: 20,
vertical: 14,
),
),
);
if (widget.fullWidth) {
return SizedBox(width: double.infinity, child: child);
}
return child;
}
}