I want to test the color change of a BoxDecoration but I don't know how to get the color...
Here is the code
testWidgets('CustomCheckbox Test', (WidgetTester tester) async{
await tester.pumpWidget(Sizer(
builder: (context, orientation, deviceType) {
return MaterialApp(
home: Material(
child: CustomCheckbox(
iconColor: Colors.purple,
activeColor: Colors.yellow,
)
),
);
}
));
expect(find.byIcon(Icons.check_outlined),findsOneWidget);
await tester.tap(find.byType(Container));
await tester.pump(const Duration(milliseconds: 500));
final container = tester.widget<Container>(find.byType(Container));
print(container.decoration);
});
When I print container.decoration
, I get BoxDecoration(color: Color(0x00000000), border: Border.all(BorderSide(Color(0x66c8c8c8), 1.8, BorderStyle.solid)), borderRadius: BorderRadius.circular(4.8))
. I want to get the color, even if it is transparent like here, but I don't know how to access to it...
container.decoration.color does not work, here is the error:
Thanks for your help !
Chris