diff --git a/example/pubspec.lock b/example/pubspec.lock index 69083bb..6d0ec4a 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -5,114 +5,122 @@ packages: dependency: transitive description: name: async - url: "https://pub.flutter-io.cn" + sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb" + url: "https://pub.dev" source: hosted - version: "2.9.0" + version: "2.13.0" bitsdojo_window: dependency: "direct main" description: name: bitsdojo_window - url: "https://pub.flutter-io.cn" + sha256: "69afdbea4273d984ef8064be967f8cdc303a79909879867afecbbf56f5ebc35f" + url: "https://pub.dev" source: hosted version: "0.1.2" bitsdojo_window_linux: dependency: transitive description: name: bitsdojo_window_linux - url: "https://pub.flutter-io.cn" + sha256: "9519c0614f98be733e0b1b7cb15b827007886f6fe36a4fb62cf3d35b9dd578ab" + url: "https://pub.dev" source: hosted - version: "0.1.2" + version: "0.1.4" bitsdojo_window_macos: dependency: transitive description: name: bitsdojo_window_macos - url: "https://pub.flutter-io.cn" + sha256: f7c5be82e74568c68c5b8449e2c5d8fd12ec195ecd70745a7b9c0f802bb0268f + url: "https://pub.dev" source: hosted - version: "0.1.2" + version: "0.1.4" bitsdojo_window_platform_interface: dependency: transitive description: name: bitsdojo_window_platform_interface - url: "https://pub.flutter-io.cn" + sha256: "65daa015a0c6dba749bdd35a0f092e7a8ba8b0766aa0480eb3ef808086f6e27c" + url: "https://pub.dev" source: hosted version: "0.1.2" bitsdojo_window_windows: dependency: transitive description: name: bitsdojo_window_windows - url: "https://pub.flutter-io.cn" + sha256: fa982cf61ede53f483e50b257344a1c250af231a3cdc93a7064dd6dc0d720b68 + url: "https://pub.dev" source: hosted - version: "0.1.2" + version: "0.1.6" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.flutter-io.cn" + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.2" characters: dependency: transitive description: name: characters - url: "https://pub.flutter-io.cn" + sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 + url: "https://pub.dev" source: hosted - version: "1.2.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.3.1" + version: "1.4.0" clock: dependency: transitive description: name: clock - url: "https://pub.flutter-io.cn" + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.2" collection: dependency: transitive description: name: collection - url: "https://pub.flutter-io.cn" + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "1.19.1" crypto: dependency: transitive description: name: crypto - url: "https://pub.flutter-io.cn" + sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf + url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.0.7" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.flutter-io.cn" + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + url: "https://pub.dev" source: hosted - version: "1.0.4" + version: "1.0.8" english_words: dependency: "direct main" description: name: english_words - url: "https://pub.flutter-io.cn" + sha256: "6a7ef6473a97bd8571b6b641d006a6e58a7c67e65fb6f3d6d1151cb46b0e983c" + url: "https://pub.dev" source: hosted version: "4.0.0" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.flutter-io.cn" + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.3.3" ffi: dependency: transitive description: name: ffi - url: "https://pub.flutter-io.cn" + sha256: d07d37192dbf97461359c1518788f203b0c9102cfd2c35a716b823741219542c + url: "https://pub.dev" source: hosted - version: "1.1.2" + version: "2.1.5" flutter: dependency: "direct main" description: flutter @@ -122,7 +130,8 @@ packages: dependency: "direct dev" description: name: flutter_lints - url: "https://pub.flutter-io.cn" + sha256: b543301ad291598523947dc534aaddc5aaad597b709d2426d3a0e0d44c5cb493 + url: "https://pub.dev" source: hosted version: "1.0.4" flutter_test: @@ -130,130 +139,178 @@ packages: description: flutter source: sdk version: "0.0.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" + url: "https://pub.dev" + source: hosted + version: "11.0.2" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" + url: "https://pub.dev" + source: hosted + version: "3.0.10" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" + url: "https://pub.dev" + source: hosted + version: "3.0.2" lints: dependency: transitive description: name: lints - url: "https://pub.flutter-io.cn" + sha256: a2c3d198cb5ea2e179926622d433331d8b58374ab8f29cdda6e863bd62fd369c + url: "https://pub.dev" source: hosted version: "1.0.1" matcher: dependency: transitive description: name: matcher - url: "https://pub.flutter-io.cn" + sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 + url: "https://pub.dev" source: hosted - version: "0.12.11" + version: "0.12.17" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.flutter-io.cn" + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + url: "https://pub.dev" source: hosted - version: "0.1.4" + version: "0.11.1" meta: dependency: transitive description: name: meta - url: "https://pub.flutter-io.cn" + sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394" + url: "https://pub.dev" source: hosted - version: "1.7.0" + version: "1.17.0" path: dependency: transitive description: name: path - url: "https://pub.flutter-io.cn" + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" source: hosted - version: "1.8.1" + version: "1.9.1" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - url: "https://pub.flutter-io.cn" + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.8" sky_engine: dependency: transitive description: flutter source: sdk - version: "0.0.99" + version: "0.0.0" source_span: dependency: transitive description: name: source_span - url: "https://pub.flutter-io.cn" + sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" + url: "https://pub.dev" source: hosted - version: "1.8.2" + version: "1.10.1" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.flutter-io.cn" + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.12.1" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.flutter-io.cn" + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.4" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.flutter-io.cn" + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.4.1" system_tray: dependency: "direct main" description: path: ".." relative: true source: path - version: "2.0.1" + version: "2.0.3" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.flutter-io.cn" + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.2.2" test_api: dependency: transitive description: name: test_api - url: "https://pub.flutter-io.cn" + sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55 + url: "https://pub.dev" source: hosted - version: "0.4.9" + version: "0.7.7" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.flutter-io.cn" + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" source: hosted - version: "1.3.1" + version: "1.4.0" uuid: dependency: transitive description: name: uuid - url: "https://pub.flutter-io.cn" + sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313" + url: "https://pub.dev" source: hosted - version: "3.0.6" + version: "3.0.7" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.flutter-io.cn" + sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b + url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.2.0" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60" + url: "https://pub.dev" + source: hosted + version: "15.0.2" win32: dependency: transitive description: name: win32 - url: "https://pub.flutter-io.cn" + sha256: d7cb55e04cd34096cd3a79b3330245f54cb96a370a1c27adb3c84b917de8b08e + url: "https://pub.dev" source: hosted - version: "2.6.1" + version: "5.15.0" sdks: - dart: ">=2.17.0 <3.0.0" - flutter: ">=1.22.0" + dart: ">=3.8.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/lib/src/tray.dart b/lib/src/tray.dart index b1ed149..02444b5 100644 --- a/lib/src/tray.dart +++ b/lib/src/tray.dart @@ -22,6 +22,8 @@ const String _kTitleKey = "title"; const String _kIconPathKey = "iconpath"; const String _kToolTipKey = "tooltip"; const String _kIsTemplateKey = "is_template"; +const String _kFontFamilyKey = "font_family"; +const String _kPreferMonospacedFallbackKey = "prefer_monospaced_fallback"; /// A callback provided to [SystemTray] to handle system tray click event. typedef SystemTrayEventCallback = void Function(String eventName); @@ -43,6 +45,8 @@ class SystemTray { String? title, String? toolTip, bool isTemplate = false, + String? fontFamily, + bool preferMonospacedFallback = false, }) async { bool value = await _platformChannel.invokeMethod( _kInitSystemTray, @@ -52,6 +56,8 @@ class SystemTray { _kIconPathKey: await Utils.getIcon(iconPath), _kToolTipKey: toolTip, _kIsTemplateKey: isTemplate, + _kFontFamilyKey: fontFamily, + _kPreferMonospacedFallbackKey: preferMonospacedFallback, }, ); return value; @@ -63,6 +69,8 @@ class SystemTray { String? iconPath, String? toolTip, bool isTemplate = false, + String? fontFamily, + bool preferMonospacedFallback = false, }) async { bool value = await _platformChannel.invokeMethod( _kSetSystemTrayInfo, @@ -71,6 +79,8 @@ class SystemTray { _kIconPathKey: await Utils.getIcon(iconPath), _kToolTipKey: toolTip, _kIsTemplateKey: isTemplate, + _kFontFamilyKey: fontFamily, + _kPreferMonospacedFallbackKey: preferMonospacedFallback, }, ); return value; @@ -87,8 +97,22 @@ class SystemTray { } /// (macOS) Sets the title displayed next to the tray icon in the status bar. - Future setTitle(String title) async { - await setSystemTrayInfo(title: title); + /// + /// **Important:** If you're using a custom font, you must pass `fontFamily` + /// (and optionally `preferMonospacedFallback`) every time you update the title, + /// otherwise it will revert to the standard system font. + /// + /// For convenience, you can also use [setSystemTrayInfo] directly. + Future setTitle( + String title, { + String? fontFamily, + bool preferMonospacedFallback = false, + }) async { + await setSystemTrayInfo( + title: title, + fontFamily: fontFamily, + preferMonospacedFallback: preferMonospacedFallback, + ); } /// (macOS) Returns string - the title displayed next to the tray icon in the status bar diff --git a/macos/Classes/Tray.swift b/macos/Classes/Tray.swift index 96ee12b..b366fb8 100644 --- a/macos/Classes/Tray.swift +++ b/macos/Classes/Tray.swift @@ -1,3 +1,4 @@ +import Cocoa import FlutterMacOS let kInitSystemTray = "InitSystemTray" @@ -15,6 +16,8 @@ private let kTitleKey = "title" private let kIconPathKey = "iconpath" private let kToolTipKey = "tooltip" private let kIsTemplateKey = "is_template" +private let kFontFamilyKey = "font_family" +private let kPreferMonospacedFallbackKey = "prefer_monospaced_fallback" private let kSystemTrayEventClick = "click" private let kSystemTrayEventRightClick = "right-click" @@ -66,6 +69,61 @@ class Tray: NSObject, NSMenuDelegate { statusItem?.menu = nil } + /// Sets the title. If fontFamily is provided, uses NSAttributedString. + /// Otherwise, falls back to standard system behavior. + private func updateTitle(_ title: String, fontFamily: String?, preferMonospacedFallback: Bool = false) { + guard let button = statusItem?.button else { return } + + // Case 1: No font family requested. Use standard behavior. + guard let family = fontFamily, !family.isEmpty else { + button.title = title + button.attributedTitle = nil // Clear any previous attributes + return + } + + // Case 2: User requested a custom font + let fontSize: CGFloat = 13.0 + var font: NSFont? + + // Check for special "system_monospaced" keyword + if family == "system_monospaced" { + if #available(macOS 10.15, *) { + font = NSFont.monospacedSystemFont(ofSize: fontSize, weight: .regular) + } else { + font = NSFont.userFixedPitchFont(ofSize: fontSize) + } + } else { + // Try to load the custom font by name (e.g., "Menlo", "Arial", "Fira Code") + // Note: Use the PostScript name or family name as shown in Font Book + font = NSFont(name: family, size: fontSize) + + // If custom font fails to load, use fallback based on user preference + if font == nil { + if preferMonospacedFallback { + // Fallback to monospaced font + if #available(macOS 10.15, *) { + font = NSFont.monospacedSystemFont(ofSize: fontSize, weight: .regular) + } else { + font = NSFont.userFixedPitchFont(ofSize: fontSize) + } + } else { + // Fallback to standard system font (proportional) + font = NSFont.systemFont(ofSize: fontSize) + } + } + } + + // Apply the font (either custom, system_monospaced, or fallback) + if let validFont = font { + let attributes: [NSAttributedString.Key: Any] = [.font: validFont] + button.attributedTitle = NSAttributedString(string: title, attributes: attributes) + } else { + // This should rarely happen, but if all font loading fails, use standard title + button.title = title + button.attributedTitle = nil + } + } + @objc func onSystemTrayEventCallback(sender: NSStatusBarButton) { if let event = NSApp.currentEvent { switch event.type { @@ -85,6 +143,8 @@ class Tray: NSObject, NSMenuDelegate { let base64Icon = arguments[kIconPathKey] as? String let toolTip = arguments[kToolTipKey] as? String let isTemplate = arguments[kIsTemplateKey] as? Bool + let fontFamily = arguments[kFontFamilyKey] as? String // Extract font family + let preferMonospacedFallback = arguments[kPreferMonospacedFallbackKey] as? Bool ?? false if statusItem != nil { result(false) @@ -104,7 +164,8 @@ class Tray: NSObject, NSMenuDelegate { } if let title = title { - statusItem?.button?.title = title + // Use the new update helper + updateTitle(title, fontFamily: fontFamily, preferMonospacedFallback: preferMonospacedFallback) } if let base64Icon = base64Icon { @@ -128,13 +189,16 @@ class Tray: NSObject, NSMenuDelegate { let base64Icon = arguments[kIconPathKey] as? String let toolTip = arguments[kToolTipKey] as? String let isTemplate = arguments[kIsTemplateKey] as? Bool + let fontFamily = arguments[kFontFamilyKey] as? String // Extract font family + let preferMonospacedFallback = arguments[kPreferMonospacedFallbackKey] as? Bool ?? false if let toolTip = toolTip { statusItem?.button?.toolTip = toolTip } if let title = title { - statusItem?.button?.title = title + // Use the new update helper + updateTitle(title, fontFamily: fontFamily, preferMonospacedFallback: preferMonospacedFallback) } if let base64Icon = base64Icon { diff --git a/pubspec.lock b/pubspec.lock index 084d0f7..a061182 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,58 +5,58 @@ packages: dependency: transitive description: name: async - url: "https://pub.flutter-io.cn" + sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb" + url: "https://pub.dev" source: hosted - version: "2.9.0" + version: "2.13.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.flutter-io.cn" + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.2" characters: dependency: transitive description: name: characters - url: "https://pub.flutter-io.cn" + sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 + url: "https://pub.dev" source: hosted - version: "1.2.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.3.1" + version: "1.4.0" clock: dependency: transitive description: name: clock - url: "https://pub.flutter-io.cn" + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.2" collection: dependency: transitive description: name: collection - url: "https://pub.flutter-io.cn" + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "1.19.1" crypto: dependency: transitive description: name: crypto - url: "https://pub.flutter-io.cn" + sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf + url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.0.7" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.flutter-io.cn" + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.3.3" flutter: dependency: "direct main" description: flutter @@ -66,7 +66,8 @@ packages: dependency: "direct dev" description: name: flutter_lints - url: "https://pub.flutter-io.cn" + sha256: b543301ad291598523947dc534aaddc5aaad597b709d2426d3a0e0d44c5cb493 + url: "https://pub.dev" source: hosted version: "1.0.4" flutter_test: @@ -74,109 +75,155 @@ packages: description: flutter source: sdk version: "0.0.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" + url: "https://pub.dev" + source: hosted + version: "11.0.2" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" + url: "https://pub.dev" + source: hosted + version: "3.0.10" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" + url: "https://pub.dev" + source: hosted + version: "3.0.2" lints: dependency: transitive description: name: lints - url: "https://pub.flutter-io.cn" + sha256: a2c3d198cb5ea2e179926622d433331d8b58374ab8f29cdda6e863bd62fd369c + url: "https://pub.dev" source: hosted version: "1.0.1" matcher: dependency: transitive description: name: matcher - url: "https://pub.flutter-io.cn" + sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 + url: "https://pub.dev" source: hosted - version: "0.12.11" + version: "0.12.17" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.flutter-io.cn" + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + url: "https://pub.dev" source: hosted - version: "0.1.4" + version: "0.11.1" meta: dependency: transitive description: name: meta - url: "https://pub.flutter-io.cn" + sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394" + url: "https://pub.dev" source: hosted - version: "1.7.0" + version: "1.17.0" path: dependency: "direct main" description: name: path - url: "https://pub.flutter-io.cn" + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" source: hosted - version: "1.8.1" + version: "1.9.1" sky_engine: dependency: transitive description: flutter source: sdk - version: "0.0.99" + version: "0.0.0" source_span: dependency: transitive description: name: source_span - url: "https://pub.flutter-io.cn" + sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" + url: "https://pub.dev" source: hosted - version: "1.8.2" + version: "1.10.1" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.flutter-io.cn" + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.12.1" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.flutter-io.cn" + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.4" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.flutter-io.cn" + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.4.1" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.flutter-io.cn" + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.2.2" test_api: dependency: transitive description: name: test_api - url: "https://pub.flutter-io.cn" + sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55 + url: "https://pub.dev" source: hosted - version: "0.4.9" + version: "0.7.7" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.flutter-io.cn" + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" source: hosted - version: "1.3.1" + version: "1.4.0" uuid: dependency: "direct main" description: name: uuid - url: "https://pub.flutter-io.cn" + sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313" + url: "https://pub.dev" source: hosted - version: "3.0.6" + version: "3.0.7" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.flutter-io.cn" + sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b + url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.2.0" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60" + url: "https://pub.dev" + source: hosted + version: "15.0.2" sdks: - dart: ">=2.17.0-0 <3.0.0" - flutter: ">=1.20.0" + dart: ">=3.8.0-0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/test/system_tray_test.dart b/test/system_tray_test.dart index 0502d7a..c6d4cac 100644 --- a/test/system_tray_test.dart +++ b/test/system_tray_test.dart @@ -7,13 +7,15 @@ void main() { TestWidgetsFlutterBinding.ensureInitialized(); setUp(() { - channel.setMockMethodCallHandler((MethodCall methodCall) async { + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger + .setMockMethodCallHandler(channel, (MethodCall methodCall) async { return '42'; }); }); tearDown(() { - channel.setMockMethodCallHandler(null); + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger + .setMockMethodCallHandler(channel, null); }); test('getPlatformVersion', () async {});