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,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