before big stream change

This commit is contained in:
Daniel 2024-08-17 13:43:26 -04:00
parent c77b178f85
commit c7e42d08d0
3 changed files with 39 additions and 17 deletions

View file

@ -2,7 +2,8 @@
<application <application
android:label="calls" android:label="calls"
android:name="${applicationName}" android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"> android:icon="@mipmap/ic_launcher"
android:usesCleartextTraffic="true">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:exported="true" android:exported="true"

View file

@ -48,6 +48,7 @@ class JustAudioDriver implements AudioDriver {
initializer.audioInit(); initializer.audioInit();
} }
@override
Stream<justaudio.PlayerState> get playerStateStream { Stream<justaudio.PlayerState> get playerStateStream {
return player.playerStateStream; return player.playerStateStream;
} }

View file

@ -11,12 +11,16 @@ class LCD extends StatefulWidget {
} }
class _LCDState extends State<LCD> { class _LCDState extends State<LCD> {
static const _lcdOnColor = Colors.amber;
static const _lcdOffColor = Color.fromARGB(255, 255, 219, 110);
Color _lcdColor = _lcdOffColor;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
decoration: const BoxDecoration( decoration: BoxDecoration(
color: Colors.amber, color: _lcdColor,
border: Border( border: const Border(
top: BorderSide(width: 3.0, color: Colors.black), top: BorderSide(width: 3.0, color: Colors.black),
left: BorderSide(width: 3.0, color: Colors.black), left: BorderSide(width: 3.0, color: Colors.black),
bottom: BorderSide( bottom: BorderSide(
@ -35,22 +39,38 @@ class _LCDState extends State<LCD> {
style: const TextStyle( style: const TextStyle(
color: Colors.black, color: Colors.black,
), ),
child: Consumer<Stillbox>(builder: (context, sb, child) { child: lcdContents(),
),
),
));
}
void lcdOn() {
setState(() {
_lcdColor = _lcdOnColor;
});
}
void lcdOff() {
setState(() {
_lcdColor = _lcdOffColor;
});
}
Widget lcdContents() {
return Consumer<Stillbox>(builder: (context, sb, child) {
if (sb.currentCall != null) { if (sb.currentCall != null) {
lcdOn();
return FutureBuilder( return FutureBuilder(
future: sb.currentCall?.tg, future: sb.currentCall?.tg,
builder: (BuildContext context, builder: (BuildContext context, AsyncSnapshot<TalkgroupInfo> tgi) {
AsyncSnapshot<TalkgroupInfo> tgi) {
return Text( return Text(
'${tgi.data?.name ?? sb.currentCall!.call.talkgroup}${tgi.data?.learned ?? false ? ' 📓' : ''}'); '${tgi.data?.name ?? sb.currentCall!.call.talkgroup}${tgi.data?.learned ?? false ? ' 📓' : ''}');
}); });
} }
return const Text(''); return const Text('');
}), });
),
),
));
} }
} }