Skip to content

Commit ef786b1

Browse files
committed
chore: Replace flutter_lints to mostly_reasonable_lints
1 parent b3b1417 commit ef786b1

21 files changed

+184
-260
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
### 0.3.8
2+
3+
* Updates minimum supported SDK version to Flutter 3.3/Dart 3.0.
4+
* [windows] fix #396 fullscreen/unfullscreen events, disable minimize on fullscreen #409
5+
* setAlignment support custom Alignment #424
6+
17
### 0.3.7
28

39
* [windows] Wrong window position in fullscreen mode with external monitor #405

README-ZH.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145

146146
```yaml
147147
dependencies:
148-
window_manager: ^0.3.7
148+
window_manager: ^0.3.8
149149
```
150150
151151

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ Add this to your package's `pubspec.yaml` file:
146146

147147
```yaml
148148
dependencies:
149-
window_manager: ^0.3.7
149+
window_manager: ^0.3.8
150150
```
151151
152152
Or

analysis_options.yaml

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1 @@
1-
include: package:flutter_lints/flutter.yaml
2-
3-
linter:
4-
rules:
5-
## Error Rules
6-
- always_use_package_imports
7-
## Style rules
8-
- directives_ordering
9-
- eol_at_end_of_file
10-
- file_names
11-
- flutter_style_todos
12-
- library_names
13-
- library_prefixes
14-
- prefer_is_empty
15-
- prefer_is_not_empty
16-
- prefer_is_not_operator
17-
- prefer_null_aware_method_calls
18-
- prefer_single_quotes
19-
- sort_constructors_first
20-
- sort_unnamed_constructors_first
21-
## Pub rules
22-
- sort_pub_dependencies
1+
include: package:mostly_reasonable_lints/flutter.yaml

example/analysis_options.yaml

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1 @@
1-
# This file configures the analyzer, which statically analyzes Dart code to
2-
# check for errors, warnings, and lints.
3-
#
4-
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5-
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6-
# invoked from the command line by running `flutter analyze`.
7-
8-
# The following line activates a set of recommended lints for Flutter apps,
9-
# packages, and plugins designed to encourage good coding practices.
10-
include: package:flutter_lints/flutter.yaml
11-
12-
linter:
13-
# The lint rules applied to this project can be customized in the
14-
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
15-
# included above or to enable additional rules. A list of all available lints
16-
# and their documentation is published at
17-
# https://dart-lang.github.io/linter/lints/index.html.
18-
#
19-
# Instead of disabling a lint rule for the entire project in the
20-
# section below, it can also be suppressed for a single line of code
21-
# or a specific dart file by using the `// ignore: name_of_lint` and
22-
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
23-
# producing the lint.
24-
rules:
25-
# avoid_print: false # Uncomment to disable the `avoid_print` rule
26-
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27-
28-
# Additional information about this file can be found at
29-
# https://dart.dev/guides/language/analysis-options
1+
include: package:mostly_reasonable_lints/flutter.yaml

example/integration_test/window_manager_test.dart

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,19 @@ Future<void> main() async {
2020
);
2121

2222
testWidgets('getBounds', (tester) async {
23-
expect(await windowManager.getBounds(),
24-
isA<Rect>().having((r) => r.size, 'size', const Size(640, 480)));
23+
expect(
24+
await windowManager.getBounds(),
25+
isA<Rect>().having((r) => r.size, 'size', const Size(640, 480)),
26+
);
2527
});
2628

27-
testWidgets('isAlwaysOnBottom', (tester) async {
28-
expect(await windowManager.isAlwaysOnBottom(), isFalse);
29-
}, skip: Platform.isMacOS || Platform.isWindows);
29+
testWidgets(
30+
'isAlwaysOnBottom',
31+
(tester) async {
32+
expect(await windowManager.isAlwaysOnBottom(), isFalse);
33+
},
34+
skip: Platform.isMacOS || Platform.isWindows,
35+
);
3036

