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

TextFormField becomes unresponsive after Navigator.push #147113

Closed
vongrad opened this issue Apr 20, 2024 · 4 comments
Closed

TextFormField becomes unresponsive after Navigator.push #147113

vongrad opened this issue Apr 20, 2024 · 4 comments
Labels
r: invalid Issue is closed as not valid

Comments

@vongrad
Copy link

vongrad commented Apr 20, 2024

Steps to reproduce

TextFormField is not able to receive focus when it is within a page that gets pushed using Navigator.of(context).push. On the other hand, if the new page is pushed using Navigator.of(context).pushReplacement, it receives focus and the user can input text. This happens specifically on simulator iPhone SE (3rd generation) with iOS 17.2 and probably other devices, although not tested. On the other hand, it works on simulator iPhone 15 Pro with iOS 17.2.

  1. Create iOS simulator running iPhone SE (3rd generation) with iOS 17.2
  2. Run the provided sample code
  3. Click on Go to page 2 button
  4. Click inside the TextFormField

Expected results

After clicking into the TextFormField, it receives focus and the user can input text into it.

Actual results

The TextFormField is unable to receive focus and becomes unresponsive.
On the other hand, if the new page is pushed using Navigator.of(context).pushReplacement, everything works as expected.

Code sample

Code sample
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            TextButton(
                onPressed: () {
                  Navigator.of(context)
                      .push(MaterialPageRoute(builder: (context) => Page2()));
                },
                child: Text('Go to page 2'))
          ],
        ),
      ),
    );
  }
}

class Page2 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(),
      body: SafeArea(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [TextFormField()],
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration
Simulator.Screen.Recording.-.iPhone.SE.3rd.generation.-.2024-04-20.at.12.02.08.mp4

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.19.6, on macOS 14.3 23D56 darwin-arm64, locale en-DK)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.2)
[✓] Connected device (5 available)
[✓] Network resources

• No issues found!
@storm265
Copy link

storm265 commented Apr 21, 2024

@vongrad, on top bar tapI/O-> Keyboard -> and uncheck Connect Hardware Keyboard
Screenshot 2024-04-21 at 6 18 54 PM

@huycozy huycozy added the in triage Presently being triaged by the triage team label Apr 22, 2024
@huycozy
Copy link
Member

huycozy commented Apr 22, 2024

@vongrad I checked the issue using the same simulator but couldn't see the issue. Maybe this is just a simulator setting as @storm265 shared above, so please check it to see if it works for you.

@huycozy huycozy added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Apr 22, 2024
@vongrad
Copy link
Author

vongrad commented Apr 23, 2024

@huycozy @storm265 That fixed it, thank you!

@vongrad vongrad closed this as completed Apr 23, 2024
@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Apr 23, 2024
@huycozy huycozy added r: invalid Issue is closed as not valid and removed in triage Presently being triaged by the triage team labels Apr 23, 2024
Copy link

github-actions bot commented May 7, 2024

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 May 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
r: invalid Issue is closed as not valid
Projects
None yet
Development

No branches or pull requests

3 participants