The flutterflow version in use is 4.1.52
The page is a mix of buttons and youtube player widgets
The page works as expected in portrait mode. But when the device is changed to landscape mode, the last video of the page plays automatically in full screen and I am unable to exit the full screen mode and have to close the app.
In pages where there are no videos, the functionality is fine.
The page was working fine until today morning when i upgraded to the above flutterflow version.
I have shared the dart files of the page.
MECHANICS PAGE CODE
`
class RefereesMechanicsWidget extends StatefulWidget {
const RefereesMechanicsWidget({super.key});
@override
State<RefereesMechanicsWidget> createState() =>
_RefereesMechanicsWidgetState();
}
class _RefereesMechanicsWidgetState extends State<RefereesMechanicsWidget> {
late RefereesMechanicsModel _model;
final scaffoldKey = GlobalKey<ScaffoldState>();
@override
void initState() {
super.initState();
_model = createModel(context, () => RefereesMechanicsModel());
WidgetsBinding.instance.addPostFrameCallback((_) => setState(() {}));
}
@override
void dispose() {
_model.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return YoutubeFullScreenWrapper(
child: GestureDetector(
onTap: () => _model.unfocusNode.canRequestFocus
? FocusScope.of(context).requestFocus(_model.unfocusNode)
: FocusScope.of(context).unfocus(),
child: Scaffold(
key: scaffoldKey,
backgroundColor: Colors.black,
appBar: AppBar(
backgroundColor: Color(0xFF613B81),
automaticallyImplyLeading: false,
leading: FlutterFlowIconButton(
borderRadius: 30.0,
borderWidth: 1.0,
buttonSize: 30.0,
icon: Icon(
Icons.arrow_circle_left_rounded,
color: Colors.black,
size: 40.0,
),
onPressed: () async {
context.pushNamed('Referees');
},
),
title: Align(
alignment: AlignmentDirectional(0.0, 0.0),
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
ClipRRect(
borderRadius: BorderRadius.circular(8.0),
child: Image.asset(
'assets/images/RV_2.0.png',
width: 75.0,
height: 75.0,
fit: BoxFit.cover,
),
),
Padding(
padding: EdgeInsets.all(8.0),
child: AutoSizeText(
'MECHANICS',
style:
FlutterFlowTheme.of(context).headlineMedium.override(
fontFamily: FlutterFlowTheme.of(context)
.headlineMediumFamily,
color: Colors.black,
fontSize: () {
if (MediaQuery.sizeOf(context).width <
kBreakpointSmall) {
return 24;
} else if (MediaQuery.sizeOf(context).width <
kBreakpointMedium) {
return 35;
} else if (MediaQuery.sizeOf(context).width <
kBreakpointLarge) {
return 40;
} else {
return 45;
}
}()
.toDouble(),
letterSpacing: 0.0,
fontWeight: FontWeight.w600,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context)
.headlineMediumFamily),
),
),
),
Align(
alignment: AlignmentDirectional(0.76, -0.83),
child: FlutterFlowYoutubePlayer(
url:
'https://www.youtube.com/watch?v=U-eZv3iDTnQ',
width: () {
if (MediaQuery.sizeOf(context).width <
kBreakpointSmall) {
return 110;
} else if (MediaQuery.sizeOf(context)
.width <
kBreakpointMedium) {
return 150;
} else if (MediaQuery.sizeOf(context)
.width <
kBreakpointLarge) {
return 200;
} else {
return 250;
}
}()
.toDouble(),
height: () {
if (MediaQuery.sizeOf(context).width <
kBreakpointSmall) {
return 110;
} else if (MediaQuery.sizeOf(context)
.width <
kBreakpointMedium) {
return 150;
} else if (MediaQuery.sizeOf(context)
.width <
kBreakpointLarge) {
return 200;
} else {
return 250;
}
}()
.toDouble(),
autoPlay: false,
looping: true,
mute: false,
showControls: true,
showFullScreen: true,
strictRelatedVideos: false,
fullScreenByDefault: true
),
),
].divide(SizedBox(width: 10.0)),
),
Align(
alignment: AlignmentDirectional(0.0, 0.0),
child: Padding(
padding: EdgeInsets.all(22.0),
child: FFButtonWidget(
onPressed: () async {
await launchURL(
'https://youtu.be/GJKj5KOzSl0?list=PLOnrMq_sQkhrUXzJwwOTHOrA_mcLfhu22');
},
text: 'Watch Mechanics Playlist',
icon: FaIcon(
FontAwesomeIcons.video,
),
options: FFButtonOptions(
width: () {
if (MediaQuery.sizeOf(context).width <
kBreakpointSmall) {
return 300;
} else if (MediaQuery.sizeOf(context)
.width <
kBreakpointMedium) {
return 600;
} else if (MediaQuery.sizeOf(context)
.width <
kBreakpointLarge) {
return 700;
} else {
return 900;
}
}()
.toDouble(),
height: () {
if (MediaQuery.sizeOf(context).width <
kBreakpointSmall) {
return 40;
} else if (MediaQuery.sizeOf(context)
.width <
kBreakpointMedium) {
return 50;
} else if (MediaQuery.sizeOf(context)
.width <
kBreakpointLarge) {
return 60;
} else {
return 70;
}
}()
.toDouble(),
padding: EdgeInsets.all(12.0),
iconPadding: EdgeInsetsDirectional.fromSTEB(
0.0, 0.0, 0.0, 0.0),
color: Color(0xFFFFE300),
textStyle: FlutterFlowTheme.of(context)
.titleSmall
.override(
fontFamily: FlutterFlowTheme.of(context)
.titleSmallFamily,
color: Colors.black,
fontSize: () {
if (MediaQuery.sizeOf(context).width <
kBreakpointSmall) {
return 20;
} else if (MediaQuery.sizeOf(context)
.width <
kBreakpointMedium) {
return 24;
} else if (MediaQuery.sizeOf(context)
.width <
kBreakpointLarge) {
return 28;
} else {
return 32;
}
}()
.toDouble(),
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap()
.containsKey(
FlutterFlowTheme.of(context)
.titleSmallFamily),
),
elevation: 3.0,
borderSide: BorderSide(
width: 1.0,
),
borderRadius: BorderRadius.circular(12.0),
),
),
),
),
Align(
alignment: AlignmentDirectional(0.0, 0.0),
child: Padding(
padding: EdgeInsets.all(22.0),
child: FFButtonWidget(
onPressed: () async {
await launchURL(
'https://youtu.be/tqDVuO6uUoo?list=PLOnrMq_sQkhrhogAX6iy5hJtGtwY3kSoX');
},
text: 'Watch Guessing Playlist',
icon: FaIcon(
FontAwesomeIcons.video,
),
options: FFButtonOptions(
width: () {
if (MediaQuery.sizeOf(context).width <
kBreakpointSmall) {
return 300;
} else if (MediaQuery.sizeOf(context)
.width <
kBreakpointMedium) {
return 600;
} else if (MediaQuery.sizeOf(context)
.width <
kBreakpointLarge) {
return 700;
} else {
return 900;
}
}()
.toDouble(),
height: () {
if (MediaQuery.sizeOf(context).width <
kBreakpointSmall) {
return 40;
} else if (MediaQuery.sizeOf(context)
.width <
kBreakpointMedium) {
return 50;
} else if (MediaQuery.sizeOf(context)
.width <
kBreakpointLarge) {
return 60;
} else {
return 70;
}
}()
.toDouble(),
padding: EdgeInsets.all(12.0),
iconPadding: EdgeInsetsDirectional.fromSTEB(
0.0, 0.0, 0.0, 0.0),
color: Color(0xFFFFE300),
textStyle: FlutterFlowTheme.of(context)
.titleSmall
.override(
fontFamily: FlutterFlowTheme.of(context)
.titleSmallFamily,
color: Colors.black,
fontSize: () {
if (MediaQuery.sizeOf(context).width <
kBreakpointSmall) {
return 20;
} else if (MediaQuery.sizeOf(context)
.width <
kBreakpointMedium) {
return 24;
} else if (MediaQuery.sizeOf(context)
.width <
kBreakpointLarge) {
return 28;
} else {
return 32;
}
}()
.toDouble(),
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap()
.containsKey(
FlutterFlowTheme.of(context)
.titleSmallFamily),
),
elevation: 3.0,
borderSide: BorderSide(
width: 1.0,
),
borderRadius: BorderRadius.circular(12.0),
),
),
),
),
],
),
),
),
],
),
),
),
),
),
);
}
}`
`
In this case, "https://www.youtube.com/watch?v=1waAdTN7pDs" is played automatically in fullscreen in landscape mode.
This happens to the last video on the page.
Other pages without video player or youtube player widgets are working fine.
PFB the manifest file.
` <activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">`
I tried with setting the fullscreenbydefault attribute to false.