Skip to content
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

Keyboard unexpectedly closes if its in a bottomSheet of a named Route #36271

Closed
Menelphor opened this issue Jul 16, 2019 · 6 comments
Closed
Labels
f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Comments

@Menelphor
Copy link

Menelphor commented Jul 16, 2019

Issue

If I'm tapping on a TextField inside a Bottom Sheet of a Scaffold of a Page which is not the home page, the keyboard disappears.
This behavior also occures on the home screen if i set:

MaterialApp(
      routes: {
        'home':(_) => Home(),
        'secondPage': (_) => SecondPage(),
      },
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      initalRoute: 'home',
    );

Steps to Reproduce

  1. Tap on the Textfield on the Bottom. => Normal behavior
  2. Tap on the red Button => Navigation to 2nd screen
  3. Tap on the Textfield on the Bottom. => Keyboard does not stay open.

Sample Code

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      routes: {
        'secondPage': (_) => SecondPage(),
      },
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Home(),
    );
  }
}

class Home extends StatefulWidget {
  @override
  _HomeState createState() => _HomeState();
}

class _HomeState extends State<Home> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('it does work here'),
      ),
      body: Center(
        child: FlatButton(
            onPressed: () => Navigator.of(context).pushNamed('secondPage'),
            child: Container(
              width: 123,
              height: 23,
              color: Colors.red,
              child: Text(
                '2nd Page',
                textAlign: TextAlign.center,
              ),
            )),
      ),
      bottomSheet: Container(
        width: double.infinity,
        color: Colors.lightGreen,
        height: 90,
        child: Center(child: Container(width: 200, child: TextField())),
      ),
    );
  }
}

class SecondPage extends StatefulWidget {
  SecondPage({Key key}) : super(key: key);

  @override
  _SecondPageState createState() => _SecondPageState();
}

class _SecondPageState extends State<SecondPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('it does not work here'),
      ),
      bottomSheet: Container(
        width: double.infinity,
        color: Colors.lightGreen,
        height: 90,
        child: Center(child: Container(width: 200, child: TextField())),
      ),
    );
  }
}

Logs

    ACTION = build
               AD_HOC_CODE_SIGNING_ALLOWED = NO
               ALTERNATE_GROUP = staff
               ALTERNATE_MODE = u+w,go-w,a+rX
               ALTERNATE_OWNER = mhein
               ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO
               ALWAYS_SEARCH_USER_PATHS = NO
               ALWAYS_USE_SEPARATE_HEADERMAPS = NO
               APPLE_INTERNAL_DEVELOPER_DIR = /AppleInternal/Developer
               APPLE_INTERNAL_DIR = /AppleInternal
               APPLE_INTERNAL_DOCUMENTATION_DIR = /AppleInternal/Documentation
               APPLE_INTERNAL_LIBRARY_DIR = /AppleInternal/Library
               APPLE_INTERNAL_TOOLS = /AppleInternal/Developer/Tools
               APPLICATION_EXTENSION_API_ONLY = NO
               APPLY_RULES_IN_COPY_FILES = NO
               ARCHS = armv7 arm64
               ARCHS_STANDARD = armv7 arm64
               ARCHS_STANDARD_32_64_BIT = armv7 arm64
               ARCHS_STANDARD_32_BIT = armv7
               ARCHS_STANDARD_64_BIT = arm64
               ARCHS_STANDARD_INCLUDING_64_BIT = armv7 arm64
               ARCHS_UNIVERSAL_IPHONE_OS = armv7 arm64
               ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon
               AVAILABLE_PLATFORMS = appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator
               BITCODE_GENERATION_MODE = marker
               BUILD_ACTIVE_RESOURCES_ONLY = NO
               BUILD_COMPONENTS = headers build
               BUILD_DIR = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios
               BUILD_ROOT = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios
               BUILD_STYLE = 
               BUILD_VARIANTS = normal
               BUILT_PRODUCTS_DIR = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios/Release-iphoneos
               CACHE_ROOT = /var/folders/cv/w2jpfd_j59l92p6zyb878fc80000gp/C/com.apple.DeveloperTools/10.2.1-10E1001/Xcode
               CCHROOT = /var/folders/cv/w2jpfd_j59l92p6zyb878fc80000gp/C/com.apple.DeveloperTools/10.2.1-10E1001/Xcode
               CHMOD = /bin/chmod
               CHOWN = /usr/sbin/chown
               CLANG_ANALYZER_NONNULL = YES
               CLANG_CXX_LANGUAGE_STANDARD = gnu++0x
               CLANG_CXX_LIBRARY = libc++
               CLANG_ENABLE_MODULES = YES
               CLANG_ENABLE_OBJC_ARC = YES
               CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES
               CLANG_WARN_BOOL_CONVERSION = YES
               CLANG_WARN_COMMA = YES
               CLANG_WARN_CONSTANT_CONVERSION = YES
               CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES
               CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR
               CLANG_WARN_EMPTY_BODY = YES
               CLANG_WARN_ENUM_CONVERSION = YES
               CLANG_WARN_INFINITE_RECURSION = YES
               CLANG_WARN_INT_CONVERSION = YES
               CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES
               CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
               CLANG_WARN_OBJC_LITERAL_CONVERSION = YES
               CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR
               CLANG_WARN_RANGE_LOOP_ANALYSIS = YES
               CLANG_WARN_STRICT_PROTOTYPES = YES
               CLANG_WARN_SUSPICIOUS_MOVE = YES
               CLANG_WARN_UNREACHABLE_CODE = YES
               CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
               CLASS_FILE_DIR = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios/Runner.build/Release-iphoneos/Runner.build/JavaClasses
               CLEAN_PRECOMPS = YES
               CLONE_HEADERS = NO
               CODESIGNING_FOLDER_PATH = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios/Release-iphoneos/Runner.app
               CODE_SIGNING_ALLOWED = YES
               CODE_SIGNING_REQUIRED = YES
               CODE_SIGN_CONTEXT_CLASS = XCiPhoneOSCodeSignContext
               CODE_SIGN_IDENTITY = iPhone Developer
               CODE_SIGN_INJECT_BASE_ENTITLEMENTS = YES
               COLOR_DIAGNOSTICS = NO
               COMBINE_HIDPI_IMAGES = NO
               COMPILER_INDEX_STORE_ENABLE = Default
               COMPOSITE_SDK_DIRS = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios/CompositeSDKs
               COMPRESS_PNG_FILES = YES
               CONFIGURATION = Release
               CONFIGURATION_BUILD_DIR = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios/Release-iphoneos
               CONFIGURATION_TEMP_DIR = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios/Runner.build/Release-iphoneos
               CONTENTS_FOLDER_PATH = Runner.app
               COPYING_PRESERVES_HFS_DATA = NO
               COPY_HEADERS_RUN_UNIFDEF = NO
               COPY_PHASE_STRIP = NO
               COPY_RESOURCES_FROM_STATIC_FRAMEWORKS = YES
               CORRESPONDING_SIMULATOR_PLATFORM_DIR = /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform
               CORRESPONDING_SIMULATOR_PLATFORM_NAME = iphonesimulator
               CORRESPONDING_SIMULATOR_SDK_DIR = /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk
               CORRESPONDING_SIMULATOR_SDK_NAME = iphonesimulator12.2
               CP = /bin/cp
               CREATE_INFOPLIST_SECTION_IN_BINARY = NO
               CURRENT_ARCH = arm64
               CURRENT_PROJECT_VERSION = 1
               CURRENT_VARIANT = normal
               DEAD_CODE_STRIPPING = YES
               DEBUGGING_SYMBOLS = YES
               DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
               DEFAULT_COMPILER = com.apple.compilers.llvm.clang.1_0
               DEFAULT_KEXT_INSTALL_PATH = /System/Library/Extensions
               DEFINES_MODULE = NO
               DEPLOYMENT_LOCATION = NO
               DEPLOYMENT_POSTPROCESSING = NO
               DEPLOYMENT_TARGET_CLANG_ENV_NAME = IPHONEOS_DEPLOYMENT_TARGET
               DEPLOYMENT_TARGET_CLANG_FLAG_NAME = miphoneos-version-min
               DEPLOYMENT_TARGET_CLANG_FLAG_PREFIX = -miphoneos-version-min=
               DEPLOYMENT_TARGET_LD_ENV_NAME = IPHONEOS_DEPLOYMENT_TARGET
               DEPLOYMENT_TARGET_LD_FLAG_NAME = ios_version_min
               DEPLOYMENT_TARGET_SETTING_NAME = IPHONEOS_DEPLOYMENT_TARGET
               DEPLOYMENT_TARGET_SUGGESTED_VALUES = 8.0 8.1 8.2 8.3 8.4 9.0 9.1 9.2 9.3 10.0 10.1 10.2 10.3 11.0 11.1 11.2 11.3 11.4 12.0 12.1 12.2
               DERIVED_FILES_DIR = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios/Runner.build/Release-iphoneos/Runner.build/DerivedSources
               DERIVED_FILE_DIR = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios/Runner.build/Release-iphoneos/Runner.build/DerivedSources
               DERIVED_SOURCES_DIR = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios/Runner.build/Release-iphoneos/Runner.build/DerivedSources
               DEVELOPER_APPLICATIONS_DIR = /Applications/Xcode.app/Contents/Developer/Applications
               DEVELOPER_BIN_DIR = /Applications/Xcode.app/Contents/Developer/usr/bin
               DEVELOPER_DIR = /Applications/Xcode.app/Contents/Developer
               DEVELOPER_FRAMEWORKS_DIR = /Applications/Xcode.app/Contents/Developer/Library/Frameworks
               DEVELOPER_FRAMEWORKS_DIR_QUOTED = /Applications/Xcode.app/Contents/Developer/Library/Frameworks
               DEVELOPER_LIBRARY_DIR = /Applications/Xcode.app/Contents/Developer/Library
               DEVELOPER_SDK_DIR = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
               DEVELOPER_TOOLS_DIR = /Applications/Xcode.app/Contents/Developer/Tools
               DEVELOPER_USR_DIR = /Applications/Xcode.app/Contents/Developer/usr
               DEVELOPMENT_LANGUAGE = en
               DOCUMENTATION_FOLDER_PATH = Runner.app/en.lproj/Documentation
               DO_HEADER_SCANNING_IN_JAM = NO
               DSTROOT = /tmp/Runner.dst
               DT_TOOLCHAIN_DIR = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
               DWARF_DSYM_FILE_NAME = Runner.app.dSYM
               DWARF_DSYM_FILE_SHOULD_ACCOMPANY_PRODUCT = NO
               DWARF_DSYM_FOLDER_PATH = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios/Release-iphoneos
               EFFECTIVE_PLATFORM_NAME = -iphoneos
               EMBEDDED_CONTENT_CONTAINS_SWIFT = NO
               EMBEDDED_PROFILE_NAME = embedded.mobileprovision
               EMBED_ASSET_PACKS_IN_PRODUCT_BUNDLE = NO
               ENABLE_BITCODE = NO
               ENABLE_DEFAULT_HEADER_SEARCH_PATHS = YES
               ENABLE_HEADER_DEPENDENCIES = YES
               ENABLE_NS_ASSERTIONS = NO
               ENABLE_ON_DEMAND_RESOURCES = YES
               ENABLE_STRICT_OBJC_MSGSEND = YES
               ENABLE_TESTABILITY = NO
               ENTITLEMENTS_ALLOWED = YES
               ENTITLEMENTS_DESTINATION = Signature
               ENTITLEMENTS_REQUIRED = YES
               EXCLUDED_INSTALLSRC_SUBDIRECTORY_PATTERNS = .DS_Store .svn .git .hg CVS
               EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES = *.nib *.lproj *.framework *.gch *.xcode* *.xcassets (*) .DS_Store CVS .svn .git .hg *.pbproj *.pbxproj
               EXECUTABLES_FOLDER_PATH = Runner.app/Executables
               EXECUTABLE_FOLDER_PATH = Runner.app
               EXECUTABLE_NAME = Runner
               EXECUTABLE_PATH = Runner.app/Runner
               EXPANDED_CODE_SIGN_IDENTITY = 
               EXPANDED_CODE_SIGN_IDENTITY_NAME = 
               EXPANDED_PROVISIONING_PROFILE = 
               FILE_LIST = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios/Runner.build/Release-iphoneos/Runner.build/Objects/LinkFileList
               FIXED_FILES_DIR = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios/Runner.build/Release-iphoneos/Runner.build/FixedFiles
               FLUTTER_APPLICATION_PATH = /Users/mhein/AndroidStudioProjects/flutter_app
               FLUTTER_BUILD_DIR = build
               FLUTTER_BUILD_NAME = 1.0.0
               FLUTTER_BUILD_NUMBER = 1
               FLUTTER_FRAMEWORK_DIR = /Users/mhein/Documents/flutter/bin/cache/artifacts/engine/ios
               FLUTTER_ROOT = /Users/mhein/Documents/flutter
               FLUTTER_TARGET = /Users/mhein/AndroidStudioProjects/flutter_app/lib/main.dart
               FRAMEWORKS_FOLDER_PATH = Runner.app/Frameworks
               FRAMEWORK_FLAG_PREFIX = -framework
               FRAMEWORK_SEARCH_PATHS =  /Users/mhein/AndroidStudioProjects/flutter_app/ios/Flutter
               FRAMEWORK_VERSION = A
               FULL_PRODUCT_NAME = Runner.app
               GCC3_VERSION = 3.3
               GCC_C_LANGUAGE_STANDARD = gnu99
               GCC_INLINES_ARE_PRIVATE_EXTERN = YES
               GCC_NO_COMMON_BLOCKS = YES
               GCC_PFE_FILE_C_DIALECTS = c objective-c c++ objective-c++
               GCC_SYMBOLS_PRIVATE_EXTERN = YES
               GCC_THUMB_SUPPORT = YES
               GCC_TREAT_WARNINGS_AS_ERRORS = NO
               GCC_VERSION = com.apple.compilers.llvm.clang.1_0
               GCC_VERSION_IDENTIFIER = com_apple_compilers_llvm_clang_1_0
               GCC_WARN_64_TO_32_BIT_CONVERSION = YES
               GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR
               GCC_WARN_UNDECLARED_SELECTOR = YES
               GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE
               GCC_WARN_UNUSED_FUNCTION = YES
               GCC_WARN_UNUSED_VARIABLE = YES
               GENERATE_MASTER_OBJECT_FILE = NO
               GENERATE_PKGINFO_FILE = YES
               GENERATE_PROFILING_CODE = NO
               GENERATE_TEXT_BASED_STUBS = NO
               GID = 20
               GROUP = staff
               HEADERMAP_INCLUDES_FLAT_ENTRIES_FOR_TARGET_BEING_BUILT = YES
               HEADERMAP_INCLUDES_FRAMEWORK_ENTRIES_FOR_ALL_PRODUCT_TYPES = YES
               HEADERMAP_INCLUDES_NONPUBLIC_NONPRIVATE_HEADERS = YES
               HEADERMAP_INCLUDES_PROJECT_HEADERS = YES
               HEADERMAP_USES_FRAMEWORK_PREFIX_ENTRIES = YES
               HEADERMAP_USES_VFS = NO
               HIDE_BITCODE_SYMBOLS = YES
               HOME = /Users/mhein
               ICONV = /usr/bin/iconv
               INFOPLIST_EXPAND_BUILD_SETTINGS = YES
               INFOPLIST_FILE = Runner/Info.plist
               INFOPLIST_OUTPUT_FORMAT = binary
               INFOPLIST_PATH = Runner.app/Info.plist
               INFOPLIST_PREPROCESS = NO
               INFOSTRINGS_PATH = Runner.app/en.lproj/InfoPlist.strings
               INLINE_PRIVATE_FRAMEWORKS = NO
               INSTALLHDRS_COPY_PHASE = NO
               INSTALLHDRS_SCRIPT_PHASE = NO
               INSTALL_DIR = /tmp/Runner.dst/Applications
               INSTALL_GROUP = staff
               INSTALL_MODE_FLAG = u+w,go-w,a+rX
               INSTALL_OWNER = mhein
               INSTALL_PATH = /Applications
               INSTALL_ROOT = /tmp/Runner.dst
               IPHONEOS_DEPLOYMENT_TARGET = 8.0
               JAVAC_DEFAULT_FLAGS = -J-Xms64m -J-XX:NewSize=4M -J-Dfile.encoding=UTF8
               JAVA_APP_STUB = /System/Library/Frameworks/JavaVM.framework/Resources/MacOS/JavaApplicationStub
               JAVA_ARCHIVE_CLASSES = YES
               JAVA_ARCHIVE_TYPE = JAR
               JAVA_COMPILER = /usr/bin/javac
               JAVA_FOLDER_PATH = Runner.app/Java
               JAVA_FRAMEWORK_RESOURCES_DIRS = Resources
               JAVA_JAR_FLAGS = cv
               JAVA_SOURCE_SUBDIR = .
               JAVA_USE_DEPENDENCIES = YES
               JAVA_ZIP_FLAGS = -urg
               JIKES_DEFAULT_FLAGS = +E +OLDCSO
               KASAN_DEFAULT_CFLAGS = -DKASAN=1 -fsanitize=address -mllvm -asan-globals-live-support -mllvm -asan-force-dynamic-shadow
               KEEP_PRIVATE_EXTERNS = NO
               LD_DEPENDENCY_INFO_FILE = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios/Runner.build/Release-iphoneos/Runner.build/Objects-normal/arm64/Runner_dependency_info.dat
               LD_GENERATE_MAP_FILE = NO
               LD_MAP_FILE_PATH = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios/Runner.build/Release-iphoneos/Runner.build/Runner-LinkMap-normal-arm64.txt
               LD_NO_PIE = NO
               LD_QUOTE_LINKER_ARGUMENTS_FOR_COMPILER_DRIVER = YES
               LD_RUNPATH_SEARCH_PATHS =  @executable_path/Frameworks
               LEGACY_DEVELOPER_DIR = /Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer
               LEX = lex
               LIBRARY_FLAG_NOSPACE = YES
               LIBRARY_FLAG_PREFIX = -l
               LIBRARY_KEXT_INSTALL_PATH = /Library/Extensions
               LIBRARY_SEARCH_PATHS =  /Users/mhein/AndroidStudioProjects/flutter_app/ios/Flutter
               LINKER_DISPLAYS_MANGLED_NAMES = NO
               LINK_FILE_LIST_normal_arm64 = 
               LINK_FILE_LIST_normal_armv7 = 
               LINK_WITH_STANDARD_LIBRARIES = YES
               LOCALIZABLE_CONTENT_DIR = 
               LOCALIZED_RESOURCES_FOLDER_PATH = Runner.app/en.lproj
               LOCALIZED_STRING_MACRO_NAMES = NSLocalizedString CFLocalizedString
               LOCAL_ADMIN_APPS_DIR = /Applications/Utilities
               LOCAL_APPS_DIR = /Applications
               LOCAL_DEVELOPER_DIR = /Library/Developer
               LOCAL_LIBRARY_DIR = /Library
               LOCROOT = 
               LOCSYMROOT = 
               MACH_O_TYPE = mh_execute
               MAC_OS_X_PRODUCT_BUILD_VERSION = 18F132
               MAC_OS_X_VERSION_ACTUAL = 101405
               MAC_OS_X_VERSION_MAJOR = 101400
               MAC_OS_X_VERSION_MINOR = 1405
               METAL_LIBRARY_FILE_BASE = default
               METAL_LIBRARY_OUTPUT_DIR = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios/Release-iphoneos/Runner.app
               MODULE_CACHE_DIR = /Users/mhein/Library/Developer/Xcode/DerivedData/ModuleCache.noindex
               MTL_ENABLE_DEBUG_INFO = NO
               NATIVE_ARCH = armv7
               NATIVE_ARCH_32_BIT = i386
               NATIVE_ARCH_64_BIT = x86_64
               NATIVE_ARCH_ACTUAL = x86_64
               NO_COMMON = YES
               OBJECT_FILE_DIR = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios/Runner.build/Release-iphoneos/Runner.build/Objects
               OBJECT_FILE_DIR_normal = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios/Runner.build/Release-iphoneos/Runner.build/Objects-normal
               OBJROOT = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios
               ONLY_ACTIVE_ARCH = NO
               OS = MACOS
               OSAC = /usr/bin/osacompile
               PACKAGE_TYPE = com.apple.package-type.wrapper.application
               PASCAL_STRINGS = YES
               PATH = /Applications/Xcode.app/Contents/Developer/usr/bin:/Users/mhein/.fastlane/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:~/Documents/flutter/bin
               PATH_PREFIXES_EXCLUDED_FROM_HEADER_DEPENDENCIES = /usr/include /usr/local/include /System/Library/Frameworks /System/Library/PrivateFrameworks /Applications/Xcode.app/Contents/Developer/Headers /Applications/Xcode.app/Contents/Developer/SDKs
               /Applications/Xcode.app/Contents/Developer/Platforms
               PBDEVELOPMENTPLIST_PATH = Runner.app/pbdevelopment.plist
               PFE_FILE_C_DIALECTS = objective-c
               PKGINFO_FILE_PATH = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios/Runner.build/Release-iphoneos/Runner.build/PkgInfo
               PKGINFO_PATH = Runner.app/PkgInfo
               PLATFORM_DEVELOPER_APPLICATIONS_DIR = /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Applications
               PLATFORM_DEVELOPER_BIN_DIR = /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin
               PLATFORM_DEVELOPER_LIBRARY_DIR = /Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library
               PLATFORM_DEVELOPER_SDK_DIR = /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
               PLATFORM_DEVELOPER_TOOLS_DIR = /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Tools
               PLATFORM_DEVELOPER_USR_DIR = /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr
               PLATFORM_DIR = /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform
               PLATFORM_DISPLAY_NAME = iOS
               PLATFORM_NAME = iphoneos
               PLATFORM_PREFERRED_ARCH = arm64
               PLATFORM_PRODUCT_BUILD_VERSION = 16E226
               PLIST_FILE_OUTPUT_FORMAT = binary
               PLUGINS_FOLDER_PATH = Runner.app/PlugIns
               PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = YES
               PRECOMP_DESTINATION_DIR = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios/Runner.build/Release-iphoneos/Runner.build/PrefixHeaders
               PRESERVE_DEAD_CODE_INITS_AND_TERMS = NO
               PRIVATE_HEADERS_FOLDER_PATH = Runner.app/PrivateHeaders
               PRODUCT_BUNDLE_IDENTIFIER = multamadio.de.flutterApp
               PRODUCT_MODULE_NAME = Runner
               PRODUCT_NAME = Runner
               PRODUCT_SETTINGS_PATH = /Users/mhein/AndroidStudioProjects/flutter_app/ios/Runner/Info.plist
               PRODUCT_TYPE = com.apple.product-type.application
               PROFILING_CODE = NO
               PROJECT = Runner
               PROJECT_DERIVED_FILE_DIR = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios/Runner.build/DerivedSources
               PROJECT_DIR = /Users/mhein/AndroidStudioProjects/flutter_app/ios
               PROJECT_FILE_PATH = /Users/mhein/AndroidStudioProjects/flutter_app/ios/Runner.xcodeproj
               PROJECT_NAME = Runner
               PROJECT_TEMP_DIR = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios/Runner.build
               PROJECT_TEMP_ROOT = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios
               PROVISIONING_PROFILE_REQUIRED = YES
               PUBLIC_HEADERS_FOLDER_PATH = Runner.app/Headers
               RECURSIVE_SEARCH_PATHS_FOLLOW_SYMLINKS = YES
               REMOVE_CVS_FROM_RESOURCES = YES
               REMOVE_GIT_FROM_RESOURCES = YES
               REMOVE_HEADERS_FROM_EMBEDDED_BUNDLES = YES
               REMOVE_HG_FROM_RESOURCES = YES
               REMOVE_SVN_FROM_RESOURCES = YES
               RESOURCE_RULES_REQUIRED = YES
               REZ_COLLECTOR_DIR = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios/Runner.build/Release-iphoneos/Runner.build/ResourceManagerResources
               REZ_OBJECTS_DIR = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios/Runner.build/Release-iphoneos/Runner.build/ResourceManagerResources/Objects
               SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = NO
               SCRIPTS_FOLDER_PATH = Runner.app/Scripts
               SDKROOT = /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk
               SDK_DIR = /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk
               SDK_DIR_iphoneos12_2 = /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk
               SDK_NAME = iphoneos12.2
               SDK_NAMES = iphoneos12.2
               SDK_PRODUCT_BUILD_VERSION = 16E226
               SDK_VERSION = 12.2
               SDK_VERSION_ACTUAL = 120200
               SDK_VERSION_MAJOR = 120000
               SDK_VERSION_MINOR = 200
               SED = /usr/bin/sed
               SEPARATE_STRIP = NO
               SEPARATE_SYMBOL_EDIT = NO
               SET_DIR_MODE_OWNER_GROUP = YES
               SET_FILE_MODE_OWNER_GROUP = NO
               SHALLOW_BUNDLE = YES
               SHARED_DERIVED_FILE_DIR = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios/Release-iphoneos/DerivedSources
               SHARED_FRAMEWORKS_FOLDER_PATH = Runner.app/SharedFrameworks
               SHARED_PRECOMPS_DIR = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios/SharedPrecompiledHeaders
               SHARED_SUPPORT_FOLDER_PATH = Runner.app/SharedSupport
               SKIP_INSTALL = NO
               SOURCE_ROOT = /Users/mhein/AndroidStudioProjects/flutter_app/ios
               SRCROOT = /Users/mhein/AndroidStudioProjects/flutter_app/ios
               STRINGS_FILE_OUTPUT_ENCODING = binary
               STRIP_BITCODE_FROM_COPIED_FILES = YES
               STRIP_INSTALLED_PRODUCT = YES
               STRIP_STYLE = all
               STRIP_SWIFT_SYMBOLS = YES
               SUPPORTED_DEVICE_FAMILIES = 1,2
               SUPPORTED_PLATFORMS = iphonesimulator iphoneos
               SUPPORTS_TEXT_BASED_API = NO
               SWIFT_COMPILATION_MODE = wholemodule
               SWIFT_OBJC_BRIDGING_HEADER = Runner/Runner-Bridging-Header.h
               SWIFT_OPTIMIZATION_LEVEL = -O
               SWIFT_PLATFORM_TARGET_PREFIX = ios
               SWIFT_SWIFT3_OBJC_INFERENCE = On
               SWIFT_VERSION = 4.0
               SYMROOT = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios
               SYSTEM_ADMIN_APPS_DIR = /Applications/Utilities
               SYSTEM_APPS_DIR = /Applications
               SYSTEM_CORE_SERVICES_DIR = /System/Library/CoreServices
               SYSTEM_DEMOS_DIR = /Applications/Extras
               SYSTEM_DEVELOPER_APPS_DIR = /Applications/Xcode.app/Contents/Developer/Applications
               SYSTEM_DEVELOPER_BIN_DIR = /Applications/Xcode.app/Contents/Developer/usr/bin
               SYSTEM_DEVELOPER_DEMOS_DIR = /Applications/Xcode.app/Contents/Developer/Applications/Utilities/Built Examples
               SYSTEM_DEVELOPER_DIR = /Applications/Xcode.app/Contents/Developer
               SYSTEM_DEVELOPER_DOC_DIR = /Applications/Xcode.app/Contents/Developer/ADC Reference Library
               SYSTEM_DEVELOPER_GRAPHICS_TOOLS_DIR = /Applications/Xcode.app/Contents/Developer/Applications/Graphics Tools
               SYSTEM_DEVELOPER_JAVA_TOOLS_DIR = /Applications/Xcode.app/Contents/Developer/Applications/Java Tools
               SYSTEM_DEVELOPER_PERFORMANCE_TOOLS_DIR = /Applications/Xcode.app/Contents/Developer/Applications/Performance Tools
               SYSTEM_DEVELOPER_RELEASENOTES_DIR = /Applications/Xcode.app/Contents/Developer/ADC Reference Library/releasenotes
               SYSTEM_DEVELOPER_TOOLS = /Applications/Xcode.app/Contents/Developer/Tools
               SYSTEM_DEVELOPER_TOOLS_DOC_DIR = /Applications/Xcode.app/Contents/Developer/ADC Reference Library/documentation/DeveloperTools
               SYSTEM_DEVELOPER_TOOLS_RELEASENOTES_DIR = /Applications/Xcode.app/Contents/Developer/ADC Reference Library/releasenotes/DeveloperTools
               SYSTEM_DEVELOPER_USR_DIR = /Applications/Xcode.app/Contents/Developer/usr
               SYSTEM_DEVELOPER_UTILITIES_DIR = /Applications/Xcode.app/Contents/Developer/Applications/Utilities
               SYSTEM_DOCUMENTATION_DIR = /Library/Documentation
               SYSTEM_KEXT_INSTALL_PATH = /System/Library/Extensions
               SYSTEM_LIBRARY_DIR = /System/Library
               TAPI_VERIFY_MODE = ErrorsOnly
               TARGETED_DEVICE_FAMILY = 1,2
               TARGETNAME = Runner
               TARGET_BUILD_DIR = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios/Release-iphoneos
               TARGET_NAME = Runner
               TARGET_TEMP_DIR = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios/Runner.build/Release-iphoneos/Runner.build
               TEMP_DIR = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios/Runner.build/Release-iphoneos/Runner.build
               TEMP_FILES_DIR = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios/Runner.build/Release-iphoneos/Runner.build
               TEMP_FILE_DIR = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios/Runner.build/Release-iphoneos/Runner.build
               TEMP_ROOT = /Users/mhein/AndroidStudioProjects/flutter_app/build/ios
               TOOLCHAIN_DIR = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
               TREAT_MISSING_BASELINES_AS_TEST_FAILURES = NO
               UID = 502
               UNLOCALIZED_RESOURCES_FOLDER_PATH = Runner.app
               UNSTRIPPED_PRODUCT = NO
               USER = mhein
               USER_APPS_DIR = /Users/mhein/Applications
               USER_LIBRARY_DIR = /Users/mhein/Library
               USE_DYNAMIC_NO_PIC = YES
               USE_HEADERMAP = YES
               USE_HEADER_SYMLINKS = NO
               VALIDATE_PRODUCT = YES
               VALID_ARCHS = arm64 arm64e armv7 armv7s
               VERBOSE_PBXCP = NO
               VERSIONING_SYSTEM = apple-generic
               VERSIONPLIST_PATH = Runner.app/version.plist
               VERSION_INFO_BUILDER = mhein
               VERSION_INFO_FILE = Runner_vers.c
               VERSION_INFO_STRING = "@(#)PROGRAM:Runner  PROJECT:Runner-1"
               WRAPPER_EXTENSION = app
               WRAPPER_NAME = Runner.app
               WRAPPER_SUFFIX = .app
               WRAP_ASSET_PACKS_IN_SEPARATE_DIRECTORIES = NO
               XCODE_APP_SUPPORT_DIR = /Applications/Xcode.app/Contents/Developer/Library/Xcode
               XCODE_PRODUCT_BUILD_VERSION = 10E1001
               XCODE_VERSION_ACTUAL = 1021
               XCODE_VERSION_MAJOR = 1000
               XCODE_VERSION_MINOR = 1020
               XPCSERVICES_FOLDER_PATH = Runner.app/XPCServices
               YACC = yacc
               arch = arm64
               variant = normal

Flutter analyze

Analyzing flutter_app...                                                
No issues found! (ran in 1.6s)

Flutter doctor

[✓] Flutter (Channel stable, v1.7.8+hotfix.3, on Mac OS X 10.14.5 18F132, locale de-DE)
    • Flutter version 1.7.8+hotfix.3 at /Users/mhein/Documents/flutter
    • Framework revision b712a172f9 (7 days ago), 2019-07-09 13:14:38 -0700
    • Engine revision 54ad777fd2
    • Dart version 2.4.0

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/mhein/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • 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-1343-b01)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 10.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.2.1, Build version 10E1001
    • CocoaPods version 1.7.0

[✓] iOS tools - develop for iOS devices
    • ios-deploy 1.9.4

[✓] Android Studio (version 3.4)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 37.0.1
    • Dart plugin version 183.6270
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

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

[✓] Connected device (1 available)
    • iPhone X • 722C7839-1DF7-4E11-837F-0CFBC9E4041D • ios • com.apple.CoreSimulator.SimRuntime.iOS-12-2 (simulator)

@HansMuller HansMuller added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels Jul 16, 2019
@Menelphor Menelphor changed the title Keyboard closes bottomSheet in named Route Keyboard unexpectedly closes if its in a bottomSheet of a named Route Jul 17, 2019
@Menelphor
Copy link
Author

