Skip to content

SafeArea show a wrong top padding with CupertinoApp #29136

@mateusfsilva

Description

@mateusfsilva

Hi,

When I use SafeArea widget with CupertinoApp the top padding always let a space between the NavigationBar and the widget body.

The following iPhone SE and iPhone XS prints shows the space in light grey.

iPhone SE

iPhone XS

Here is the code to reproduce the error:

import 'package:flutter/cupertino.dart';

void main() => runApp(SafeAreaCupertino());

class SafeAreaCupertino extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return CupertinoApp(
      title: 'Flutter SafeArea Cupertino',
      home: SafeAreaPage(),
      color: CupertinoColors.white,
      debugShowCheckedModeBanner: false,
    );
  }
}

class SafeAreaPage extends StatelessWidget {
  const SafeAreaPage() : super();

  @override
  Widget build(BuildContext context) {
    return CupertinoPageScaffold(
      backgroundColor: CupertinoColors.extraLightBackgroundGray,
      navigationBar: CupertinoNavigationBar(
        backgroundColor: CupertinoColors.lightBackgroundGray,
        middle: Text(
          'SafeArea Test Page',
        ),
      ),
      child: SafeArea(
        child: Column(
          children: <Widget>[
            Expanded(
              child: Container(
                color: CupertinoColors.white,
                child: Center(
                  child: Text(
                    'Container()',
                    style: TextStyle(
                      color: CupertinoColors.activeBlue,
                    ),
                  ),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}

You can find the screenshots from Xcode SafeArea here and here.

Logs

[✓] Flutter (Channel dev, v1.3.9, on Mac OS X 10.13.6 17G5019, locale pt-BR)
    • Flutter version 1.3.9 at /Users/mateus.gustavo/desenvolvimento/flutter
    • Framework revision f91df4abe1 (18 hours ago), 2019-03-09 21:19:28 -0500
    • Engine revision 4e54bc93ca
    • Dart version 2.2.1 (build 2.2.1-dev.1.0 2fb6cd9f5f)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/mateus.gustavo/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • ANDROID_HOME = /Users/mateus.gustavo/Library/Android/sdk
    • ANDROID_SDK_ROOT = /usr/local/share/android-sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.1, Build version 10B61
    • ios-deploy 2.0.0
    • CocoaPods version 1.6.1

[✓] Android Studio (version 3.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 33.3.1
    • Dart plugin version 182.5215
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[✓] IntelliJ IDEA Community Edition (version 2018.3.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 31.3.4
    • Dart plugin version 183.4886.3

[✓] VS Code (version 1.32.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 2.24.0

[✓] Connected device (2 available)
    • iPhone SE • 1394BC79-70AC-4480-9492-180FEAEE98B8 • ios • iOS 12.1 (simulator)
    • iPhone XS • 13E39E94-526E-4E08-A9C9-A76A27703D3C • ios • iOS 12.1 (simulator)

• No issues found!

Metadata

Metadata

Labels

a: fidelityMatching the OEM platforms betterf: cupertinoflutter/packages/flutter/cupertino repositoryframeworkflutter/packages/flutter repository. See also f: labels.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions