File tree Expand file tree Collapse file tree 2 files changed +51
-1
lines changed Expand file tree Collapse file tree 2 files changed +51
-1
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ class GFCard extends StatelessWidget {
115115
116116 @override
117117 Widget build (BuildContext context) {
118- final CardThemeData cardTheme = CardTheme .of (context);
118+ final CardTheme cardTheme = CardTheme .of (context);
119119
120120 final Widget cardChild = Padding (
121121 padding: padding,
Original file line number Diff line number Diff line change 1+ import 'package:flutter/material.dart' ;
2+ import 'package:flutter_test/flutter_test.dart' ;
3+ import 'package:getwidget/getwidget.dart' ;
4+
5+ void main () {
6+ testWidgets ('GFBadge displays text when text is provided' , (WidgetTester tester) async {
7+ await tester.pumpWidget (
8+ MaterialApp (
9+ home: Scaffold (
10+ body: GFBadge (
11+ text: 'Test Badge' ,
12+ ),
13+ ),
14+ ),
15+ );
16+
17+ expect (find.text ('Test Badge' ), findsOneWidget);
18+ });
19+
20+ testWidgets ('GFBadge displays child widget when no text is provided' , (WidgetTester tester) async {
21+ final childKey = Key ('child_key' );
22+ await tester.pumpWidget (
23+ MaterialApp (
24+ home: Scaffold (
25+ body: GFBadge (
26+ child: Container (key: childKey),
27+ ),
28+ ),
29+ ),
30+ );
31+
32+ expect (find.byKey (childKey), findsOneWidget);
33+ });
34+
35+ testWidgets ('GFBadge uses default size and color properties' , (WidgetTester tester) async {
36+ await tester.pumpWidget (
37+ MaterialApp (
38+ home: Scaffold (
39+ body: GFBadge (
40+ text: 'Default' ,
41+ ),
42+ ),
43+ ),
44+ );
45+
46+ final badge = tester.widget <GFBadge >(find.byType (GFBadge ));
47+ expect (badge.color, GFColors .DANGER );
48+ expect (badge.size, GFSize .SMALL );
49+ });
50+ }
You can’t perform that action at this time.
0 commit comments