mirror of
https://github.com/amigan/calls.git
synced 2024-11-21 04:19:47 -05:00
wip
This commit is contained in:
parent
8e99afeb31
commit
9bc788035b
2 changed files with 15 additions and 35 deletions
|
@ -1,6 +1,8 @@
|
|||
import 'package:web_socket_channel/web_socket_channel.dart';
|
||||
import '../pb/stillbox.pb.dart';
|
||||
|
||||
class LiveFeeder {
|
||||
late Uri _wsUri;
|
||||
late WebSocketChannel channel;
|
||||
|
||||
LiveFeeder();
|
||||
|
@ -12,13 +14,21 @@ class LiveFeeder {
|
|||
String port = (baseUri.hasPort ? ':' + baseUri.port.toString() : '');
|
||||
socketUrl = 'ws://${baseUri.host}$port/ws';
|
||||
}
|
||||
final wsUri = Uri.parse(socketUrl);
|
||||
_wsUri = Uri.parse(socketUrl);
|
||||
}
|
||||
|
||||
channel = WebSocketChannel.connect(wsUri);
|
||||
void connect() {
|
||||
channel = WebSocketChannel.connect(_wsUri);
|
||||
channel.stream.listen((event) => _handleData(event));
|
||||
}
|
||||
|
||||
void _handleData(dynamic event) {
|
||||
print(event);
|
||||
final msg = Message.fromBuffer(event);
|
||||
switch (msg.whichToClientMessage()) {
|
||||
case Message_ToClientMessage.call:
|
||||
case Message_ToClientMessage.notification:
|
||||
case Message_ToClientMessage.popup:
|
||||
case Message_ToClientMessage.error:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,15 +5,6 @@ import '../../views/keypad.dart';
|
|||
class MainRadio extends StatefulWidget {
|
||||
const MainRadio({super.key, required this.title});
|
||||
|
||||
// This widget is the home page of your application. It is stateful, meaning
|
||||
// that it has a State object (defined below) that contains fields that affect
|
||||
// how it looks.
|
||||
|
||||
// This class is the configuration for the state. It holds the values (in this
|
||||
// case the title) provided by the parent (in this case the App widget) and
|
||||
// used by the build method of the State. Fields in a Widget subclass are
|
||||
// always marked "final".
|
||||
|
||||
final String title;
|
||||
|
||||
@override
|
||||
|
@ -23,32 +14,11 @@ class MainRadio extends StatefulWidget {
|
|||
class _MainRadioState extends State<MainRadio> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// This method is rerun every time setState is called, for instance as done
|
||||
// by the _incrementCounter method above.
|
||||
//
|
||||
// The Flutter framework has been optimized to make rerunning build methods
|
||||
// fast, so that you can just rebuild anything that needs updating rather
|
||||
// than having to individually change instances of widgets.
|
||||
return Scaffold(
|
||||
body: const Center(
|
||||
// Center is a layout widget. It takes a single child and positions it
|
||||
// in the middle of the parent.
|
||||
return const Scaffold(
|
||||
body: Center(
|
||||
child: SizedBox(
|
||||
width: 500.0,
|
||||
child: Column(
|
||||
// Column is also a layout widget. It takes a list of children and
|
||||
// arranges them vertically. By default, it sizes itself to fit its
|
||||
// children horizontally, and tries to be as tall as its parent.
|
||||
//
|
||||
// Column has various properties to control how it sizes itself and
|
||||
// how it positions its children. Here we use mainAxisAlignment to
|
||||
// center the children vertically; the main axis here is the vertical
|
||||
// axis because Columns are vertical (the cross axis would be
|
||||
// horizontal).
|
||||
//
|
||||
// TRY THIS: Invoke "debug painting" (choose the "Toggle Debug Paint"
|
||||
// action in the IDE, or press "p" in the console), to see the
|
||||
// wireframe for each widget.
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
ScannerLabel(),
|
||||
|
|
Loading…
Reference in a new issue