probe_agent: widgets of package:material_ui and cupertino_ui get wrong answers for is enabled/disabled, is checked and the tooltip selector (Flutter 3.50)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 55/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- dart, flutter
- 领域
- mobile-dev, testing-qa
调研方向
Start with the type checks in probe_agent/lib/src/executor.dart, finder.dart, and device_view.dart, then review the measured cases in test/measure_test.dart. Compare handling of legacy and standalone Material and Cupertino widgets, especially enabled state, checked state, and tooltip lookup. Done means those cases pass for migrated widgets on a device while the existing legacy behavior and obscured-field protection remain correct.
由索引模型根据 Issue 内容生成。
描述
What happens
Flutter 3.50 deprecates package:flutter/material.dart and package:flutter/cupertino.dart in favour of the standalone packages material_ui and cupertino_ui ("Migrate to standalone material_ui and cupertino_ui packages", docs.flutter.dev, page dated 2026-11-09). The agent decides what a widget is by its Dart type, taken from package:flutter/material.dart and package:flutter/cupertino.dart (probe_agent/lib/src/executor.dart, finder.dart, device_view.dart). A widget of material_ui is a different class, so on an app that has migrated, some steps give a wrong answer, one of them a silent false pass.
Measured
A scratch app on Flutter 3.50.0 with material_ui 1.11.1 and cupertino_ui 1.1.7 (what ^1.0.0 resolved to), the agent of main (a path dependency), a widget test that runs the agent's own request handler on a screen of each library's widgets. The control is the same screen built from package:flutter/material.dart. One run, no device.
| Step | package:flutter/material.dart (control) |
material_ui / cupertino_ui |
|---|---|---|
see "Submit" (text) and tap "Submit" on an ElevatedButton |
ok | ok |
see #go is enabled (enabled button) |
ok | ok |
see #off is disabled (button with onPressed: null) |
ok | fails: "#off" is enabled |
see #off is enabled (the same disabled button) |
fails: is disabled |
passes (false pass) |
type "x" into #f and see #f contains "x" on a TextField |
ok | ok |
see #cb is checked (Checkbox) and see #sw is checked (Switch) |
ok | fail: "is not a checkable control" |
see #cs is checked (CupertinoSwitch) |
not run | fails: "is not a checkable control" |
tap "Add item" (an IconButton found by its tooltip) |
ok | fails: Widget not found |
type into a CupertinoTextField, contains |
not run | ok |
see #pw is filled (obscured TextField) |
ok | ok |
see "hunter2" (the value of an obscured field must not be found) |
not found, as designed | not found, as designed |
see #f is focused |
ok | ok |
So what runs through the widgets library (text, hit testing, EditableText, focus) works, and the obscured-field protection holds (it goes through EditableText). What is decided by a Material or Cupertino class does not: disabled state of buttons, checked state of checkboxes, switches and radios, the tooltip selector.
Not measured
Route handling (a material_ui Scaffold, dialog or bottom sheet: the agent's route code names BottomSheet, CupertinoPageScaffold and others), TextField(enabled: false), chips and list tiles, TextFormField, DropdownButton, the segmented and picker widgets, probe device view and Studio's inspector, and any device (iOS or Android). Whether the standalone packages re-export or wrap the in-framework classes in a way that would let one check cover both was not read in their source.
Why it matters, and what is not known
The in-framework libraries are still in packages/flutter on 3.50 (the page says "formally deprecated" and gives no removal version), so apps that have not migrated are unaffected. An app that migrates and is tested with FlutterProbe gets the answers above, and is enabled on a disabled button passes. The CLI cannot see it.
Not fixed here
This is a report with a measurement (the RELEASES log gets a note). A fix has to recognise both families of classes (by importing material_ui and cupertino_ui, which raises the Flutter floor of the agent to 3.47, by class name, or by another test of the widget) and has to be tested on a device with a migrated fixture; the choice is open.
The measurement test (scratch, test/measure_test.dart of an app that depends on material_ui, cupertino_ui and the agent)
import 'dart:convert';
import 'package:cupertino_ui/cupertino_ui.dart' as cui;
import 'package:flutter/material.dart' as fm; // the legacy in-framework library: the control
import 'package:flutter/widgets.dart';
import 'package:flutter_probe_agent/src/executor.dart';
import 'package:flutter_probe_agent/src/protocol.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:material_ui/material_ui.dart' as mu;
// What the agent does on widgets from package:material_ui / cupertino_ui compared with the same widgets from package:flutter/material.dart.
// Each case prints one line: "<library> | <step> | ok" or the error message.
final results = <String>[];
Future<String> run(ProbeExecutor ex, List<String> sent, String method, Map<String, dynamic> params) async {
sent.clear();
await ex.dispatch(ProbeRequest(jsonrpc: '2.0', id: 1, method: method, params: params));
final m = jsonDecode(sent.last) as Map<String, dynamic>;
return m.containsKey('error') ? ((m['error'] as Map)['message'] as String).split('\n').first : 'ok';
}
Map<String, dynamic> byText(String t, {String check = '', bool negated = false}) => {
'selector': {'kind': 'text', 'text': t},
if (check.isNotEmpty) 'check': check,
'negated': negated,
};
Map<String, dynamic> byId(String id, {String check = '', bool negated = false}) => {
'selector': {'kind': 'id', 'text': '#$id'},
if (check.isNotEmpty) 'check': check,
'negated': negated,
};
Widget muApp(Widget body) => mu.MaterialApp(home: mu.Scaffold(body: body));
Widget fmApp(Widget body) => fm.MaterialApp(home: fm.Scaffold(body: body));
void main() {
for (final lib in ['flutter/material', 'material_ui']) {
final isMu = lib == 'material_ui';
testWidgets('measure $lib', (tester) async {
final sent = <String>[];
final ex = ProbeExecutor((m) => sent.add(m));
bool checked = true;
bool sw = true;
final pw = TextEditingController(text: 'hunter2-SECRET');
final field = TextEditingController();
final body = Column(children: [
isMu ? mu.ElevatedButton(key: const ValueKey('go'), onPressed: () {}, child: const Text('Submit')) : fm.ElevatedButton(key: const ValueKey('go'), onPressed: () {}, child: const Text('Submit')),
isMu ? const mu.ElevatedButton(key: ValueKey('off'), onPressed: null, child: Text('Disabled one')) : const fm.ElevatedButton(key: ValueKey('off'), onPressed: null, child: Text('Disabled one')),
isMu ? mu.TextField(key: const ValueKey('f'), controller: field) : fm.TextField(key: const ValueKey('f'), controller: field),
isMu ? mu.TextField(key: const ValueKey('pw'), obscureText: true, controller: pw) : fm.TextField(key: const ValueKey('pw'), obscureText: true, controller: pw),
isMu ? mu.Checkbox(key: const ValueKey('cb'), value: checked, onChanged: (v) {}) : fm.Checkbox(key: const ValueKey('cb'), value: checked, onChanged: (v) {}),
isMu ? mu.Switch(key: const ValueKey('sw'), value: sw, onChanged: (v) {}) : fm.Switch(key: const ValueKey('sw'), value: sw, onChanged: (v) {}),
isMu ? mu.IconButton(key: const ValueKey('ib'), tooltip: 'Add item', icon: const Icon(IconData(0xe047)), onPressed: () {}) : fm.IconButton(key: const ValueKey('ib'), tooltip: 'Add item', icon: const Icon(IconData(0xe047)), onPressed: () {}),
]);
await tester.pumpWidget(isMu ? muApp(body) : fmApp(body));
await tester.pumpAndSettle();
Future<void> rec(String step, String method, Map<String, dynamic> p) async => results.add('$lib | $step | ${await run(ex, sent, method, p)}');
await rec('see "Submit"', ProbeMethods.see, byText('Submit'));
await rec('tap "Submit"', ProbeMethods.tap, byText('Submit'));
await rec('see #go is enabled', ProbeMethods.see, byId('go', check: 'enabled'));
await rec('see #off is disabled', ProbeMethods.see, byId('off', check: 'disabled'));
await rec('see #off is enabled (should fail)', ProbeMethods.see, byId('off', check: 'enabled'));
await rec('type "x" into #f', ProbeMethods.type_, {'selector': {'kind': 'id', 'text': '#f'}, 'text': 'x'});
await rec('see #f contains "x"', ProbeMethods.see, {...byId('f', check: 'contains'), 'check_val': 'x'});
await rec('see #cb is checked', ProbeMethods.see, byId('cb', check: 'checked'));
await rec('see #sw is checked', ProbeMethods.see, byId('sw', check: 'checked'));
await rec('tap "Add item" (tooltip)', ProbeMethods.tap, byText('Add item'));
await rec('see #pw is filled', ProbeMethods.see, byId('pw', check: 'filled'));
await rec('see "hunter2" (must NOT find the password)', ProbeMethods.see, byText('hunter2'));
await rec('see #f is focused', ProbeMethods.see, byId('f', check: 'focused'));
});
}
testWidgets('cupertino_ui', (tester) async {
final sent = <String>[];
final ex = ProbeExecutor((m) => sent.add(m));
await tester.pumpWidget(mu.MaterialApp(home: mu.Scaffold(body: Column(children: [
cui.CupertinoTextField(key: const ValueKey('ct'), placeholder: 'Type here'),
cui.CupertinoSwitch(key: const ValueKey('cs'), value: true, onChanged: (v) {}),
]))));
await tester.pumpAndSettle();
results.add('cupertino_ui | type "x" into #ct | ${await run(ex, sent, ProbeMethods.type_, {'selector': {'kind': 'id', 'text': '#ct'}, 'text': 'x'})}');
results.add('cupertino_ui | see #ct contains "x" | ${await run(ex, sent, ProbeMethods.see, {...byId('ct', check: 'contains'), 'check_val': 'x'})}');
results.add('cupertino_ui | see #cs is checked | ${await run(ex, sent, ProbeMethods.see, byId('cs', check: 'checked'))}');
});
tearDownAll(() {
// ignore: avoid_print
print('\n=== RESULTS ===\n${results.join('\n')}\n=== END ===');
});
}
- 主要语言
- Go
- 星标
- 6
- 派生
- 3
- 平均合并
- 6 小时 28 分钟
- 30 天内合并 PR
- 362
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
AlphaWaveSystems/flutter-probe 的其他 Issue
-
agent: is checked on a wrapper holding several checkables answers from the first one in tree order未关闭bug
难度 2/5 1-3 小时 新手友好度 76/100
AlphaWaveSystems/flutter-probe#865 ·
维护者通常 1 天内回复
-
area/cli bug
难度 2/5 1-3 小时 新手友好度 73/100
AlphaWaveSystems/flutter-probe#424 ·
维护者通常 1 天内回复
-
area/docs documentation
难度 2/5 1-3 小时 新手友好度 70/100
AlphaWaveSystems/flutter-probe#409 ·
维护者通常 1 天内回复
-
Dial timeout error should say how long it waited and name the timeout setting可能已有人在做 @jay23606 于 2 天前认领。 未关闭area/cli bug
难度 2/5 1-3 小时 新手友好度 78/100
AlphaWaveSystems/flutter-probe#408 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 45/100
AlphaWaveSystems/flutter-probe#888 ·
维护者通常 1 天内回复
查看 AlphaWaveSystems/flutter-probe 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
IBM-Cloud/terraform-provider-ibm#7115 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 86/100
fluxcd/notification-controller#1441 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 66/100
volcengine/volcengine-go-sdk#163 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 76/100
OneBusAway/maglev#2145 ·
维护者通常 2 天内回复
-
priority/medium status/ready type/chore
难度 2/5 1-3 小时 新手友好度 84/100
discobox-ai/discobox#1357 ·
维护者通常 1 天内回复