4
2
Fork 0

working on welcome page

pull/31/head
Sudharshan S. 2019-02-20 22:39:53 +08:00
parent fa2b2b001a
commit 7b7b5479bf
Signed by: sudharshan
GPG Key ID: C861C97AAF3D9559
9 changed files with 56 additions and 15 deletions

View File

@ -1,11 +1,13 @@
import 'package:flutter/material.dart';
import 'src/ui/screens/home.dart';
import "src/ui/screens/welcome.dart";
import 'themer.dart';
class Routes {
final routes = <String, WidgetBuilder>{
'/home': (BuildContext context) => Container(child: Home()),
'/welcome': (BuildContext context) => Welcome(),
};
final theme = buildTheme();
@ -15,7 +17,7 @@ class Routes {
title: "Beep",
theme: theme,
routes: routes,
home: Container(child: Home()),
home: Welcome(),
));
}
}

View File

@ -1,7 +1,5 @@
import "package:rxdart/rxdart.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 "../models/user_model.dart";
@ -15,6 +13,7 @@ class VoiceConnection {
VoiceConnection() {
_bottomBarBus.listen((data) => print(data));
_peerManager.initialize();
}
Observable<Map<String, dynamic>> get bus => _bottomBarBus.stream;
@ -29,7 +28,6 @@ class VoiceConnection {
// Add the users to the streams
users.forEach((user) {
print("hi");
_peerManager.addPeer(user.id);
});

View File

@ -44,13 +44,11 @@ class PeerConnectionFactory {
};
PeerConnectionFactory(this._localUserId, this._localDeviceId, this._stream,
this.onMessageCallback) {
_initialize();
}
this.onMessageCallback);
// initialize() method sets up a subscription to the eventsource and
// attaches a callback to it
_initialize() async {
initialize() async {
_signalingServer = await EventSource.connect(
"$baseUrlSignaling/subscribe/$_localUserId/device/$_localDeviceId");

View File

@ -15,13 +15,11 @@ class PeerManager {
List<MediaStream> _currentStreams = [];
Map<String, RTCPeerConnection> _currentConnections = {};
PeerManager(this._selfUserId, this._selfDeviceId) {
_initialize();
}
PeerManager(this._selfUserId, this._selfDeviceId);
List<MediaStream> get streams => _currentStreams;
_initialize() async {
initialize() async {
final Map<String, dynamic> mediaConstraints = {
"audio": true,
"video": false
@ -30,6 +28,7 @@ class PeerManager {
_localStream = await navigator.getUserMedia(mediaConstraints);
_peerConnectionFactory = PeerConnectionFactory(
_selfUserId, _selfDeviceId, _localStream, _signalEventHandler);
await _peerConnectionFactory.initialize();
}
addPeer(String userId) async {
@ -64,7 +63,7 @@ class PeerManager {
}
_signalEventHandler(Map<String, dynamic> data) async {
switch (data["type"]) {
switch (SignalType.values[data["type"]]) {
case SignalType.CANDIDATE:
String userId = data["fromUser"];
String deviceId = data["fromDevice"];

View File

View File

@ -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),
),
));
}
}

View File

View File

@ -27,6 +27,10 @@ ThemeData buildTheme() {
TextTheme buildTextTheme(TextTheme base) {
return base
.copyWith(
display4: base.display4
.copyWith(fontSize: 40.0, fontWeight: FontWeight.w600),
display3: base.display3
.copyWith(fontSize: 30.0, fontWeight: FontWeight.w700),
display2: base.display2
.copyWith(fontSize: 18.0, fontWeight: FontWeight.w500),
display1: base.display1

View File

@ -12,8 +12,8 @@ dependencies:
rxdart: ^0.20.0
http: ^0.12.0+1
eventsource: ^0.2.1
flutter_webrtc: ^00.1.0
flutter_webrtc: ^0.1.0
pin_code_text_field: ^1.1.3
dev_dependencies:
flutter_test: