From a0a9acc9d9710d05bb59d70e06386cf50c45a9b0 Mon Sep 17 00:00:00 2001 From: Hiroshi Horie <548776+hiroshihorie@users.noreply.github.com> Date: Thu, 28 Oct 2021 02:14:52 +0900 Subject: [PATCH] example app: allow scroll in connect page --- example/lib/pages/connect.dart | 125 +++++++++++---------- lib/src/participant/local_participant.dart | 2 +- lib/src/track/local_video_track.dart | 2 +- 3 files changed, 66 insertions(+), 63 deletions(-) diff --git a/example/lib/pages/connect.dart b/example/lib/pages/connect.dart index b427215..076694e 100644 --- a/example/lib/pages/connect.dart +++ b/example/lib/pages/connect.dart @@ -110,74 +110,77 @@ class _ConnectPageState extends State { Widget build(BuildContext context) => Scaffold( body: Container( alignment: Alignment.center, - child: Container( - padding: const EdgeInsets.symmetric( - horizontal: 20, - ), - constraints: const BoxConstraints(maxWidth: 400), - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Padding( - padding: const EdgeInsets.only(bottom: 70), - child: SvgPicture.asset( - 'images/logo-dark.svg', + child: SingleChildScrollView( + child: Container( + padding: const EdgeInsets.symmetric( + horizontal: 20, + vertical: 20, + ), + constraints: const BoxConstraints(maxWidth: 400), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Padding( + padding: const EdgeInsets.only(bottom: 70), + child: SvgPicture.asset( + 'images/logo-dark.svg', + ), ), - ), - Padding( - padding: const EdgeInsets.only(bottom: 25), - child: LKTextField( - label: 'Server URL', - ctrl: _uriCtrl, + Padding( + padding: const EdgeInsets.only(bottom: 25), + child: LKTextField( + label: 'Server URL', + ctrl: _uriCtrl, + ), ), - ), - Padding( - padding: const EdgeInsets.only(bottom: 25), - child: LKTextField( - label: 'Token', - ctrl: _tokenCtrl, + Padding( + padding: const EdgeInsets.only(bottom: 25), + child: LKTextField( + label: 'Token', + ctrl: _tokenCtrl, + ), ), - ), - Padding( - padding: const EdgeInsets.only(bottom: 50), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - const Text('Simulcast'), - Switch( - value: _simulcast, - onChanged: (value) => _setSimulcast(value), - inactiveTrackColor: Colors.white.withOpacity(.2), - activeTrackColor: LKColors.lkBlue, - inactiveThumbColor: Colors.white.withOpacity(.5), - activeColor: Colors.white, - ), - ], + Padding( + padding: const EdgeInsets.only(bottom: 50), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + const Text('Simulcast'), + Switch( + value: _simulcast, + onChanged: (value) => _setSimulcast(value), + inactiveTrackColor: Colors.white.withOpacity(.2), + activeTrackColor: LKColors.lkBlue, + inactiveThumbColor: Colors.white.withOpacity(.5), + activeColor: Colors.white, + ), + ], + ), ), - ), - ElevatedButton( - onPressed: _busy ? null : () => _connect(context), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - if (_busy) - const Padding( - padding: EdgeInsets.only(right: 10), - child: SizedBox( - height: 15, - width: 15, - child: CircularProgressIndicator( - color: Colors.white, - strokeWidth: 2, + ElevatedButton( + onPressed: _busy ? null : () => _connect(context), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + if (_busy) + const Padding( + padding: EdgeInsets.only(right: 10), + child: SizedBox( + height: 15, + width: 15, + child: CircularProgressIndicator( + color: Colors.white, + strokeWidth: 2, + ), ), ), - ), - const Text('CONNECT'), - ], + const Text('CONNECT'), + ], + ), ), - ), - ], + ], + ), ), ), ), diff --git a/lib/src/participant/local_participant.dart b/lib/src/participant/local_participant.dart index 50783ae..4540177 100644 --- a/lib/src/participant/local_participant.dart +++ b/lib/src/participant/local_participant.dart @@ -76,7 +76,7 @@ class LocalParticipant extends Participant { final pub = LocalTrackPublication(trackInfo, track, this); addTrackPublication(pub); - + [events, roomEvents].emit(TrackPublishedEvent( participant: this, publication: pub, diff --git a/lib/src/track/local_video_track.dart b/lib/src/track/local_video_track.dart index ee40990..c83e55b 100644 --- a/lib/src/track/local_video_track.dart +++ b/lib/src/track/local_video_track.dart @@ -41,7 +41,7 @@ class LocalVideoTrack extends VideoTrack { // stop the current track & stream await mediaStreamTrack.stop(); await mediaStream.dispose(); - + // create new track with options final newStream = await _createStream(currentOptions); final newTrack = newStream.getVideoTracks().first;