-
Notifications
You must be signed in to change notification settings - Fork 755
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Fullscreen is not pure full screen feature. #278
Comments
Hi @princeteck. I had a similar issue and I managed to solve it by adding a boolean variable to know when we are or not using Fullscreen, so I can change AppBar to null when we are using Fullscreen. Also, I added a WillPopScope widget to handle the back button press when Fullscreen to exit fullscreen. Here is my final file. I receive a Live Object as Parameter. class LiveDetail extends StatefulWidget {
final Live live;
LiveDetail({
Key key,
@required this.live,
}) : super(key: key);
@override
_LiveDetailState createState() => _LiveDetailState();
}
class _LiveDetailState extends State<LiveDetail> {
YoutubePlayerController _controller;
bool showAppBar = true;
@override
void initState() {
_controller = YoutubePlayerController(
initialVideoId: widget.live.videoId,
flags: YoutubePlayerFlags(autoPlay: true, isLive: widget.live.isLive, controlsVisibleAtStart: true),
);
super.initState();
}
Future<bool> _onWillPop() {
if (_controller.value.isFullScreen) {
_controller.toggleFullScreenMode();
} else {
Navigator.pop(context);
}
}
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: _onWillPop,
child: MaterialApp(
title: 'Live',
theme: ThemeData(primaryColor: Color(CustomColors.grena)),
debugShowCheckedModeBanner: false,
home: Scaffold(
appBar: showAppBar
? AppBar(
title: Text(widget.live.title),
leading: new IconButton(
icon: new Icon(Icons.arrow_back),
onPressed: () {
Navigator.pop(context);
},
),
)
: null,
body: Container(
child: YoutubePlayerBuilder(
player: YoutubePlayer(controller: _controller),
builder: (context, player) {
return Column(
children: <Widget>[player],
);
},
onEnterFullScreen: () {
setState(() {
showAppBar = false;
});
},
onExitFullScreen: () {
setState(() {
showAppBar = true;
});
},
),
)),
),
);
}
}
|
Simply place your Scaffold under |
this seems to work but now one new issue I am facing. the video is cropped when tested on live device but shows correctly on iOS simulator. I think the aspect Ratio is screwed up. |
But setstate will rebuild the widget, mean the video will restart again and again when onEnterFullScreen and onExitFullScreen callback triggered |
I'm sorry to re-open this issue, but I used this workaround and I got the same result as @princeteck. The video is cropped, so I can't see all the captions. If someone have a solution for this it would be great :) |
Or you can only change the toolbarHeight param in the AppBar AppBar(
title: Text('Your title'),
toolbarHeight: _fullScreen ? 0 : 56,
), |
Everything works fine for me, just the fullscreen thing. its just rotating the orientation of the app. If I go back from the full screen, the app orientation is landscape which is not expected. also all the widgets are not hidden like appbar and other widget when we go full screen.
_controller.value.isFullScreen
is a final value so I am not even able to use it to show or hide the widgets based on the full screen state.The text was updated successfully, but these errors were encountered: