27 lines
796 B
Dart
27 lines
796 B
Dart
|
|
import 'package:halkyon_learn_flutter/src/core/video/youtube_videos.dart';
|
||
|
|
import 'package:material_ui/material_ui.dart';
|
||
|
|
|
||
|
|
/// [YoutubeVideos] that plays nothing: its player is a text naming the video,
|
||
|
|
/// and it notes the videos it was asked to open.
|
||
|
|
class FakeYoutubeVideos({bool playInApp = false}) implements YoutubeVideos {
|
||
|
|
@override
|
||
|
|
final bool playInApp = playInApp;
|
||
|
|
|
||
|
|
/// The videos opened outside the app, in order.
|
||
|
|
final opened = <YoutubeVideo>[];
|
||
|
|
|
||
|
|
/// The videos whose player was built, in order.
|
||
|
|
final played = <YoutubeVideo>[];
|
||
|
|
|
||
|
|
@override
|
||
|
|
Widget player(YoutubeVideo video) {
|
||
|
|
played.add(video);
|
||
|
|
return Text('Playing ${video.id} from ${video.start}');
|
||
|
|
}
|
||
|
|
|
||
|
|
@override
|
||
|
|
Future<bool> open(YoutubeVideo video) async {
|
||
|
|
opened.add(video);
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
}
|