'Flutter iOS - How to hide the DONE button at the top of the ios keyboard?

The DONE button doesn't work on Flutter Web (Safari, Chrome).

I just added a Textformfield Widget to 'Counter Example Project' and built it on Chrome.

And I access the same Localhost URL on the iOS simulator.

As you can see in the GIF, when I press the done button, the keyboard does not disappear and continues to reappear.

Is there any way to hide this 'DONE' button? Or is there any good way to solve this problem?

I'm sorry about my poor English... Please answer me. Thank you.


Here is my whole flutter code below.


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

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

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

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

  final String title;

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

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            TextFormField(
                autofocus: false,
                enableSuggestions: false,
                toolbarOptions: null,
                keyboardType: TextInputType.visiblePassword),
            const Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headline4,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
    );
  }
}

video



Solution 1:[1]

I had the same issue. I resolved it by upgrading Flutter to version 3.0.0 (using command flutter upgrade).

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1