@@ -20,7 +20,7 @@ void main() {
2020 alignment: Alignment .topLeft,
2121 child: Builder (
2222 builder: (BuildContext context) {
23- // theme.textTtheme is updated when the MaterialApp is built.
23+ // theme.textTheme is updated when the MaterialApp is built.
2424 theme = Theme .of (context);
2525 return const Badge (
2626 label: Text ('0' ),
@@ -71,7 +71,7 @@ void main() {
7171 alignment: Alignment .topLeft,
7272 child: Builder (
7373 builder: (BuildContext context) {
74- // theme.textTtheme is updated when the MaterialApp is built.
74+ // theme.textTheme is updated when the MaterialApp is built.
7575 theme = Theme .of (context);
7676 return const Badge (
7777 label: Text ('0' ),
@@ -202,5 +202,27 @@ void main() {
202202 expect (tester.renderObject (find.byType (Badge )), paints..rrect (color: black));
203203 });
204204
205+ testWidgets ('isLabelVisible' , (WidgetTester tester) async {
206+ await tester.pumpWidget (
207+ MaterialApp (
208+ theme: ThemeData .light (useMaterial3: true ),
209+ home: const Align (
210+ alignment: Alignment .topLeft,
211+ child: Badge (
212+ label: Text ('0' ),
213+ isLabelVisible: false ,
214+ child: Icon (Icons .add),
215+ ),
216+ ),
217+ ),
218+ );
219+
220+ expect (find.text ('0' ), findsNothing);
221+ expect (find.byType (Icon ), findsOneWidget);
205222
223+ expect (tester.getSize (find.byType (Badge )), const Size (24 , 24 )); // default Icon size
224+ expect (tester.getTopLeft (find.byType (Badge )), Offset .zero);
225+ final RenderBox box = tester.renderObject (find.byType (Badge ));
226+ expect (box, isNot (paints..rrect ()));
227+ });
206228}
0 commit comments