mirror of
https://github.com/amigan/calls.git
synced 2024-11-21 12:29:47 -05:00
before big stream change
This commit is contained in:
parent
c77b178f85
commit
c7e42d08d0
3 changed files with 39 additions and 17 deletions
|
@ -2,7 +2,8 @@
|
|||
<application
|
||||
android:label="calls"
|
||||
android:name="${applicationName}"
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:usesCleartextTraffic="true">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
|
|
|
@ -48,6 +48,7 @@ class JustAudioDriver implements AudioDriver {
|
|||
initializer.audioInit();
|
||||
}
|
||||
|
||||
@override
|
||||
Stream<justaudio.PlayerState> get playerStateStream {
|
||||
return player.playerStateStream;
|
||||
}
|
||||
|
|
|
@ -11,12 +11,16 @@ class LCD extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _LCDState extends State<LCD> {
|
||||
static const _lcdOnColor = Colors.amber;
|
||||
static const _lcdOffColor = Color.fromARGB(255, 255, 219, 110);
|
||||
Color _lcdColor = _lcdOffColor;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.amber,
|
||||
border: Border(
|
||||
decoration: BoxDecoration(
|
||||
color: _lcdColor,
|
||||
border: const Border(
|
||||
top: BorderSide(width: 3.0, color: Colors.black),
|
||||
left: BorderSide(width: 3.0, color: Colors.black),
|
||||
bottom: BorderSide(
|
||||
|
@ -35,23 +39,39 @@ class _LCDState extends State<LCD> {
|
|||
style: const TextStyle(
|
||||
color: Colors.black,
|
||||
),
|
||||
child: Consumer<Stillbox>(builder: (context, sb, child) {
|
||||
if (sb.currentCall != null) {
|
||||
return FutureBuilder(
|
||||
future: sb.currentCall?.tg,
|
||||
builder: (BuildContext context,
|
||||
AsyncSnapshot<TalkgroupInfo> tgi) {
|
||||
return Text(
|
||||
'${tgi.data?.name ?? sb.currentCall!.call.talkgroup}${tgi.data?.learned ?? false ? ' 📓' : ''}');
|
||||
});
|
||||
}
|
||||
|
||||
return const Text('');
|
||||
}),
|
||||
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) {
|
||||
lcdOn();
|
||||
return FutureBuilder(
|
||||
future: sb.currentCall?.tg,
|
||||
builder: (BuildContext context, AsyncSnapshot<TalkgroupInfo> tgi) {
|
||||
return Text(
|
||||
'${tgi.data?.name ?? sb.currentCall!.call.talkgroup}${tgi.data?.learned ?? false ? ' 📓' : ''}');
|
||||
});
|
||||
}
|
||||
|
||||
return const Text('');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class ScannerLabel extends StatefulWidget {
|
||||
|
|
Loading…
Reference in a new issue