33import 'package:flutter/material.dart' ;
44
55class WindowCaptionButtonIcon extends StatelessWidget {
6- final String name;
7- final Color ? color;
8- final String package;
9-
106 const WindowCaptionButtonIcon ({
117 Key ? key,
128 required this .name,
139 this .color,
1410 this .package = 'window_manager' ,
1511 }) : super (key: key);
1612
13+ final String name;
14+ final Color ? color;
15+ final String package;
16+
1717 @override
1818 Widget build (BuildContext context) {
1919 return Image .asset (
@@ -28,66 +28,13 @@ class WindowCaptionButtonIcon extends StatelessWidget {
2828
2929// ignore: must_be_immutable
3030class WindowCaptionButton extends StatefulWidget {
31- final Brightness ? brightness;
32- final Widget ? icon;
33- final String ? iconName;
34- final VoidCallback ? onPressed;
35-
36- _ButtonBgColorScheme _lightButtonBgColorScheme = _ButtonBgColorScheme (
37- normal: Colors .transparent,
38- hovered: Colors .black.withOpacity (0.0373 ),
39- pressed: Colors .black.withOpacity (0.0241 ),
40- );
41- _ButtonIconColorScheme _lightButtonIconColorScheme = _ButtonIconColorScheme (
42- normal: Colors .black.withOpacity (0.8956 ),
43- hovered: Colors .black.withOpacity (0.8956 ),
44- pressed: Colors .black.withOpacity (0.6063 ),
45- disabled: Colors .black.withOpacity (0.3614 ),
46- );
47- _ButtonBgColorScheme _darkButtonBgColorScheme = _ButtonBgColorScheme (
48- normal: Colors .transparent,
49- hovered: Colors .white.withOpacity (0.0605 ),
50- pressed: Colors .white.withOpacity (0.0419 ),
51- );
52- _ButtonIconColorScheme _darkButtonIconColorScheme = _ButtonIconColorScheme (
53- normal: Colors .white,
54- hovered: Colors .white,
55- pressed: Colors .white.withOpacity (0.786 ),
56- disabled: Colors .black.withOpacity (0.3628 ),
57- );
58-
5931 WindowCaptionButton ({
6032 Key ? key,
6133 this .brightness,
6234 this .icon,
6335 this .iconName,
6436 required this .onPressed,
6537 }) : super (key: key);
66-
67- WindowCaptionButton .minimize ({
68- Key ? key,
69- this .brightness,
70- this .icon,
71- this .onPressed,
72- }) : iconName = 'images/ic_chrome_minimize.png' ,
73- super (key: key);
74-
75- WindowCaptionButton .maximize ({
76- Key ? key,
77- this .brightness,
78- this .icon,
79- this .onPressed,
80- }) : iconName = 'images/ic_chrome_maximize.png' ,
81- super (key: key);
82-
83- WindowCaptionButton .unmaximize ({
84- Key ? key,
85- this .brightness,
86- this .icon,
87- this .onPressed,
88- }) : iconName = 'images/ic_chrome_unmaximize.png' ,
89- super (key: key);
90-
9138 WindowCaptionButton .close ({
9239 Key ? key,
9340 this .brightness,
@@ -118,6 +65,58 @@ class WindowCaptionButton extends StatefulWidget {
11865 ),
11966 super (key: key);
12067
68+ WindowCaptionButton .unmaximize ({
69+ Key ? key,
70+ this .brightness,
71+ this .icon,
72+ this .onPressed,
73+ }) : iconName = 'images/ic_chrome_unmaximize.png' ,
74+ super (key: key);
75+
76+ WindowCaptionButton .maximize ({
77+ Key ? key,
78+ this .brightness,
79+ this .icon,
80+ this .onPressed,
81+ }) : iconName = 'images/ic_chrome_maximize.png' ,
82+ super (key: key);
83+
84+ WindowCaptionButton .minimize ({
85+ Key ? key,
86+ this .brightness,
87+ this .icon,
88+ this .onPressed,
89+ }) : iconName = 'images/ic_chrome_minimize.png' ,
90+ super (key: key);
91+
92+ final Brightness ? brightness;
93+ final Widget ? icon;
94+ final String ? iconName;
95+ final VoidCallback ? onPressed;
96+
97+ _ButtonBgColorScheme _lightButtonBgColorScheme = _ButtonBgColorScheme (
98+ normal: Colors .transparent,
99+ hovered: Colors .black.withOpacity (0.0373 ),
100+ pressed: Colors .black.withOpacity (0.0241 ),
101+ );
102+ _ButtonIconColorScheme _lightButtonIconColorScheme = _ButtonIconColorScheme (
103+ normal: Colors .black.withOpacity (0.8956 ),
104+ hovered: Colors .black.withOpacity (0.8956 ),
105+ pressed: Colors .black.withOpacity (0.6063 ),
106+ disabled: Colors .black.withOpacity (0.3614 ),
107+ );
108+ _ButtonBgColorScheme _darkButtonBgColorScheme = _ButtonBgColorScheme (
109+ normal: Colors .transparent,
110+ hovered: Colors .white.withOpacity (0.0605 ),
111+ pressed: Colors .white.withOpacity (0.0419 ),
112+ );
113+ _ButtonIconColorScheme _darkButtonIconColorScheme = _ButtonIconColorScheme (
114+ normal: Colors .white,
115+ hovered: Colors .white,
116+ pressed: Colors .white.withOpacity (0.786 ),
117+ disabled: Colors .black.withOpacity (0.3628 ),
118+ );
119+
121120 _ButtonBgColorScheme get buttonBgColorScheme => brightness != Brightness .dark
122121 ? _lightButtonBgColorScheme
123122 : _darkButtonBgColorScheme;
@@ -184,27 +183,25 @@ class _WindowCaptionButtonState extends State<WindowCaptionButton> {
184183}
185184
186185class _ButtonBgColorScheme {
187- final Color normal;
188- final Color hovered;
189- final Color pressed;
190-
191186 _ButtonBgColorScheme ({
192187 required this .normal,
193188 required this .hovered,
194189 required this .pressed,
195190 });
196- }
197-
198- class _ButtonIconColorScheme {
199191 final Color normal;
200192 final Color hovered;
201193 final Color pressed;
202- final Color disabled;
194+ }
203195
196+ class _ButtonIconColorScheme {
204197 _ButtonIconColorScheme ({
205198 required this .normal,
206199 required this .hovered,
207200 required this .pressed,
208201 required this .disabled,
209202 });
203+ final Color normal;
204+ final Color hovered;
205+ final Color pressed;
206+ final Color disabled;
210207}
0 commit comments