-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Closed
Copy link
Labels
a: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problems
Description
For example, native iOS shows a disabled button when it finds no spell check suggestion for a word:
Flutter creates a button that looks tappable but nothing happens if you do tap it:
All of Flutter's buttons allow this kind of disabled button by passing null for onPressed. Only ContextMenuButton doesn't support this (its onPressed is uniquely non-nullable):
| final VoidCallback onPressed; |
I propose we make it nullable so that it can be used to create disabled buttons.
Steps to reproduce
- Run an app on iOS with spell check enabled, such as the one below.
- Type a bunch of crazy text (so that it has no spell check suggestions). Longer is better.
- Tap the misspelled word.
Expected: The "No replacements found" button looks disabled, like native.
Actual: It is tappable but does nothing.
Example app
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.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 StatelessWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
CupertinoTextField(
maxLines: 4,
spellCheckConfiguration: SpellCheckConfiguration(
spellCheckService: DefaultSpellCheckService(),
),
),
],
),
),
);
}
}Metadata
Metadata
Assignees
Labels
a: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problems