3137
testWidgets('isAlwaysOnTop', (tester) async {
3238
expect(await windowManager.isAlwaysOnTop(), isFalse);
@@ -44,9 +50,13 @@ Future<void> main() async {
4450
expect(await windowManager.isFullScreen(), isFalse);
4551
});
4652

47-
testWidgets('hasShadow', (tester) async {
48-
expect(await windowManager.hasShadow(), isTrue);
49-
}, skip: Platform.isLinux);
53+
testWidgets(
54+
'hasShadow',
55+
(tester) async {
56+
expect(await windowManager.hasShadow(), isTrue);
57+
},
58+
skip: Platform.isLinux,
59+
);
5060

5161
testWidgets('isMaximizable', (tester) async {
5262
expect(await windowManager.isMaximizable(), isTrue);
@@ -56,17 +66,25 @@ Future<void> main() async {
5666
expect(await windowManager.isMaximized(), isFalse);
5767
});
5868

59-
testWidgets('isMinimizable', (tester) async {
60-
expect(await windowManager.isMinimizable(), isTrue);
61-
}, skip: Platform.isMacOS);
69+
testWidgets(
70+
'isMinimizable',
71+
(tester) async {
72+
expect(await windowManager.isMinimizable(), isTrue);
73+
},
74+
skip: Platform.isMacOS,
75+
);
6276

6377
testWidgets('isMinimized', (tester) async {
6478
expect(await windowManager.isMinimized(), isFalse);
6579
});
6680

67-
testWidgets('isMovable', (tester) async {
68-
expect(await windowManager.isMovable(), isTrue);
69-
}, skip: Platform.isLinux || Platform.isWindows);
81+
testWidgets(
82+
'isMovable',
83+
(tester) async {
84+
expect(await windowManager.isMovable(), isTrue);
85+
},
86+
skip: Platform.isLinux || Platform.isWindows,
87+
);
7088

7189
testWidgets('getOpacity', (tester) async {
7290
expect(await windowManager.getOpacity(), 1.0);
@@ -88,9 +106,13 @@ Future<void> main() async {
88106
expect(await windowManager.getSize(), const Size(640, 480));
89107
});
90108

91-
testWidgets('isSkipTaskbar', (tester) async {
92-
expect(await windowManager.isSkipTaskbar(), isFalse);
93-
}, skip: Platform.isWindows);
109+
testWidgets(
110+
'isSkipTaskbar',
111+
(tester) async {
112+
expect(await windowManager.isSkipTaskbar(), isFalse);
113+
},
114+
skip: Platform.isWindows,
115+
);
94116

95117
testWidgets('getTitle', (tester) async {
96118
expect(await windowManager.getTitle(), 'window_manager_test');

example/lib/main.dart

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import 'package:flutter/material.dart';
21
import 'package:bot_toast/bot_toast.dart';
2+
import 'package:flutter/material.dart';
33
import 'package:window_manager/window_manager.dart';
4-
5-
import './pages/home.dart';
6-
import 'themes/themes.dart';
7-
import 'utilities/utilities.dart';
4+
import 'package:window_manager_example/pages/home.dart';
5+
import 'package:window_manager_example/themes/themes.dart';
6+
import 'package:window_manager_example/utilities/utilities.dart';
87

98
void main() async {
109
WidgetsFlutterBinding.ensureInitialized();
@@ -27,7 +26,7 @@ void main() async {
2726
}
2827

2928
class MyApp extends StatefulWidget {
30-
const MyApp({Key? key}) : super(key: key);
29+
const MyApp({super.key});
3130

3231
@override
3332
State<MyApp> createState() => _MyAppState();

example/lib/pages/home.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ import 'package:flutter/material.dart';
88
import 'package:preference_list/preference_list.dart';
99
import 'package:tray_manager/tray_manager.dart';
1010
import 'package:window_manager/window_manager.dart';
11-
12-
import '../utilities/utilities.dart';
11+
import 'package:window_manager_example/utilities/utilities.dart';
1312

1413
const _kSizes = [
1514
Size(400, 400),
@@ -28,7 +27,7 @@ const _kMaxSizes = [
2827
];
2928

3029
class HomePage extends StatefulWidget {
31-
const HomePage({Key? key}) : super(key: key);
30+
const HomePage({super.key});
3231

3332
@override
3433
State<HomePage> createState() => _HomePageState();
@@ -73,7 +72,7 @@ class _HomePageState extends State<HomePage> with TrayListener, WindowListener {
7372
super.dispose();
7473
}
7574

76-
void _init() async {
75+
Future<void> _init() async {
7776
await trayManager.setIcon(
7877
Platform.isWindows
7978
? 'images/tray_icon_original.ico'
@@ -100,7 +99,7 @@ class _HomePageState extends State<HomePage> with TrayListener, WindowListener {
10099
setState(() {});
101100
}
102101

103-
void _handleSetIcon(String iconType) async {
102+
Future<void> _handleSetIcon(String iconType) async {
104103
_iconType = iconType;
105104
String iconPath =
106105
Platform.isWindows ? 'images/tray_icon.ico' : 'images/tray_icon.png';
@@ -980,7 +979,8 @@ class _HomePageState extends State<HomePage> with TrayListener, WindowListener {
980979
child: const Text('DragToResizeArea'),
981980
onTap: () {
982981
BotToast.showText(
983-
text: 'DragToResizeArea example');
982+
text: 'DragToResizeArea example',
983+
);
984984
},
985985
),
986986
),
@@ -1026,7 +1026,7 @@ class _HomePageState extends State<HomePage> with TrayListener, WindowListener {
10261026
}
10271027

10281028
@override
1029-
void onTrayMenuItemClick(MenuItem menuItem) async {
1029+
Future<void> onTrayMenuItemClick(MenuItem menuItem) async {
10301030
switch (menuItem.key) {
10311031
case 'show_window':
10321032
await windowManager.focus();

example/lib/utilities/config.dart

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import 'dart:collection';
22

33
import 'package:flutter/material.dart';
44

5-
class _ListenerEntry extends LinkedListEntry<_ListenerEntry> {
5+
final class _ListenerEntry extends LinkedListEntry<_ListenerEntry> {
66
_ListenerEntry(this.listener);
77
final VoidCallback listener;
88
}
@@ -42,10 +42,12 @@ class _ConfigChangeNotifier implements Listenable {
4242
try {
4343
if (entry.list != null) entry.listener();
4444
} catch (exception, stack) {
45-
FlutterError.reportError(FlutterErrorDetails(
46-
exception: exception,
47-
stack: stack,
48-
));
45+
FlutterError.reportError(
46+
FlutterErrorDetails(
47+
exception: exception,
48+
stack: stack,
49+
),
50+
);
4951
}
5052
}
5153
}

0 commit comments

Comments
 (0)