CustomWindowButton constructor

CustomWindowButton({
  1. Key? key,
  2. required WindowButtonType type,
  3. Color color = kTheme1,
})

Implementation

CustomWindowButton({super.key, required WindowButtonType type, this.color = kTheme1})
    : action = switch (type) {
        // i love pattern matching :D
        WindowButtonType.MINIMIZE => appWindow.minimize,
        WindowButtonType.MAXIMIZE_RESTORE => appWindow.maximizeOrRestore,
        WindowButtonType.CLOSE => appWindow.close,
        WindowButtonType.HIDE => appWindow.hide
      },
      icon = switch (type) {
        // i love pattern matching :D
        WindowButtonType.MINIMIZE => Ionicons.remove_circle,
        WindowButtonType.MAXIMIZE_RESTORE => Ionicons.scan_circle,
        WindowButtonType.CLOSE || WindowButtonType.HIDE => Ionicons.close_circle,
      };