@@ -5,15 +5,19 @@ import 'package:keyviz/domain/vault/vault.dart';
55
66// base preset of the keycap
77enum KeyCapStyle {
8- minimal,
9- flat,
10- elevated,
11- plastic,
12- mechanical;
8+ minimal ( "最小" ) ,
9+ flat ( "平铺按压" ) ,
10+ elevated ( "平铺升高" ) ,
11+ plastic ( "塑料键帽" ) ,
12+ mechanical ( "机械键帽" ) ;
1313 // retro;
1414
15+ const KeyCapStyle (this .label);
16+
17+ final String label;
18+
1519 @override
16- String toString () => name. capitalize () ;
20+ String toString () => label ;
1721}
1822
1923// text capitalization
@@ -23,6 +27,7 @@ enum TextCap {
2327 lower ("tt" );
2428
2529 const TextCap (this .symbol);
30+
2631 final String symbol;
2732
2833 @override
@@ -31,11 +36,12 @@ enum TextCap {
3136
3237// modifier text length
3338enum ModifierTextLength {
34- iconOnly ("Icon Only " ),
35- shortLength ("Short Text " ),
36- fullLength ("Full Text " );
39+ iconOnly ("仅图标 " ),
40+ shortLength ("简略信息 " ),
41+ fullLength ("全部信息 " );
3742
3843 const ModifierTextLength (this .label);
44+
3945 final String label;
4046
4147 @override
@@ -49,6 +55,7 @@ enum VerticalAlignment {
4955 bottom (VuesaxIcons .alignBottom);
5056
5157 const VerticalAlignment (this .iconName);
58+
5259 final String iconName;
5360}
5461
@@ -59,17 +66,22 @@ enum HorizontalAlignment {
5966 right (VuesaxIcons .alignRight);
6067
6168 const HorizontalAlignment (this .iconName);
69+
6270 final String iconName;
6371}
6472
6573// mouse animation type
6674enum MouseClickAnimation {
67- static ,
68- focus,
69- filled;
75+ static ("静态" ),
76+ focus ("焦点" ),
77+ filled ("填充" );
78+
79+ const MouseClickAnimation (this .label);
80+
81+ final String label;
7082
7183 @override
72- String toString () => name. capitalize () ;
84+ String toString () => label ;
7385}
7486
7587// style provider of the keycap visualization
@@ -126,23 +138,27 @@ class KeyStyleProvider extends ChangeNotifier {
126138 // primary color to be used on flat keycap container
127139 // and elevated/isometric keycap's upper container
128140 Color _primaryColor1 = Colors .white;
141+
129142 // second color for gradient
130143 Color _primaryColor2 = Colors .white;
131144
132145 // secondary color to be used on
133146 // elevated/isometric keycap's bottom container
134147 Color _secondaryColor1 = Colors .black;
148+
135149 // second color for gradient
136150 Color _secondaryColor2 = Colors .grey[600 ]! ;
137151
138152 // primary color to be used on modifiers keys
139153 Color _mPrimaryColor1 = const Color (0xffb8b8b8 );
154+
140155 // second color for gradient
141156 Color _mPrimaryColor2 = const Color (0xff545454 );
142157
143158 // secondary color to be used on
144159 // elevated/isometric keycap's bottom container
145160 Color _mSecondaryColor1 = Colors .deepPurple;
161+
146162 // second color for gradient
147163 Color _mSecondaryColor2 = Colors .deepPurple;
148164
@@ -192,13 +208,19 @@ class KeyStyleProvider extends ChangeNotifier {
192208 bool get differentColorForModifiers => _differentColorForModifiers;
193209
194210 double get fontSize => _fontSize;
211+
195212 Color get fontColor => _fontColor;
213+
196214 Color get mFontColor => _mFontColor;
215+
197216 TextCap get textCap => _textCap;
217+
198218 ModifierTextLength get modifierTextLength => _modifierTextLength;
199219
200220 VerticalAlignment get verticalAlignment => _verticalAlignment;
221+
201222 HorizontalAlignment get horizontalAlignment => _horizontalAlignment;
223+
202224 Alignment get childrenAlignment {
203225 switch (_verticalAlignment) {
204226 case VerticalAlignment .top:
@@ -240,8 +262,11 @@ class KeyStyleProvider extends ChangeNotifier {
240262 }
241263
242264 bool get showIcon => _showIcon;
265+
243266 bool get showSymbol => _showSymbol;
267+
244268 bool get addPlusSeparator => _addPlusSeparator;
269+
245270 Widget ? get separator {
246271 return _addPlusSeparator
247272 ? Text (
@@ -256,33 +281,52 @@ class KeyStyleProvider extends ChangeNotifier {
256281 }
257282
258283 bool get isGradient => _isGradient;
284+
259285 Color get primaryColor1 => _primaryColor1;
286+
260287 Color get primaryColor2 => _primaryColor2;
288+
261289 Color get secondaryColor1 => _secondaryColor1;
290+
262291 Color get secondaryColor2 => _secondaryColor2;
292+
263293 Color get mPrimaryColor1 => _mPrimaryColor1;
294+
264295 Color get mPrimaryColor2 => _mPrimaryColor2;
296+
265297 Color get mSecondaryColor1 => _mSecondaryColor1;
298+
266299 Color get mSecondaryColor2 => _mSecondaryColor2;
267300
268301 bool get borderEnabled => _borderEnabled;
302+
269303 Color get borderColor => _borderColor;
304+
270305 Color get mBorderColor => _mBorderColor;
306+
271307 double get borderWidth => _borderWidth;
308+
272309 double get cornerSmoothing => _cornerSmoothing;
273310
274311 bool get backgroundEnabled => _backgroundEnabled;
312+
275313 Color get backgroundColor => _backgroundColor;
314+
276315 Color get backgroundColorWithOpacity =>
277316 _backgroundColor.withOpacity (_backgroundOpacity);
317+
278318 double get backgroundOpacity => _backgroundOpacity;
319+
279320 double get backgroundSpacing => _fontSize * .5 ;
280321
281322 Alignment get alignment => _alignment;
323+
282324 double get margin => _margin;
283325
284326 MouseClickAnimation get clickAnimation => _clickAnimation;
327+
285328 double get cursorHighlightSize => _fontSize * 4 ;
329+
286330 Color get clickColor => _clickColor;
287331
288332 // key cap properties
0 commit comments