Unverified Commit 4f569fb3 authored by LongCatIsLooong's avatar LongCatIsLooong Committed by GitHub

CupertinoTextField to show disabled background color when decoration is null (#78140)

parent 5e84b1c3
......@@ -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)));
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment