working on welcome page
parent
fa2b2b001a
commit
7b7b5479bf
|
@ -1,11 +1,13 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'src/ui/screens/home.dart';
|
import 'src/ui/screens/home.dart';
|
||||||
|
import "src/ui/screens/welcome.dart";
|
||||||
import 'themer.dart';
|
import 'themer.dart';
|
||||||
|
|
||||||
class Routes {
|
class Routes {
|
||||||
final routes = <String, WidgetBuilder>{
|
final routes = <String, WidgetBuilder>{
|
||||||
'/home': (BuildContext context) => Container(child: Home()),
|
'/home': (BuildContext context) => Container(child: Home()),
|
||||||
|
'/welcome': (BuildContext context) => Welcome(),
|
||||||
};
|
};
|
||||||
|
|
||||||
final theme = buildTheme();
|
final theme = buildTheme();
|
||||||
|
@ -15,7 +17,7 @@ class Routes {
|
||||||
title: "Beep",
|
title: "Beep",
|
||||||
theme: theme,
|
theme: theme,
|
||||||
routes: routes,
|
routes: routes,
|
||||||
home: Container(child: Home()),
|
home: Welcome(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import "package:rxdart/rxdart.dart";
|
import "package:rxdart/rxdart.dart";
|
||||||
import "package:flutter_webrtc/webrtc.dart";
|
import "package:flutter_webrtc/webrtc.dart";
|
||||||
import 'dart:async' show Stream;
|
|
||||||
import 'package:async/async.dart' show StreamGroup;
|
|
||||||
|
|
||||||
import "../resources/conversation_api_provider.dart";
|
import "../resources/conversation_api_provider.dart";
|
||||||
import "../models/user_model.dart";
|
import "../models/user_model.dart";
|
||||||
|
@ -15,6 +13,7 @@ class VoiceConnection {
|
||||||
|
|
||||||
VoiceConnection() {
|
VoiceConnection() {
|
||||||
_bottomBarBus.listen((data) => print(data));
|
_bottomBarBus.listen((data) => print(data));
|
||||||
|
_peerManager.initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
Observable<Map<String, dynamic>> get bus => _bottomBarBus.stream;
|
Observable<Map<String, dynamic>> get bus => _bottomBarBus.stream;
|
||||||
|
@ -29,7 +28,6 @@ class VoiceConnection {
|
||||||
|
|
||||||
// Add the users to the streams
|
// Add the users to the streams
|
||||||
users.forEach((user) {
|
users.forEach((user) {
|
||||||
print("hi");
|
|
||||||
_peerManager.addPeer(user.id);
|
_peerManager.addPeer(user.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -44,13 +44,11 @@ class PeerConnectionFactory {
|
||||||
};
|
};
|
||||||
|
|
||||||
PeerConnectionFactory(this._localUserId, this._localDeviceId, this._stream,
|
PeerConnectionFactory(this._localUserId, this._localDeviceId, this._stream,
|
||||||
this.onMessageCallback) {
|
this.onMessageCallback);
|
||||||
_initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
// initialize() method sets up a subscription to the eventsource and
|
// initialize() method sets up a subscription to the eventsource and
|
||||||
// attaches a callback to it
|
// attaches a callback to it
|
||||||
_initialize() async {
|
initialize() async {
|
||||||
_signalingServer = await EventSource.connect(
|
_signalingServer = await EventSource.connect(
|
||||||
"$baseUrlSignaling/subscribe/$_localUserId/device/$_localDeviceId");
|
"$baseUrlSignaling/subscribe/$_localUserId/device/$_localDeviceId");
|
||||||
|
|
||||||
|
|
|
@ -15,13 +15,11 @@ class PeerManager {
|
||||||
List<MediaStream> _currentStreams = [];
|
List<MediaStream> _currentStreams = [];
|
||||||
Map<String, RTCPeerConnection> _currentConnections = {};
|
Map<String, RTCPeerConnection> _currentConnections = {};
|
||||||
|
|
||||||
PeerManager(this._selfUserId, this._selfDeviceId) {
|
PeerManager(this._selfUserId, this._selfDeviceId);
|
||||||
_initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
List<MediaStream> get streams => _currentStreams;
|
List<MediaStream> get streams => _currentStreams;
|
||||||
|
|
||||||
_initialize() async {
|
initialize() async {
|
||||||
final Map<String, dynamic> mediaConstraints = {
|
final Map<String, dynamic> mediaConstraints = {
|
||||||
"audio": true,
|
"audio": true,
|
||||||
"video": false
|
"video": false
|
||||||
|
@ -30,6 +28,7 @@ class PeerManager {
|
||||||
_localStream = await navigator.getUserMedia(mediaConstraints);
|
_localStream = await navigator.getUserMedia(mediaConstraints);
|
||||||
_peerConnectionFactory = PeerConnectionFactory(
|
_peerConnectionFactory = PeerConnectionFactory(
|
||||||
_selfUserId, _selfDeviceId, _localStream, _signalEventHandler);
|
_selfUserId, _selfDeviceId, _localStream, _signalEventHandler);
|
||||||
|
await _peerConnectionFactory.initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
addPeer(String userId) async {
|
addPeer(String userId) async {
|
||||||
|
@ -64,7 +63,7 @@ class PeerManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
_signalEventHandler(Map<String, dynamic> data) async {
|
_signalEventHandler(Map<String, dynamic> data) async {
|
||||||
switch (data["type"]) {
|
switch (SignalType.values[data["type"]]) {
|
||||||
case SignalType.CANDIDATE:
|
case SignalType.CANDIDATE:
|
||||||
String userId = data["fromUser"];
|
String userId = data["fromUser"];
|
||||||
String deviceId = data["fromDevice"];
|
String deviceId = data["fromDevice"];
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
import "package:flutter/material.dart";
|
||||||
|
|
||||||
|
class Welcome extends StatelessWidget {
|
||||||
|
final String logo = "assets/logo.png";
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
body: Container(
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
|
||||||
|
Image.asset(logo,
|
||||||
|
semanticLabel: "Beep logo", width: 30.0, height: 50.0),
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.only(left: 10.0),
|
||||||
|
child: Text("Beep",
|
||||||
|
style: Theme.of(context).accentTextTheme.display3)),
|
||||||
|
]),
|
||||||
|
Text("Welcome!", style: Theme.of(context).accentTextTheme.display4),
|
||||||
|
Text("Let's get you set up",
|
||||||
|
style: Theme.of(context).accentTextTheme.display2),
|
||||||
|
]),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
colors: [
|
||||||
|
Theme.of(context).primaryColor,
|
||||||
|
Theme.of(context).primaryColorDark
|
||||||
|
],
|
||||||
|
begin: Alignment.topLeft,
|
||||||
|
end: Alignment.bottomRight,
|
||||||
|
stops: [0.0, 1.0],
|
||||||
|
tileMode: TileMode.clamp),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
|
@ -27,6 +27,10 @@ ThemeData buildTheme() {
|
||||||
TextTheme buildTextTheme(TextTheme base) {
|
TextTheme buildTextTheme(TextTheme base) {
|
||||||
return base
|
return base
|
||||||
.copyWith(
|
.copyWith(
|
||||||
|
display4: base.display4
|
||||||
|
.copyWith(fontSize: 40.0, fontWeight: FontWeight.w600),
|
||||||
|
display3: base.display3
|
||||||
|
.copyWith(fontSize: 30.0, fontWeight: FontWeight.w700),
|
||||||
display2: base.display2
|
display2: base.display2
|
||||||
.copyWith(fontSize: 18.0, fontWeight: FontWeight.w500),
|
.copyWith(fontSize: 18.0, fontWeight: FontWeight.w500),
|
||||||
display1: base.display1
|
display1: base.display1
|
||||||
|
|
|
@ -12,8 +12,8 @@ dependencies:
|
||||||
rxdart: ^0.20.0
|
rxdart: ^0.20.0
|
||||||
http: ^0.12.0+1
|
http: ^0.12.0+1
|
||||||
eventsource: ^0.2.1
|
eventsource: ^0.2.1
|
||||||
flutter_webrtc: ^00.1.0
|
flutter_webrtc: ^0.1.0
|
||||||
|
pin_code_text_field: ^1.1.3
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|
Loading…
Reference in New Issue