Skip to content

Commit

Permalink
chore: Replace flutter_lints to mostly_reasonable_lints
Browse files Browse the repository at this point in the history
  • Loading branch information
lijy91 committed Jan 28, 2024
1 parent b3b1417 commit ef786b1
Show file tree
Hide file tree
Showing 21 changed files with 184 additions and 260 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### 0.3.8

* Updates minimum supported SDK version to Flutter 3.3/Dart 3.0.
* [windows] fix #396 fullscreen/unfullscreen events, disable minimize on fullscreen #409
* setAlignment support custom Alignment #424

### 0.3.7

* [windows] Wrong window position in fullscreen mode with external monitor #405
Expand Down
2 changes: 1 addition & 1 deletion README-ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@

```yaml
dependencies:
window_manager: ^0.3.7
window_manager: ^0.3.8
```
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Add this to your package's `pubspec.yaml` file:

```yaml
dependencies:
window_manager: ^0.3.7
window_manager: ^0.3.8
```
Or
Expand Down
23 changes: 1 addition & 22 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1 @@
include: package:flutter_lints/flutter.yaml

linter:
rules:
## Error Rules
- always_use_package_imports
## Style rules
- directives_ordering
- eol_at_end_of_file
- file_names
- flutter_style_todos
- library_names
- library_prefixes
- prefer_is_empty
- prefer_is_not_empty
- prefer_is_not_operator
- prefer_null_aware_method_calls
- prefer_single_quotes
- sort_constructors_first
- sort_unnamed_constructors_first
## Pub rules
- sort_pub_dependencies
include: package:mostly_reasonable_lints/flutter.yaml
30 changes: 1 addition & 29 deletions example/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
include: package:mostly_reasonable_lints/flutter.yaml
56 changes: 39 additions & 17 deletions example/integration_test/window_manager_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,19 @@ Future<void> main() async {
);

testWidgets('getBounds', (tester) async {
expect(await windowManager.getBounds(),
isA<Rect>().having((r) => r.size, 'size', const Size(640, 480)));
expect(
await windowManager.getBounds(),
isA<Rect>().having((r) => r.size, 'size', const Size(640, 480)),
);
});

testWidgets('isAlwaysOnBottom', (tester) async {
expect(await windowManager.isAlwaysOnBottom(), isFalse);
}, skip: Platform.isMacOS || Platform.isWindows);
testWidgets(
'isAlwaysOnBottom',
(tester) async {
expect(await windowManager.isAlwaysOnBottom(), isFalse);
},
skip: Platform.isMacOS || Platform.isWindows,
);

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

testWidgets('hasShadow', (tester) async {
expect(await windowManager.hasShadow(), isTrue);
}, skip: Platform.isLinux);
testWidgets(
'hasShadow',
(tester) async {
expect(await windowManager.hasShadow(), isTrue);
},
skip: Platform.isLinux,
);

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

testWidgets('isMinimizable', (tester) async {
expect(await windowManager.isMinimizable(), isTrue);
}, skip: Platform.isMacOS);
testWidgets(
'isMinimizable',
(tester) async {
expect(await windowManager.isMinimizable(), isTrue);
},
skip: Platform.isMacOS,
);

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

testWidgets('isMovable', (tester) async {
expect(await windowManager.isMovable(), isTrue);
}, skip: Platform.isLinux || Platform.isWindows);
testWidgets(
'isMovable',
(tester) async {
expect(await windowManager.isMovable(), isTrue);
},
skip: Platform.isLinux || Platform.isWindows,
);

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

testWidgets('isSkipTaskbar', (tester) async {
expect(await windowManager.isSkipTaskbar(), isFalse);
}, skip: Platform.isWindows);
testWidgets(
'isSkipTaskbar',
(tester) async {
expect(await windowManager.isSkipTaskbar(), isFalse);
},
skip: Platform.isWindows,
);

testWidgets('getTitle', (tester) async {
expect(await windowManager.getTitle(), 'window_manager_test');
Expand Down
11 changes: 5 additions & 6 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import 'package:flutter/material.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:window_manager/window_manager.dart';

import './pages/home.dart';
import 'themes/themes.dart';
import 'utilities/utilities.dart';
import 'package:window_manager_example/pages/home.dart';
import 'package:window_manager_example/themes/themes.dart';
import 'package:window_manager_example/utilities/utilities.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
Expand All @@ -27,7 +26,7 @@ void main() async {
}

class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
const MyApp({super.key});

@override
State<MyApp> createState() => _MyAppState();
Expand Down
14 changes: 7 additions & 7 deletions example/lib/pages/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import 'package:flutter/material.dart';
import 'package:preference_list/preference_list.dart';
import 'package:tray_manager/tray_manager.dart';
import 'package:window_manager/window_manager.dart';

import '../utilities/utilities.dart';
import 'package:window_manager_example/utilities/utilities.dart';

const _kSizes = [
Size(400, 400),
Expand All @@ -28,7 +27,7 @@ const _kMaxSizes = [
];

class HomePage extends StatefulWidget {
const HomePage({Key? key}) : super(key: key);
const HomePage({super.key});

@override
State<HomePage> createState() => _HomePageState();
Expand Down Expand Up @@ -73,7 +72,7 @@ class _HomePageState extends State<HomePage> with TrayListener, WindowListener {
super.dispose();
}

void _init() async {
Future<void> _init() async {
await trayManager.setIcon(
Platform.isWindows
? 'images/tray_icon_original.ico'
Expand All @@ -100,7 +99,7 @@ class _HomePageState extends State<HomePage> with TrayListener, WindowListener {
setState(() {});
}

void _handleSetIcon(String iconType) async {
Future<void> _handleSetIcon(String iconType) async {
_iconType = iconType;
String iconPath =
Platform.isWindows ? 'images/tray_icon.ico' : 'images/tray_icon.png';
Expand Down Expand Up @@ -980,7 +979,8 @@ class _HomePageState extends State<HomePage> with TrayListener, WindowListener {
child: const Text('DragToResizeArea'),
onTap: () {
BotToast.showText(
text: 'DragToResizeArea example');
text: 'DragToResizeArea example',
);
},
),
),
Expand Down Expand Up @@ -1026,7 +1026,7 @@ class _HomePageState extends State<HomePage> with TrayListener, WindowListener {
}

@override
void onTrayMenuItemClick(MenuItem menuItem) async {
Future<void> onTrayMenuItemClick(MenuItem menuItem) async {
switch (menuItem.key) {
case 'show_window':
await windowManager.focus();
Expand Down
12 changes: 7 additions & 5 deletions example/lib/utilities/config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'dart:collection';

import 'package:flutter/material.dart';

class _ListenerEntry extends LinkedListEntry<_ListenerEntry> {
final class _ListenerEntry extends LinkedListEntry<_ListenerEntry> {
_ListenerEntry(this.listener);
final VoidCallback listener;
}
Expand Down Expand Up @@ -42,10 +42,12 @@ class _ConfigChangeNotifier implements Listenable {
try {
if (entry.list != null) entry.listener();
} catch (exception, stack) {
FlutterError.reportError(FlutterErrorDetails(
exception: exception,
stack: stack,
));
FlutterError.reportError(
FlutterErrorDetails(
exception: exception,
stack: stack,
),
);
}
}
}
Expand Down
Loading

0 comments on commit ef786b1

Please sign in to comment.