Skip to content

Commit 15717d4

Browse files
committed
Refactor widget formatting and improve test readability
Simplifies widget construction in example.dart by reducing unnecessary line breaks and improves readability in mayr_flutter_extensions_test.dart by formatting test code and expectations for clarity.
1 parent b402ea5 commit 15717d4

File tree

2 files changed

+19
-21
lines changed

2 files changed

+19
-21
lines changed

example/example.dart

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,8 @@ class ExampleScreen extends StatelessWidget {
6262
// Expanded example
6363
Row(
6464
children: [
65-
Container(
66-
height: 50,
67-
color: Colors.red,
68-
).expanded(2),
69-
Container(
70-
height: 50,
71-
color: Colors.green,
72-
).expanded(1),
65+
Container(height: 50, color: Colors.red).expanded(2),
66+
Container(height: 50, color: Colors.green).expanded(1),
7367
],
7468
),
7569

@@ -85,10 +79,7 @@ class ExampleScreen extends StatelessWidget {
8579
Container(
8680
padding: const EdgeInsets.all(16),
8781
color: Colors.amber,
88-
child: const Text(
89-
'Tap Me',
90-
style: TextStyle(fontSize: 18),
91-
),
82+
child: const Text('Tap Me', style: TextStyle(fontSize: 18)),
9283
).inkWellManager(() {
9384
context.showSnackBar("Widget tapped!");
9485
}).onTap(),

test/mayr_flutter_extensions_test.dart

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,18 @@ void main() {
2626
final paddedWidget = testWidget.paddingAll(16);
2727

2828
expect(paddedWidget, isA<Padding>());
29-
expect((paddedWidget as Padding).padding, equals(const EdgeInsets.all(16)));
29+
expect(
30+
(paddedWidget as Padding).padding,
31+
equals(const EdgeInsets.all(16)),
32+
);
3033
});
3134

3235
testWidgets('opacity wraps widget in Opacity', (tester) async {
3336
const testWidget = Text('Test');
3437
final opacityWidget = testWidget.opacity(0.5);
3538

3639
expect(opacityWidget, isA<Opacity>());
37-
expect((opacityWidget as Opacity).opacity, equals(0.5));
40+
expect((opacityWidget).opacity, equals(0.5));
3841
});
3942

4043
testWidgets('showIf shows widget when condition is true', (tester) async {
@@ -126,9 +129,10 @@ void main() {
126129
group('InkWellManager', () {
127130
testWidgets('onTap creates InkWell with tap callback', (tester) async {
128131
bool tapped = false;
129-
final widget = const Text('Test').inkWellManager(() {
130-
tapped = true;
131-
}).onTap();
132+
final widget =
133+
const Text('Test').inkWellManager(() {
134+
tapped = true;
135+
}).onTap();
132136

133137
expect(widget, isA<InkWell>());
134138

@@ -138,11 +142,14 @@ void main() {
138142
expect(tapped, isTrue);
139143
});
140144

141-
testWidgets('onLongPress creates InkWell with long press callback', (tester) async {
145+
testWidgets('onLongPress creates InkWell with long press callback', (
146+
tester,
147+
) async {
142148
bool longPressed = false;
143-
final widget = const Text('Test').inkWellManager(() {
144-
longPressed = true;
145-
}).onLongPress();
149+
final widget =
150+
const Text('Test').inkWellManager(() {
151+
longPressed = true;
152+
}).onLongPress();
146153

147154
expect(widget, isA<InkWell>());
148155

0 commit comments

Comments
 (0)