mirror of
https://github.com/flutter/flutter
synced 2024-10-04 07:19:46 +00:00
CupertinoTextField to show disabled background color when decoration is null (#78140)
This commit is contained in:
parent
5e84b1c343
commit
4f569fb326
|
@ -1216,6 +1216,7 @@ class _CupertinoTextFieldState extends State<CupertinoTextField> with Restoratio
|
|||
ignoring: !enabled,
|
||||
child: Container(
|
||||
decoration: effectiveDecoration,
|
||||
color: !enabled && effectiveDecoration == null ? disabledColor : null,
|
||||
child: _selectionGestureDetectorBuilder.buildGestureDetector(
|
||||
behavior: HitTestBehavior.translucent,
|
||||
child: Align(
|
||||
|
|
|
@ -4695,4 +4695,28 @@ void main() {
|
|||
0xFF050505,
|
||||
);
|
||||
});
|
||||
|
||||
// Regression test for https://github.com/flutter/flutter/issues/78097.
|
||||
testWidgets(
|
||||
'still gets disabled background color when decoration is null',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const CupertinoApp(
|
||||
home: Center(
|
||||
child: CupertinoTextField(
|
||||
decoration: null,
|
||||
enabled: false,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
final Color disabledColor = tester.widget<ColoredBox>(
|
||||
find.descendant(
|
||||
of: find.byType(CupertinoTextField),
|
||||
matching: find.byType(ColoredBox),
|
||||
),
|
||||
).color;
|
||||
expect(disabledColor, isSameColorAs(const Color(0xFFFAFAFA)));
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue