import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; enum ChromeStyle { seam, prompt, inline } enum ResizeEdge { topLeft, top, topRight, left, right, bottomLeft, bottom, bottomRight } class WindowControls extends ChangeNotifier { static const _channel = MethodChannel('clide/window'); ChromeStyle _style = ChromeStyle.seam; ChromeStyle get style => _style; void setStyle(ChromeStyle s) { if (_style == s) return; _style = s; notifyListeners(); } Future startResize(ResizeEdge edge) async { try { await _channel.invokeMethod('startResize', edge.index); } on MissingPluginException { // no-op } } Future startDrag() async { try { await _channel.invokeMethod('startDrag'); } on MissingPluginException { // no-op } } Future minimize() async { try { await _channel.invokeMethod('minimize'); } on MissingPluginException { // no-op } } Future toggleMaximize() async { try { await _channel.invokeMethod('maximize'); } on MissingPluginException { // no-op } } Future close() async { try { await _channel.invokeMethod('close'); } on MissingPluginException { // no-op } } Future isMaximized() async { try { final result = await _channel.invokeMethod('isMaximized'); return result ?? false; } on MissingPluginException { return false; } } /// Opens the native OS directory picker. /// Returns the selected path, or null if the user cancelled. /// Throws [MissingPluginException] if the platform has no handler, /// so callers can fall back to a text-input dialog. Future pickDirectory() { return _channel.invokeMethod('pickDirectory'); } }