-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathuse_nearest_context_test.dart
More file actions
60 lines (52 loc) · 1.42 KB
/
use_nearest_context_test.dart
File metadata and controls
60 lines (52 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// ignore_for_file: avoid_unused_parameters, unused_local_variable
import 'package:flutter/material.dart';
/// Check the `use_nearest_context` rule
void showDialog(BuildContext context) {
final outerContext = context;
showModalBottomSheet(
context: context,
builder: (BuildContext _) {
/// expect_lint: use_nearest_context
return SizedBox.fromSize(size: outerContext.size);
},
);
showModalBottomSheet(
context: context,
builder: (BuildContext _) {
/// expect_lint: use_nearest_context
return SizedBox.fromSize(size: context.size);
},
);
final fun = ({required BuildContext context}) {
/// expect_lint: use_nearest_context
outerContext.mounted;
};
showModalBottomSheet(
context: context,
builder: (_) {
/// expect_lint: use_nearest_context
return SizedBox.fromSize(size: context.size);
},
);
showModalBottomSheet(
context: context,
builder: (BuildContext innerContext) {
/// expect_lint: use_nearest_context
return SizedBox.fromSize(size: context.size);
},
);
showModalBottomSheet(
context: context,
builder: (BuildContext innerContext) {
///Allowed
return SizedBox.fromSize(size: innerContext.size);
});
showModalBottomSheet(
///Allowed
context: context,
builder: (BuildContext context) {
///Allowed
return SizedBox.fromSize(size: context.size);
},
);
}