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>
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
/// Immutable domain model for a highlight video entry on the Media screen.
|
||||
///
|
||||
/// [thumbnailUrl] is nullable so the UI can render a placeholder when no
|
||||
/// thumbnail is available — common while highlights are still being uploaded.
|
||||
class Highlight {
|
||||
const Highlight({
|
||||
required this.id,
|
||||
required this.title,
|
||||
required this.description,
|
||||
required this.youtubeUrl,
|
||||
required this.publishedAt,
|
||||
this.thumbnailUrl,
|
||||
});
|
||||
|
||||
final String id;
|
||||
final String title;
|
||||
final String description;
|
||||
final String youtubeUrl;
|
||||
final String? thumbnailUrl;
|
||||
final DateTime publishedAt;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(this, other)) return true;
|
||||
if (other is! Highlight) return false;
|
||||
return other.id == id &&
|
||||
other.title == title &&
|
||||
other.description == description &&
|
||||
other.youtubeUrl == youtubeUrl &&
|
||||
other.thumbnailUrl == thumbnailUrl &&
|
||||
other.publishedAt == publishedAt;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
id,
|
||||
title,
|
||||
description,
|
||||
youtubeUrl,
|
||||
thumbnailUrl,
|
||||
publishedAt,
|
||||
);
|
||||
|
||||
@override
|
||||
String toString() => 'Highlight(id: $id, title: $title)';
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/// Social platforms surfaced on the Media screen. The enum values are stable
|
||||
/// identifiers used for icon mapping and snackbar copy.
|
||||
enum SocialPlatform { instagram, youtube, twitter, tiktok }
|
||||
|
||||
/// Immutable domain model for a single social media link card on the Media
|
||||
/// screen. Pairs a [platform] with the community's [handle], a deep [url],
|
||||
/// and a friendly [displayName].
|
||||
class MediaLink {
|
||||
const MediaLink({
|
||||
required this.platform,
|
||||
required this.handle,
|
||||
required this.url,
|
||||
required this.displayName,
|
||||
});
|
||||
|
||||
final SocialPlatform platform;
|
||||
final String handle;
|
||||
final String url;
|
||||
final String displayName;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(this, other)) return true;
|
||||
if (other is! MediaLink) return false;
|
||||
return other.platform == platform &&
|
||||
other.handle == handle &&
|
||||
other.url == url &&
|
||||
other.displayName == displayName;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(platform, handle, url, displayName);
|
||||
|
||||
@override
|
||||
String toString() => 'MediaLink($platform, $handle)';
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
import '../domain/highlight.dart';
|
||||
import '../domain/media_link.dart';
|
||||
|
||||
/// Repository for the Media screen content.
|
||||
///
|
||||
/// All content is static for the MVP — social handles and highlight metadata
|
||||
/// rarely change and don't justify a Firestore round-trip. Future Phase 2
|
||||
/// work can swap these getters for a Firestore-backed source if needed
|
||||
/// (e.g. an admin-editable `media_links` collection).
|
||||
class MediaRepository {
|
||||
const MediaRepository();
|
||||
|
||||
/// Social media accounts featured at the top of the Media screen.
|
||||
static const List<MediaLink> socialLinks = <MediaLink>[
|
||||
MediaLink(
|
||||
platform: SocialPlatform.instagram,
|
||||
handle: '@windedfc_official',
|
||||
url: 'https://instagram.com/windedfc_official',
|
||||
displayName: 'Instagram',
|
||||
),
|
||||
MediaLink(
|
||||
platform: SocialPlatform.youtube,
|
||||
handle: 'Winded FC',
|
||||
url: 'https://youtube.com/@windedfc',
|
||||
displayName: 'YouTube',
|
||||
),
|
||||
MediaLink(
|
||||
platform: SocialPlatform.twitter,
|
||||
handle: '@windedfc',
|
||||
url: 'https://twitter.com/windedfc',
|
||||
displayName: 'Twitter / X',
|
||||
),
|
||||
MediaLink(
|
||||
platform: SocialPlatform.tiktok,
|
||||
handle: '@windedfc',
|
||||
url: 'https://tiktok.com/@windedfc',
|
||||
displayName: 'TikTok',
|
||||
),
|
||||
];
|
||||
|
||||
/// Highlight reels surfaced in the Media screen feed. Ordered newest first
|
||||
/// to match how the UI presents them.
|
||||
static final List<Highlight> highlights = <Highlight>[
|
||||
Highlight(
|
||||
id: 'highlight_summer_kickoff_final',
|
||||
title: 'Summer Kickoff 7v7 – Final Highlights',
|
||||
description:
|
||||
'Green Eagles vs. Red Lions went the distance — extra time, a '
|
||||
'goal-line clearance, and a winner from 30 yards. Catch every '
|
||||
'turning point from the championship match.',
|
||||
youtubeUrl: 'https://youtube.com/watch?v=winded_summer_final',
|
||||
publishedAt: DateTime(2026, 5, 10),
|
||||
),
|
||||
Highlight(
|
||||
id: 'highlight_best_goals_may_2026',
|
||||
title: 'Best Goals of the Month – May 2026',
|
||||
description:
|
||||
'Ten goals, one tape. Volleys, scorpion kicks, and a half-pitch '
|
||||
'lob — our community voted, and these are the May standouts.',
|
||||
youtubeUrl: 'https://youtube.com/watch?v=winded_may_goals',
|
||||
publishedAt: DateTime(2026, 5, 6),
|
||||
),
|
||||
Highlight(
|
||||
id: 'highlight_wednesday_pickup',
|
||||
title: 'Wednesday Night Pick-Up – Top Moments',
|
||||
description:
|
||||
'No standings, no pressure — just the best plays from this week\'s '
|
||||
'open run at Riverside Park. Bring cleats and friends next time.',
|
||||
youtubeUrl: 'https://youtube.com/watch?v=winded_wed_pickup',
|
||||
publishedAt: DateTime(2026, 4, 30),
|
||||
),
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../infrastructure/media_repository.dart';
|
||||
import 'widgets/highlight_card.dart';
|
||||
import 'widgets/social_link_card.dart';
|
||||
|
||||
/// Top-level Media screen. Promotes community social presence above the fold
|
||||
/// and a feed of highlight reels below. Data is read directly from
|
||||
/// [MediaRepository] static getters — no Riverpod state since the content is
|
||||
/// hardcoded for the MVP.
|
||||
class MediaScreen extends StatelessWidget {
|
||||
const MediaScreen({super.key});
|
||||
|
||||
static const double _maxContentWidth = 760;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final socialLinks = MediaRepository.socialLinks;
|
||||
final highlights = MediaRepository.highlights;
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Media')),
|
||||
body: SafeArea(
|
||||
child: Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: _maxContentWidth),
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.fromLTRB(16, 16, 16, 32),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: <Widget>[
|
||||
_SectionHeader(
|
||||
title: 'Follow Us',
|
||||
subtitle: 'Stay connected on your favorite platform',
|
||||
textTheme: theme.textTheme,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
ListView.separated(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: socialLinks.length,
|
||||
separatorBuilder: (context, index) =>
|
||||
const SizedBox(height: 8),
|
||||
itemBuilder: (context, index) {
|
||||
return SocialLinkCard(link: socialLinks[index]);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const Divider(),
|
||||
const SizedBox(height: 16),
|
||||
_SectionHeader(
|
||||
title: 'Highlights',
|
||||
subtitle: 'Recent reels and top moments',
|
||||
textTheme: theme.textTheme,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
ListView.separated(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: highlights.length,
|
||||
separatorBuilder: (context, index) =>
|
||||
const SizedBox(height: 12),
|
||||
itemBuilder: (context, index) {
|
||||
return HighlightCard(highlight: highlights[index]);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _SectionHeader extends StatelessWidget {
|
||||
const _SectionHeader({
|
||||
required this.title,
|
||||
required this.subtitle,
|
||||
required this.textTheme,
|
||||
});
|
||||
|
||||
final String title;
|
||||
final String subtitle;
|
||||
final TextTheme textTheme;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 4),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
title,
|
||||
style: textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
subtitle,
|
||||
style: textTheme.bodySmall?.copyWith(
|
||||
color: scheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import '../../domain/highlight.dart';
|
||||
|
||||
/// Card for one highlight reel. Renders:
|
||||
/// * a 160px thumbnail area (placeholder until [Highlight.thumbnailUrl] is
|
||||
/// populated — Phase 2 will swap to `Image.network`)
|
||||
/// * the title, description (clipped to 2 lines), and published date
|
||||
/// * a "Watch on YouTube" outlined button that surfaces a snackbar
|
||||
/// placeholder; real launching ships with the `url_launcher` package.
|
||||
class HighlightCard extends StatelessWidget {
|
||||
const HighlightCard({super.key, required this.highlight});
|
||||
|
||||
final Highlight highlight;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final scheme = theme.colorScheme;
|
||||
final formattedDate = DateFormat.yMMMMd().format(highlight.publishedAt);
|
||||
|
||||
return Card(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
_Thumbnail(thumbnailUrl: highlight.thumbnailUrl),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 12, 16, 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
highlight.title,
|
||||
style: theme.textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
Text(
|
||||
highlight.description,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
color: scheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
Icons.calendar_today_outlined,
|
||||
size: 14,
|
||||
color: scheme.onSurfaceVariant,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
formattedDate,
|
||||
style: theme.textTheme.bodySmall?.copyWith(
|
||||
color: scheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: OutlinedButton.icon(
|
||||
onPressed: () => _handleWatch(context),
|
||||
icon: const Icon(Icons.play_arrow, size: 18),
|
||||
label: const Text('Watch on YouTube'),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _handleWatch(BuildContext context) {
|
||||
ScaffoldMessenger.of(context)
|
||||
..hideCurrentSnackBar()
|
||||
..showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Opening YouTube...'),
|
||||
duration: Duration(seconds: 2),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _Thumbnail extends StatelessWidget {
|
||||
const _Thumbnail({required this.thumbnailUrl});
|
||||
|
||||
final String? thumbnailUrl;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
|
||||
if (thumbnailUrl == null) {
|
||||
return Container(
|
||||
height: 160,
|
||||
width: double.infinity,
|
||||
color: scheme.surfaceContainerHighest,
|
||||
alignment: Alignment.center,
|
||||
child: Icon(
|
||||
Icons.play_circle_outline,
|
||||
size: 48,
|
||||
color: scheme.primary,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return SizedBox(
|
||||
height: 160,
|
||||
width: double.infinity,
|
||||
child: Image.network(
|
||||
thumbnailUrl!,
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (context, error, stackTrace) => Container(
|
||||
color: scheme.surfaceContainerHighest,
|
||||
alignment: Alignment.center,
|
||||
child: Icon(
|
||||
Icons.broken_image_outlined,
|
||||
size: 36,
|
||||
color: scheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
loadingBuilder: (context, child, progress) {
|
||||
if (progress == null) return child;
|
||||
return Container(
|
||||
color: scheme.surfaceContainerHighest,
|
||||
alignment: Alignment.center,
|
||||
child: const SizedBox(
|
||||
width: 24,
|
||||
height: 24,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../domain/media_link.dart';
|
||||
|
||||
/// Brand colors for each social platform. Hardcoded on purpose — these are
|
||||
/// the official platform brand colors, not theme tokens, so they remain
|
||||
/// recognisable regardless of the app's color scheme.
|
||||
const Map<SocialPlatform, Color> _platformAccent = <SocialPlatform, Color>{
|
||||
SocialPlatform.instagram: Color(0xFFE1306C),
|
||||
SocialPlatform.youtube: Color(0xFFFF0000),
|
||||
SocialPlatform.twitter: Color(0xFF1DA1F2),
|
||||
SocialPlatform.tiktok: Color(0xFF69C9D0),
|
||||
};
|
||||
|
||||
const Map<SocialPlatform, IconData> _platformIcon = <SocialPlatform, IconData>{
|
||||
SocialPlatform.instagram: Icons.photo_camera,
|
||||
SocialPlatform.youtube: Icons.play_circle_filled,
|
||||
SocialPlatform.twitter: Icons.tag,
|
||||
SocialPlatform.tiktok: Icons.music_note,
|
||||
};
|
||||
|
||||
/// Wide tappable card for a single social platform. Shows a brand-colored
|
||||
/// icon leading, the platform name + handle as the title/subtitle, and a
|
||||
/// trailing chevron. Tapping surfaces an "Opening …" snackbar — actual URL
|
||||
/// launching will be wired up once `url_launcher` is added to pubspec.
|
||||
class SocialLinkCard extends StatelessWidget {
|
||||
const SocialLinkCard({super.key, required this.link});
|
||||
|
||||
final MediaLink link;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final scheme = theme.colorScheme;
|
||||
final accent = _platformAccent[link.platform] ?? scheme.primary;
|
||||
final icon = _platformIcon[link.platform] ?? Icons.public;
|
||||
|
||||
return Card(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: ListTile(
|
||||
onTap: () => _handleTap(context),
|
||||
leading: Container(
|
||||
width: 44,
|
||||
height: 44,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: accent.withValues(alpha: 0.15),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(icon, color: accent, size: 24),
|
||||
),
|
||||
title: Text(
|
||||
link.displayName,
|
||||
style: theme.textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
subtitle: Text(
|
||||
link.handle,
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
color: scheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
trailing: Icon(
|
||||
Icons.chevron_right,
|
||||
color: scheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _handleTap(BuildContext context) {
|
||||
ScaffoldMessenger.of(context)
|
||||
..hideCurrentSnackBar()
|
||||
..showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Opening ${link.displayName}...'),
|
||||
duration: const Duration(seconds: 2),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user