mirror of
https://github.com/amigan/calls.git
synced 2024-11-21 20:39: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
|
<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"
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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('');
|
||||||
}),
|
});
|
||||||
),
|
|
||||||
),
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue