Preserve Flutter mirror-os codebase
@@ -0,0 +1,45 @@
|
||||
# Miscellaneous
|
||||
*.class
|
||||
*.log
|
||||
*.pyc
|
||||
*.swp
|
||||
.DS_Store
|
||||
.atom/
|
||||
.build/
|
||||
.buildlog/
|
||||
.history
|
||||
.svn/
|
||||
.swiftpm/
|
||||
migrate_working_dir/
|
||||
|
||||
# IntelliJ related
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
.idea/
|
||||
|
||||
# The .vscode folder contains launch configuration and tasks you configure in
|
||||
# VS Code which you may wish to be included in version control, so this line
|
||||
# is commented out by default.
|
||||
#.vscode/
|
||||
|
||||
# Flutter/Dart/Pub related
|
||||
**/doc/api/
|
||||
**/ios/Flutter/.last_build_id
|
||||
.dart_tool/
|
||||
.flutter-plugins-dependencies
|
||||
.pub-cache/
|
||||
.pub/
|
||||
/build/
|
||||
/coverage/
|
||||
|
||||
# Symbolication related
|
||||
app.*.symbols
|
||||
|
||||
# Obfuscation related
|
||||
app.*.map.json
|
||||
|
||||
# Android Studio will place build artifacts here
|
||||
/android/app/debug
|
||||
/android/app/profile
|
||||
/android/app/release
|
||||
@@ -0,0 +1,30 @@
|
||||
# This file tracks properties of this Flutter project.
|
||||
# Used by Flutter tool to assess capabilities and perform upgrades etc.
|
||||
#
|
||||
# This file should be version controlled and should not be manually edited.
|
||||
|
||||
version:
|
||||
revision: "924134a44c189315be2148659913dda1671cbe99"
|
||||
channel: "stable"
|
||||
|
||||
project_type: app
|
||||
|
||||
# Tracks metadata for the flutter migrate command
|
||||
migration:
|
||||
platforms:
|
||||
- platform: root
|
||||
create_revision: 924134a44c189315be2148659913dda1671cbe99
|
||||
base_revision: 924134a44c189315be2148659913dda1671cbe99
|
||||
- platform: web
|
||||
create_revision: 924134a44c189315be2148659913dda1671cbe99
|
||||
base_revision: 924134a44c189315be2148659913dda1671cbe99
|
||||
|
||||
# User provided section
|
||||
|
||||
# List of Local paths (relative to this file) that should be
|
||||
# ignored by the migrate tool.
|
||||
#
|
||||
# Files that are not part of the templates will be ignored by default.
|
||||
unmanaged_files:
|
||||
- 'lib/main.dart'
|
||||
- 'ios/Runner.xcodeproj/project.pbxproj'
|
||||
@@ -0,0 +1,17 @@
|
||||
# mirror_display
|
||||
|
||||
A new Flutter project.
|
||||
|
||||
## Getting Started
|
||||
|
||||
This project is a starting point for a Flutter application.
|
||||
|
||||
A few resources to get you started if this is your first Flutter project:
|
||||
|
||||
- [Learn Flutter](https://docs.flutter.dev/get-started/learn-flutter)
|
||||
- [Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
|
||||
- [Flutter learning resources](https://docs.flutter.dev/reference/learning-resources)
|
||||
|
||||
For help getting started with Flutter development, view the
|
||||
[online documentation](https://docs.flutter.dev/), which offers tutorials,
|
||||
samples, guidance on mobile development, and a full API reference.
|
||||
@@ -0,0 +1,53 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.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 'screens/dashboard_screen.dart';
|
||||
import 'screens/workout_screen.dart';
|
||||
import 'screens/media_screen.dart';
|
||||
import 'screens/standby_screen.dart';
|
||||
|
||||
class MirrorDisplayApp extends ConsumerWidget {
|
||||
const MirrorDisplayApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final activeScreen = ref.watch(
|
||||
displayStateProvider.select((s) => s.activeScreen),
|
||||
);
|
||||
|
||||
return MaterialApp(
|
||||
title: 'Mirror OS',
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: MirrorTheme.dark,
|
||||
home: Scaffold(
|
||||
body: AnimatedSwitcher(
|
||||
duration: MirrorAnimations.screenTransitionDuration,
|
||||
transitionBuilder: MirrorAnimations.screenTransitionBuilder,
|
||||
child: _buildScreen(activeScreen),
|
||||
),
|
||||
),
|
||||
shortcuts: {
|
||||
LogicalKeySet(LogicalKeyboardKey.escape): const _ExitIntent(),
|
||||
},
|
||||
actions: {
|
||||
_ExitIntent: CallbackAction<_ExitIntent>(
|
||||
onInvoke: (_) => SystemNavigator.pop(),
|
||||
),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildScreen(ScreenType screen) => switch (screen) {
|
||||
ScreenType.dashboard => const DashboardScreen(key: ValueKey('dashboard')),
|
||||
ScreenType.workout => const WorkoutScreen(key: ValueKey('workout')),
|
||||
ScreenType.media => const MediaScreen(key: ValueKey('media')),
|
||||
ScreenType.standby => const StandbyScreen(key: ValueKey('standby')),
|
||||
};
|
||||
}
|
||||
|
||||
class _ExitIntent extends Intent {
|
||||
const _ExitIntent();
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:media_kit/media_kit.dart';
|
||||
import 'app.dart';
|
||||
import 'providers/layout_provider.dart';
|
||||
import 'services/ws_server.dart';
|
||||
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
MediaKit.ensureInitialized();
|
||||
|
||||
final container = ProviderContainer();
|
||||
|
||||
// Load layout from disk before starting WS server
|
||||
await container.read(layoutProvider.future);
|
||||
|
||||
final wsServer = container.read(wsServerProvider);
|
||||
await wsServer.start();
|
||||
|
||||
runApp(
|
||||
UncontrolledProviderScope(
|
||||
container: container,
|
||||
child: const MirrorDisplayApp(),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,921 @@
|
||||
import 'dart:async';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:mirror_protocol/mirror_protocol.dart';
|
||||
import 'package:mirror_core/mirror_core.dart';
|
||||
import '../services/ws_server.dart';
|
||||
import 'player_provider.dart';
|
||||
|
||||
final displayStateProvider =
|
||||
NotifierProvider<DisplayStateNotifier, DisplayState>(DisplayStateNotifier.new);
|
||||
|
||||
final youtubeServiceProvider = Provider<YouTubeService>((ref) {
|
||||
final service = YouTubeService();
|
||||
ref.onDispose(() => service.dispose());
|
||||
return service;
|
||||
});
|
||||
|
||||
final plexServiceProvider = Provider<PlexService>((ref) {
|
||||
const host = String.fromEnvironment('PLEX_HOST', defaultValue: '192.168.86.172');
|
||||
const port = int.fromEnvironment('PLEX_PORT', defaultValue: 32400);
|
||||
const token = String.fromEnvironment('PLEX_TOKEN', defaultValue: '');
|
||||
return PlexService(host: host, port: port, token: token);
|
||||
});
|
||||
|
||||
final spotifyServiceProvider = Provider<SpotifyService>((ref) {
|
||||
return SpotifyService();
|
||||
});
|
||||
|
||||
class DisplayStateNotifier extends Notifier<DisplayState> {
|
||||
Timer? _programTimer;
|
||||
|
||||
@override
|
||||
DisplayState build() => DisplayState.initial();
|
||||
|
||||
void navigate(ScreenType target) {
|
||||
state = state.copyWith(activeScreen: target);
|
||||
_broadcast();
|
||||
}
|
||||
|
||||
// --- Program handling ---
|
||||
|
||||
void handleProgram(ProgramAction action, Map<String, dynamic>? payload) {
|
||||
switch (action) {
|
||||
case ProgramAction.playWorkout:
|
||||
_startProgramWorkout(payload);
|
||||
case ProgramAction.skipExercise:
|
||||
_advanceProgramExercise(1);
|
||||
case ProgramAction.previousExercise:
|
||||
_advanceProgramExercise(-1);
|
||||
case ProgramAction.pauseExercise:
|
||||
_pauseProgramExercise();
|
||||
case ProgramAction.resumeExercise:
|
||||
_resumeProgramExercise();
|
||||
case ProgramAction.stopProgram:
|
||||
_stopProgram();
|
||||
case ProgramAction.browse:
|
||||
break;
|
||||
}
|
||||
_broadcast();
|
||||
}
|
||||
|
||||
void _startProgramWorkout(Map<String, dynamic>? payload) {
|
||||
if (payload == null) return;
|
||||
|
||||
final programId = payload['programId'] as String? ?? '';
|
||||
final programName = payload['programName'] as String? ?? '';
|
||||
final workoutName = payload['workoutName'] as String? ?? '';
|
||||
final rawExercises = payload['exercises'] as List<dynamic>? ?? [];
|
||||
|
||||
final exercises = rawExercises
|
||||
.map((e) => ProgramExercise.fromJson(e as Map<String, dynamic>))
|
||||
.toList();
|
||||
|
||||
if (exercises.isEmpty) return;
|
||||
|
||||
state = state.copyWith(
|
||||
activeScreen: ScreenType.workout,
|
||||
program: ProgramSessionState(
|
||||
programId: programId,
|
||||
programName: programName,
|
||||
workoutName: workoutName,
|
||||
exercises: exercises.map((e) => e.id).toList(),
|
||||
currentExerciseIndex: 0,
|
||||
phase: 'playing',
|
||||
currentSet: 1,
|
||||
totalSets: exercises.first.sets,
|
||||
),
|
||||
);
|
||||
|
||||
_playProgramExercise(exercises.first);
|
||||
}
|
||||
|
||||
void _playProgramExercise(ProgramExercise exercise) {
|
||||
_programTimer?.cancel();
|
||||
|
||||
switch (exercise.type) {
|
||||
case 'video':
|
||||
if (exercise.videoPath != null) {
|
||||
final client = ref.read(workoutApiClientProvider);
|
||||
final streamUrl = client.streamUrl(exercise.videoPath!);
|
||||
final duration = exercise.durationSeconds ?? 0;
|
||||
|
||||
state = state.copyWith(
|
||||
playback: PlaybackState(
|
||||
mediaId: exercise.id,
|
||||
title: exercise.instructionTitle ?? 'Exercise',
|
||||
source: MediaSource.workout,
|
||||
position: Duration.zero,
|
||||
duration: Duration(seconds: duration),
|
||||
isPlaying: true,
|
||||
),
|
||||
);
|
||||
|
||||
ref.read(playerProvider).play(streamUrl);
|
||||
}
|
||||
case 'youtube':
|
||||
// YouTube exercises show an instruction card with countdown
|
||||
final duration = exercise.setDurationSeconds ?? exercise.durationSeconds ?? 30;
|
||||
final program = state.program;
|
||||
if (program != null) {
|
||||
state = state.copyWith(
|
||||
program: program.copyWith(
|
||||
phase: 'youtube',
|
||||
timerRemaining: duration,
|
||||
),
|
||||
clearPlayback: true,
|
||||
);
|
||||
_startProgramCountdown(duration);
|
||||
}
|
||||
case 'instruction':
|
||||
final duration = exercise.setDurationSeconds ?? exercise.durationSeconds ?? 30;
|
||||
final program = state.program;
|
||||
if (program != null) {
|
||||
state = state.copyWith(
|
||||
program: program.copyWith(
|
||||
phase: 'instruction',
|
||||
timerRemaining: duration,
|
||||
),
|
||||
clearPlayback: true,
|
||||
);
|
||||
_startProgramCountdown(duration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _startProgramCountdown(int seconds) {
|
||||
_programTimer?.cancel();
|
||||
var remaining = seconds;
|
||||
_programTimer = Timer.periodic(const Duration(seconds: 1), (timer) {
|
||||
remaining--;
|
||||
final program = state.program;
|
||||
if (program == null || remaining <= 0) {
|
||||
timer.cancel();
|
||||
if (program != null) {
|
||||
_onProgramSetCompleted();
|
||||
}
|
||||
return;
|
||||
}
|
||||
state = state.copyWith(
|
||||
program: program.copyWith(timerRemaining: remaining),
|
||||
);
|
||||
_broadcast();
|
||||
});
|
||||
}
|
||||
|
||||
void _onProgramSetCompleted() {
|
||||
final program = state.program;
|
||||
if (program == null) return;
|
||||
|
||||
if (program.currentSet < program.totalSets) {
|
||||
// More sets remaining
|
||||
state = state.copyWith(
|
||||
program: program.copyWith(currentSet: program.currentSet + 1),
|
||||
);
|
||||
// Restart the same exercise
|
||||
_replayCurrentProgramExercise();
|
||||
} else {
|
||||
// All sets done, advance to next exercise
|
||||
_advanceProgramExercise(1);
|
||||
}
|
||||
}
|
||||
|
||||
void _replayCurrentProgramExercise() {
|
||||
final program = state.program;
|
||||
if (program == null) return;
|
||||
// Re-fetch exercises from payload stored as IDs — we need to get fresh exercise data
|
||||
// For now, re-trigger the timer for instruction/youtube types
|
||||
final phase = program.phase;
|
||||
if (phase == 'youtube' || phase == 'instruction') {
|
||||
// Restart countdown (we'd need exercise duration, use timerRemaining as template)
|
||||
// This is a simplified restart — ideally we store exercises in program state
|
||||
_startProgramCountdown(program.timerRemaining > 0 ? program.timerRemaining : 30);
|
||||
}
|
||||
}
|
||||
|
||||
void _advanceProgramExercise(int direction) {
|
||||
final program = state.program;
|
||||
if (program == null) return;
|
||||
|
||||
_programTimer?.cancel();
|
||||
ref.read(playerProvider).stop();
|
||||
|
||||
final nextIndex = program.currentExerciseIndex + direction;
|
||||
if (nextIndex < 0 || nextIndex >= program.exercises.length) {
|
||||
state = state.copyWith(
|
||||
program: program.copyWith(phase: 'completed'),
|
||||
clearPlayback: true,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
state = state.copyWith(
|
||||
program: program.copyWith(
|
||||
currentExerciseIndex: nextIndex,
|
||||
currentSet: 1,
|
||||
phase: 'playing',
|
||||
),
|
||||
);
|
||||
// Note: the remote sends exercises in playWorkout payload.
|
||||
// For skip/previous we broadcast state and let the remote re-send
|
||||
// the exercise data if needed, or we handle it via a stored exercises list.
|
||||
// For simplicity, we update the index and broadcast — the remote can
|
||||
// send a new playWorkout if complex exercise data is needed.
|
||||
}
|
||||
|
||||
void _pauseProgramExercise() {
|
||||
_programTimer?.cancel();
|
||||
final program = state.program;
|
||||
if (program != null) {
|
||||
if (program.phase == 'playing') {
|
||||
ref.read(playerProvider).pause();
|
||||
final current = state.playback;
|
||||
if (current != null) {
|
||||
state = state.copyWith(playback: current.copyWith(isPlaying: false));
|
||||
}
|
||||
}
|
||||
// For timer-based exercises, stopping the timer is enough
|
||||
}
|
||||
}
|
||||
|
||||
void _resumeProgramExercise() {
|
||||
final program = state.program;
|
||||
if (program != null) {
|
||||
if (program.phase == 'playing') {
|
||||
ref.read(playerProvider).resume();
|
||||
final current = state.playback;
|
||||
if (current != null) {
|
||||
state = state.copyWith(playback: current.copyWith(isPlaying: true));
|
||||
}
|
||||
} else if (program.phase == 'youtube' || program.phase == 'instruction') {
|
||||
_startProgramCountdown(program.timerRemaining);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _stopProgram() {
|
||||
_programTimer?.cancel();
|
||||
ref.read(playerProvider).stop();
|
||||
state = state.copyWith(clearProgram: true, clearPlayback: true);
|
||||
}
|
||||
|
||||
// --- Media handling ---
|
||||
|
||||
void handleMedia(MediaAction action, Map<String, dynamic>? payload) {
|
||||
switch (action) {
|
||||
case MediaAction.searchYouTube:
|
||||
_searchYouTube(payload);
|
||||
case MediaAction.playYouTube:
|
||||
_playYouTube(payload);
|
||||
case MediaAction.browsePlex:
|
||||
_browsePlex(payload);
|
||||
case MediaAction.playPlex:
|
||||
_playPlex(payload);
|
||||
case MediaAction.spotifyPlay:
|
||||
_spotifyPlay(payload);
|
||||
case MediaAction.spotifyPause:
|
||||
_spotifyPause();
|
||||
case MediaAction.spotifyNext:
|
||||
_spotifyNext();
|
||||
case MediaAction.spotifyPrevious:
|
||||
_spotifyPrevious();
|
||||
case MediaAction.spotifyTransfer:
|
||||
_spotifyTransfer(payload);
|
||||
}
|
||||
_broadcast();
|
||||
}
|
||||
|
||||
Future<void> _searchYouTube(Map<String, dynamic>? payload) async {
|
||||
final query = payload?['query'] as String?;
|
||||
if (query == null || query.isEmpty) return;
|
||||
|
||||
try {
|
||||
final yt = ref.read(youtubeServiceProvider);
|
||||
final results = await yt.search(query);
|
||||
final data = results
|
||||
.map((v) => {
|
||||
'id': v.id,
|
||||
'title': v.title,
|
||||
'author': v.author,
|
||||
'durationMs': v.duration.inMilliseconds,
|
||||
'thumbnailUrl': v.thumbnailUrl,
|
||||
})
|
||||
.toList();
|
||||
// Broadcast search results as an event
|
||||
ref.read(wsServerProvider).broadcast(
|
||||
EventMessage(event: 'youtubeResults', data: {'results': data}),
|
||||
);
|
||||
} catch (e) {
|
||||
print('YouTube search failed: $e');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _playYouTube(Map<String, dynamic>? payload) async {
|
||||
final videoId = payload?['videoId'] as String?;
|
||||
final title = payload?['title'] as String? ?? 'YouTube';
|
||||
if (videoId == null) return;
|
||||
|
||||
try {
|
||||
final yt = ref.read(youtubeServiceProvider);
|
||||
final streamUrl = await yt.getStreamUrl(videoId);
|
||||
|
||||
state = state.copyWith(
|
||||
activeScreen: ScreenType.media,
|
||||
playback: PlaybackState(
|
||||
mediaId: videoId,
|
||||
title: title,
|
||||
source: MediaSource.youtube,
|
||||
position: Duration.zero,
|
||||
duration: Duration.zero,
|
||||
isPlaying: true,
|
||||
),
|
||||
clearSpotify: true,
|
||||
);
|
||||
|
||||
ref.read(playerProvider).play(streamUrl);
|
||||
} catch (e) {
|
||||
print('YouTube playback failed: $e');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _browsePlex(Map<String, dynamic>? payload) async {
|
||||
try {
|
||||
final plex = ref.read(plexServiceProvider);
|
||||
final libraryId = payload?['libraryId'] as String?;
|
||||
final itemId = payload?['itemId'] as String?;
|
||||
|
||||
List<Map<String, dynamic>> items;
|
||||
if (itemId != null) {
|
||||
final children = await plex.fetchChildren(itemId);
|
||||
items = children.map((c) => c.toJson()).toList();
|
||||
} else if (libraryId != null) {
|
||||
final results = await plex.fetchItems(libraryId);
|
||||
items = results.map((r) => r.toJson()).toList();
|
||||
} else {
|
||||
final libraries = await plex.fetchLibraries();
|
||||
items = libraries.map((l) => l.toJson()).toList();
|
||||
}
|
||||
|
||||
ref.read(wsServerProvider).broadcast(
|
||||
EventMessage(event: 'plexBrowse', data: {'items': items}),
|
||||
);
|
||||
} catch (e) {
|
||||
print('Plex browse failed: $e');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _playPlex(Map<String, dynamic>? payload) async {
|
||||
final streamUrl = payload?['streamUrl'] as String?;
|
||||
final title = payload?['title'] as String? ?? 'Plex';
|
||||
if (streamUrl == null || streamUrl.isEmpty) return;
|
||||
|
||||
try {
|
||||
state = state.copyWith(
|
||||
activeScreen: ScreenType.media,
|
||||
playback: PlaybackState(
|
||||
mediaId: streamUrl,
|
||||
title: title,
|
||||
source: MediaSource.plex,
|
||||
position: Duration.zero,
|
||||
duration: Duration.zero,
|
||||
isPlaying: true,
|
||||
),
|
||||
clearSpotify: true,
|
||||
);
|
||||
|
||||
ref.read(playerProvider).play(streamUrl);
|
||||
} catch (e) {
|
||||
print('Plex playback failed: $e');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _spotifyPlay(Map<String, dynamic>? payload) async {
|
||||
try {
|
||||
final spotify = ref.read(spotifyServiceProvider);
|
||||
final token = payload?['token'] as String?;
|
||||
if (token != null) spotify.setToken(token);
|
||||
|
||||
final deviceId = payload?['deviceId'] as String?;
|
||||
await spotify.play(deviceId: deviceId);
|
||||
|
||||
// Fetch current state
|
||||
final playback = await spotify.getCurrentPlayback();
|
||||
if (playback != null) {
|
||||
state = state.copyWith(
|
||||
activeScreen: ScreenType.media,
|
||||
spotify: SpotifyState(
|
||||
isPlaying: playback.isPlaying,
|
||||
trackName: playback.trackName,
|
||||
artistName: playback.artistName,
|
||||
albumImageUrl: playback.albumArt,
|
||||
progressMs: playback.progressMs,
|
||||
durationMs: playback.durationMs,
|
||||
),
|
||||
clearPlayback: true,
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
print('Spotify play failed: $e');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _spotifyPause() async {
|
||||
try {
|
||||
final spotify = ref.read(spotifyServiceProvider);
|
||||
await spotify.pause();
|
||||
final current = state.spotify;
|
||||
if (current != null) {
|
||||
state = state.copyWith(
|
||||
spotify: current.copyWith(isPlaying: false),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
print('Spotify pause failed: $e');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _spotifyNext() async {
|
||||
try {
|
||||
final spotify = ref.read(spotifyServiceProvider);
|
||||
await spotify.next();
|
||||
// Brief delay for Spotify to update
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
final playback = await spotify.getCurrentPlayback();
|
||||
if (playback != null) {
|
||||
state = state.copyWith(
|
||||
spotify: SpotifyState(
|
||||
isPlaying: playback.isPlaying,
|
||||
trackName: playback.trackName,
|
||||
artistName: playback.artistName,
|
||||
albumImageUrl: playback.albumArt,
|
||||
progressMs: playback.progressMs,
|
||||
durationMs: playback.durationMs,
|
||||
),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
print('Spotify next failed: $e');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _spotifyPrevious() async {
|
||||
try {
|
||||
final spotify = ref.read(spotifyServiceProvider);
|
||||
await spotify.previous();
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
final playback = await spotify.getCurrentPlayback();
|
||||
if (playback != null) {
|
||||
state = state.copyWith(
|
||||
spotify: SpotifyState(
|
||||
isPlaying: playback.isPlaying,
|
||||
trackName: playback.trackName,
|
||||
artistName: playback.artistName,
|
||||
albumImageUrl: playback.albumArt,
|
||||
progressMs: playback.progressMs,
|
||||
durationMs: playback.durationMs,
|
||||
),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
print('Spotify previous failed: $e');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _spotifyTransfer(Map<String, dynamic>? payload) async {
|
||||
final deviceId = payload?['deviceId'] as String?;
|
||||
if (deviceId == null) return;
|
||||
|
||||
try {
|
||||
final spotify = ref.read(spotifyServiceProvider);
|
||||
await spotify.transferPlayback(deviceId);
|
||||
} catch (e) {
|
||||
print('Spotify transfer failed: $e');
|
||||
}
|
||||
}
|
||||
|
||||
void handlePlayback(PlaybackAction action, dynamic value) {
|
||||
final player = ref.read(playerProvider);
|
||||
switch (action) {
|
||||
case PlaybackAction.pause:
|
||||
final current = state.playback;
|
||||
if (current != null) {
|
||||
player.pause();
|
||||
state = state.copyWith(playback: current.copyWith(isPlaying: false));
|
||||
}
|
||||
case PlaybackAction.resume:
|
||||
final current = state.playback;
|
||||
if (current != null) {
|
||||
player.resume();
|
||||
state = state.copyWith(playback: current.copyWith(isPlaying: true));
|
||||
}
|
||||
case PlaybackAction.seek:
|
||||
final current = state.playback;
|
||||
if (current != null && value is num) {
|
||||
final pos = Duration(milliseconds: value.toInt());
|
||||
player.seek(pos);
|
||||
state = state.copyWith(playback: current.copyWith(position: pos));
|
||||
}
|
||||
case PlaybackAction.stop:
|
||||
player.stop();
|
||||
state = state.copyWith(clearPlayback: true);
|
||||
case PlaybackAction.setVolume:
|
||||
final current = state.playback;
|
||||
if (current != null && value is num) {
|
||||
player.setVolume(value.toDouble());
|
||||
state = state.copyWith(playback: current.copyWith(volume: value.toDouble()));
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
_broadcast();
|
||||
}
|
||||
|
||||
void handleWorkout(WorkoutAction action, Map<String, dynamic>? payload) {
|
||||
final session = state.workout ?? const WorkoutSessionState(phase: WorkoutPhase.idle);
|
||||
|
||||
switch (action) {
|
||||
case WorkoutAction.browse:
|
||||
final path = payload?['path'] as String?;
|
||||
final filter = payload?['filter'] != null
|
||||
? WorkoutFilter.fromJson(payload!['filter'] as String)
|
||||
: session.filter;
|
||||
state = state.copyWith(
|
||||
activeScreen: ScreenType.workout,
|
||||
workout: session.copyWith(
|
||||
phase: WorkoutPhase.browsing,
|
||||
currentPath: path,
|
||||
clearCurrentPath: path == null || path.isEmpty,
|
||||
filter: filter,
|
||||
),
|
||||
);
|
||||
_fetchVideos(path, filter);
|
||||
case WorkoutAction.playVideo:
|
||||
final payload2 = payload;
|
||||
if (payload2 != null && payload2.containsKey('path')) {
|
||||
_playFromPayload(payload2);
|
||||
} else {
|
||||
final videoId = payload?['videoId'] as String?;
|
||||
if (videoId != null) _startVideo(videoId);
|
||||
}
|
||||
case WorkoutAction.playFolder:
|
||||
if (payload != null && payload.containsKey('videos')) {
|
||||
_playFolderFromPayload(payload);
|
||||
} else {
|
||||
_playFolder(payload?['unwatchedOnly'] as bool? ?? false);
|
||||
}
|
||||
case WorkoutAction.pauseWorkout:
|
||||
handlePlayback(PlaybackAction.pause, null);
|
||||
case WorkoutAction.resumeWorkout:
|
||||
handlePlayback(PlaybackAction.resume, null);
|
||||
case WorkoutAction.skipVideo:
|
||||
_advanceQueue();
|
||||
case WorkoutAction.skipRest:
|
||||
_skipRest();
|
||||
case WorkoutAction.previousVideo:
|
||||
_previousVideo();
|
||||
case WorkoutAction.stopSession:
|
||||
ref.read(playerProvider).stop();
|
||||
state = state.copyWith(
|
||||
workout: session.copyWith(phase: WorkoutPhase.idle),
|
||||
clearPlayback: true,
|
||||
);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
_broadcast();
|
||||
}
|
||||
|
||||
void updatePlaybackPosition(Duration position) {
|
||||
final current = state.playback;
|
||||
if (current != null) {
|
||||
state = state.copyWith(playback: current.copyWith(position: position));
|
||||
_broadcast();
|
||||
}
|
||||
}
|
||||
|
||||
void onMediaCompleted() {
|
||||
final session = state.workout;
|
||||
if (session != null && session.phase == WorkoutPhase.playing) {
|
||||
_advanceQueue();
|
||||
} else {
|
||||
state = state.copyWith(clearPlayback: true);
|
||||
}
|
||||
_broadcast();
|
||||
}
|
||||
|
||||
Future<void> _fetchVideos(String? path, WorkoutFilter filter) async {
|
||||
try {
|
||||
final client = ref.read(workoutApiClientProvider);
|
||||
final result = await client.fetchVideos(folder: path, filter: filter);
|
||||
final stats = await client.fetchStats();
|
||||
final session = state.workout;
|
||||
if (session != null) {
|
||||
state = state.copyWith(
|
||||
workout: session.copyWith(
|
||||
videos: result.videos,
|
||||
folders: result.folders,
|
||||
stats: stats,
|
||||
),
|
||||
);
|
||||
_broadcast();
|
||||
}
|
||||
} catch (e) {
|
||||
print('Failed to fetch videos: $e');
|
||||
}
|
||||
}
|
||||
|
||||
void _startVideo(String videoId) {
|
||||
final session = state.workout;
|
||||
if (session == null) return;
|
||||
|
||||
final video = session.videos.firstWhere(
|
||||
(v) => v.id == videoId,
|
||||
orElse: () => session.videos.first,
|
||||
);
|
||||
|
||||
final client = ref.read(workoutApiClientProvider);
|
||||
final streamUrl = client.streamUrl(video.path);
|
||||
final startPosition = video.lastPosition > 0 ? video.lastPosition : video.trimStart;
|
||||
|
||||
state = state.copyWith(
|
||||
workout: session.copyWith(
|
||||
phase: WorkoutPhase.playing,
|
||||
queue: [
|
||||
QueueItemState(
|
||||
videoId: video.id,
|
||||
title: video.title,
|
||||
path: video.path,
|
||||
duration: video.duration,
|
||||
trimStart: video.trimStart,
|
||||
trimEnd: video.trimEnd,
|
||||
restSeconds: video.restSeconds,
|
||||
),
|
||||
],
|
||||
currentIndex: 0,
|
||||
),
|
||||
playback: PlaybackState(
|
||||
mediaId: video.id,
|
||||
title: video.title,
|
||||
source: MediaSource.workout,
|
||||
position: Duration(seconds: startPosition),
|
||||
duration: Duration(seconds: video.duration),
|
||||
isPlaying: true,
|
||||
),
|
||||
);
|
||||
|
||||
ref.read(playerProvider).play(
|
||||
streamUrl,
|
||||
startPosition: startPosition > 0 ? Duration(seconds: startPosition) : null,
|
||||
);
|
||||
}
|
||||
|
||||
void _playFolder(bool unwatchedOnly) {
|
||||
final session = state.workout;
|
||||
if (session == null) return;
|
||||
|
||||
final videos = unwatchedOnly
|
||||
? session.videos.where((v) => v.percentCompleted < 95).toList()
|
||||
: session.videos;
|
||||
|
||||
if (videos.isEmpty) return;
|
||||
|
||||
final queue = videos
|
||||
.map((v) => QueueItemState(
|
||||
videoId: v.id,
|
||||
title: v.title,
|
||||
path: v.path,
|
||||
duration: v.duration,
|
||||
trimStart: v.trimStart,
|
||||
trimEnd: v.trimEnd,
|
||||
restSeconds: v.restSeconds,
|
||||
))
|
||||
.toList();
|
||||
|
||||
final first = videos.first;
|
||||
final client = ref.read(workoutApiClientProvider);
|
||||
final streamUrl = client.streamUrl(first.path);
|
||||
final startPos = first.lastPosition > 0 ? first.lastPosition : first.trimStart;
|
||||
|
||||
state = state.copyWith(
|
||||
workout: session.copyWith(
|
||||
phase: WorkoutPhase.playing,
|
||||
queue: queue,
|
||||
currentIndex: 0,
|
||||
),
|
||||
playback: PlaybackState(
|
||||
mediaId: first.id,
|
||||
title: first.title,
|
||||
source: MediaSource.workout,
|
||||
position: Duration(seconds: startPos),
|
||||
duration: Duration(seconds: first.duration),
|
||||
isPlaying: true,
|
||||
),
|
||||
);
|
||||
|
||||
ref.read(playerProvider).play(
|
||||
streamUrl,
|
||||
startPosition: startPos > 0 ? Duration(seconds: startPos) : null,
|
||||
);
|
||||
}
|
||||
|
||||
void _advanceQueue() {
|
||||
final session = state.workout;
|
||||
if (session == null) return;
|
||||
|
||||
final nextIndex = session.currentIndex + 1;
|
||||
if (nextIndex >= session.queue.length) {
|
||||
state = state.copyWith(
|
||||
workout: session.copyWith(phase: WorkoutPhase.completed),
|
||||
clearPlayback: true,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
final next = session.queue[nextIndex];
|
||||
if (next.restSeconds > 0) {
|
||||
state = state.copyWith(
|
||||
workout: session.copyWith(
|
||||
phase: WorkoutPhase.resting,
|
||||
currentIndex: nextIndex,
|
||||
restRemaining: next.restSeconds,
|
||||
),
|
||||
clearPlayback: true,
|
||||
);
|
||||
_startRestCountdown(next.restSeconds);
|
||||
} else {
|
||||
_playQueueItem(nextIndex);
|
||||
}
|
||||
}
|
||||
|
||||
void _previousVideo() {
|
||||
final session = state.workout;
|
||||
if (session == null || session.currentIndex <= 0) return;
|
||||
_playQueueItem(session.currentIndex - 1);
|
||||
}
|
||||
|
||||
void _skipRest() {
|
||||
final session = state.workout;
|
||||
if (session == null) return;
|
||||
_playQueueItem(session.currentIndex);
|
||||
}
|
||||
|
||||
void _playQueueItem(int index) {
|
||||
final session = state.workout;
|
||||
if (session == null || index >= session.queue.length) return;
|
||||
|
||||
final item = session.queue[index];
|
||||
final client = ref.read(workoutApiClientProvider);
|
||||
final streamUrl = client.streamUrl(item.path);
|
||||
|
||||
state = state.copyWith(
|
||||
workout: session.copyWith(
|
||||
phase: WorkoutPhase.playing,
|
||||
currentIndex: index,
|
||||
),
|
||||
playback: PlaybackState(
|
||||
mediaId: item.videoId,
|
||||
title: item.title,
|
||||
source: MediaSource.workout,
|
||||
position: Duration(seconds: item.trimStart),
|
||||
duration: Duration(seconds: item.duration),
|
||||
isPlaying: true,
|
||||
),
|
||||
);
|
||||
|
||||
ref.read(playerProvider).play(
|
||||
streamUrl,
|
||||
startPosition: item.trimStart > 0 ? Duration(seconds: item.trimStart) : null,
|
||||
);
|
||||
}
|
||||
|
||||
Timer? _restTimer;
|
||||
|
||||
void _playFromPayload(Map<String, dynamic> payload) {
|
||||
final videoId = payload['videoId'] as String;
|
||||
final title = payload['title'] as String? ?? '';
|
||||
final path = payload['path'] as String;
|
||||
final duration = (payload['duration'] as num?)?.toInt() ?? 0;
|
||||
final trimStart = (payload['trimStart'] as num?)?.toInt() ?? 0;
|
||||
final trimEnd = (payload['trimEnd'] as num?)?.toInt() ?? 0;
|
||||
final restSeconds = (payload['restSeconds'] as num?)?.toInt() ?? 0;
|
||||
final lastPosition = (payload['lastPosition'] as num?)?.toInt() ?? 0;
|
||||
|
||||
final client = ref.read(workoutApiClientProvider);
|
||||
final streamUrl = client.streamUrl(path);
|
||||
final startPos = lastPosition > 0 ? lastPosition : trimStart;
|
||||
|
||||
final session = state.workout ?? const WorkoutSessionState(phase: WorkoutPhase.idle);
|
||||
|
||||
state = state.copyWith(
|
||||
activeScreen: ScreenType.workout,
|
||||
workout: session.copyWith(
|
||||
phase: WorkoutPhase.playing,
|
||||
queue: [
|
||||
QueueItemState(
|
||||
videoId: videoId,
|
||||
title: title,
|
||||
path: path,
|
||||
duration: duration,
|
||||
trimStart: trimStart,
|
||||
trimEnd: trimEnd,
|
||||
restSeconds: restSeconds,
|
||||
),
|
||||
],
|
||||
currentIndex: 0,
|
||||
),
|
||||
playback: PlaybackState(
|
||||
mediaId: videoId,
|
||||
title: title,
|
||||
source: MediaSource.workout,
|
||||
position: Duration(seconds: startPos),
|
||||
duration: Duration(seconds: duration),
|
||||
isPlaying: true,
|
||||
),
|
||||
);
|
||||
|
||||
ref.read(playerProvider).play(
|
||||
streamUrl,
|
||||
startPosition: startPos > 0 ? Duration(seconds: startPos) : null,
|
||||
);
|
||||
_broadcast();
|
||||
}
|
||||
|
||||
void _playFolderFromPayload(Map<String, dynamic> payload) {
|
||||
final rawVideos = payload['videos'] as List<dynamic>;
|
||||
if (rawVideos.isEmpty) return;
|
||||
|
||||
final queue = rawVideos.map((v) {
|
||||
final m = v as Map<String, dynamic>;
|
||||
return QueueItemState(
|
||||
videoId: m['videoId'] as String,
|
||||
title: m['title'] as String? ?? '',
|
||||
path: m['path'] as String,
|
||||
duration: (m['duration'] as num?)?.toInt() ?? 0,
|
||||
trimStart: (m['trimStart'] as num?)?.toInt() ?? 0,
|
||||
trimEnd: (m['trimEnd'] as num?)?.toInt() ?? 0,
|
||||
restSeconds: (m['restSeconds'] as num?)?.toInt() ?? 0,
|
||||
);
|
||||
}).toList();
|
||||
|
||||
final first = queue.first;
|
||||
final lastPosition = (rawVideos.first as Map<String, dynamic>)['lastPosition'] as num?;
|
||||
final startPos = (lastPosition?.toInt() ?? 0) > 0
|
||||
? lastPosition!.toInt()
|
||||
: first.trimStart;
|
||||
|
||||
final client = ref.read(workoutApiClientProvider);
|
||||
final streamUrl = client.streamUrl(first.path);
|
||||
|
||||
final session = state.workout ?? const WorkoutSessionState(phase: WorkoutPhase.idle);
|
||||
|
||||
state = state.copyWith(
|
||||
activeScreen: ScreenType.workout,
|
||||
workout: session.copyWith(
|
||||
phase: WorkoutPhase.playing,
|
||||
queue: queue,
|
||||
currentIndex: 0,
|
||||
),
|
||||
playback: PlaybackState(
|
||||
mediaId: first.videoId,
|
||||
title: first.title,
|
||||
source: MediaSource.workout,
|
||||
position: Duration(seconds: startPos),
|
||||
duration: Duration(seconds: first.duration),
|
||||
isPlaying: true,
|
||||
),
|
||||
);
|
||||
|
||||
ref.read(playerProvider).play(
|
||||
streamUrl,
|
||||
startPosition: startPos > 0 ? Duration(seconds: startPos) : null,
|
||||
);
|
||||
_broadcast();
|
||||
}
|
||||
|
||||
void _startRestCountdown(int seconds) {
|
||||
_restTimer?.cancel();
|
||||
var remaining = seconds;
|
||||
_restTimer = Timer.periodic(const Duration(seconds: 1), (timer) {
|
||||
remaining--;
|
||||
final session = state.workout;
|
||||
if (session == null || remaining <= 0) {
|
||||
timer.cancel();
|
||||
if (session != null) _playQueueItem(session.currentIndex);
|
||||
return;
|
||||
}
|
||||
state = state.copyWith(
|
||||
workout: session.copyWith(restRemaining: remaining),
|
||||
);
|
||||
_broadcast();
|
||||
});
|
||||
}
|
||||
|
||||
void _broadcast() {
|
||||
ref.read(wsServerProvider).broadcastState(state);
|
||||
}
|
||||
}
|
||||
|
||||
final workoutApiClientProvider = Provider<WorkoutApiClient>((ref) {
|
||||
const url = String.fromEnvironment('WORKOUT_PLAYER_URL',
|
||||
defaultValue: 'http://192.168.86.172:8091');
|
||||
return WorkoutApiClient(baseUrl: url);
|
||||
});
|
||||
@@ -0,0 +1,27 @@
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:mirror_protocol/mirror_protocol.dart';
|
||||
import '../services/layout_persistence.dart';
|
||||
import '../services/ws_server.dart';
|
||||
|
||||
final layoutProvider =
|
||||
AsyncNotifierProvider<LayoutNotifier, DashboardLayoutConfig>(
|
||||
LayoutNotifier.new);
|
||||
|
||||
class LayoutNotifier extends AsyncNotifier<DashboardLayoutConfig> {
|
||||
late final LayoutPersistence _persistence;
|
||||
|
||||
@override
|
||||
Future<DashboardLayoutConfig> build() async {
|
||||
_persistence = LayoutPersistence();
|
||||
return _persistence.load();
|
||||
}
|
||||
|
||||
Future<void> updateLayout(DashboardLayoutConfig config) async {
|
||||
state = AsyncData(config);
|
||||
await _persistence.save(config);
|
||||
// Broadcast to connected clients
|
||||
ref
|
||||
.read(wsServerProvider)
|
||||
.broadcast(DashboardConfigResponse(layout: config));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
import 'dart:async';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:media_kit/media_kit.dart';
|
||||
import 'package:media_kit_video/media_kit_video.dart';
|
||||
import 'package:mirror_protocol/mirror_protocol.dart';
|
||||
import 'display_state_provider.dart';
|
||||
|
||||
final playerProvider = Provider<PlayerService>((ref) {
|
||||
final service = PlayerService(ref);
|
||||
ref.onDispose(() => service.dispose());
|
||||
return service;
|
||||
});
|
||||
|
||||
final videoControllerProvider = Provider<VideoController>((ref) {
|
||||
return ref.watch(playerProvider).videoController;
|
||||
});
|
||||
|
||||
class PlayerService {
|
||||
final Ref _ref;
|
||||
late final Player _player;
|
||||
late final VideoController _videoController;
|
||||
StreamSubscription? _positionSub;
|
||||
StreamSubscription? _playingSub;
|
||||
StreamSubscription? _completedSub;
|
||||
StreamSubscription? _durationSub;
|
||||
Timer? _progressSaveTimer;
|
||||
|
||||
PlayerService(this._ref) {
|
||||
_player = Player();
|
||||
_videoController = VideoController(_player);
|
||||
|
||||
_positionSub = _player.stream.position.listen((position) {
|
||||
_ref.read(displayStateProvider.notifier).updatePlaybackPosition(position);
|
||||
});
|
||||
|
||||
_playingSub = _player.stream.playing.listen((playing) {
|
||||
final state = _ref.read(displayStateProvider);
|
||||
final current = state.playback;
|
||||
if (current != null && current.isPlaying != playing) {
|
||||
_ref.read(displayStateProvider.notifier).updatePlaybackPosition(
|
||||
_player.state.position,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
_durationSub = _player.stream.duration.listen((duration) {
|
||||
final state = _ref.read(displayStateProvider);
|
||||
final current = state.playback;
|
||||
if (current != null && current.duration != duration) {
|
||||
// Update duration if it wasn't known initially
|
||||
}
|
||||
});
|
||||
|
||||
_completedSub = _player.stream.completed.listen((completed) {
|
||||
if (completed) {
|
||||
_ref.read(displayStateProvider.notifier).onMediaCompleted();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
VideoController get videoController => _videoController;
|
||||
Player get player => _player;
|
||||
|
||||
Future<void> play(String url, {Duration? startPosition}) async {
|
||||
await _player.open(Media(url));
|
||||
if (startPosition != null && startPosition > Duration.zero) {
|
||||
// Wait briefly for the player to initialize before seeking
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
await _player.seek(startPosition);
|
||||
}
|
||||
_startProgressSaving();
|
||||
}
|
||||
|
||||
Future<void> pause() async => await _player.pause();
|
||||
|
||||
Future<void> resume() async => await _player.play();
|
||||
|
||||
Future<void> seek(Duration position) async => await _player.seek(position);
|
||||
|
||||
Future<void> setVolume(double volume) async =>
|
||||
await _player.setVolume(volume * 100);
|
||||
|
||||
Future<void> stop() async {
|
||||
_stopProgressSaving();
|
||||
await _player.stop();
|
||||
}
|
||||
|
||||
void _startProgressSaving() {
|
||||
_stopProgressSaving();
|
||||
_progressSaveTimer = Timer.periodic(const Duration(seconds: 10), (_) {
|
||||
final state = _ref.read(displayStateProvider);
|
||||
final workout = state.workout;
|
||||
final playback = state.playback;
|
||||
|
||||
if (workout != null &&
|
||||
workout.phase == WorkoutPhase.playing &&
|
||||
playback != null &&
|
||||
playback.source == MediaSource.workout) {
|
||||
final client = _ref.read(workoutApiClientProvider);
|
||||
final percent = playback.duration.inSeconds > 0
|
||||
? (playback.position.inSeconds / playback.duration.inSeconds * 100).round()
|
||||
: 0;
|
||||
client.updateProgress(
|
||||
videoId: playback.mediaId,
|
||||
position: playback.position.inSeconds,
|
||||
percent: percent,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void _stopProgressSaving() {
|
||||
_progressSaveTimer?.cancel();
|
||||
_progressSaveTimer = null;
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
_stopProgressSaving();
|
||||
_positionSub?.cancel();
|
||||
_playingSub?.cancel();
|
||||
_completedSub?.cancel();
|
||||
_durationSub?.cancel();
|
||||
_player.dispose();
|
||||
}
|
||||
}
|
||||
@@ -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';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:mirror_protocol/mirror_protocol.dart';
|
||||
|
||||
class LayoutPersistence {
|
||||
final String _path;
|
||||
|
||||
LayoutPersistence({String? path})
|
||||
: _path = path ??
|
||||
'${Platform.environment['HOME']}/.config/mirror-os/dashboard_layout.json';
|
||||
|
||||
Future<DashboardLayoutConfig> load() async {
|
||||
final file = File(_path);
|
||||
if (!await file.exists()) {
|
||||
return DashboardLayoutConfig.defaultLayout();
|
||||
}
|
||||
try {
|
||||
final content = await file.readAsString();
|
||||
final json = jsonDecode(content) as Map<String, dynamic>;
|
||||
return DashboardLayoutConfig.fromJson(json);
|
||||
} catch (_) {
|
||||
return DashboardLayoutConfig.defaultLayout();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> save(DashboardLayoutConfig layout) async {
|
||||
final file = File(_path);
|
||||
final dir = file.parent;
|
||||
if (!await dir.exists()) {
|
||||
await dir.create(recursive: true);
|
||||
}
|
||||
final content = const JsonEncoder.withIndent(' ').convert(layout.toJson());
|
||||
await file.writeAsString(content);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:shelf/shelf_io.dart' as shelf_io;
|
||||
import 'package:shelf_web_socket/shelf_web_socket.dart';
|
||||
import 'package:web_socket_channel/web_socket_channel.dart';
|
||||
import 'package:mirror_protocol/mirror_protocol.dart';
|
||||
import '../providers/display_state_provider.dart';
|
||||
import '../providers/layout_provider.dart';
|
||||
import 'layout_persistence.dart';
|
||||
|
||||
final wsServerProvider = Provider<WsServer>((ref) => WsServer(ref));
|
||||
|
||||
class WsServer {
|
||||
final Ref _ref;
|
||||
final Set<WebSocketChannel> _clients = {};
|
||||
HttpServer? _server;
|
||||
final int port;
|
||||
final LayoutPersistence _layoutPersistence = LayoutPersistence();
|
||||
DashboardLayoutConfig? _currentLayout;
|
||||
|
||||
WsServer(this._ref, {this.port = 9090});
|
||||
|
||||
Future<void> start() async {
|
||||
_currentLayout = await _layoutPersistence.load();
|
||||
|
||||
final handler = webSocketHandler((WebSocketChannel channel) {
|
||||
_clients.add(channel);
|
||||
|
||||
// Send current state on connect
|
||||
final state = _ref.read(displayStateProvider);
|
||||
final sync = StateSync(state: state);
|
||||
channel.sink.add(sync.encode());
|
||||
|
||||
channel.stream.listen(
|
||||
(data) => _handleMessage(channel, data as String),
|
||||
onDone: () => _clients.remove(channel),
|
||||
onError: (_) => _clients.remove(channel),
|
||||
);
|
||||
});
|
||||
|
||||
_server = await shelf_io.serve(handler, InternetAddress.anyIPv4, port);
|
||||
print('WebSocket server running on :$port');
|
||||
}
|
||||
|
||||
void _handleMessage(WebSocketChannel sender, String raw) {
|
||||
try {
|
||||
final message = MirrorMessage.decode(raw);
|
||||
_routeMessage(sender, message);
|
||||
} catch (e) {
|
||||
print('Invalid message: $e');
|
||||
}
|
||||
}
|
||||
|
||||
void _routeMessage(WebSocketChannel sender, MirrorMessage message) {
|
||||
final notifier = _ref.read(displayStateProvider.notifier);
|
||||
|
||||
switch (message) {
|
||||
case NavigateCommand(:final target):
|
||||
notifier.navigate(target);
|
||||
case PlaybackCommand(:final action, :final value):
|
||||
notifier.handlePlayback(action, value);
|
||||
case WorkoutCommand(:final action, :final payload):
|
||||
notifier.handleWorkout(action, payload);
|
||||
case ProgramCommand(:final action, :final payload):
|
||||
notifier.handleProgram(action, payload);
|
||||
case MediaCommand(:final action, :final payload):
|
||||
notifier.handleMedia(action, payload);
|
||||
case RegisterMessage():
|
||||
// Already handled on connect
|
||||
break;
|
||||
case DashboardConfigRequest():
|
||||
_handleConfigRequest(sender);
|
||||
case DashboardConfigUpdate(:final layout):
|
||||
_handleConfigUpdate(layout);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void _handleConfigRequest(WebSocketChannel sender) {
|
||||
final layout = _currentLayout ?? DashboardLayoutConfig.defaultLayout();
|
||||
final response = DashboardConfigResponse(layout: layout);
|
||||
try {
|
||||
sender.sink.add(response.encode());
|
||||
} catch (_) {
|
||||
_clients.remove(sender);
|
||||
}
|
||||
}
|
||||
|
||||
void _handleConfigUpdate(DashboardLayoutConfig layout) {
|
||||
_currentLayout = layout;
|
||||
_layoutPersistence.save(layout);
|
||||
// Update the layout provider so dashboard screen rebuilds
|
||||
_ref.read(layoutProvider.notifier).updateLayout(layout);
|
||||
}
|
||||
|
||||
void broadcast(MirrorMessage message) {
|
||||
final encoded = message.encode();
|
||||
for (final client in _clients.toList()) {
|
||||
try {
|
||||
client.sink.add(encoded);
|
||||
} catch (_) {
|
||||
_clients.remove(client);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void broadcastState(DisplayState state) {
|
||||
broadcast(StateSync(state: state));
|
||||
}
|
||||
|
||||
DashboardLayoutConfig get currentLayout =>
|
||||
_currentLayout ?? DashboardLayoutConfig.defaultLayout();
|
||||
|
||||
Future<void> stop() async {
|
||||
for (final client in _clients) {
|
||||
await client.sink.close();
|
||||
}
|
||||
_clients.clear();
|
||||
await _server?.close();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
flutter/ephemeral
|
||||
@@ -0,0 +1,128 @@
|
||||
# Project-level configuration.
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
project(runner LANGUAGES CXX)
|
||||
|
||||
# The name of the executable created for the application. Change this to change
|
||||
# the on-disk name of your application.
|
||||
set(BINARY_NAME "mirror_display")
|
||||
# The unique GTK application identifier for this application. See:
|
||||
# https://wiki.gnome.org/HowDoI/ChooseApplicationID
|
||||
set(APPLICATION_ID "com.example.mirror_display")
|
||||
|
||||
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
|
||||
# versions of CMake.
|
||||
cmake_policy(SET CMP0063 NEW)
|
||||
|
||||
# Load bundled libraries from the lib/ directory relative to the binary.
|
||||
set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
|
||||
|
||||
# Root filesystem for cross-building.
|
||||
if(FLUTTER_TARGET_PLATFORM_SYSROOT)
|
||||
set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT})
|
||||
set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT})
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
endif()
|
||||
|
||||
# Define build configuration options.
|
||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
set(CMAKE_BUILD_TYPE "Debug" CACHE
|
||||
STRING "Flutter build mode" FORCE)
|
||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
|
||||
"Debug" "Profile" "Release")
|
||||
endif()
|
||||
|
||||
# Compilation settings that should be applied to most targets.
|
||||
#
|
||||
# Be cautious about adding new options here, as plugins use this function by
|
||||
# default. In most cases, you should add new options to specific targets instead
|
||||
# of modifying this function.
|
||||
function(APPLY_STANDARD_SETTINGS TARGET)
|
||||
target_compile_features(${TARGET} PUBLIC cxx_std_14)
|
||||
target_compile_options(${TARGET} PRIVATE -Wall -Werror)
|
||||
target_compile_options(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O3>")
|
||||
target_compile_definitions(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:NDEBUG>")
|
||||
endfunction()
|
||||
|
||||
# Flutter library and tool build rules.
|
||||
set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
|
||||
add_subdirectory(${FLUTTER_MANAGED_DIR})
|
||||
|
||||
# System-level dependencies.
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
|
||||
|
||||
# Application build; see runner/CMakeLists.txt.
|
||||
add_subdirectory("runner")
|
||||
|
||||
# Run the Flutter tool portions of the build. This must not be removed.
|
||||
add_dependencies(${BINARY_NAME} flutter_assemble)
|
||||
|
||||
# Only the install-generated bundle's copy of the executable will launch
|
||||
# correctly, since the resources must in the right relative locations. To avoid
|
||||
# people trying to run the unbundled copy, put it in a subdirectory instead of
|
||||
# the default top-level location.
|
||||
set_target_properties(${BINARY_NAME}
|
||||
PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run"
|
||||
)
|
||||
|
||||
|
||||
# Generated plugin build rules, which manage building the plugins and adding
|
||||
# them to the application.
|
||||
include(flutter/generated_plugins.cmake)
|
||||
|
||||
|
||||
# === Installation ===
|
||||
# By default, "installing" just makes a relocatable bundle in the build
|
||||
# directory.
|
||||
set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
|
||||
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
|
||||
endif()
|
||||
|
||||
# Start with a clean build bundle directory every time.
|
||||
install(CODE "
|
||||
file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\")
|
||||
" COMPONENT Runtime)
|
||||
|
||||
set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
|
||||
set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
|
||||
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
|
||||
COMPONENT Runtime)
|
||||
|
||||
install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
|
||||
COMPONENT Runtime)
|
||||
|
||||
install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
|
||||
COMPONENT Runtime)
|
||||
|
||||
foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES})
|
||||
install(FILES "${bundled_library}"
|
||||
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
|
||||
COMPONENT Runtime)
|
||||
endforeach(bundled_library)
|
||||
|
||||
# Copy the native assets provided by the build.dart from all packages.
|
||||
set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/")
|
||||
install(DIRECTORY "${NATIVE_ASSETS_DIR}"
|
||||
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
|
||||
COMPONENT Runtime)
|
||||
|
||||
# Fully re-copy the assets directory on each build to avoid having stale files
|
||||
# from a previous install.
|
||||
set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
|
||||
install(CODE "
|
||||
file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
|
||||
" COMPONENT Runtime)
|
||||
install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
|
||||
DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
|
||||
|
||||
# Install the AOT library on non-Debug builds only.
|
||||
if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
|
||||
install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
|
||||
COMPONENT Runtime)
|
||||
endif()
|
||||
@@ -0,0 +1,88 @@
|
||||
# This file controls Flutter-level build steps. It should not be edited.
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
|
||||
|
||||
# Configuration provided via flutter tool.
|
||||
include(${EPHEMERAL_DIR}/generated_config.cmake)
|
||||
|
||||
# TODO: Move the rest of this into files in ephemeral. See
|
||||
# https://github.com/flutter/flutter/issues/57146.
|
||||
|
||||
# Serves the same purpose as list(TRANSFORM ... PREPEND ...),
|
||||
# which isn't available in 3.10.
|
||||
function(list_prepend LIST_NAME PREFIX)
|
||||
set(NEW_LIST "")
|
||||
foreach(element ${${LIST_NAME}})
|
||||
list(APPEND NEW_LIST "${PREFIX}${element}")
|
||||
endforeach(element)
|
||||
set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# === Flutter Library ===
|
||||
# System-level dependencies.
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
|
||||
pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
|
||||
pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)
|
||||
|
||||
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so")
|
||||
|
||||
# Published to parent scope for install step.
|
||||
set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
|
||||
set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
|
||||
set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
|
||||
set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE)
|
||||
|
||||
list(APPEND FLUTTER_LIBRARY_HEADERS
|
||||
"fl_basic_message_channel.h"
|
||||
"fl_binary_codec.h"
|
||||
"fl_binary_messenger.h"
|
||||
"fl_dart_project.h"
|
||||
"fl_engine.h"
|
||||
"fl_json_message_codec.h"
|
||||
"fl_json_method_codec.h"
|
||||
"fl_message_codec.h"
|
||||
"fl_method_call.h"
|
||||
"fl_method_channel.h"
|
||||
"fl_method_codec.h"
|
||||
"fl_method_response.h"
|
||||
"fl_plugin_registrar.h"
|
||||
"fl_plugin_registry.h"
|
||||
"fl_standard_message_codec.h"
|
||||
"fl_standard_method_codec.h"
|
||||
"fl_string_codec.h"
|
||||
"fl_value.h"
|
||||
"fl_view.h"
|
||||
"flutter_linux.h"
|
||||
)
|
||||
list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/")
|
||||
add_library(flutter INTERFACE)
|
||||
target_include_directories(flutter INTERFACE
|
||||
"${EPHEMERAL_DIR}"
|
||||
)
|
||||
target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}")
|
||||
target_link_libraries(flutter INTERFACE
|
||||
PkgConfig::GTK
|
||||
PkgConfig::GLIB
|
||||
PkgConfig::GIO
|
||||
)
|
||||
add_dependencies(flutter flutter_assemble)
|
||||
|
||||
# === Flutter tool backend ===
|
||||
# _phony_ is a non-existent file to force this command to run every time,
|
||||
# since currently there's no way to get a full input/output list from the
|
||||
# flutter tool.
|
||||
add_custom_command(
|
||||
OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/_phony_
|
||||
COMMAND ${CMAKE_COMMAND} -E env
|
||||
${FLUTTER_TOOL_ENVIRONMENT}
|
||||
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh"
|
||||
${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE}
|
||||
VERBATIM
|
||||
)
|
||||
add_custom_target(flutter_assemble DEPENDS
|
||||
"${FLUTTER_LIBRARY}"
|
||||
${FLUTTER_LIBRARY_HEADERS}
|
||||
)
|
||||
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// Generated file. Do not edit.
|
||||
//
|
||||
|
||||
// clang-format off
|
||||
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <media_kit_libs_linux/media_kit_libs_linux_plugin.h>
|
||||
#include <media_kit_video/media_kit_video_plugin.h>
|
||||
|
||||
void fl_register_plugins(FlPluginRegistry* registry) {
|
||||
g_autoptr(FlPluginRegistrar) media_kit_libs_linux_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "MediaKitLibsLinuxPlugin");
|
||||
media_kit_libs_linux_plugin_register_with_registrar(media_kit_libs_linux_registrar);
|
||||
g_autoptr(FlPluginRegistrar) media_kit_video_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "MediaKitVideoPlugin");
|
||||
media_kit_video_plugin_register_with_registrar(media_kit_video_registrar);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// Generated file. Do not edit.
|
||||
//
|
||||
|
||||
// clang-format off
|
||||
|
||||
#ifndef GENERATED_PLUGIN_REGISTRANT_
|
||||
#define GENERATED_PLUGIN_REGISTRANT_
|
||||
|
||||
#include <flutter_linux/flutter_linux.h>
|
||||
|
||||
// Registers Flutter plugins.
|
||||
void fl_register_plugins(FlPluginRegistry* registry);
|
||||
|
||||
#endif // GENERATED_PLUGIN_REGISTRANT_
|
||||
@@ -0,0 +1,25 @@
|
||||
#
|
||||
# Generated file, do not edit.
|
||||
#
|
||||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
media_kit_libs_linux
|
||||
media_kit_video
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
)
|
||||
|
||||
set(PLUGIN_BUNDLED_LIBRARIES)
|
||||
|
||||
foreach(plugin ${FLUTTER_PLUGIN_LIST})
|
||||
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
|
||||
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
|
||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
|
||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
|
||||
endforeach(plugin)
|
||||
|
||||
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
|
||||
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
|
||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
|
||||
endforeach(ffi_plugin)
|
||||
@@ -0,0 +1,26 @@
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
project(runner LANGUAGES CXX)
|
||||
|
||||
# Define the application target. To change its name, change BINARY_NAME in the
|
||||
# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer
|
||||
# work.
|
||||
#
|
||||
# Any new source files that you add to the application should be added here.
|
||||
add_executable(${BINARY_NAME}
|
||||
"main.cc"
|
||||
"my_application.cc"
|
||||
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
|
||||
)
|
||||
|
||||
# Apply the standard set of build settings. This can be removed for applications
|
||||
# that need different build settings.
|
||||
apply_standard_settings(${BINARY_NAME})
|
||||
|
||||
# Add preprocessor definitions for the application ID.
|
||||
add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
|
||||
|
||||
# Add dependency libraries. Add any application-specific dependencies here.
|
||||
target_link_libraries(${BINARY_NAME} PRIVATE flutter)
|
||||
target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
|
||||
|
||||
target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
|
||||
@@ -0,0 +1,6 @@
|
||||
#include "my_application.h"
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
g_autoptr(MyApplication) app = my_application_new();
|
||||
return g_application_run(G_APPLICATION(app), argc, argv);
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
#include "my_application.h"
|
||||
|
||||
#include <flutter_linux/flutter_linux.h>
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
#include <gdk/gdkx.h>
|
||||
#endif
|
||||
|
||||
#include "flutter/generated_plugin_registrant.h"
|
||||
|
||||
struct _MyApplication {
|
||||
GtkApplication parent_instance;
|
||||
char** dart_entrypoint_arguments;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
|
||||
|
||||
// Called when first Flutter frame received.
|
||||
static void first_frame_cb(MyApplication* self, FlView* view) {
|
||||
gtk_widget_show(gtk_widget_get_toplevel(GTK_WIDGET(view)));
|
||||
}
|
||||
|
||||
// Implements GApplication::activate.
|
||||
static void my_application_activate(GApplication* application) {
|
||||
MyApplication* self = MY_APPLICATION(application);
|
||||
GtkWindow* window =
|
||||
GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));
|
||||
|
||||
// Use a header bar when running in GNOME as this is the common style used
|
||||
// by applications and is the setup most users will be using (e.g. Ubuntu
|
||||
// desktop).
|
||||
// If running on X and not using GNOME then just use a traditional title bar
|
||||
// in case the window manager does more exotic layout, e.g. tiling.
|
||||
// If running on Wayland assume the header bar will work (may need changing
|
||||
// if future cases occur).
|
||||
gboolean use_header_bar = TRUE;
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
GdkScreen* screen = gtk_window_get_screen(window);
|
||||
if (GDK_IS_X11_SCREEN(screen)) {
|
||||
const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen);
|
||||
if (g_strcmp0(wm_name, "GNOME Shell") != 0) {
|
||||
use_header_bar = FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (use_header_bar) {
|
||||
GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
|
||||
gtk_widget_show(GTK_WIDGET(header_bar));
|
||||
gtk_header_bar_set_title(header_bar, "mirror_display");
|
||||
gtk_header_bar_set_show_close_button(header_bar, TRUE);
|
||||
gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
|
||||
} else {
|
||||
gtk_window_set_title(window, "mirror_display");
|
||||
}
|
||||
|
||||
gtk_window_set_default_size(window, 1280, 720);
|
||||
|
||||
g_autoptr(FlDartProject) project = fl_dart_project_new();
|
||||
fl_dart_project_set_dart_entrypoint_arguments(
|
||||
project, self->dart_entrypoint_arguments);
|
||||
|
||||
FlView* view = fl_view_new(project);
|
||||
GdkRGBA background_color;
|
||||
// Background defaults to black, override it here if necessary, e.g. #00000000
|
||||
// for transparent.
|
||||
gdk_rgba_parse(&background_color, "#000000");
|
||||
fl_view_set_background_color(view, &background_color);
|
||||
gtk_widget_show(GTK_WIDGET(view));
|
||||
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
|
||||
|
||||
// Show the window when Flutter renders.
|
||||
// Requires the view to be realized so we can start rendering.
|
||||
g_signal_connect_swapped(view, "first-frame", G_CALLBACK(first_frame_cb),
|
||||
self);
|
||||
gtk_widget_realize(GTK_WIDGET(view));
|
||||
|
||||
fl_register_plugins(FL_PLUGIN_REGISTRY(view));
|
||||
|
||||
gtk_widget_grab_focus(GTK_WIDGET(view));
|
||||
}
|
||||
|
||||
// Implements GApplication::local_command_line.
|
||||
static gboolean my_application_local_command_line(GApplication* application,
|
||||
gchar*** arguments,
|
||||
int* exit_status) {
|
||||
MyApplication* self = MY_APPLICATION(application);
|
||||
// Strip out the first argument as it is the binary name.
|
||||
self->dart_entrypoint_arguments = g_strdupv(*arguments + 1);
|
||||
|
||||
g_autoptr(GError) error = nullptr;
|
||||
if (!g_application_register(application, nullptr, &error)) {
|
||||
g_warning("Failed to register: %s", error->message);
|
||||
*exit_status = 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
g_application_activate(application);
|
||||
*exit_status = 0;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Implements GApplication::startup.
|
||||
static void my_application_startup(GApplication* application) {
|
||||
// MyApplication* self = MY_APPLICATION(object);
|
||||
|
||||
// Perform any actions required at application startup.
|
||||
|
||||
G_APPLICATION_CLASS(my_application_parent_class)->startup(application);
|
||||
}
|
||||
|
||||
// Implements GApplication::shutdown.
|
||||
static void my_application_shutdown(GApplication* application) {
|
||||
// MyApplication* self = MY_APPLICATION(object);
|
||||
|
||||
// Perform any actions required at application shutdown.
|
||||
|
||||
G_APPLICATION_CLASS(my_application_parent_class)->shutdown(application);
|
||||
}
|
||||
|
||||
// Implements GObject::dispose.
|
||||
static void my_application_dispose(GObject* object) {
|
||||
MyApplication* self = MY_APPLICATION(object);
|
||||
g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev);
|
||||
G_OBJECT_CLASS(my_application_parent_class)->dispose(object);
|
||||
}
|
||||
|
||||
static void my_application_class_init(MyApplicationClass* klass) {
|
||||
G_APPLICATION_CLASS(klass)->activate = my_application_activate;
|
||||
G_APPLICATION_CLASS(klass)->local_command_line =
|
||||
my_application_local_command_line;
|
||||
G_APPLICATION_CLASS(klass)->startup = my_application_startup;
|
||||
G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown;
|
||||
G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
|
||||
}
|
||||
|
||||
static void my_application_init(MyApplication* self) {}
|
||||
|
||||
MyApplication* my_application_new() {
|
||||
// Set the program name to the application ID, which helps various systems
|
||||
// like GTK and desktop environments map this running application to its
|
||||
// corresponding .desktop file. This ensures better integration by allowing
|
||||
// the application to be recognized beyond its binary name.
|
||||
g_set_prgname(APPLICATION_ID);
|
||||
|
||||
return MY_APPLICATION(g_object_new(my_application_get_type(),
|
||||
"application-id", APPLICATION_ID, "flags",
|
||||
G_APPLICATION_NON_UNIQUE, nullptr));
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef FLUTTER_MY_APPLICATION_H_
|
||||
#define FLUTTER_MY_APPLICATION_H_
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_DECLARE_FINAL_TYPE(MyApplication,
|
||||
my_application,
|
||||
MY,
|
||||
APPLICATION,
|
||||
GtkApplication)
|
||||
|
||||
/**
|
||||
* my_application_new:
|
||||
*
|
||||
* Creates a new Flutter-based application.
|
||||
*
|
||||
* Returns: a new #MyApplication.
|
||||
*/
|
||||
MyApplication* my_application_new();
|
||||
|
||||
#endif // FLUTTER_MY_APPLICATION_H_
|
||||
@@ -0,0 +1,7 @@
|
||||
# Flutter-related
|
||||
**/Flutter/ephemeral/
|
||||
**/Pods/
|
||||
|
||||
# Xcode-related
|
||||
**/dgph
|
||||
**/xcuserdata/
|
||||
@@ -0,0 +1,2 @@
|
||||
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
|
||||
#include "ephemeral/Flutter-Generated.xcconfig"
|
||||
@@ -0,0 +1,2 @@
|
||||
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
|
||||
#include "ephemeral/Flutter-Generated.xcconfig"
|
||||
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// Generated file. Do not edit.
|
||||
//
|
||||
|
||||
import FlutterMacOS
|
||||
import Foundation
|
||||
|
||||
import media_kit_libs_macos_video
|
||||
import media_kit_video
|
||||
import nsd_macos
|
||||
import package_info_plus
|
||||
import wakelock_plus
|
||||
|
||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
MediaKitLibsMacosVideoPlugin.register(with: registry.registrar(forPlugin: "MediaKitLibsMacosVideoPlugin"))
|
||||
MediaKitVideoPlugin.register(with: registry.registrar(forPlugin: "MediaKitVideoPlugin"))
|
||||
NsdMacosPlugin.register(with: registry.registrar(forPlugin: "NsdMacosPlugin"))
|
||||
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
|
||||
WakelockPlusMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockPlusMacosPlugin"))
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
platform :osx, '10.15'
|
||||
|
||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||
|
||||
project 'Runner', {
|
||||
'Debug' => :debug,
|
||||
'Profile' => :release,
|
||||
'Release' => :release,
|
||||
}
|
||||
|
||||
def flutter_root
|
||||
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
|
||||
unless File.exist?(generated_xcode_build_settings_path)
|
||||
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
|
||||
end
|
||||
|
||||
File.foreach(generated_xcode_build_settings_path) do |line|
|
||||
matches = line.match(/FLUTTER_ROOT\=(.*)/)
|
||||
return matches[1].strip if matches
|
||||
end
|
||||
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
|
||||
end
|
||||
|
||||
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
|
||||
|
||||
flutter_macos_podfile_setup
|
||||
|
||||
target 'Runner' do
|
||||
use_frameworks!
|
||||
|
||||
flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
|
||||
target 'RunnerTests' do
|
||||
inherit! :search_paths
|
||||
end
|
||||
end
|
||||
|
||||
post_install do |installer|
|
||||
installer.pods_project.targets.each do |target|
|
||||
flutter_additional_macos_build_settings(target)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,28 @@
|
||||
PODS:
|
||||
- FlutterMacOS (1.0.0)
|
||||
- media_kit_libs_macos_video (1.0.4):
|
||||
- FlutterMacOS
|
||||
- media_kit_video (0.0.1):
|
||||
- FlutterMacOS
|
||||
|
||||
DEPENDENCIES:
|
||||
- FlutterMacOS (from `Flutter/ephemeral`)
|
||||
- media_kit_libs_macos_video (from `Flutter/ephemeral/.symlinks/plugins/media_kit_libs_macos_video/macos`)
|
||||
- media_kit_video (from `Flutter/ephemeral/.symlinks/plugins/media_kit_video/macos`)
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
FlutterMacOS:
|
||||
:path: Flutter/ephemeral
|
||||
media_kit_libs_macos_video:
|
||||
:path: Flutter/ephemeral/.symlinks/plugins/media_kit_libs_macos_video/macos
|
||||
media_kit_video:
|
||||
:path: Flutter/ephemeral/.symlinks/plugins/media_kit_video/macos
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
FlutterMacOS: d0db08ddef1a9af05a5ec4b724367152bb0500b1
|
||||
media_kit_libs_macos_video: 85a23e549b5f480e72cae3e5634b5514bc692f65
|
||||
media_kit_video: fa6564e3799a0a28bff39442334817088b7ca758
|
||||
|
||||
PODFILE CHECKSUM: 54d867c82ac51cbd61b565781b9fada492027009
|
||||
|
||||
COCOAPODS: 1.16.2
|
||||
@@ -0,0 +1,825 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 54;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXAggregateTarget section */
|
||||
33CC111A2044C6BA0003C045 /* Flutter Assemble */ = {
|
||||
isa = PBXAggregateTarget;
|
||||
buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */;
|
||||
buildPhases = (
|
||||
33CC111E2044C6BF0003C045 /* ShellScript */,
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "Flutter Assemble";
|
||||
productName = FLX;
|
||||
};
|
||||
/* End PBXAggregateTarget section */
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C80D7294CF71000263BE5 /* RunnerTests.swift */; };
|
||||
335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; };
|
||||
33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; };
|
||||
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; };
|
||||
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; };
|
||||
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
|
||||
78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; };
|
||||
92F4B0A147574513CB9E1061 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0ADBF64CBDB7A460FC19BA16 /* Pods_Runner.framework */; };
|
||||
BC5DB3620A4042B7006CF7A3 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E93B8EDF9498337873E91BD /* Pods_RunnerTests.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
331C80D9294CF71000263BE5 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 33CC10E52044A3C60003C045 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 33CC10EC2044A3C60003C045;
|
||||
remoteInfo = Runner;
|
||||
};
|
||||
33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 33CC10E52044A3C60003C045 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 33CC111A2044C6BA0003C045;
|
||||
remoteInfo = FLX;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
33CC110E2044A8840003C045 /* Bundle Framework */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
);
|
||||
name = "Bundle Framework";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
0ADBF64CBDB7A460FC19BA16 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
0E8DBE2344231BA987B1CAEA /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
|
||||
331C80D5294CF71000263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; };
|
||||
333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = "<group>"; };
|
||||
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = "<group>"; };
|
||||
33CC10ED2044A3C60003C045 /* mirror_display.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = mirror_display.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = "<group>"; };
|
||||
33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
|
||||
33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = "<group>"; };
|
||||
33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = "<group>"; };
|
||||
33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = "<group>"; };
|
||||
33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = "<group>"; };
|
||||
33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = "<group>"; };
|
||||
33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = "<group>"; };
|
||||
33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = "<group>"; };
|
||||
33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = "<group>"; };
|
||||
3E3B0ABD864A936C723C8D17 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
5BEECA01FA72021AD4C5C626 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
5E93B8EDF9498337873E91BD /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlutterGeneratedPluginSwiftPackage; path = ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; sourceTree = "<group>"; };
|
||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
|
||||
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
|
||||
BA38C6EE8C9F943C3130C49D /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = "<group>"; };
|
||||
E1D12E48B61A58C77478B122 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
|
||||
FFC9A3FE0EE4C729366A8668 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
331C80D2294CF70F00263BE5 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
BC5DB3620A4042B7006CF7A3 /* Pods_RunnerTests.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
33CC10EA2044A3C60003C045 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */,
|
||||
92F4B0A147574513CB9E1061 /* Pods_Runner.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
331C80D6294CF71000263BE5 /* RunnerTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
331C80D7294CF71000263BE5 /* RunnerTests.swift */,
|
||||
);
|
||||
path = RunnerTests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
33BA886A226E78AF003329D5 /* Configs */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
33E5194F232828860026EE4D /* AppInfo.xcconfig */,
|
||||
9740EEB21CF90195004384FC /* Debug.xcconfig */,
|
||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
|
||||
333000ED22D3DE5D00554162 /* Warnings.xcconfig */,
|
||||
);
|
||||
path = Configs;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
33CC10E42044A3C60003C045 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
33FAB671232836740065AC1E /* Runner */,
|
||||
33CEB47122A05771004F2AC0 /* Flutter */,
|
||||
331C80D6294CF71000263BE5 /* RunnerTests */,
|
||||
33CC10EE2044A3C60003C045 /* Products */,
|
||||
D73912EC22F37F3D000D13A0 /* Frameworks */,
|
||||
B6808CFC35874201BFC689FB /* Pods */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
33CC10EE2044A3C60003C045 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
33CC10ED2044A3C60003C045 /* mirror_display.app */,
|
||||
331C80D5294CF71000263BE5 /* RunnerTests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
33CC11242044D66E0003C045 /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
33CC10F22044A3C60003C045 /* Assets.xcassets */,
|
||||
33CC10F42044A3C60003C045 /* MainMenu.xib */,
|
||||
33CC10F72044A3C60003C045 /* Info.plist */,
|
||||
);
|
||||
name = Resources;
|
||||
path = ..;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
33CEB47122A05771004F2AC0 /* Flutter */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */,
|
||||
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */,
|
||||
33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */,
|
||||
33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */,
|
||||
33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */,
|
||||
);
|
||||
path = Flutter;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
33FAB671232836740065AC1E /* Runner */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
33CC10F02044A3C60003C045 /* AppDelegate.swift */,
|
||||
33CC11122044BFA00003C045 /* MainFlutterWindow.swift */,
|
||||
33E51913231747F40026EE4D /* DebugProfile.entitlements */,
|
||||
33E51914231749380026EE4D /* Release.entitlements */,
|
||||
33CC11242044D66E0003C045 /* Resources */,
|
||||
33BA886A226E78AF003329D5 /* Configs */,
|
||||
);
|
||||
path = Runner;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B6808CFC35874201BFC689FB /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
5BEECA01FA72021AD4C5C626 /* Pods-Runner.debug.xcconfig */,
|
||||
0E8DBE2344231BA987B1CAEA /* Pods-Runner.release.xcconfig */,
|
||||
E1D12E48B61A58C77478B122 /* Pods-Runner.profile.xcconfig */,
|
||||
3E3B0ABD864A936C723C8D17 /* Pods-RunnerTests.debug.xcconfig */,
|
||||
BA38C6EE8C9F943C3130C49D /* Pods-RunnerTests.release.xcconfig */,
|
||||
FFC9A3FE0EE4C729366A8668 /* Pods-RunnerTests.profile.xcconfig */,
|
||||
);
|
||||
name = Pods;
|
||||
path = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D73912EC22F37F3D000D13A0 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0ADBF64CBDB7A460FC19BA16 /* Pods_Runner.framework */,
|
||||
5E93B8EDF9498337873E91BD /* Pods_RunnerTests.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
331C80D4294CF70F00263BE5 /* RunnerTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */;
|
||||
buildPhases = (
|
||||
AB6E2BB8E62BFC0F7A5A00D2 /* [CP] Check Pods Manifest.lock */,
|
||||
331C80D1294CF70F00263BE5 /* Sources */,
|
||||
331C80D2294CF70F00263BE5 /* Frameworks */,
|
||||
331C80D3294CF70F00263BE5 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
331C80DA294CF71000263BE5 /* PBXTargetDependency */,
|
||||
);
|
||||
name = RunnerTests;
|
||||
productName = RunnerTests;
|
||||
productReference = 331C80D5294CF71000263BE5 /* RunnerTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
33CC10EC2044A3C60003C045 /* Runner */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */;
|
||||
buildPhases = (
|
||||
CDF9B9EEFF196EBB60634B7C /* [CP] Check Pods Manifest.lock */,
|
||||
33CC10E92044A3C60003C045 /* Sources */,
|
||||
33CC10EA2044A3C60003C045 /* Frameworks */,
|
||||
33CC10EB2044A3C60003C045 /* Resources */,
|
||||
33CC110E2044A8840003C045 /* Bundle Framework */,
|
||||
3399D490228B24CF009A79C7 /* ShellScript */,
|
||||
415CABAF4FD7908B456F221E /* [CP] Embed Pods Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
33CC11202044C79F0003C045 /* PBXTargetDependency */,
|
||||
);
|
||||
name = Runner;
|
||||
packageProductDependencies = (
|
||||
78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */,
|
||||
);
|
||||
productName = Runner;
|
||||
productReference = 33CC10ED2044A3C60003C045 /* mirror_display.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
33CC10E52044A3C60003C045 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
BuildIndependentTargetsInParallel = YES;
|
||||
LastSwiftUpdateCheck = 0920;
|
||||
LastUpgradeCheck = 1510;
|
||||
ORGANIZATIONNAME = "";
|
||||
TargetAttributes = {
|
||||
331C80D4294CF70F00263BE5 = {
|
||||
CreatedOnToolsVersion = 14.0;
|
||||
TestTargetID = 33CC10EC2044A3C60003C045;
|
||||
};
|
||||
33CC10EC2044A3C60003C045 = {
|
||||
CreatedOnToolsVersion = 9.2;
|
||||
LastSwiftMigration = 1100;
|
||||
ProvisioningStyle = Automatic;
|
||||
SystemCapabilities = {
|
||||
com.apple.Sandbox = {
|
||||
enabled = 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
33CC111A2044C6BA0003C045 = {
|
||||
CreatedOnToolsVersion = 9.2;
|
||||
ProvisioningStyle = Manual;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */;
|
||||
compatibilityVersion = "Xcode 9.3";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 33CC10E42044A3C60003C045;
|
||||
packageReferences = (
|
||||
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */,
|
||||
);
|
||||
productRefGroup = 33CC10EE2044A3C60003C045 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
33CC10EC2044A3C60003C045 /* Runner */,
|
||||
331C80D4294CF70F00263BE5 /* RunnerTests */,
|
||||
33CC111A2044C6BA0003C045 /* Flutter Assemble */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
331C80D3294CF70F00263BE5 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
33CC10EB2044A3C60003C045 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */,
|
||||
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
3399D490228B24CF009A79C7 /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n";
|
||||
};
|
||||
33CC111E2044C6BF0003C045 /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
Flutter/ephemeral/FlutterInputs.xcfilelist,
|
||||
);
|
||||
inputPaths = (
|
||||
Flutter/ephemeral/tripwire,
|
||||
);
|
||||
outputFileListPaths = (
|
||||
Flutter/ephemeral/FlutterOutputs.xcfilelist,
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire";
|
||||
};
|
||||
415CABAF4FD7908B456F221E /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
AB6E2BB8E62BFC0F7A5A00D2 /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
CDF9B9EEFF196EBB60634B7C /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
331C80D1294CF70F00263BE5 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
33CC10E92044A3C60003C045 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */,
|
||||
33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */,
|
||||
335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
331C80DA294CF71000263BE5 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 33CC10EC2044A3C60003C045 /* Runner */;
|
||||
targetProxy = 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */;
|
||||
};
|
||||
33CC11202044C79F0003C045 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */;
|
||||
targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
33CC10F42044A3C60003C045 /* MainMenu.xib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
33CC10F52044A3C60003C045 /* Base */,
|
||||
);
|
||||
name = MainMenu.xib;
|
||||
path = Runner;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
331C80DB294CF71000263BE5 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 3E3B0ABD864A936C723C8D17 /* Pods-RunnerTests.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.mirrorDisplay.RunnerTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/mirror_display.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/mirror_display";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
331C80DC294CF71000263BE5 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = BA38C6EE8C9F943C3130C49D /* Pods-RunnerTests.release.xcconfig */;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.mirrorDisplay.RunnerTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/mirror_display.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/mirror_display";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
331C80DD294CF71000263BE5 /* Profile */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = FFC9A3FE0EE4C729366A8668 /* Pods-RunnerTests.profile.xcconfig */;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.mirrorDisplay.RunnerTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/mirror_display.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/mirror_display";
|
||||
};
|
||||
name = Profile;
|
||||
};
|
||||
338D0CE9231458BD00FA5F75 /* Profile */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = macosx;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
};
|
||||
name = Profile;
|
||||
};
|
||||
338D0CEA231458BD00FA5F75 /* Profile */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Profile;
|
||||
};
|
||||
338D0CEB231458BD00FA5F75 /* Profile */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Profile;
|
||||
};
|
||||
33CC10F92044A3C60003C045 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
33CC10FA2044A3C60003C045 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = macosx;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
33CC10FC2044A3C60003C045 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
33CC10FD2044A3C60003C045 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
33CC111C2044C6BA0003C045 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
33CC111D2044C6BA0003C045 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
331C80DB294CF71000263BE5 /* Debug */,
|
||||
331C80DC294CF71000263BE5 /* Release */,
|
||||
331C80DD294CF71000263BE5 /* Profile */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
33CC10F92044A3C60003C045 /* Debug */,
|
||||
33CC10FA2044A3C60003C045 /* Release */,
|
||||
338D0CE9231458BD00FA5F75 /* Profile */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
33CC10FC2044A3C60003C045 /* Debug */,
|
||||
33CC10FD2044A3C60003C045 /* Release */,
|
||||
338D0CEA231458BD00FA5F75 /* Profile */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
33CC111C2044C6BA0003C045 /* Debug */,
|
||||
33CC111D2044C6BA0003C045 /* Release */,
|
||||
338D0CEB231458BD00FA5F75 /* Profile */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
|
||||
/* Begin XCLocalSwiftPackageReference section */
|
||||
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */ = {
|
||||
isa = XCLocalSwiftPackageReference;
|
||||
relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage;
|
||||
};
|
||||
/* End XCLocalSwiftPackageReference section */
|
||||
|
||||
/* Begin XCSwiftPackageProductDependency section */
|
||||
78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
productName = FlutterGeneratedPluginSwiftPackage;
|
||||
};
|
||||
/* End XCSwiftPackageProductDependency section */
|
||||
};
|
||||
rootObject = 33CC10E52044A3C60003C045 /* Project object */;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<PreActions>
|
||||
<ExecutionAction
|
||||
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
|
||||
<ActionContent
|
||||
title = "Run Prepare Flutter Framework Script"
|
||||
scriptText = ""$FLUTTER_ROOT"/packages/flutter_tools/bin/macos_assemble.sh prepare ">
|
||||
<EnvironmentBuildable>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
|
||||
BuildableName = "mirror_display.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</EnvironmentBuildable>
|
||||
</ActionContent>
|
||||
</ExecutionAction>
|
||||
</PreActions>
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
|
||||
BuildableName = "mirror_display.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
|
||||
BuildableName = "mirror_display.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO"
|
||||
parallelizable = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "331C80D4294CF70F00263BE5"
|
||||
BuildableName = "RunnerTests.xctest"
|
||||
BlueprintName = "RunnerTests"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
enableGPUValidationMode = "1"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
|
||||
BuildableName = "mirror_display.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Profile"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
|
||||
BuildableName = "mirror_display.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:Runner.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Pods/Pods.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,13 @@
|
||||
import Cocoa
|
||||
import FlutterMacOS
|
||||
|
||||
@main
|
||||
class AppDelegate: FlutterAppDelegate {
|
||||
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"size" : "16x16",
|
||||
"idiom" : "mac",
|
||||
"filename" : "app_icon_16.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "16x16",
|
||||
"idiom" : "mac",
|
||||
"filename" : "app_icon_32.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "32x32",
|
||||
"idiom" : "mac",
|
||||
"filename" : "app_icon_32.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "32x32",
|
||||
"idiom" : "mac",
|
||||
"filename" : "app_icon_64.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "128x128",
|
||||
"idiom" : "mac",
|
||||
"filename" : "app_icon_128.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "128x128",
|
||||
"idiom" : "mac",
|
||||
"filename" : "app_icon_256.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "256x256",
|
||||
"idiom" : "mac",
|
||||
"filename" : "app_icon_256.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "256x256",
|
||||
"idiom" : "mac",
|
||||
"filename" : "app_icon_512.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "512x512",
|
||||
"idiom" : "mac",
|
||||
"filename" : "app_icon_512.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "512x512",
|
||||
"idiom" : "mac",
|
||||
"filename" : "app_icon_1024.png",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 101 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 520 B |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
@@ -0,0 +1,343 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
|
||||
<connections>
|
||||
<outlet property="delegate" destination="Voe-Tx-rLC" id="GzC-gU-4Uq"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="Runner" customModuleProvider="target">
|
||||
<connections>
|
||||
<outlet property="applicationMenu" destination="uQy-DD-JDr" id="XBo-yE-nKs"/>
|
||||
<outlet property="mainFlutterWindow" destination="QvC-M9-y7g" id="gIp-Ho-8D9"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
|
||||
<menu title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
|
||||
<items>
|
||||
<menuItem title="APP_NAME" id="1Xt-HY-uBw">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="APP_NAME" systemMenu="apple" id="uQy-DD-JDr">
|
||||
<items>
|
||||
<menuItem title="About APP_NAME" id="5kV-Vb-QxS">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="orderFrontStandardAboutPanel:" target="-1" id="Exp-CZ-Vem"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/>
|
||||
<menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW"/>
|
||||
<menuItem isSeparatorItem="YES" id="wFC-TO-SCJ"/>
|
||||
<menuItem title="Services" id="NMo-om-nkz">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
|
||||
<menuItem title="Hide APP_NAME" keyEquivalent="h" id="Olw-nP-bQN">
|
||||
<connections>
|
||||
<action selector="hide:" target="-1" id="PnN-Uc-m68"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Hide Others" keyEquivalent="h" id="Vdr-fp-XzO">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="hideOtherApplications:" target="-1" id="VT4-aY-XCT"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Show All" id="Kd2-mp-pUS">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="unhideAllApplications:" target="-1" id="Dhg-Le-xox"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
|
||||
<menuItem title="Quit APP_NAME" keyEquivalent="q" id="4sb-4s-VLi">
|
||||
<connections>
|
||||
<action selector="terminate:" target="-1" id="Te7-pn-YzF"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Edit" id="5QF-Oa-p0T">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Edit" id="W48-6f-4Dl">
|
||||
<items>
|
||||
<menuItem title="Undo" keyEquivalent="z" id="dRJ-4n-Yzg">
|
||||
<connections>
|
||||
<action selector="undo:" target="-1" id="M6e-cu-g7V"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Redo" keyEquivalent="Z" id="6dh-zS-Vam">
|
||||
<connections>
|
||||
<action selector="redo:" target="-1" id="oIA-Rs-6OD"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="WRV-NI-Exz"/>
|
||||
<menuItem title="Cut" keyEquivalent="x" id="uRl-iY-unG">
|
||||
<connections>
|
||||
<action selector="cut:" target="-1" id="YJe-68-I9s"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Copy" keyEquivalent="c" id="x3v-GG-iWU">
|
||||
<connections>
|
||||
<action selector="copy:" target="-1" id="G1f-GL-Joy"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Paste" keyEquivalent="v" id="gVA-U4-sdL">
|
||||
<connections>
|
||||
<action selector="paste:" target="-1" id="UvS-8e-Qdg"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Paste and Match Style" keyEquivalent="V" id="WeT-3V-zwk">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="pasteAsPlainText:" target="-1" id="cEh-KX-wJQ"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Delete" id="pa3-QI-u2k">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="delete:" target="-1" id="0Mk-Ml-PaM"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Select All" keyEquivalent="a" id="Ruw-6m-B2m">
|
||||
<connections>
|
||||
<action selector="selectAll:" target="-1" id="VNm-Mi-diN"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="uyl-h8-XO2"/>
|
||||
<menuItem title="Find" id="4EN-yA-p0u">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Find" id="1b7-l0-nxx">
|
||||
<items>
|
||||
<menuItem title="Find…" tag="1" keyEquivalent="f" id="Xz5-n4-O0W">
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="-1" id="cD7-Qs-BN4"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Find and Replace…" tag="12" keyEquivalent="f" id="YEy-JH-Tfz">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="-1" id="WD3-Gg-5AJ"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Find Next" tag="2" keyEquivalent="g" id="q09-fT-Sye">
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="-1" id="NDo-RZ-v9R"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Find Previous" tag="3" keyEquivalent="G" id="OwM-mh-QMV">
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="-1" id="HOh-sY-3ay"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="buJ-ug-pKt">
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="-1" id="U76-nv-p5D"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Jump to Selection" keyEquivalent="j" id="S0p-oC-mLd">
|
||||
<connections>
|
||||
<action selector="centerSelectionInVisibleArea:" target="-1" id="IOG-6D-g5B"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Spelling and Grammar" id="Dv1-io-Yv7">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Spelling" id="3IN-sU-3Bg">
|
||||
<items>
|
||||
<menuItem title="Show Spelling and Grammar" keyEquivalent=":" id="HFo-cy-zxI">
|
||||
<connections>
|
||||
<action selector="showGuessPanel:" target="-1" id="vFj-Ks-hy3"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Check Document Now" keyEquivalent=";" id="hz2-CU-CR7">
|
||||
<connections>
|
||||
<action selector="checkSpelling:" target="-1" id="fz7-VC-reM"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="bNw-od-mp5"/>
|
||||
<menuItem title="Check Spelling While Typing" id="rbD-Rh-wIN">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleContinuousSpellChecking:" target="-1" id="7w6-Qz-0kB"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Check Grammar With Spelling" id="mK6-2p-4JG">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleGrammarChecking:" target="-1" id="muD-Qn-j4w"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Correct Spelling Automatically" id="78Y-hA-62v">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleAutomaticSpellingCorrection:" target="-1" id="2lM-Qi-WAP"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Substitutions" id="9ic-FL-obx">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Substitutions" id="FeM-D8-WVr">
|
||||
<items>
|
||||
<menuItem title="Show Substitutions" id="z6F-FW-3nz">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="orderFrontSubstitutionsPanel:" target="-1" id="oku-mr-iSq"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="gPx-C9-uUO"/>
|
||||
<menuItem title="Smart Copy/Paste" id="9yt-4B-nSM">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleSmartInsertDelete:" target="-1" id="3IJ-Se-DZD"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Smart Quotes" id="hQb-2v-fYv">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleAutomaticQuoteSubstitution:" target="-1" id="ptq-xd-QOA"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Smart Dashes" id="rgM-f4-ycn">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleAutomaticDashSubstitution:" target="-1" id="oCt-pO-9gS"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Smart Links" id="cwL-P1-jid">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleAutomaticLinkDetection:" target="-1" id="Gip-E3-Fov"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Data Detectors" id="tRr-pd-1PS">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleAutomaticDataDetection:" target="-1" id="R1I-Nq-Kbl"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Text Replacement" id="HFQ-gK-NFA">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleAutomaticTextReplacement:" target="-1" id="DvP-Fe-Py6"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Transformations" id="2oI-Rn-ZJC">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Transformations" id="c8a-y6-VQd">
|
||||
<items>
|
||||
<menuItem title="Make Upper Case" id="vmV-6d-7jI">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="uppercaseWord:" target="-1" id="sPh-Tk-edu"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Make Lower Case" id="d9M-CD-aMd">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="lowercaseWord:" target="-1" id="iUZ-b5-hil"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Capitalize" id="UEZ-Bs-lqG">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="capitalizeWord:" target="-1" id="26H-TL-nsh"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Speech" id="xrE-MZ-jX0">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Speech" id="3rS-ZA-NoH">
|
||||
<items>
|
||||
<menuItem title="Start Speaking" id="Ynk-f8-cLZ">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="startSpeaking:" target="-1" id="654-Ng-kyl"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Stop Speaking" id="Oyz-dy-DGm">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="stopSpeaking:" target="-1" id="dX8-6p-jy9"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="View" id="H8h-7b-M4v">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="View" id="HyV-fh-RgO">
|
||||
<items>
|
||||
<menuItem title="Enter Full Screen" keyEquivalent="f" id="4J7-dP-txa">
|
||||
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="toggleFullScreen:" target="-1" id="dU3-MA-1Rq"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Window" id="aUF-d1-5bR">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Window" systemMenu="window" id="Td7-aD-5lo">
|
||||
<items>
|
||||
<menuItem title="Minimize" keyEquivalent="m" id="OY7-WF-poV">
|
||||
<connections>
|
||||
<action selector="performMiniaturize:" target="-1" id="VwT-WD-YPe"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Zoom" id="R4o-n2-Eq4">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="performZoom:" target="-1" id="DIl-cC-cCs"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="eu3-7i-yIM"/>
|
||||
<menuItem title="Bring All to Front" id="LE2-aR-0XJ">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="arrangeInFront:" target="-1" id="DRN-fu-gQh"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Help" id="EPT-qC-fAb">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Help" systemMenu="help" id="rJ0-wn-3NY"/>
|
||||
</menuItem>
|
||||
</items>
|
||||
<point key="canvasLocation" x="142" y="-258"/>
|
||||
</menu>
|
||||
<window title="APP_NAME" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g" customClass="MainFlutterWindow" customModule="Runner" customModuleProvider="target">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
|
||||
<rect key="contentRect" x="335" y="390" width="800" height="600"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1577"/>
|
||||
<view key="contentView" wantsLayer="YES" id="EiT-Mj-1SZ">
|
||||
<rect key="frame" x="0.0" y="0.0" width="800" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</view>
|
||||
</window>
|
||||
</objects>
|
||||
</document>
|
||||
@@ -0,0 +1,14 @@
|
||||
// Application-level settings for the Runner target.
|
||||
//
|
||||
// This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the
|
||||
// future. If not, the values below would default to using the project name when this becomes a
|
||||
// 'flutter create' template.
|
||||
|
||||
// The application's name. By default this is also the title of the Flutter window.
|
||||
PRODUCT_NAME = mirror_display
|
||||
|
||||
// The application's bundle identifier
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.mirrorDisplay
|
||||
|
||||
// The copyright displayed in application information
|
||||
PRODUCT_COPYRIGHT = Copyright © 2026 com.example. All rights reserved.
|
||||
@@ -0,0 +1,2 @@
|
||||
#include "../../Flutter/Flutter-Debug.xcconfig"
|
||||
#include "Warnings.xcconfig"
|
||||
@@ -0,0 +1,2 @@
|
||||
#include "../../Flutter/Flutter-Release.xcconfig"
|
||||
#include "Warnings.xcconfig"
|
||||
@@ -0,0 +1,13 @@
|
||||
WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES
|
||||
CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
|
||||
CLANG_WARN_PRAGMA_PACK = YES
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES
|
||||
CLANG_WARN_COMMA = YES
|
||||
GCC_WARN_STRICT_SELECTOR_MATCH = YES
|
||||
CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
|
||||
GCC_WARN_SHADOW = YES
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<true/>
|
||||
<key>com.apple.security.cs.allow-jit</key>
|
||||
<true/>
|
||||
<key>com.apple.security.network.server</key>
|
||||
<true/>
|
||||
<key>com.apple.security.network.client</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string></string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>$(FLUTTER_BUILD_NAME)</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>$(PRODUCT_COPYRIGHT)</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,15 @@
|
||||
import Cocoa
|
||||
import FlutterMacOS
|
||||
|
||||
class MainFlutterWindow: NSWindow {
|
||||
override func awakeFromNib() {
|
||||
let flutterViewController = FlutterViewController()
|
||||
let windowFrame = self.frame
|
||||
self.contentViewController = flutterViewController
|
||||
self.setFrame(windowFrame, display: true)
|
||||
|
||||
RegisterGeneratedPlugins(registry: flutterViewController)
|
||||
|
||||
super.awakeFromNib()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<true/>
|
||||
<key>com.apple.security.network.server</key>
|
||||
<true/>
|
||||
<key>com.apple.security.network.client</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,12 @@
|
||||
import Cocoa
|
||||
import FlutterMacOS
|
||||
import XCTest
|
||||
|
||||
class RunnerTests: XCTestCase {
|
||||
|
||||
func testExample() {
|
||||
// If you add code to the Runner application, consider adding tests here.
|
||||
// See https://developer.apple.com/documentation/xctest for more information about using XCTest.
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
name: mirror_display
|
||||
description: Mirror OS display app — fullscreen kiosk for Raspberry Pi 4
|
||||
version: 0.1.0
|
||||
publish_to: none
|
||||
resolution: workspace
|
||||
|
||||
environment:
|
||||
sdk: ^3.5.0
|
||||
flutter: ^3.24.0
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
mirror_protocol: any
|
||||
mirror_core: any
|
||||
mirror_ui: any
|
||||
flutter_riverpod: ^2.5.0
|
||||
shelf: ^1.4.0
|
||||
shelf_web_socket: ^2.0.0
|
||||
web_socket_channel: ^3.0.0
|
||||
nsd: ^5.0.0
|
||||
media_kit: ^1.2.6
|
||||
media_kit_video: ^2.0.1
|
||||
media_kit_libs_macos_video: ^1.1.4
|
||||
media_kit_libs_linux: ^1.2.1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
|
After Width: | Height: | Size: 917 B |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 20 KiB |
@@ -0,0 +1,46 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<!--
|
||||
If you are serving your web app in a path other than the root, change the
|
||||
href value below to reflect the base path you are serving from.
|
||||
|
||||
The path provided below has to start and end with a slash "/" in order for
|
||||
it to work correctly.
|
||||
|
||||
For more details:
|
||||
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
|
||||
|
||||
This is a placeholder for base href that will be replaced by the value of
|
||||
the `--base-href` argument provided to `flutter build`.
|
||||
-->
|
||||
<base href="$FLUTTER_BASE_HREF">
|
||||
|
||||
<meta charset="UTF-8">
|
||||
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
|
||||
<meta name="description" content="A new Flutter project.">
|
||||
|
||||
<!-- iOS meta tags & icons -->
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<meta name="apple-mobile-web-app-title" content="mirror_display">
|
||||
<link rel="apple-touch-icon" href="icons/Icon-192.png">
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="icon" type="image/png" href="favicon.png"/>
|
||||
|
||||
<title>mirror_display</title>
|
||||
<link rel="manifest" href="manifest.json">
|
||||
</head>
|
||||
<body>
|
||||
<!--
|
||||
You can customize the "flutter_bootstrap.js" script.
|
||||
This is useful to provide a custom configuration to the Flutter loader
|
||||
or to give the user feedback during the initialization process.
|
||||
|
||||
For more details:
|
||||
* https://docs.flutter.dev/platform-integration/web/initialization
|
||||
-->
|
||||
<script src="flutter_bootstrap.js" async></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "mirror_display",
|
||||
"short_name": "mirror_display",
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"background_color": "#0175C2",
|
||||
"theme_color": "#0175C2",
|
||||
"description": "A new Flutter project.",
|
||||
"orientation": "portrait-primary",
|
||||
"prefer_related_applications": false,
|
||||
"icons": [
|
||||
{
|
||||
"src": "icons/Icon-192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "icons/Icon-512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "icons/Icon-maskable-192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable"
|
||||
},
|
||||
{
|
||||
"src": "icons/Icon-maskable-512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
# Miscellaneous
|
||||
*.class
|
||||
*.log
|
||||
*.pyc
|
||||
*.swp
|
||||
.DS_Store
|
||||
.atom/
|
||||
.build/
|
||||
.buildlog/
|
||||
.history
|
||||
.svn/
|
||||
.swiftpm/
|
||||
migrate_working_dir/
|
||||
|
||||
# IntelliJ related
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
.idea/
|
||||
|
||||
# The .vscode folder contains launch configuration and tasks you configure in
|
||||
# VS Code which you may wish to be included in version control, so this line
|
||||
# is commented out by default.
|
||||
#.vscode/
|
||||
|
||||
# Flutter/Dart/Pub related
|
||||
**/doc/api/
|
||||
**/ios/Flutter/.last_build_id
|
||||
.dart_tool/
|
||||
.flutter-plugins-dependencies
|
||||
.pub-cache/
|
||||
.pub/
|
||||
/build/
|
||||
/coverage/
|
||||
|
||||
# Symbolication related
|
||||
app.*.symbols
|
||||
|
||||
# Obfuscation related
|
||||
app.*.map.json
|
||||
|
||||
# Android Studio will place build artifacts here
|
||||
/android/app/debug
|
||||
/android/app/profile
|
||||
/android/app/release
|
||||
@@ -0,0 +1,30 @@
|
||||
# This file tracks properties of this Flutter project.
|
||||
# Used by Flutter tool to assess capabilities and perform upgrades etc.
|
||||
#
|
||||
# This file should be version controlled and should not be manually edited.
|
||||
|
||||
version:
|
||||
revision: "924134a44c189315be2148659913dda1671cbe99"
|
||||
channel: "stable"
|
||||
|
||||
project_type: app
|
||||
|
||||
# Tracks metadata for the flutter migrate command
|
||||
migration:
|
||||
platforms:
|
||||
- platform: root
|
||||
create_revision: 924134a44c189315be2148659913dda1671cbe99
|
||||
base_revision: 924134a44c189315be2148659913dda1671cbe99
|
||||
- platform: android
|
||||
create_revision: 924134a44c189315be2148659913dda1671cbe99
|
||||
base_revision: 924134a44c189315be2148659913dda1671cbe99
|
||||
|
||||
# User provided section
|
||||
|
||||
# List of Local paths (relative to this file) that should be
|
||||
# ignored by the migrate tool.
|
||||
#
|
||||
# Files that are not part of the templates will be ignored by default.
|
||||
unmanaged_files:
|
||||
- 'lib/main.dart'
|
||||
- 'ios/Runner.xcodeproj/project.pbxproj'
|
||||
@@ -0,0 +1,17 @@
|
||||
# mirror_remote
|
||||
|
||||
A new Flutter project.
|
||||
|
||||
## Getting Started
|
||||
|
||||
This project is a starting point for a Flutter application.
|
||||
|
||||
A few resources to get you started if this is your first Flutter project:
|
||||
|
||||
- [Learn Flutter](https://docs.flutter.dev/get-started/learn-flutter)
|
||||
- [Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
|
||||
- [Flutter learning resources](https://docs.flutter.dev/reference/learning-resources)
|
||||
|
||||
For help getting started with Flutter development, view the
|
||||
[online documentation](https://docs.flutter.dev/), which offers tutorials,
|
||||
samples, guidance on mobile development, and a full API reference.
|
||||
@@ -0,0 +1,14 @@
|
||||
gradle-wrapper.jar
|
||||
/.gradle
|
||||
/captures/
|
||||
/gradlew
|
||||
/gradlew.bat
|
||||
/local.properties
|
||||
GeneratedPluginRegistrant.java
|
||||
.cxx/
|
||||
|
||||
# Remember to never publicly share your keystore.
|
||||
# See https://flutter.dev/to/reference-keystore
|
||||
key.properties
|
||||
**/*.keystore
|
||||
**/*.jks
|
||||
@@ -0,0 +1,45 @@
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
|
||||
id("dev.flutter.flutter-gradle-plugin")
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.example.mirror_remote"
|
||||
compileSdk = flutter.compileSdkVersion
|
||||
ndkVersion = flutter.ndkVersion
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||
applicationId = "com.example.mirror_remote"
|
||||
// You can update the following values to match your application needs.
|
||||
// For more information, see: https://flutter.dev/to/review-gradle-config.
|
||||
minSdk = flutter.minSdkVersion
|
||||
targetSdk = flutter.targetSdkVersion
|
||||
versionCode = flutter.versionCode
|
||||
versionName = flutter.versionName
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
// TODO: Add your own signing config for the release build.
|
||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
||||
signingConfig = signingConfigs.getByName("debug")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
kotlin {
|
||||
compilerOptions {
|
||||
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
|
||||
}
|
||||
}
|
||||
|
||||
flutter {
|
||||
source = "../.."
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- The INTERNET permission is required for development. Specifically,
|
||||
the Flutter tool needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
</manifest>
|
||||
@@ -0,0 +1,47 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<application
|
||||
android:label="mirror_remote"
|
||||
android:name="${applicationName}"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:usesCleartextTraffic="true">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTop"
|
||||
android:taskAffinity=""
|
||||
android:theme="@style/LaunchTheme"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||
android:hardwareAccelerated="true"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<!-- Specifies an Android theme to apply to this Activity as soon as
|
||||
the Android process has started. This theme is visible to the user
|
||||
while the Flutter UI initializes. After that, this theme continues
|
||||
to determine the Window background behind the Flutter UI. -->
|
||||
<meta-data
|
||||
android:name="io.flutter.embedding.android.NormalTheme"
|
||||
android:resource="@style/NormalTheme"
|
||||
/>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<!-- Don't delete the meta-data below.
|
||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||
<meta-data
|
||||
android:name="flutterEmbedding"
|
||||
android:value="2" />
|
||||
</application>
|
||||
<!-- Required to query activities that can process text, see:
|
||||
https://developer.android.com/training/package-visibility and
|
||||
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
|
||||
|
||||
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
|
||||
<queries>
|
||||
<intent>
|
||||
<action android:name="android.intent.action.PROCESS_TEXT"/>
|
||||
<data android:mimeType="text/plain"/>
|
||||
</intent>
|
||||
</queries>
|
||||
</manifest>
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.example.mirror_remote
|
||||
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
|
||||
class MainActivity : FlutterActivity()
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Modify this file to customize your launch splash screen -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="?android:colorBackground" />
|
||||
|
||||
<!-- You can insert your own image assets here -->
|
||||
<!-- <item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@mipmap/launch_image" />
|
||||
</item> -->
|
||||
</layer-list>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Modify this file to customize your launch splash screen -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@android:color/white" />
|
||||
|
||||
<!-- You can insert your own image assets here -->
|
||||
<!-- <item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@mipmap/launch_image" />
|
||||
</item> -->
|
||||
</layer-list>
|
||||
|
After Width: | Height: | Size: 544 B |
|
After Width: | Height: | Size: 442 B |
|
After Width: | Height: | Size: 721 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
|
||||
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<!-- Show a splash screen on the activity. Automatically removed when
|
||||
the Flutter engine draws its first frame -->
|
||||
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||
</style>
|
||||
<!-- Theme applied to the Android Window as soon as the process has started.
|
||||
This theme determines the color of the Android Window while your
|
||||
Flutter UI initializes, as well as behind your Flutter UI while its
|
||||
running.
|
||||
|
||||
This Theme is only used starting with V2 of Flutter's Android embedding. -->
|
||||
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<item name="android:windowBackground">?android:colorBackground</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
|
||||
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<!-- Show a splash screen on the activity. Automatically removed when
|
||||
the Flutter engine draws its first frame -->
|
||||
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||
</style>
|
||||
<!-- Theme applied to the Android Window as soon as the process has started.
|
||||
This theme determines the color of the Android Window while your
|
||||
Flutter UI initializes, as well as behind your Flutter UI while its
|
||||
running.
|
||||
|
||||
This Theme is only used starting with V2 of Flutter's Android embedding. -->
|
||||
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<item name="android:windowBackground">?android:colorBackground</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -0,0 +1,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- The INTERNET permission is required for development. Specifically,
|
||||
the Flutter tool needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
</manifest>
|
||||
@@ -0,0 +1,24 @@
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
val newBuildDir: Directory =
|
||||
rootProject.layout.buildDirectory
|
||||
.dir("../../build")
|
||||
.get()
|
||||
rootProject.layout.buildDirectory.value(newBuildDir)
|
||||
|
||||
subprojects {
|
||||
val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
|
||||
project.layout.buildDirectory.value(newSubprojectBuildDir)
|
||||
}
|
||||
subprojects {
|
||||
project.evaluationDependsOn(":app")
|
||||
}
|
||||
|
||||
tasks.register<Delete>("clean") {
|
||||
delete(rootProject.layout.buildDirectory)
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
|
||||
android.useAndroidX=true
|
||||
# This newDsl flag was added by the Flutter template
|
||||
android.newDsl=false
|
||||
# This builtInKotlin flag was added by the Flutter template
|
||||
android.builtInKotlin=false
|
||||
@@ -0,0 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-all.zip
|
||||
@@ -0,0 +1,26 @@
|
||||
pluginManagement {
|
||||
val flutterSdkPath =
|
||||
run {
|
||||
val properties = java.util.Properties()
|
||||
file("local.properties").inputStream().use { properties.load(it) }
|
||||
val flutterSdkPath = properties.getProperty("flutter.sdk")
|
||||
require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
|
||||
flutterSdkPath
|
||||
}
|
||||
|
||||
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
|
||||
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
|
||||
id("com.android.application") version "9.0.1" apply false
|
||||
id("org.jetbrains.kotlin.android") version "2.3.20" apply false
|
||||
}
|
||||
|
||||
include(":app")
|
||||
@@ -0,0 +1,15 @@
|
||||
// This is a generated file; do not edit or check into version control.
|
||||
FLUTTER_ROOT=/opt/homebrew/share/flutter
|
||||
FLUTTER_APPLICATION_PATH=/Users/csader/mirror-os/apps/remote
|
||||
FLUTTER_FRAMEWORK_SWIFT_PACKAGE_PATH=/Users/csader/mirror-os/apps/remote/ios/Flutter/ephemeral/Packages/.packages/FlutterFramework
|
||||
COCOAPODS_PARALLEL_CODE_SIGN=true
|
||||
FLUTTER_TARGET=lib/main.dart
|
||||
FLUTTER_BUILD_DIR=build
|
||||
FLUTTER_BUILD_NAME=0.1.0
|
||||
FLUTTER_BUILD_NUMBER=0.1.0
|
||||
EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386
|
||||
EXCLUDED_ARCHS[sdk=iphoneos*]=armv7
|
||||
DART_OBFUSCATION=false
|
||||
TRACK_WIDGET_CREATION=true
|
||||
TREE_SHAKE_ICONS=false
|
||||
PACKAGE_CONFIG=.dart_tool/package_config.json
|
||||
@@ -0,0 +1,34 @@
|
||||
// swift-tools-version: 5.9
|
||||
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
||||
//
|
||||
// Generated file. Do not edit.
|
||||
//
|
||||
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "FlutterGeneratedPluginSwiftPackage",
|
||||
platforms: [
|
||||
.iOS("13.0")
|
||||
],
|
||||
products: [
|
||||
.library(name: "FlutterGeneratedPluginSwiftPackage", type: .static, targets: ["FlutterGeneratedPluginSwiftPackage"])
|
||||
],
|
||||
dependencies: [
|
||||
.package(name: "url_launcher_ios", path: "../.packages/url_launcher_ios-6.4.1"),
|
||||
.package(name: "shared_preferences_foundation", path: "../.packages/shared_preferences_foundation-2.5.6"),
|
||||
.package(name: "nsd_ios", path: "../.packages/nsd_ios-3.0.1"),
|
||||
.package(name: "FlutterFramework", path: "../.packages/FlutterFramework")
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
name: "FlutterGeneratedPluginSwiftPackage",
|
||||
dependencies: [
|
||||
.product(name: "url-launcher-ios", package: "url_launcher_ios"),
|
||||
.product(name: "shared-preferences-foundation", package: "shared_preferences_foundation"),
|
||||
.product(name: "nsd-ios", package: "nsd_ios"),
|
||||
.product(name: "FlutterFramework", package: "FlutterFramework")
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@@ -0,0 +1,3 @@
|
||||
//
|
||||
// Generated file. Do not edit.
|
||||
//
|
||||
@@ -0,0 +1,32 @@
|
||||
#
|
||||
# Generated file, do not edit.
|
||||
#
|
||||
|
||||
import lldb
|
||||
|
||||
def handle_new_rx_page(frame: lldb.SBFrame, bp_loc, extra_args, intern_dict):
|
||||
"""Intercept NOTIFY_DEBUGGER_ABOUT_RX_PAGES and touch the pages."""
|
||||
base = frame.register["x0"].GetValueAsAddress()
|
||||
page_len = frame.register["x1"].GetValueAsUnsigned()
|
||||
|
||||
# Note: NOTIFY_DEBUGGER_ABOUT_RX_PAGES will check contents of the
|
||||
# first page to see if handled it correctly. This makes diagnosing
|
||||
# misconfiguration (e.g. missing breakpoint) easier.
|
||||
data = bytearray(page_len)
|
||||
data[0:8] = b'IHELPED!'
|
||||
|
||||
error = lldb.SBError()
|
||||
frame.GetThread().GetProcess().WriteMemory(base, data, error)
|
||||
if not error.Success():
|
||||
print(f'Failed to write into {base}[+{page_len}]', error)
|
||||
return
|
||||
|
||||
def __lldb_init_module(debugger: lldb.SBDebugger, _):
|
||||
target = debugger.GetDummyTarget()
|
||||
# Caveat: must use BreakpointCreateByRegEx here and not
|
||||
# BreakpointCreateByName. For some reasons callback function does not
|
||||
# get carried over from dummy target for the later.
|
||||
bp = target.BreakpointCreateByRegex("^NOTIFY_DEBUGGER_ABOUT_RX_PAGES$")
|
||||
bp.SetScriptCallbackFunction('{}.handle_new_rx_page'.format(__name__))
|
||||
bp.SetAutoContinue(True)
|
||||
print("-- LLDB integration loaded --")
|
||||
@@ -0,0 +1,5 @@
|
||||
#
|
||||
# Generated file, do not edit.
|
||||
#
|
||||
|
||||
command script import --relative-to-command-file flutter_lldb_helper.py
|
||||
@@ -0,0 +1,12 @@
|
||||
FLUTTER_ROOT=/opt/homebrew/share/flutter
|
||||
FLUTTER_APPLICATION_PATH=/Users/csader/mirror-os/apps/remote
|
||||
FLUTTER_FRAMEWORK_SWIFT_PACKAGE_PATH=/Users/csader/mirror-os/apps/remote/ios/Flutter/ephemeral/Packages/.packages/FlutterFramework
|
||||
COCOAPODS_PARALLEL_CODE_SIGN=true
|
||||
FLUTTER_TARGET=lib/main.dart
|
||||
FLUTTER_BUILD_DIR=build
|
||||
FLUTTER_BUILD_NAME=0.1.0
|
||||
FLUTTER_BUILD_NUMBER=0.1.0
|
||||
DART_OBFUSCATION=false
|
||||
TRACK_WIDGET_CREATION=true
|
||||
TREE_SHAKE_ICONS=false
|
||||
PACKAGE_CONFIG=.dart_tool/package_config.json
|
||||
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
# This is a generated file; do not edit or check into version control.
|
||||
export "FLUTTER_ROOT=/opt/homebrew/share/flutter"
|
||||
export "FLUTTER_APPLICATION_PATH=/Users/csader/mirror-os/apps/remote"
|
||||
export "FLUTTER_FRAMEWORK_SWIFT_PACKAGE_PATH=/Users/csader/mirror-os/apps/remote/ios/Flutter/ephemeral/Packages/.packages/FlutterFramework"
|
||||
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
|
||||
export "FLUTTER_TARGET=lib/main.dart"
|
||||
export "FLUTTER_BUILD_DIR=build"
|
||||
export "FLUTTER_BUILD_NAME=0.1.0"
|
||||
export "FLUTTER_BUILD_NUMBER=0.1.0"
|
||||
export "DART_OBFUSCATION=false"
|
||||
export "TRACK_WIDGET_CREATION=true"
|
||||
export "TREE_SHAKE_ICONS=false"
|
||||
export "PACKAGE_CONFIG=.dart_tool/package_config.json"
|
||||
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// Generated file. Do not edit.
|
||||
//
|
||||
|
||||
// clang-format off
|
||||
|
||||
#ifndef GeneratedPluginRegistrant_h
|
||||
#define GeneratedPluginRegistrant_h
|
||||
|
||||
#import <Flutter/Flutter.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface GeneratedPluginRegistrant : NSObject
|
||||
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
#endif /* GeneratedPluginRegistrant_h */
|
||||
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// Generated file. Do not edit.
|
||||
//
|
||||
|
||||
// clang-format off
|
||||
|
||||
#import "GeneratedPluginRegistrant.h"
|
||||
|
||||
#if __has_include(<nsd_ios/NsdIosPlugin.h>)
|
||||
#import <nsd_ios/NsdIosPlugin.h>
|
||||
#else
|
||||
@import nsd_ios;
|
||||
#endif
|
||||
|
||||
#if __has_include(<shared_preferences_foundation/SharedPreferencesPlugin.h>)
|
||||
#import <shared_preferences_foundation/SharedPreferencesPlugin.h>
|
||||
#else
|
||||
@import shared_preferences_foundation;
|
||||
#endif
|
||||
|
||||
#if __has_include(<url_launcher_ios/URLLauncherPlugin.h>)
|
||||
#import <url_launcher_ios/URLLauncherPlugin.h>
|
||||
#else
|
||||
@import url_launcher_ios;
|
||||
#endif
|
||||
|
||||
@implementation GeneratedPluginRegistrant
|
||||
|
||||
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry {
|
||||
[NsdIosPlugin registerWithRegistrar:[registry registrarForPlugin:@"NsdIosPlugin"]];
|
||||
[SharedPreferencesPlugin registerWithRegistrar:[registry registrarForPlugin:@"SharedPreferencesPlugin"]];
|
||||
[URLLauncherPlugin registerWithRegistrar:[registry registrarForPlugin:@"URLLauncherPlugin"]];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,97 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:mirror_ui/mirror_ui.dart';
|
||||
import 'providers/connection_provider.dart';
|
||||
import 'screens/connect_screen.dart';
|
||||
import 'screens/remote_dashboard.dart';
|
||||
import 'screens/remote_workout.dart';
|
||||
import 'screens/remote_media.dart';
|
||||
import 'package:mirror_protocol/mirror_protocol.dart';
|
||||
|
||||
class MirrorRemoteApp extends StatelessWidget {
|
||||
const MirrorRemoteApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'Mirror Remote',
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: MirrorTheme.dark,
|
||||
home: const _RemoteShell(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _RemoteShell extends ConsumerWidget {
|
||||
const _RemoteShell();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final connection = ref.watch(connectionProvider);
|
||||
|
||||
if (!connection.connected) {
|
||||
return const ConnectScreen();
|
||||
}
|
||||
|
||||
return const _ConnectedRemote();
|
||||
}
|
||||
}
|
||||
|
||||
class _ConnectedRemote extends ConsumerStatefulWidget {
|
||||
const _ConnectedRemote();
|
||||
|
||||
@override
|
||||
ConsumerState<_ConnectedRemote> createState() => _ConnectedRemoteState();
|
||||
}
|
||||
|
||||
class _ConnectedRemoteState extends ConsumerState<_ConnectedRemote> {
|
||||
int _currentIndex = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final activeScreen = ref.watch(
|
||||
mirrorStateProvider.select((s) => s?.activeScreen),
|
||||
);
|
||||
|
||||
// Sync tab to mirror's active screen
|
||||
final tabIndex = switch (activeScreen) {
|
||||
ScreenType.dashboard => 0,
|
||||
ScreenType.workout => 1,
|
||||
ScreenType.media => 2,
|
||||
_ => _currentIndex,
|
||||
};
|
||||
|
||||
return Scaffold(
|
||||
body: SafeArea(
|
||||
child: IndexedStack(
|
||||
index: tabIndex,
|
||||
children: const [
|
||||
RemoteDashboard(),
|
||||
RemoteWorkout(),
|
||||
RemoteMedia(),
|
||||
],
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: NavigationBar(
|
||||
selectedIndex: tabIndex,
|
||||
onDestinationSelected: (index) {
|
||||
setState(() => _currentIndex = index);
|
||||
final target = switch (index) {
|
||||
0 => ScreenType.dashboard,
|
||||
1 => ScreenType.workout,
|
||||
2 => ScreenType.media,
|
||||
_ => ScreenType.dashboard,
|
||||
};
|
||||
ref.read(connectionProvider.notifier).send(
|
||||
NavigateCommand(target: target),
|
||||
);
|
||||
},
|
||||
destinations: const [
|
||||
NavigationDestination(icon: Icon(Icons.dashboard), label: 'Home'),
|
||||
NavigationDestination(icon: Icon(Icons.fitness_center), label: 'Workout'),
|
||||
NavigationDestination(icon: Icon(Icons.music_note), label: 'Media'),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'app.dart';
|
||||
|
||||
void main() {
|
||||
runApp(
|
||||
const ProviderScope(child: MirrorRemoteApp()),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
import 'dart:async';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:web_socket_channel/web_socket_channel.dart';
|
||||
import 'package:mirror_protocol/mirror_protocol.dart';
|
||||
|
||||
final connectionProvider =
|
||||
NotifierProvider<ConnectionNotifier, ConnectionState>(ConnectionNotifier.new);
|
||||
|
||||
final mirrorStateProvider = StateProvider<DisplayState?>((ref) => null);
|
||||
|
||||
final dashboardConfigProvider = StateProvider<DashboardLayoutConfig?>((ref) => null);
|
||||
|
||||
class ConnectionState {
|
||||
final bool connected;
|
||||
final bool connecting;
|
||||
final String? host;
|
||||
final String? error;
|
||||
final bool manualDisconnect;
|
||||
|
||||
const ConnectionState({
|
||||
this.connected = false,
|
||||
this.connecting = false,
|
||||
this.host,
|
||||
this.error,
|
||||
this.manualDisconnect = false,
|
||||
});
|
||||
|
||||
ConnectionState copyWith({
|
||||
bool? connected,
|
||||
bool? connecting,
|
||||
String? host,
|
||||
String? error,
|
||||
bool clearError = false,
|
||||
bool? manualDisconnect,
|
||||
}) =>
|
||||
ConnectionState(
|
||||
connected: connected ?? this.connected,
|
||||
connecting: connecting ?? this.connecting,
|
||||
host: host ?? this.host,
|
||||
error: clearError ? null : (error ?? this.error),
|
||||
manualDisconnect: manualDisconnect ?? this.manualDisconnect,
|
||||
);
|
||||
}
|
||||
|
||||
class ConnectionNotifier extends Notifier<ConnectionState> {
|
||||
WebSocketChannel? _channel;
|
||||
Timer? _reconnectTimer;
|
||||
|
||||
@override
|
||||
ConnectionState build() => const ConnectionState();
|
||||
|
||||
Future<void> connect(String host, {int port = 9090}) async {
|
||||
state = state.copyWith(connecting: true, clearError: true, manualDisconnect: false);
|
||||
|
||||
try {
|
||||
final uri = Uri.parse('ws://$host:$port');
|
||||
_channel = WebSocketChannel.connect(uri);
|
||||
await _channel!.ready;
|
||||
|
||||
state = state.copyWith(connected: true, connecting: false, host: host);
|
||||
|
||||
// Send registration
|
||||
_channel!.sink.add(RegisterMessage(role: 'remote').encode());
|
||||
|
||||
// Listen for messages
|
||||
_channel!.stream.listen(
|
||||
_handleMessage,
|
||||
onDone: () => _onDisconnected(),
|
||||
onError: (e) => _onDisconnected(error: e.toString()),
|
||||
);
|
||||
} catch (e) {
|
||||
state = state.copyWith(
|
||||
connected: false,
|
||||
connecting: false,
|
||||
error: 'Failed to connect: $e',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void _handleMessage(dynamic data) {
|
||||
try {
|
||||
final message = MirrorMessage.decode(data as String);
|
||||
switch (message) {
|
||||
case StateSync(state: final mirrorState):
|
||||
ref.read(mirrorStateProvider.notifier).state = mirrorState;
|
||||
case DashboardConfigResponse(layout: final layout):
|
||||
ref.read(dashboardConfigProvider.notifier).state = layout;
|
||||
case StatePatch():
|
||||
break;
|
||||
case EventMessage():
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} catch (e) {
|
||||
print('Failed to parse message: $e');
|
||||
}
|
||||
}
|
||||
|
||||
void _onDisconnected({String? error}) {
|
||||
state = state.copyWith(connected: false, error: error);
|
||||
_channel = null;
|
||||
|
||||
// Only auto-reconnect if not intentionally disconnected
|
||||
if (state.host != null && error != null) {
|
||||
_reconnectTimer?.cancel();
|
||||
_reconnectTimer = Timer(const Duration(seconds: 3), () {
|
||||
if (state.host != null && !state.connected) {
|
||||
connect(state.host!);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void send(MirrorMessage message) {
|
||||
_channel?.sink.add(message.encode());
|
||||
}
|
||||
|
||||
void disconnect() {
|
||||
_reconnectTimer?.cancel();
|
||||
_channel?.sink.close();
|
||||
_channel = null;
|
||||
state = const ConnectionState(manualDisconnect: true);
|
||||
ref.read(mirrorStateProvider.notifier).state = null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:mirror_core/mirror_core.dart';
|
||||
import 'settings_provider.dart';
|
||||
|
||||
final haServiceProvider = Provider<HomeAssistantService?>((ref) {
|
||||
final settings = ref.watch(settingsProvider).valueOrNull;
|
||||
if (settings == null || settings.haBaseUrl == null || settings.haToken == null) {
|
||||
return null;
|
||||
}
|
||||
return HomeAssistantService(
|
||||
baseUrl: settings.haBaseUrl!,
|
||||
token: settings.haToken!,
|
||||
);
|
||||
});
|
||||
|
||||
final haEntitiesProvider =
|
||||
AsyncNotifierProvider<HaEntitiesNotifier, HaEntitiesState>(HaEntitiesNotifier.new);
|
||||
|
||||
class HaEntitiesState {
|
||||
final List<HaEntity> entities;
|
||||
final HaWeather? weather;
|
||||
final List<HaCalendarEvent> calendarEvents;
|
||||
final String? error;
|
||||
|
||||
const HaEntitiesState({
|
||||
this.entities = const [],
|
||||
this.weather,
|
||||
this.calendarEvents = const [],
|
||||
this.error,
|
||||
});
|
||||
}
|
||||
|
||||
class HaEntitiesNotifier extends AsyncNotifier<HaEntitiesState> {
|
||||
@override
|
||||
Future<HaEntitiesState> build() async {
|
||||
final service = ref.watch(haServiceProvider);
|
||||
if (service == null) {
|
||||
return const HaEntitiesState(error: 'Configure Home Assistant in Settings');
|
||||
}
|
||||
try {
|
||||
final entities = await service.getStates();
|
||||
// Find weather entity
|
||||
final weatherEntity = entities.firstWhere(
|
||||
(e) => e.entityId.startsWith('weather.'),
|
||||
orElse: () => HaEntity(entityId: '', state: '', attributes: {}, lastChanged: null),
|
||||
);
|
||||
HaWeather? weather;
|
||||
if (weatherEntity.entityId.isNotEmpty) {
|
||||
weather = HaWeather.fromEntity(weatherEntity);
|
||||
}
|
||||
return HaEntitiesState(
|
||||
entities: entities,
|
||||
weather: weather,
|
||||
);
|
||||
} catch (e) {
|
||||
return HaEntitiesState(error: 'HA connection failed: $e');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> toggleEntity(String entityId) async {
|
||||
final service = ref.read(haServiceProvider);
|
||||
if (service == null) return;
|
||||
|
||||
final entity = state.valueOrNull?.entities.firstWhere(
|
||||
(e) => e.entityId == entityId,
|
||||
orElse: () => HaEntity(entityId: '', state: '', attributes: {}, lastChanged: null),
|
||||
);
|
||||
if (entity == null || entity.entityId.isEmpty) return;
|
||||
|
||||
final isOn = entity.state == 'on';
|
||||
if (isOn) {
|
||||
await service.turnOff(entityId);
|
||||
} else {
|
||||
await service.turnOn(entityId);
|
||||
}
|
||||
// Refresh state
|
||||
ref.invalidateSelf();
|
||||
}
|
||||
|
||||
Future<void> callScene(String entityId) async {
|
||||
final service = ref.read(haServiceProvider);
|
||||
if (service == null) return;
|
||||
await service.callService('scene', 'turn_on', entityId: entityId);
|
||||
ref.invalidateSelf();
|
||||
}
|
||||
|
||||
void refresh() => ref.invalidateSelf();
|
||||
}
|
||||
|
||||
class HaWeather {
|
||||
final double? temperature;
|
||||
final String? condition;
|
||||
final double? humidity;
|
||||
|
||||
const HaWeather({this.temperature, this.condition, this.humidity});
|
||||
|
||||
factory HaWeather.fromEntity(HaEntity entity) {
|
||||
final attrs = entity.attributes;
|
||||
return HaWeather(
|
||||
temperature: (attrs['temperature'] as num?)?.toDouble(),
|
||||
condition: entity.state,
|
||||
humidity: (attrs['humidity'] as num?)?.toDouble(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:mirror_core/mirror_core.dart';
|
||||
import 'settings_provider.dart';
|
||||
|
||||
final plexServiceProvider = Provider<PlexService?>((ref) {
|
||||
final settings = ref.watch(settingsProvider).valueOrNull;
|
||||
if (settings == null || settings.plexHost == null || settings.plexToken == null) {
|
||||
return null;
|
||||
}
|
||||
return PlexService(
|
||||
host: settings.plexHost!,
|
||||
port: settings.plexPort,
|
||||
token: settings.plexToken!,
|
||||
);
|
||||
});
|
||||
|
||||
final plexBrowseProvider =
|
||||
AsyncNotifierProvider<PlexBrowseNotifier, PlexBrowseState>(
|
||||
PlexBrowseNotifier.new);
|
||||
|
||||
class PlexBrowseState {
|
||||
final List<PlexLibrary> libraries;
|
||||
final PlexLibrary? currentLibrary;
|
||||
final List<PlexItem> items;
|
||||
final List<String> breadcrumb;
|
||||
final String? error;
|
||||
|
||||
const PlexBrowseState({
|
||||
this.libraries = const [],
|
||||
this.currentLibrary,
|
||||
this.items = const [],
|
||||
this.breadcrumb = const [],
|
||||
this.error,
|
||||
});
|
||||
}
|
||||
|
||||
class PlexBrowseNotifier extends AsyncNotifier<PlexBrowseState> {
|
||||
@override
|
||||
Future<PlexBrowseState> build() async {
|
||||
final service = ref.watch(plexServiceProvider);
|
||||
if (service == null) {
|
||||
return const PlexBrowseState(error: 'Configure Plex in Settings');
|
||||
}
|
||||
final libraries = await service.fetchLibraries();
|
||||
return PlexBrowseState(libraries: libraries);
|
||||
}
|
||||
|
||||
Future<void> openLibrary(PlexLibrary library) async {
|
||||
final service = ref.read(plexServiceProvider);
|
||||
if (service == null) return;
|
||||
state = const AsyncValue.loading();
|
||||
state = await AsyncValue.guard(() async {
|
||||
final items = await service.fetchItems(library.id);
|
||||
return PlexBrowseState(
|
||||
libraries: state.valueOrNull?.libraries ?? [],
|
||||
currentLibrary: library,
|
||||
items: items,
|
||||
breadcrumb: [library.title],
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> openItem(PlexItem item) async {
|
||||
final service = ref.read(plexServiceProvider);
|
||||
if (service == null) return;
|
||||
if (item.type == 'show' || item.type == 'season' || item.type == 'artist' || item.type == 'album') {
|
||||
state = const AsyncValue.loading();
|
||||
state = await AsyncValue.guard(() async {
|
||||
final children = await service.fetchChildren(item.id);
|
||||
final prev = state.valueOrNull;
|
||||
return PlexBrowseState(
|
||||
libraries: prev?.libraries ?? [],
|
||||
currentLibrary: prev?.currentLibrary,
|
||||
items: children,
|
||||
breadcrumb: [...(prev?.breadcrumb ?? []), item.title],
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> goBack() async {
|
||||
final prev = state.valueOrNull;
|
||||
if (prev == null) return;
|
||||
|
||||
if (prev.breadcrumb.length <= 1) {
|
||||
state = AsyncValue.data(PlexBrowseState(
|
||||
libraries: prev.libraries,
|
||||
));
|
||||
} else {
|
||||
if (prev.currentLibrary != null) {
|
||||
await openLibrary(prev.currentLibrary!);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void refresh() {
|
||||
ref.invalidateSelf();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:mirror_core/mirror_core.dart';
|
||||
|
||||
final programsApiProvider = Provider<ProgramsApiClient>((ref) {
|
||||
return ProgramsApiClient(baseUrl: 'http://192.168.86.172:8091');
|
||||
});
|
||||
|
||||
final programsProvider =
|
||||
AsyncNotifierProvider<ProgramsNotifier, List<Program>>(ProgramsNotifier.new);
|
||||
|
||||
class ProgramsNotifier extends AsyncNotifier<List<Program>> {
|
||||
@override
|
||||
Future<List<Program>> build() async {
|
||||
final client = ref.read(programsApiProvider);
|
||||
return client.fetchPrograms();
|
||||
}
|
||||
|
||||
Future<void> refresh() async {
|
||||
state = const AsyncValue.loading();
|
||||
state = await AsyncValue.guard(() async {
|
||||
final client = ref.read(programsApiProvider);
|
||||
return client.fetchPrograms();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
final settingsProvider = AsyncNotifierProvider<SettingsNotifier, AppSettings>(SettingsNotifier.new);
|
||||
|
||||
class AppSettings {
|
||||
final String mirrorHost;
|
||||
final int mirrorPort;
|
||||
final String workoutPlayerUrl;
|
||||
final String? plexHost;
|
||||
final int plexPort;
|
||||
final String? plexToken;
|
||||
final String? haBaseUrl;
|
||||
final String? haToken;
|
||||
final String? spotifyClientId;
|
||||
final bool spotifyConnected;
|
||||
|
||||
const AppSettings({
|
||||
this.mirrorHost = 'mirror.local',
|
||||
this.mirrorPort = 9090,
|
||||
this.workoutPlayerUrl = 'http://192.168.86.172:8091',
|
||||
this.plexHost,
|
||||
this.plexPort = 32400,
|
||||
this.plexToken,
|
||||
this.haBaseUrl,
|
||||
this.haToken,
|
||||
this.spotifyClientId,
|
||||
this.spotifyConnected = false,
|
||||
});
|
||||
|
||||
AppSettings copyWith({
|
||||
String? mirrorHost,
|
||||
int? mirrorPort,
|
||||
String? workoutPlayerUrl,
|
||||
String? plexHost,
|
||||
int? plexPort,
|
||||
String? plexToken,
|
||||
String? haBaseUrl,
|
||||
String? haToken,
|
||||
String? spotifyClientId,
|
||||
bool? spotifyConnected,
|
||||
}) =>
|
||||
AppSettings(
|
||||
mirrorHost: mirrorHost ?? this.mirrorHost,
|
||||
mirrorPort: mirrorPort ?? this.mirrorPort,
|
||||
workoutPlayerUrl: workoutPlayerUrl ?? this.workoutPlayerUrl,
|
||||
plexHost: plexHost ?? this.plexHost,
|
||||
plexPort: plexPort ?? this.plexPort,
|
||||
plexToken: plexToken ?? this.plexToken,
|
||||
haBaseUrl: haBaseUrl ?? this.haBaseUrl,
|
||||
haToken: haToken ?? this.haToken,
|
||||
spotifyClientId: spotifyClientId ?? this.spotifyClientId,
|
||||
spotifyConnected: spotifyConnected ?? this.spotifyConnected,
|
||||
);
|
||||
}
|
||||
|
||||
class SettingsNotifier extends AsyncNotifier<AppSettings> {
|
||||
@override
|
||||
Future<AppSettings> build() async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
return AppSettings(
|
||||
mirrorHost: prefs.getString('mirror_host') ?? 'mirror.local',
|
||||
mirrorPort: prefs.getInt('mirror_port') ?? 9090,
|
||||
workoutPlayerUrl: prefs.getString('workout_player_url') ?? 'http://192.168.86.172:8091',
|
||||
plexHost: prefs.getString('plex_host'),
|
||||
plexPort: prefs.getInt('plex_port') ?? 32400,
|
||||
plexToken: prefs.getString('plex_token'),
|
||||
haBaseUrl: prefs.getString('ha_base_url'),
|
||||
haToken: prefs.getString('ha_token'),
|
||||
spotifyClientId: prefs.getString('spotify_client_id'),
|
||||
spotifyConnected: prefs.getBool('spotify_connected') ?? false,
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> save(AppSettings settings) async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
await prefs.setString('mirror_host', settings.mirrorHost);
|
||||
await prefs.setInt('mirror_port', settings.mirrorPort);
|
||||
await prefs.setString('workout_player_url', settings.workoutPlayerUrl);
|
||||
if (settings.plexHost != null) {
|
||||
await prefs.setString('plex_host', settings.plexHost!);
|
||||
} else {
|
||||
await prefs.remove('plex_host');
|
||||
}
|
||||
await prefs.setInt('plex_port', settings.plexPort);
|
||||
if (settings.plexToken != null) {
|
||||
await prefs.setString('plex_token', settings.plexToken!);
|
||||
} else {
|
||||
await prefs.remove('plex_token');
|
||||
}
|
||||
if (settings.haBaseUrl != null) {
|
||||
await prefs.setString('ha_base_url', settings.haBaseUrl!);
|
||||
} else {
|
||||
await prefs.remove('ha_base_url');
|
||||
}
|
||||
if (settings.haToken != null) {
|
||||
await prefs.setString('ha_token', settings.haToken!);
|
||||
} else {
|
||||
await prefs.remove('ha_token');
|
||||
}
|
||||
if (settings.spotifyClientId != null) {
|
||||
await prefs.setString('spotify_client_id', settings.spotifyClientId!);
|
||||
} else {
|
||||
await prefs.remove('spotify_client_id');
|
||||
}
|
||||
await prefs.setBool('spotify_connected', settings.spotifyConnected);
|
||||
state = AsyncValue.data(settings);
|
||||
}
|
||||
}
|
||||