Preserve Flutter mirror-os codebase
This commit is contained in:
@@ -0,0 +1,513 @@
|
||||
import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:mirror_protocol/mirror_protocol.dart';
|
||||
import 'package:mirror_ui/mirror_ui.dart';
|
||||
import '../providers/display_state_provider.dart';
|
||||
import '../providers/layout_provider.dart';
|
||||
|
||||
class DashboardScreen extends ConsumerStatefulWidget {
|
||||
const DashboardScreen({super.key});
|
||||
|
||||
@override
|
||||
ConsumerState<DashboardScreen> createState() => _DashboardScreenState();
|
||||
}
|
||||
|
||||
class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
late Stream<DateTime> _clockStream;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_clockStream = Stream.periodic(
|
||||
const Duration(seconds: 1),
|
||||
(_) => DateTime.now(),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final layoutAsync = ref.watch(layoutProvider);
|
||||
|
||||
return Container(
|
||||
color: MirrorTheme.background,
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
child: layoutAsync.when(
|
||||
loading: () => const Center(
|
||||
child: CircularProgressIndicator(color: MirrorTheme.accent),
|
||||
),
|
||||
error: (_, __) => _buildWithLayout(DashboardLayoutConfig.defaultLayout()),
|
||||
data: (layout) => _buildWithLayout(layout),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildWithLayout(DashboardLayoutConfig layout) {
|
||||
final visibleWidgets = layout.widgets
|
||||
.where((w) => w.visible)
|
||||
.toList()
|
||||
..sort((a, b) => a.position.compareTo(b.position));
|
||||
|
||||
return SingleChildScrollView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 80, vertical: 60),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
for (int i = 0; i < visibleWidgets.length; i++) ...[
|
||||
if (i > 0) const SizedBox(height: 32),
|
||||
_buildWidget(visibleWidgets[i]),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildWidget(DashboardWidgetConfig widget) {
|
||||
return switch (widget.type) {
|
||||
'clock' => _ClockWidget(clockStream: _clockStream),
|
||||
'weather' => _WeatherWidget(config: widget.config),
|
||||
'calendar' => const _CalendarWidget(),
|
||||
'ha_entities' => _HaEntitiesWidget(config: widget.config),
|
||||
'now_playing' => const _NowPlayingWidget(),
|
||||
_ => const SizedBox.shrink(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// --- Clock Widget ---
|
||||
|
||||
class _ClockWidget extends StatelessWidget {
|
||||
final Stream<DateTime> clockStream;
|
||||
|
||||
const _ClockWidget({required this.clockStream});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return StreamBuilder<DateTime>(
|
||||
stream: clockStream,
|
||||
builder: (context, snapshot) {
|
||||
final now = snapshot.data ?? DateTime.now();
|
||||
return Column(
|
||||
children: [
|
||||
Text(
|
||||
_formatDate(now),
|
||||
style: Theme.of(context).textTheme.headlineSmall?.copyWith(
|
||||
color: MirrorTheme.textSecondary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
_formatTime(now),
|
||||
style: Theme.of(context).textTheme.displayLarge?.copyWith(
|
||||
fontSize: 120,
|
||||
fontWeight: FontWeight.w300,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
String _formatTime(DateTime dt) {
|
||||
final hour = dt.hour > 12 ? dt.hour - 12 : (dt.hour == 0 ? 12 : dt.hour);
|
||||
final min = dt.minute.toString().padLeft(2, '0');
|
||||
return '$hour:$min';
|
||||
}
|
||||
|
||||
String _formatDate(DateTime dt) {
|
||||
const days = [
|
||||
'Sunday', 'Monday', 'Tuesday', 'Wednesday',
|
||||
'Thursday', 'Friday', 'Saturday',
|
||||
];
|
||||
const months = [
|
||||
'January', 'February', 'March', 'April', 'May', 'June',
|
||||
'July', 'August', 'September', 'October', 'November', 'December',
|
||||
];
|
||||
return '${days[dt.weekday % 7]}, ${months[dt.month - 1]} ${dt.day}';
|
||||
}
|
||||
}
|
||||
|
||||
// --- Weather Widget ---
|
||||
|
||||
class _WeatherWidget extends ConsumerWidget {
|
||||
final Map<String, dynamic> config;
|
||||
|
||||
const _WeatherWidget({required this.config});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final dashboard =
|
||||
ref.watch(displayStateProvider.select((s) => s.dashboard));
|
||||
final weather = dashboard.weather;
|
||||
|
||||
final temp = weather?.temp ?? 72.0;
|
||||
final condition = weather?.condition ?? 'clear';
|
||||
final humidity = weather?.humidity ?? 45;
|
||||
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(32),
|
||||
decoration: BoxDecoration(
|
||||
color: MirrorTheme.surface,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
_weatherIcon(condition),
|
||||
size: 56,
|
||||
color: MirrorTheme.accent,
|
||||
),
|
||||
const SizedBox(width: 32),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'${temp.round()}°',
|
||||
style: Theme.of(context).textTheme.displaySmall?.copyWith(
|
||||
fontWeight: FontWeight.w300,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
_capitalizeCondition(condition),
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
color: MirrorTheme.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(width: 48),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.water_drop_outlined,
|
||||
size: 20, color: MirrorTheme.textMuted),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'$humidity%',
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
color: MirrorTheme.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
IconData _weatherIcon(String condition) => switch (condition.toLowerCase()) {
|
||||
'clear' || 'sunny' => Icons.wb_sunny,
|
||||
'cloudy' || 'overcast' => Icons.cloud,
|
||||
'partlycloudy' || 'partly_cloudy' => Icons.cloud_queue,
|
||||
'rainy' || 'rain' => Icons.water_drop,
|
||||
'snowy' || 'snow' => Icons.ac_unit,
|
||||
'stormy' || 'thunderstorm' => Icons.flash_on,
|
||||
'foggy' || 'fog' => Icons.blur_on,
|
||||
'windy' => Icons.air,
|
||||
_ => Icons.wb_sunny,
|
||||
};
|
||||
|
||||
String _capitalizeCondition(String condition) {
|
||||
if (condition.isEmpty) return '';
|
||||
return condition[0].toUpperCase() + condition.substring(1);
|
||||
}
|
||||
}
|
||||
|
||||
// --- Calendar Widget ---
|
||||
|
||||
class _CalendarWidget extends ConsumerWidget {
|
||||
const _CalendarWidget();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final events = ref.watch(
|
||||
displayStateProvider.select((s) => s.dashboard.calendarEvents));
|
||||
|
||||
if (events.isEmpty) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(32),
|
||||
decoration: BoxDecoration(
|
||||
color: MirrorTheme.surface,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'No upcoming events',
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
color: MirrorTheme.textMuted,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(24),
|
||||
decoration: BoxDecoration(
|
||||
color: MirrorTheme.surface,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.calendar_today,
|
||||
size: 20, color: MirrorTheme.accent),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
'UPCOMING',
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: MirrorTheme.accent,
|
||||
letterSpacing: 2,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
...events.take(3).map((event) => Padding(
|
||||
padding: const EdgeInsets.only(bottom: 16),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (event.startTime.isNotEmpty)
|
||||
SizedBox(
|
||||
width: 80,
|
||||
child: Text(
|
||||
_formatEventTime(event.startTime),
|
||||
style:
|
||||
Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
fontFamily: MirrorTheme.fontMono,
|
||||
color: MirrorTheme.textSecondary,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (event.startTime.isNotEmpty) const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Text(
|
||||
event.summary,
|
||||
style: Theme.of(context).textTheme.bodyLarge,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String _formatEventTime(String isoTime) {
|
||||
try {
|
||||
final dt = DateTime.parse(isoTime);
|
||||
final hour =
|
||||
dt.hour > 12 ? dt.hour - 12 : (dt.hour == 0 ? 12 : dt.hour);
|
||||
final min = dt.minute.toString().padLeft(2, '0');
|
||||
final period = dt.hour >= 12 ? 'PM' : 'AM';
|
||||
return '$hour:$min $period';
|
||||
} catch (_) {
|
||||
return isoTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- HA Entities Widget ---
|
||||
|
||||
class _HaEntitiesWidget extends ConsumerWidget {
|
||||
final Map<String, dynamic> config;
|
||||
|
||||
const _HaEntitiesWidget({required this.config});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final haEntities =
|
||||
ref.watch(displayStateProvider.select((s) => s.dashboard.haEntities));
|
||||
|
||||
// Filter to only show entities listed in widget config
|
||||
final configuredEntities =
|
||||
(config['entities'] as List<dynamic>?)?.cast<String>() ?? [];
|
||||
|
||||
final entitiesToShow = configuredEntities.isEmpty
|
||||
? haEntities
|
||||
: haEntities.where((e) {
|
||||
final id = e['entity_id'] as String? ?? '';
|
||||
return configuredEntities.contains(id);
|
||||
}).toList();
|
||||
|
||||
if (entitiesToShow.isEmpty) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(32),
|
||||
decoration: BoxDecoration(
|
||||
color: MirrorTheme.surface,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'No entities configured',
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
color: MirrorTheme.textMuted,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(24),
|
||||
decoration: BoxDecoration(
|
||||
color: MirrorTheme.surface,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.sensors, size: 20, color: MirrorTheme.accent),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
'HOME',
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: MirrorTheme.accent,
|
||||
letterSpacing: 2,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
...entitiesToShow.map((entity) {
|
||||
final attrs =
|
||||
(entity['attributes'] as Map<String, dynamic>?) ?? {};
|
||||
final friendlyName =
|
||||
attrs['friendly_name'] as String? ??
|
||||
(entity['entity_id'] as String? ?? '');
|
||||
final stateValue = entity['state'] as String? ?? 'unknown';
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 12),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
friendlyName,
|
||||
style: Theme.of(context).textTheme.bodyLarge,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Text(
|
||||
stateValue,
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
color: MirrorTheme.accent,
|
||||
fontFamily: MirrorTheme.fontMono,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// --- Now Playing Widget ---
|
||||
|
||||
class _NowPlayingWidget extends ConsumerWidget {
|
||||
const _NowPlayingWidget();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final playback = ref.watch(displayStateProvider.select((s) => s.playback));
|
||||
final spotify = ref.watch(displayStateProvider.select((s) => s.spotify));
|
||||
|
||||
// Show nothing if nothing is playing
|
||||
final hasPlayback = playback != null && playback.isPlaying;
|
||||
final hasSpotify = spotify != null && spotify.isPlaying;
|
||||
|
||||
if (!hasPlayback && !hasSpotify) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
|
||||
final title = hasSpotify
|
||||
? (spotify.trackName ?? 'Unknown Track')
|
||||
: (playback?.title ?? '');
|
||||
final subtitle = hasSpotify ? (spotify.artistName ?? '') : '';
|
||||
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(24),
|
||||
decoration: BoxDecoration(
|
||||
color: MirrorTheme.surface,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 48,
|
||||
height: 48,
|
||||
decoration: BoxDecoration(
|
||||
color: MirrorTheme.accentDim,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.music_note,
|
||||
color: MirrorTheme.accent,
|
||||
size: 24,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
if (subtitle.isNotEmpty) ...[
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
subtitle,
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: MirrorTheme.textSecondary,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
const Icon(
|
||||
Icons.play_circle_filled,
|
||||
color: MirrorTheme.accent,
|
||||
size: 32,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,298 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:media_kit_video/media_kit_video.dart';
|
||||
import 'package:mirror_protocol/mirror_protocol.dart';
|
||||
import 'package:mirror_ui/mirror_ui.dart';
|
||||
import '../providers/display_state_provider.dart';
|
||||
import '../providers/player_provider.dart';
|
||||
|
||||
class MediaScreen extends ConsumerWidget {
|
||||
const MediaScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final playback = ref.watch(displayStateProvider.select((s) => s.playback));
|
||||
final spotify = ref.watch(displayStateProvider.select((s) => s.spotify));
|
||||
|
||||
// Spotify playback
|
||||
if (spotify != null && spotify.trackName != null) {
|
||||
return _buildSpotify(context, spotify);
|
||||
}
|
||||
|
||||
// Video playback (YouTube / Plex)
|
||||
if (playback != null && playback.source != MediaSource.workout) {
|
||||
return _buildVideoPlayback(context, ref, playback);
|
||||
}
|
||||
|
||||
// Nothing playing
|
||||
return Container(
|
||||
color: MirrorTheme.background,
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(Icons.music_note, size: 64, color: MirrorTheme.textMuted),
|
||||
const SizedBox(height: 24),
|
||||
Text(
|
||||
'Nothing playing',
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
color: MirrorTheme.textMuted,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSpotify(BuildContext context, SpotifyState spotify) {
|
||||
final progress = spotify.durationMs > 0
|
||||
? spotify.progressMs / spotify.durationMs
|
||||
: 0.0;
|
||||
|
||||
return Container(
|
||||
color: MirrorTheme.background,
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 80),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
// Source indicator
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(Icons.music_note, size: 20, color: MirrorTheme.accent),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'SPOTIFY',
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: MirrorTheme.accent,
|
||||
letterSpacing: 2,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 40),
|
||||
// Album art
|
||||
if (spotify.albumImageUrl != null)
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
child: Image.network(
|
||||
spotify.albumImageUrl!,
|
||||
width: 400,
|
||||
height: 400,
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (_, __, ___) => _albumArtPlaceholder(),
|
||||
),
|
||||
)
|
||||
else
|
||||
_albumArtPlaceholder(),
|
||||
const SizedBox(height: 60),
|
||||
// Track name
|
||||
Text(
|
||||
spotify.trackName ?? '',
|
||||
style: Theme.of(context).textTheme.headlineLarge,
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
// Artist name
|
||||
Text(
|
||||
spotify.artistName ?? '',
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
color: MirrorTheme.textSecondary,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 40),
|
||||
// Progress bar
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
child: LinearProgressIndicator(
|
||||
value: progress,
|
||||
minHeight: 4,
|
||||
backgroundColor: MirrorTheme.surfaceLight,
|
||||
color: MirrorTheme.accent,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
_formatDuration(Duration(milliseconds: spotify.progressMs)),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
fontFamily: MirrorTheme.fontMono,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
_formatDuration(Duration(milliseconds: spotify.durationMs)),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
fontFamily: MirrorTheme.fontMono,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 40),
|
||||
Icon(
|
||||
spotify.isPlaying ? Icons.pause_circle_filled : Icons.play_circle_filled,
|
||||
size: 72,
|
||||
color: MirrorTheme.textPrimary,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildVideoPlayback(BuildContext context, WidgetRef ref, PlaybackState playback) {
|
||||
final progress = playback.duration.inMilliseconds > 0
|
||||
? playback.position.inMilliseconds / playback.duration.inMilliseconds
|
||||
: 0.0;
|
||||
|
||||
return Container(
|
||||
color: Colors.black,
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
child: Stack(
|
||||
children: [
|
||||
// Video output
|
||||
Consumer(
|
||||
builder: (context, ref, _) {
|
||||
final controller = ref.watch(videoControllerProvider);
|
||||
return Video(controller: controller);
|
||||
},
|
||||
),
|
||||
|
||||
// Paused indicator
|
||||
if (!playback.isPlaying)
|
||||
const Center(
|
||||
child: Icon(Icons.pause_circle_filled, size: 120, color: Colors.white70),
|
||||
),
|
||||
|
||||
// Source indicator top-left
|
||||
Positioned(
|
||||
top: 30,
|
||||
left: 30,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black54,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
_sourceIcon(playback.source),
|
||||
size: 18,
|
||||
color: MirrorTheme.accent,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
playback.source.toJson().toUpperCase(),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: MirrorTheme.accent,
|
||||
letterSpacing: 1,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Bottom overlay
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(40),
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [Colors.transparent, Colors.black87],
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
playback.title,
|
||||
style: Theme.of(context).textTheme.headlineMedium,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
child: LinearProgressIndicator(
|
||||
value: progress,
|
||||
minHeight: 4,
|
||||
backgroundColor: Colors.white24,
|
||||
color: MirrorTheme.accent,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
_formatDuration(playback.position),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
fontFamily: MirrorTheme.fontMono,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
_formatDuration(playback.duration),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
fontFamily: MirrorTheme.fontMono,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _albumArtPlaceholder() {
|
||||
return Container(
|
||||
width: 400,
|
||||
height: 400,
|
||||
decoration: BoxDecoration(
|
||||
color: MirrorTheme.surface,
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.music_note,
|
||||
size: 120,
|
||||
color: MirrorTheme.textMuted,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
IconData _sourceIcon(MediaSource source) => switch (source) {
|
||||
MediaSource.youtube => Icons.smart_display,
|
||||
MediaSource.plex => Icons.movie,
|
||||
MediaSource.local => Icons.folder,
|
||||
_ => Icons.music_note,
|
||||
};
|
||||
|
||||
String _formatDuration(Duration d) {
|
||||
final minutes = d.inMinutes;
|
||||
final seconds = (d.inSeconds % 60).toString().padLeft(2, '0');
|
||||
return '$minutes:$seconds';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class StandbyScreen extends StatelessWidget {
|
||||
const StandbyScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const ColoredBox(
|
||||
color: Colors.black,
|
||||
child: SizedBox.expand(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,512 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:media_kit_video/media_kit_video.dart';
|
||||
import 'package:mirror_protocol/mirror_protocol.dart';
|
||||
import 'package:mirror_ui/mirror_ui.dart';
|
||||
import '../providers/display_state_provider.dart';
|
||||
import '../providers/player_provider.dart';
|
||||
|
||||
class WorkoutScreen extends ConsumerWidget {
|
||||
const WorkoutScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final workout = ref.watch(displayStateProvider.select((s) => s.workout));
|
||||
final program = ref.watch(displayStateProvider.select((s) => s.program));
|
||||
final playback = ref.watch(displayStateProvider.select((s) => s.playback));
|
||||
|
||||
// Program session takes priority if active
|
||||
if (program != null && program.phase != 'completed') {
|
||||
return _buildProgramSession(context, ref, program, playback);
|
||||
}
|
||||
|
||||
if (workout == null || workout.phase == WorkoutPhase.idle) {
|
||||
return _buildIdle(context);
|
||||
}
|
||||
|
||||
return switch (workout.phase) {
|
||||
WorkoutPhase.browsing => _buildBrowsing(context),
|
||||
WorkoutPhase.playing => _buildPlaying(context, workout, playback),
|
||||
WorkoutPhase.resting => _buildResting(context, workout),
|
||||
WorkoutPhase.completed => _buildCompleted(context),
|
||||
_ => _buildIdle(context),
|
||||
};
|
||||
}
|
||||
|
||||
// --- Program session rendering ---
|
||||
|
||||
Widget _buildProgramSession(
|
||||
BuildContext context,
|
||||
WidgetRef ref,
|
||||
ProgramSessionState program,
|
||||
PlaybackState? playback,
|
||||
) {
|
||||
return switch (program.phase) {
|
||||
'playing' => _buildProgramVideo(context, ref, program, playback),
|
||||
'youtube' => _buildProgramYouTube(context, program),
|
||||
'instruction' => _buildProgramInstruction(context, program),
|
||||
_ => _buildCompleted(context),
|
||||
};
|
||||
}
|
||||
|
||||
Widget _buildProgramVideo(
|
||||
BuildContext context,
|
||||
WidgetRef ref,
|
||||
ProgramSessionState program,
|
||||
PlaybackState? playback,
|
||||
) {
|
||||
if (playback == null) return _buildIdle(context);
|
||||
|
||||
final progress = playback.duration.inMilliseconds > 0
|
||||
? playback.position.inMilliseconds / playback.duration.inMilliseconds
|
||||
: 0.0;
|
||||
|
||||
return Container(
|
||||
color: Colors.black,
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
child: Stack(
|
||||
children: [
|
||||
Consumer(
|
||||
builder: (context, ref, _) {
|
||||
final controller = ref.watch(videoControllerProvider);
|
||||
return Video(controller: controller);
|
||||
},
|
||||
),
|
||||
if (playback.isPlaying == false)
|
||||
const Center(
|
||||
child: Icon(Icons.pause_circle_filled, size: 120, color: Colors.white70),
|
||||
),
|
||||
// Program info top-right
|
||||
Positioned(
|
||||
top: 30,
|
||||
right: 30,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black54,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
program.programName,
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: MirrorTheme.accent,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'Set ${program.currentSet}/${program.totalSets}',
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
// Bottom overlay with title and progress
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(40),
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [Colors.transparent, Colors.black87],
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
playback.title,
|
||||
style: Theme.of(context).textTheme.headlineMedium,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
child: LinearProgressIndicator(
|
||||
value: progress,
|
||||
minHeight: 4,
|
||||
backgroundColor: Colors.white24,
|
||||
color: MirrorTheme.accent,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'${_formatDuration(playback.position)} / ${_formatDuration(playback.duration)}',
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
fontFamily: MirrorTheme.fontMono,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_buildProgramProgressBar(context, program),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildProgramYouTube(BuildContext context, ProgramSessionState program) {
|
||||
return Container(
|
||||
color: MirrorTheme.background,
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
child: Stack(
|
||||
children: [
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 80),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(Icons.smart_display, size: 64, color: MirrorTheme.accent),
|
||||
const SizedBox(height: 24),
|
||||
Text(
|
||||
program.workoutName,
|
||||
style: Theme.of(context).textTheme.headlineSmall?.copyWith(
|
||||
color: MirrorTheme.textSecondary,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 48),
|
||||
TimerDisplay(seconds: program.timerRemaining),
|
||||
const SizedBox(height: 32),
|
||||
Text(
|
||||
'Set ${program.currentSet}/${program.totalSets}',
|
||||
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
|
||||
color: MirrorTheme.textPrimary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'Follow along with YouTube reference',
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
color: MirrorTheme.textMuted,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
// Program progress at bottom
|
||||
Positioned(
|
||||
bottom: 40,
|
||||
left: 40,
|
||||
right: 40,
|
||||
child: _buildProgramProgressBar(context, program),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildProgramInstruction(BuildContext context, ProgramSessionState program) {
|
||||
return Container(
|
||||
color: MirrorTheme.background,
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
child: Stack(
|
||||
children: [
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 80),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
program.workoutName,
|
||||
style: Theme.of(context).textTheme.headlineSmall?.copyWith(
|
||||
color: MirrorTheme.textSecondary,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 48),
|
||||
TimerDisplay(seconds: program.timerRemaining),
|
||||
const SizedBox(height: 32),
|
||||
Text(
|
||||
'Set ${program.currentSet}/${program.totalSets}',
|
||||
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
|
||||
color: MirrorTheme.textPrimary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'${program.currentExerciseIndex + 1} of ${program.exercises.length}',
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
color: MirrorTheme.textMuted,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
// Program progress at bottom
|
||||
Positioned(
|
||||
bottom: 40,
|
||||
left: 40,
|
||||
right: 40,
|
||||
child: _buildProgramProgressBar(context, program),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildProgramProgressBar(BuildContext context, ProgramSessionState program) {
|
||||
final total = program.exercises.length;
|
||||
if (total == 0) return const SizedBox.shrink();
|
||||
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
child: SizedBox(
|
||||
height: 8,
|
||||
child: Row(
|
||||
children: List.generate(total, (i) {
|
||||
final Color color;
|
||||
if (i < program.currentExerciseIndex) {
|
||||
color = MirrorTheme.success; // completed
|
||||
} else if (i == program.currentExerciseIndex) {
|
||||
color = MirrorTheme.accent; // current
|
||||
} else {
|
||||
color = MirrorTheme.surfaceLight; // remaining
|
||||
}
|
||||
return Expanded(
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(right: i < total - 1 ? 2 : 0),
|
||||
color: color,
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// --- Standard workout rendering ---
|
||||
|
||||
Widget _buildIdle(BuildContext context) {
|
||||
return Container(
|
||||
color: MirrorTheme.background,
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(Icons.fitness_center, size: 64, color: MirrorTheme.textMuted),
|
||||
const SizedBox(height: 24),
|
||||
Text(
|
||||
'Browse workouts on your phone',
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
color: MirrorTheme.textMuted,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'mirror.local:9090',
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: MirrorTheme.accent,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBrowsing(BuildContext context) {
|
||||
return Container(
|
||||
color: MirrorTheme.background,
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(Icons.phone_android, size: 48, color: MirrorTheme.accent),
|
||||
const SizedBox(height: 24),
|
||||
Text(
|
||||
'Select a workout on your phone',
|
||||
style: Theme.of(context).textTheme.headlineMedium,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPlaying(BuildContext context, WorkoutSessionState workout, PlaybackState? playback) {
|
||||
if (playback == null) return _buildIdle(context);
|
||||
|
||||
final progress = playback.duration.inMilliseconds > 0
|
||||
? playback.position.inMilliseconds / playback.duration.inMilliseconds
|
||||
: 0.0;
|
||||
|
||||
return Container(
|
||||
color: Colors.black,
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
child: Stack(
|
||||
children: [
|
||||
// Real video output
|
||||
Consumer(
|
||||
builder: (context, ref, _) {
|
||||
final controller = ref.watch(videoControllerProvider);
|
||||
return Video(controller: controller);
|
||||
},
|
||||
),
|
||||
|
||||
// Paused indicator
|
||||
if (!playback.isPlaying)
|
||||
const Center(
|
||||
child: Icon(Icons.pause_circle_filled, size: 120, color: Colors.white70),
|
||||
),
|
||||
|
||||
// Queue indicator
|
||||
if (workout.queue.length > 1)
|
||||
Positioned(
|
||||
top: 30,
|
||||
right: 30,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black54,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Text(
|
||||
'${workout.currentIndex + 1} / ${workout.queue.length}',
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Bottom overlay
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(40),
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [Colors.transparent, Colors.black87],
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
playback.title,
|
||||
style: Theme.of(context).textTheme.headlineMedium,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
child: LinearProgressIndicator(
|
||||
value: progress,
|
||||
minHeight: 4,
|
||||
backgroundColor: Colors.white24,
|
||||
color: MirrorTheme.accent,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'${_formatDuration(playback.position)} / ${_formatDuration(playback.duration)}',
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
fontFamily: MirrorTheme.fontMono,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildResting(BuildContext context, WorkoutSessionState workout) {
|
||||
final nextTitle = workout.currentIndex < workout.queue.length
|
||||
? workout.queue[workout.currentIndex].title
|
||||
: '';
|
||||
|
||||
return Container(
|
||||
color: MirrorTheme.background,
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
'REST',
|
||||
style: Theme.of(context).textTheme.labelLarge?.copyWith(
|
||||
color: MirrorTheme.accent,
|
||||
letterSpacing: 8,
|
||||
fontSize: 24,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 40),
|
||||
TimerDisplay(seconds: workout.restRemaining),
|
||||
const SizedBox(height: 40),
|
||||
if (nextTitle.isNotEmpty)
|
||||
Text(
|
||||
'Up next: $nextTitle',
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
color: MirrorTheme.textMuted,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCompleted(BuildContext context) {
|
||||
return Container(
|
||||
color: MirrorTheme.background,
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(Icons.check_circle, size: 96, color: MirrorTheme.success),
|
||||
const SizedBox(height: 24),
|
||||
Text(
|
||||
'DONE',
|
||||
style: Theme.of(context).textTheme.displaySmall?.copyWith(
|
||||
color: MirrorTheme.success,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
'Session complete',
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
color: MirrorTheme.textMuted,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String _formatDuration(Duration d) {
|
||||
final minutes = d.inMinutes;
|
||||
final seconds = (d.inSeconds % 60).toString().padLeft(2, '0');
|
||||
return '$minutes:$seconds';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user