Skip to content

Commit ddbb7bf

Browse files
committed
Update example
1 parent 0471ba3 commit ddbb7bf

File tree

8 files changed

+64
-75
lines changed

8 files changed

+64
-75
lines changed

packages/hotkey_manager/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

packages/hotkey_manager/example/lib/pages/home.dart

Lines changed: 47 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import 'package:flutter/material.dart';
55
import 'package:flutter/services.dart';
66
import 'package:hotkey_manager/hotkey_manager.dart';
77
import 'package:hotkey_manager_example/widgets/record_hotkey_dialog.dart';
8-
import 'package:preference_list/preference_list.dart';
98

109
class ExampleIntent extends Intent {}
1110

@@ -73,77 +72,61 @@ class _HomePageState extends State<HomePage> {
7372
}
7473

7574
Widget _buildBody(BuildContext context) {
76-
return PreferenceList(
75+
return ListView(
7776
children: <Widget>[
78-
PreferenceListSection(
79-
title: const Text('REGISTERED HOTKEY LIST'),
80-
children: [
81-
for (var registeredHotKey in _registeredHotKeyList)
82-
PreferenceListItem(
83-
padding: const EdgeInsets.all(12),
84-
title: Row(
77+
const Text('REGISTERED HOTKEY LIST'),
78+
for (var registeredHotKey in _registeredHotKeyList)
79+
ListTile(
80+
title: Row(
81+
mainAxisSize: MainAxisSize.min,
82+
children: [
83+
HotKeyVirtualView(hotKey: registeredHotKey),
84+
const SizedBox(width: 10),
85+
Text(
86+
registeredHotKey.scope.toString(),
87+
style: const TextStyle(
88+
color: Colors.grey,
89+
fontSize: 12,
90+
),
91+
),
92+
],
93+
),
94+
trailing: SizedBox(
95+
width: 40,
96+
height: 40,
97+
child: CupertinoButton(
98+
padding: EdgeInsets.zero,
99+
child: const Stack(
100+
alignment: Alignment.center,
85101
children: [
86-
HotKeyVirtualView(hotKey: registeredHotKey),
87-
const SizedBox(width: 10),
88-
Text(
89-
registeredHotKey.scope.toString(),
90-
style: const TextStyle(
91-
color: Colors.grey,
92-
fontSize: 12,
93-
),
102+
Icon(
103+
CupertinoIcons.delete,
104+
size: 18,
105+
color: Colors.red,
94106
),
95107
],
96108
),
97-
accessoryView: SizedBox(
98-
width: 40,
99-
height: 40,
100-
child: CupertinoButton(
101-
padding: EdgeInsets.zero,
102-
child: const Stack(
103-
alignment: Alignment.center,
104-
children: [
105-
Icon(
106-
CupertinoIcons.delete,
107-
size: 18,
108-
color: Colors.red,
109-
),
110-
],
111-
),
112-
onPressed: () => _handleHotKeyUnregister(registeredHotKey),
113-
),
114-
),
115-
),
116-
PreferenceListItem(
117-
title: Text(
118-
'Register a new HotKey',
119-
style: TextStyle(
120-
color: Theme.of(context).primaryColor,
121-
),
109+
onPressed: () => _handleHotKeyUnregister(registeredHotKey),
122110
),
123-
accessoryView: Container(),
124-
onTap: () {
125-
_handleClickRegisterNewHotKey();
126-
},
127111
),
128-
],
112+
),
113+
ListTile(
114+
title: const Text(
115+
'Register a new HotKey',
116+
),
117+
onTap: () {
118+
_handleClickRegisterNewHotKey();
119+
},
129120
),
130-
PreferenceListSection(
131-
children: [
132-
PreferenceListItem(
133-
title: Text(
134-
'Unregister all HotKeys',
135-
style: TextStyle(
136-
color: Theme.of(context).primaryColor,
137-
),
138-
),
139-
accessoryView: Container(),
140-
onTap: () async {
141-
await hotKeyManager.unregisterAll();
142-
_registeredHotKeyList = hotKeyManager.registeredHotKeyList;
143-
setState(() {});
144-
},
145-
),
146-
],
121+
ListTile(
122+
title: const Text(
123+
'Unregister all HotKeys',
124+
),
125+
onTap: () async {
126+
await hotKeyManager.unregisterAll();
127+
_registeredHotKeyList = hotKeyManager.registeredHotKeyList;
128+
setState(() {});
129+
},
147130
),
148131
],
149132
);

packages/hotkey_manager/example/macos/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
platform :osx, '10.14'
1+
platform :osx, '10.15'
22

33
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
44
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

packages/hotkey_manager/example/macos/Podfile.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ EXTERNAL SOURCES:
2020
:path: Flutter/ephemeral/.symlinks/plugins/hotkey_manager_macos/macos
2121

2222
SPEC CHECKSUMS:
23-
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
23+
FlutterMacOS: d0db08ddef1a9af05a5ec4b724367152bb0500b1
2424
HotKey: e96d8a2ddbf4591131e2bb3f54e69554d90cdca6
25-
hotkey_manager_macos: 1e2edb0c7ae4fe67108af44a9d3445de41404160
25+
hotkey_manager_macos: a4317849af96d2430fa89944d3c58977ca089fbe
2626

27-
PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367
27+
PODFILE CHECKSUM: 9ebaf0ce3d369aaa26a9ea0e159195ed94724cf3
2828

29-
COCOAPODS: 1.14.3
29+
COCOAPODS: 1.16.2

packages/hotkey_manager/example/macos/Runner.xcodeproj/project.pbxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@
553553
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
554554
GCC_WARN_UNUSED_FUNCTION = YES;
555555
GCC_WARN_UNUSED_VARIABLE = YES;
556-
MACOSX_DEPLOYMENT_TARGET = 10.14;
556+
MACOSX_DEPLOYMENT_TARGET = 10.15;
557557
MTL_ENABLE_DEBUG_INFO = NO;
558558
SDKROOT = macosx;
559559
SWIFT_COMPILATION_MODE = wholemodule;
@@ -632,7 +632,7 @@
632632
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
633633
GCC_WARN_UNUSED_FUNCTION = YES;
634634
GCC_WARN_UNUSED_VARIABLE = YES;
635-
MACOSX_DEPLOYMENT_TARGET = 10.14;
635+
MACOSX_DEPLOYMENT_TARGET = 10.15;
636636
MTL_ENABLE_DEBUG_INFO = YES;
637637
ONLY_ACTIVE_ARCH = YES;
638638
SDKROOT = macosx;
@@ -679,7 +679,7 @@
679679
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
680680
GCC_WARN_UNUSED_FUNCTION = YES;
681681
GCC_WARN_UNUSED_VARIABLE = YES;
682-
MACOSX_DEPLOYMENT_TARGET = 10.14;
682+
MACOSX_DEPLOYMENT_TARGET = 10.15;
683683
MTL_ENABLE_DEBUG_INFO = NO;
684684
SDKROOT = macosx;
685685
SWIFT_COMPILATION_MODE = wholemodule;

packages/hotkey_manager/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
ignoresPersistentStateOnLaunch = "NO"
6060
debugDocumentVersioning = "YES"
6161
debugServiceExtension = "internal"
62+
enableGPUValidationMode = "1"
6263
allowLocationSimulation = "YES">
6364
<BuildableProductRunnable
6465
runnableDebuggingMode = "0">
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import Cocoa
22
import FlutterMacOS
33

4-
@NSApplicationMain
4+
@main
55
class AppDelegate: FlutterAppDelegate {
66
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
77
return true
88
}
9+
10+
override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
11+
return true
12+
}
913
}

packages/hotkey_manager/example/pubspec.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ environment:
66
sdk: ">=2.18.0 <4.0.0"
77

88
dependencies:
9-
bot_toast: ^4.0.1
9+
bot_toast: ^4.1.3
1010
cupertino_icons: ^1.0.2
1111
flutter:
1212
sdk: flutter
1313
hotkey_manager:
1414
path: ../
15-
preference_list: ^0.0.1
1615

1716
dev_dependencies:
1817
flutter_test:

0 commit comments

Comments
 (0)