File tree Expand file tree Collapse file tree 2 files changed +12
-10
lines changed Expand file tree Collapse file tree 2 files changed +12
-10
lines changed Original file line number Diff line number Diff line change 1
1
import 'dart:async' ;
2
+ import 'dart:typed_data' ;
2
3
3
4
import 'package:flutter/material.dart' ;
4
5
import 'package:flutter_webrtc/flutter_webrtc.dart' ;
@@ -20,12 +21,14 @@ class ThumbnailWidget extends StatefulWidget {
20
21
21
22
class _ThumbnailWidgetState extends State <ThumbnailWidget > {
22
23
final List <StreamSubscription > _subscriptions = [];
23
-
24
+ Uint8List ? _thumbnail;
24
25
@override
25
26
void initState () {
26
27
super .initState ();
27
28
_subscriptions.add (widget.source.onThumbnailChanged.stream.listen ((event) {
28
- setState(() {});
29
+ setState (() {
30
+ _thumbnail = event;
31
+ });
29
32
}));
30
33
_subscriptions.add (widget.source.onNameChanged.stream.listen ((event) {
31
34
setState (() {});
@@ -55,9 +58,9 @@ class _ThumbnailWidgetState extends State<ThumbnailWidget> {
55
58
print ('Selected source id => ${widget .source .id }' );
56
59
widget.onTap (widget.source);
57
60
},
58
- child: widget.source.thumbnail != null
61
+ child: _thumbnail != null
59
62
? Image .memory (
60
- widget.source.thumbnail ! ,
63
+ _thumbnail ! ,
61
64
gaplessPlayback: true ,
62
65
alignment: Alignment .center,
63
66
)
@@ -190,8 +193,8 @@ class ScreenSelectDialog extends Dialog {
190
193
Container (
191
194
constraints: BoxConstraints .expand (height: 24 ),
192
195
child: TabBar (
193
- onTap: (value) => Future . delayed (
194
- Duration (milliseconds : 300 ) , () {
196
+ onTap: (value) =>
197
+ Future . delayed ( Duration .zero , () {
195
198
_sourceType = value == 0
196
199
? SourceType .Screen
197
200
: SourceType .Window ;
Original file line number Diff line number Diff line change @@ -107,10 +107,9 @@ class DesktopCapturerNative extends DesktopCapturer {
107
107
}
108
108
break ;
109
109
case 'desktopSourceRemoved' :
110
- final source = _sources[map['id' ] as String ];
111
- if (source != null ) {
112
- _sources.remove ((source) => source.id == map['id' ]);
113
- _onRemoved.add (source);
110
+ final id = map['id' ] as String ;
111
+
4E3D
if (_sources[id] != null ) {
112
+ _onRemoved.add (_sources.remove (id)! );
114
113
}
115
114
break ;
116
115
case 'desktopSourceThumbnailChanged' :
You can’t perform that action at this time.
0 commit comments