File tree Expand file tree Collapse file tree 3 files changed +23
-4
lines changed Expand file tree Collapse file tree 3 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import 'dart:core';
3
3
import 'src/basic_sample/basic_sample.dart' ;
4
4
import 'src/call_sample/call_sample.dart' ;
5
5
import 'src/route_item.dart' ;
6
+ import 'package:shared_preferences/shared_preferences.dart' ;
6
7
7
8
void main () => runApp (new MyApp ());
8
9
@@ -14,10 +15,17 @@ class MyApp extends StatefulWidget {
14
15
15
16
16
17
class _MyAppState extends State <MyApp > {
18
+
19
+ List <RouteItem > items;
20
+ String _ip = '192.168.31.152' ;
21
+ SharedPreferences prefs;
22
+
17
23
@override
18
24
initState () {
19
25
super .initState ();
20
26
27
+ _initData ();
28
+
21
29
_initItems ();
22
30
23
31
}
@@ -50,8 +58,13 @@ class _MyAppState extends State<MyApp> {
50
58
);
51
59
}
52
60
53
- List <RouteItem > items;
54
- String _ip = '192.168.31.152' ;
61
+
62
+ _initData () async {
63
+ prefs = await SharedPreferences .getInstance ();
64
+ setState (() {
65
+ _ip = prefs.getString ('ip' ) ?? '' ;
66
+ });
67
+ }
55
68
56
69
_initItems (){
57
70
@@ -92,6 +105,9 @@ class _MyAppState extends State<MyApp> {
92
105
onPressed: () {},
93
106
child: RaisedButton (
94
107
onPressed: () {
108
+
109
+ prefs.setString ('ip' , _ip);
110
+
95
111
Navigator .push (
96
112
context,
97
113
MaterialPageRoute (
Original file line number Diff line number Diff line change 1
1
import 'package:flutter/material.dart' ;
2
+ import 'dart:io' ;
2
3
import 'dart:core' ;
3
4
import 'dart:async' ;
4
5
import 'signaling.dart' ;
@@ -19,7 +20,7 @@ class _CallSampleState extends State<CallSample> {
19
20
GlobalKey <FormState > _formKey = new GlobalKey <FormState >();
20
21
Signaling _signaling;
21
22
String _roomId;
22
- String _displayName = "flutter " ;
23
+ String _displayName = Platform .operatingSystem + "_flutter " ;
23
24
List <dynamic > _peers;
24
25
25
26
final _localRenderer = new RTCVideoRenderer ();
@@ -118,7 +119,7 @@ class _CallSampleState extends State<CallSample> {
118
119
actions: < Widget > [
119
120
IconButton (
120
121
icon: const Icon (Icons .settings),
121
- onPressed: _connect ,
122
+ onPressed: null ,
122
123
tooltip: 'setup' ,
123
124
),
124
125
],
Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ dev_dependencies:
16
16
webrtc :
17
17
path : ../
18
18
19
+ shared_preferences : ^0.4.2
20
+
19
21
# For information on the generic Dart part of this file, see the
20
22
# following page: https://www.dartlang.org/tools/pub/pubspec
21
23
You can’t perform that action at this time.
0 commit comments