Line data Source code
1 : /// Text configuration for customizing text labels in the ExpandedGoogleCastPlayerController widget.
2 : ///
3 : /// This class allows you to customize all text content displayed in the expanded player,
4 : /// making it easy to support internationalization or custom branding.
5 : ///
6 : /// Example usage:
7 : /// ```dart
8 : /// ExpandedGoogleCastPlayerController(
9 : /// texts: ExpandedGoogleCastPlayerTexts(
10 : /// nowPlaying: 'Reproduciendo ahora',
11 : /// unknownTitle: 'TÃtulo desconocido',
12 : /// castingToDevice: (deviceName) => 'Transmitiendo a $deviceName',
13 : /// noCaptionsAvailable: 'Sin subtÃtulos disponibles',
14 : /// captionsOff: 'Desactivar',
15 : /// trackFallback: (trackId) => 'Pista $trackId',
16 : /// ),
17 : /// )
18 : /// ```
19 : class GoogleCastPlayerTexts {
20 : /// Text displayed when media title is unknown or empty
21 : final String unknownTitle;
22 :
23 : /// Text displayed in the app bar header
24 : final String nowPlaying;
25 :
26 : /// Function that returns text showing which device is being cast to.
27 : /// The [deviceName] parameter contains the friendly name of the cast device.
28 : final String Function(String deviceName) castingToDevice;
29 :
30 : /// Text displayed when no caption tracks are available
31 : final String noCaptionsAvailable;
32 :
33 : /// Text displayed for the option to turn off captions
34 : final String captionsOff;
35 :
36 : /// Function that returns fallback text for caption track names.
37 : /// The [trackId] parameter contains the numeric ID of the track.
38 : final String Function(int trackId) trackFallback;
39 :
40 : /// Creates a new [GoogleCastPlayerTexts].
41 5 : const GoogleCastPlayerTexts({
42 : this.unknownTitle = 'Unknown Title',
43 : this.nowPlaying = 'Now Playing',
44 : this.castingToDevice = _defaultCastingToDevice,
45 : this.noCaptionsAvailable = 'No captions available',
46 : this.captionsOff = 'Off',
47 : this.trackFallback = _defaultTrackFallback,
48 : });
49 :
50 0 : static String _defaultCastingToDevice(String deviceName) =>
51 0 : 'Casting to $deviceName';
52 0 : static String _defaultTrackFallback(int trackId) => 'Track $trackId';
53 : }
|