Skip to content

Commit 752d579

Browse files
authored
Merge pull request #7 from PlugFox/feature/quadtree
Feature/quadtree
2 parents 71ff6f3 + 8464b49 commit 752d579

File tree

25 files changed

+2794
-118
lines changed

25 files changed

+2794
-118
lines changed

.github/workflows/checkout.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
- name: 🚂 Setup Flutter and dependencies
6767
uses: ./.github/actions/setup
6868
with:
69-
flutter-version: 3.24.3
69+
flutter-version: 3.27.1
7070

7171
- name: 👷 Install Dependencies
7272
timeout-minutes: 1

.vscode/launch.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,20 @@
2424
"--dart-define-from-file=config/development.json",
2525
],
2626
"env": {}
27+
},
28+
{
29+
"name": "Example (Release, Web, CanvasKit)",
30+
"type": "dart",
31+
"program": "lib/main.dart",
32+
"request": "launch",
33+
"flutterMode": "release",
34+
"cwd": "${workspaceFolder}/example",
35+
"args": [
36+
"--dart-define-from-file=config/development.json",
37+
"--device-id=chrome",
38+
"--web-port=3000",
39+
],
40+
"env": {}
2741
}
2842
]
2943
}

CHANGELOG.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1+
## 0.0.6
2+
3+
- **ADDED**: Basic `QuadTree` implementation and example
4+
- **CHANGED**: Minimum Flutter version is now 3.27.0
5+
16
## 0.0.5
27

3-
- **CHANGED**: `frameRate` is replaced with `needsPaint` in `RePainter` delegate.
8+
- **CHANGED**: `frameRate` is replaced with `needsPaint` in `RePainter` delegate
49

510
## 0.0.4
611

712
- **ADDED**: More examples
8-
- **CHANGED**: Change interface of `RePainter` delegate.
13+
- **CHANGED**: Change interface of `RePainter` delegate
914

1015
## 0.0.3
1116

devtools_options.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
description: This file stores settings for Dart & Flutter DevTools.
2+
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
3+
extensions:

example/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
*.swp
66
.DS_Store
77
.atom/
8+
.build/
89
.buildlog/
910
.history
1011
.svn/
12+
.swiftpm/
1113
migrate_working_dir/
1214

1315
# IntelliJ related
85.3 KB
Binary file not shown.
85.2 KB
Binary file not shown.

example/lib/main.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@ import 'package:repaintexample/src/common/util/app_zone.dart';
33
import 'package:repaintexample/src/common/widget/app.dart';
44

55
void main() => appZone(
6-
() => runApp(const App()),
6+
() => runApp(App(
7+
initalRoute:
8+
WidgetsBinding.instance.platformDispatcher.defaultRouteName,
9+
)),
710
);

example/lib/src/common/util/app_zone.dart

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
import 'dart:async';
22

3+
import 'package:flutter/widgets.dart';
34
import 'package:l/l.dart';
45

56
/// Catch all application errors and logs.
67
void appZone(FutureOr<void> Function() fn) => l.capture<void>(
78
() => runZonedGuarded<void>(
8-
() => fn(),
9+
() {
10+
final binding = WidgetsFlutterBinding.ensureInitialized()
11+
..deferFirstFrame();
12+
fn();
13+
binding.allowFirstFrame();
14+
},
915
l.e,
1016
),
1117
const LogOptions(
1218
handlePrint: true,
1319
messageFormatting: _messageFormatting,
14-
outputInRelease: false,
20+
outputInRelease: true,
1521
printColors: true,
1622
),
1723
);

example/lib/src/common/widget/app.dart

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ import 'package:repaintexample/src/feature/home/home_screen.dart';
77
/// {@endtemplate}
88
class App extends StatefulWidget {
99
/// {@macro app}
10-
const App({super.key});
10+
const App({String? initalRoute, super.key}) : _initalRoute = initalRoute;
11+
12+
final String? _initalRoute;
1113

1214
/// Change the navigation stack.
1315
static void navigate(BuildContext context,
@@ -40,6 +42,19 @@ class _AppState extends State<App> {
4042
final ValueNotifier<List<Page<void>>> _pages =
4143
ValueNotifier<List<Page<void>>>(defaultPages);
4244

45+
@override
46+
void initState() {
47+
super.initState();
48+
final initialRoute = widget._initalRoute;
49+
if (initialRoute != null &&
50+
initialRoute.isNotEmpty &&
51+
initialRoute != '/') {
52+
final uri = Uri.tryParse(initialRoute);
53+
final page = $routes[uri?.pathSegments.firstOrNull]?.call(null);
54+
if (page != null) navigate((_) => [page]);
55+
}
56+
}
57+
4358
/// Changes the navigation stack.
4459
void navigate(List<Page<void>> Function(List<Page<void>> pages) change) {
4560
final pages = change(_pages.value);

0 commit comments

Comments
 (0)