flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
166.27k stars 27.51k forks source link

CupertinoSliverNavigationBar doesn't become compact in landscape mode #39254

Open kerberjg opened 5 years ago

kerberjg commented 5 years ago

While it is okay for CupertinoSliverNavigationBar to be "large" in portrait mode (and becoming small as the user scrolls down), it should always stay small in landscape mode.

This could be easily solvable if a parameter controlling the size was present in the constructor (so it could be wrapped in a OrientationBuilder), but this is not the case.

This is how it should look like: Simulator Screen Shot - iPhone 6s - 2019-08-26 at 19 17 10

This is what it actually looks like: Simulator Screen Shot - iPhone 6s - 2019-08-26 at 19 17 15

I would like to propose a fix:

Expose the large property of _NavigationBarStaticComponents and have the _CupertinoSliverNavigationBarState use a OrientationBuilder to manipulate this property as needed.

KagurazakaHanabi commented 5 years ago

Why not automatic change the large property

final _NavigationBarStaticComponents components = _NavigationBarStaticComponents(
  keys: keys,
  // ...
  padding: widget.padding,
  large: MediaQuery.of(context).orientation != Orientation.landscape,
);
TahaTesser commented 4 years ago

Hi @kerberjg Are you suggesting a large title should automatically shrink to normal rise when rotating the device.

kerberjg commented 4 years ago

@TahaTesser Yes, and it should stay that way as long as it's in landscape, as per native iOS behavior

TahaTesser commented 4 years ago
code sample ```dart import 'package:flutter/cupertino.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return CupertinoApp( title: 'Cupertino App', home: CupertinoPageScaffold( child: CustomScrollView( slivers: [ CupertinoSliverNavigationBar( largeTitle: Text('August 26, 2019'), ), SliverList( delegate: new SliverChildListDelegate([ Image.network('https://i.imgur.com/QCNbOAo.png'), Image.network('https://i.imgur.com/QCNbOAo.png'), Image.network('https://i.imgur.com/QCNbOAo.png'), Image.network('https://i.imgur.com/QCNbOAo.png'), Image.network('https://i.imgur.com/QCNbOAo.png'), Image.network('https://i.imgur.com/QCNbOAo.png'), Image.network('https://i.imgur.com/QCNbOAo.png'), Image.network('https://i.imgur.com/QCNbOAo.png'), Image.network('https://i.imgur.com/QCNbOAo.png'), Image.network('https://i.imgur.com/QCNbOAo.png'), Image.network('https://i.imgur.com/QCNbOAo.png'), Image.network('https://i.imgur.com/QCNbOAo.png'), ])) ], ), ), ); } } ```
flutter doctor -v ```bash [✓] Flutter (Channel master, 1.22.0-10.0.pre.138, on Mac OS X 10.15.6 19G2021, locale en-GB) • Flutter version 1.22.0-10.0.pre.138 at /Users/tahatesser/Code/flutter_master • Framework revision 620cd16cf0 (3 days ago), 2020-09-11 10:35:03 -0400 • Engine revision a0bd862cc0 • Dart version 2.10.0 (build 2.10.0-115.0.dev) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2) • Android SDK at /Users/tahatesser/Code/sdk • Platform android-30, build-tools 30.0.2 • ANDROID_HOME = /Users/tahatesser/Code/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 11.7) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 11.7, Build version 11E801a • CocoaPods version 1.9.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 4.0) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 49.0.2 • Dart plugin version 193.7547 • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593) [✓] VS Code (version 1.49.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.14.1 [✓] Connected device (4 available) • Taha’s iPhone (mobile) • 00008020-001059882212002E • ios • iOS 13.7 • macOS (desktop) • macos • darwin-x64 • Mac OS X 10.15.6 19G2021 • Web Server (web) • web-server • web-javascript • Flutter Tools • Chrome (web) • chrome • web-javascript • Google Chrome 85.0.4183.102 • No issues found! ```
maheshj01 commented 1 year ago

I can still reproduce the issue, The title is still of the same size in both landscape and portrait mode.

https://user-images.githubusercontent.com/31410839/203650365-46c440bf-3e78-40ab-8856-d8a8b671354f.mov

flutter doctor -v (mac) ``` [✓] Flutter (Channel master, 3.6.0-6.0.pre.33, on macOS 12.6 21G115 darwin-arm64, locale en-IN) • Flutter version 3.6.0-6.0.pre.33 on channel master at • Upstream repository https://github.com/flutter/flutter.git • Framework revision a9858ec524 (72 minutes ago), 2022-11-21 10:58:11 -0500 • Engine revision 46a6b54295 • Dart version 2.19.0 (build 2.19.0-406.0.dev) • DevTools version 2.19.0 • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades. [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc4) • Android SDK at /Users/mahesh/Library/Android/sdk • Platform android-33, build-tools 33.0.0-rc4 • ANDROID_HOME = /Users/mahesh/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 14.0.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14A400 • CocoaPods version 1.11.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2021.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) [✓] IntelliJ IDEA Community Edition (version 2021.2.1) • IntelliJ at /Applications/IntelliJ IDEA CE.app • Flutter plugin version 61.2.4 • Dart plugin version 212.5080.8 [✓] VS Code (version 1.70.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.53.20221101 [✓] Connected device (3 available) • iPhone 12 Pro (mobile) • 026D5789-9E78-4AD5-B1B2-3F8D4E7F65E4 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 12.6 21G115 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 107.0.5304.110 [✓] HTTP Host Availability • All required HTTP hosts are available • No issues found! ``` ``` [✓] Flutter (Channel stable, 3.3.9, on macOS 12.6 21G115 darwin-arm, locale en-IN) • Flutter version 3.3.9 on channel stable at /Users/mahesh/Development/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision b8f7f1f986 (24 hours ago), 2022-11-23 06:43:51 +0900 • Engine revision 8f2221fbef • Dart version 2.18.5 • DevTools version 2.15.0 [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc4) • Android SDK at /Users/mahesh/Library/Android/sdk • Platform android-33, build-tools 33.0.0-rc4 • ANDROID_HOME = /Users/mahesh/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 14.0.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14A400 • CocoaPods version 1.11.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2021.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) [✓] IntelliJ IDEA Community Edition (version 2021.2.1) • IntelliJ at /Applications/IntelliJ IDEA CE.app • Flutter plugin version 61.2.4 • Dart plugin version 212.5080.8 [✓] VS Code (version 1.70.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.53.20221101 [✓] Connected device (3 available) • iPhone 12 Pro (mobile) • 026D5789-9E78-4AD5-B1B2-3F8D4E7F65E4 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 12.6 21G115 darwin-arm • Chrome (web) • chrome • web-javascript • Google Chrome 107.0.5304.110 [✓] HTTP Host Availability • All required HTTP hosts are available • No issues found! ```