-
Notifications
You must be signed in to change notification settings - Fork 224
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
fix: Layouts don't respect orientation on iPad #1225
base: flutter_app
Are you sure you want to change the base?
fix: Layouts don't respect orientation on iPad #1225
Conversation
Reviewer's Guide by SourceryThis pull request locks the app orientation to portrait mode on both iOS and macOS. This was achieved by modifying the Info.plist file for iOS, updating macOS project settings, and adjusting shared schemes. Class diagram for main.dartclassDiagram
class MyApp {
-Key? key
+MyApp(Key? key)
+Widget build(BuildContext context)
}
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @samruddhi-Rahegaonkar - I've reviewed your changes - here's some feedback:
Overall Comments:
- It might be worth investigating if there's a way to achieve this in the Flutter code itself, rather than modifying platform-specific files.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
e7775cf
to
63ccea7
Compare
Build StatusBuild successful. APKs to test: https://github.com/fossasia/badgemagic-app/actions/runs/13746218460/artifacts/2717500135. Screenshots (Android)
Screenshots (iPhone)
Screenshots (iPad)
|
841eda1
to
11320e8
Compare
iOS/Runner/Info.plist
Outdated
<dict> | ||
<key>CADisableMinimumFrameDurationOnPhone</key> | ||
<true/> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>$(DEVELOPMENT_LANGUAGE)</string> | ||
<key>CFBundleDisplayName</key> | ||
<string>Badge Magic</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>badgemagic</string> | ||
<key>CFBundlePackageType</key> | ||
<string>APPL</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>$(FLUTTER_BUILD_NAME)</string> | ||
<key>CFBundleSignature</key> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering why this was changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @adityastic . I’ll have a look at this — the change seems unintended.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks much!
0a481f0
to
4c91306
Compare
@adityastic Let's rebase this and test :)) |
4c91306
to
2c5ece0
Compare
2c5ece0
to
18d4b70
Compare
@adityastic There we go ! |
Awesome! Great job! |
18d4b70
to
c395166
Compare
c395166
to
c08ced9
Compare
@@ -45,7 +45,6 @@ | |||
<key>UISupportedInterfaceOrientations~ipad</key> | |||
<array> | |||
<string>UIInterfaceOrientationPortrait</string> | |||
<string>UIInterfaceOrientationPortraitUpsideDown</string> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we removing this ?
@@ -48,7 +56,6 @@ class _DrawBadgeState extends State<DrawBadge> { | |||
|
|||
void _setLandscapeOrientation() { | |||
SystemChrome.setPreferredOrientations([ | |||
DeviceOrientation.landscapeLeft, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for here.
import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
import 'package:provider/provider.dart'; | ||
import 'globals/globals.dart' as globals; | ||
|
||
void main() { | ||
setupLocator(); | ||
WidgetsFlutterBinding.ensureInitialized(); | ||
SystemChrome.setPreferredOrientations([ | ||
DeviceOrientation.portraitUp, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not both portraitUp
and portraitDown
, if we are supporting only portrait here ?
void initState() { | ||
super.initState(); | ||
SystemChrome.setPreferredOrientations([ | ||
DeviceOrientation.landscapeRight, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for here, why not both landscapeRight
and landscapeLeft
?
Also, why do we need this separately in initState()
, when we already work with the orientations in didChangeDependencies()
?
Does it make any difference ?
Fixes
-This PR fixes issue #1190 by fixing the required orientation for particular screens on iPad.
Changes
SystemChrome.setPreferredOrientations
for particular screens.Screenshots / Recordings
Checklist:
constants.dart
without hard coding any value.Fixes #1190.
Summary by Sourcery