Update 1:

Providing a Global Key to the Container in the bottom Sheet forces the keyboard to stay alive, but then a red screen flickers on Ios and i get the following error:

I/flutter (15864): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (15864): The following assertion was thrown while finalizing the widget tree:
I/flutter (15864): Duplicate GlobalKey detected in widget tree.
I/flutter (15864): The following GlobalKey was specified multiple times in the widget tree. This will lead to parts of
I/flutter (15864): the widget tree being truncated unexpectedly, because the second time a key is seen, the previous
I/flutter (15864): instance is moved to the new location. The key was:
I/flutter (15864): - [GlobalKey#06a16]
I/flutter (15864): This was determined by noticing that after the widget with the above global key was moved out of its
I/flutter (15864): previous parent, that previous parent never updated during this frame, meaning that it either did
I/flutter (15864): not update at all or updated before the widget was moved, in either case implying that it still
I/flutter (15864): thinks that it should have a child with that global key.
I/flutter (15864): The specific parent that did not update after having one or more children forcibly removed due to
I/flutter (15864): GlobalKey reparenting is:
I/flutter (15864): - _InheritedResetNotifier
I/flutter (15864): A GlobalKey can only be specified on one widget at a time in the widget tree.
I/flutter (15864): 
I/flutter (15864): When the exception was thrown, this was the stack:
I/flutter (15864): #0      BuildOwner.finalizeTree.<anonymous closure> (package:flutter/src/widgets/framework.dart:2485:15)
I/flutter (15864): #1      BuildOwner.finalizeTree (package:flutter/src/widgets/framework.dart:2510:8)
I/flutter (15864): #2      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:702:18)
I/flutter (15864): #3      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:285:5)
I/flutter (15864): #4      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1016:15)
I/flutter (15864): #5      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:958:9)
I/flutter (15864): #6      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:874:5)
I/flutter (15864): #10     _invoke (dart:ui/hooks.dart:236:10)
I/flutter (15864): #11     _drawFrame (dart:ui/hooks.dart:194:3)
I/flutter (15864): (elided 3 frames from package dart:async)
I/flutter (15864): ════════════════════════════════════════════════════════════════════════════════════════════════════
I/HwSecImmHelper(15864): mSecurityInputMethodService is null
I/flutter (15864): Another exception was thrown: Duplicate GlobalKey detected in widget tree.

updated CodeSnippet:

class SecondPage extends StatefulWidget {
  SecondPage({Key key}) : super(key: key);

  @override
  _SecondPageState createState() => _SecondPageState();
}

class _SecondPageState extends State<SecondPage> {
  static final Key _key = GlobalKey();
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('it does not work here'),
      ),
      bottomSheet: Container(
        key: _key,
        width: double.infinity,
        color: Colors.lightGreen,
        height: 90,
        child: Center(child: Container(width: 200, child: TextField())),
      ),
    );
  }
}

@Menelphor
Copy link
Author

Menelphor commented Aug 5, 2019

Found a solution:
Wrapping the bottomSheet in a Widget and holding it in State before the build method solves the problem

@DarthThanatos
Copy link

Thank you Menelphor, you solved it!

@TahaTesser
Copy link
Member

Hi @Menelphor
given your last message I feel safe to close this issue,
if you disagree please write in the comments and I will reopen it.
Thank you

@Firzan97
Copy link

Firzan97 commented Dec 5, 2020

You also can wrapped it with stack then using Positioned with bottom: 0..

@github-actions
Copy link

github-actions bot commented Aug 9, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

No branches or pull requests

5 participants