This commit is contained in:
2026-03-26 13:46:23 +03:00
parent 87431a9fc9
commit 2d5eb92cba
7 changed files with 243 additions and 66 deletions
@@ -206,7 +206,10 @@ class _AccountEditorOverlayState extends State<AccountEditorOverlay> {
accountName: dash.tempAccountName,
previewPrimary: dash.tempPrimary,
previewSecondary: dash.tempSecondary,
previewGradientType: dash.tempGradientType,
previewGradientType:
Theme.of(widget.context).brightness == Brightness.dark
? dash.tempDarkGradientType
: dash.tempLightGradientType,
),
),
Positioned(
@@ -67,7 +67,11 @@ class AccountColorPanel extends StatelessWidget {
dashboardState.overlayEntry?.markNeedsBuild();
}
final isSolid = dashboardState.tempGradientType == GradientType.solid;
final activeGradientType =
Theme.of(dashboardContext).brightness == Brightness.dark
? dashboardState.tempDarkGradientType
: dashboardState.tempLightGradientType;
final isSolid = activeGradientType == GradientType.solid;
final currentHSV = (isSolid || dashboardState.editingPrimary)
? dashboardState.tempPrimaryHSV
: dashboardState.tempSecondaryHSV;
@@ -96,8 +100,14 @@ class AccountColorPanel extends StatelessWidget {
onTap: () {
dashboardState.setState(() {
if (isSolid)
dashboardState.tempGradientType =
CardColorService.defaultGradient;
if (Theme.of(dashboardContext).brightness ==
Brightness.dark) {
dashboardState.tempDarkGradientType =
CardColorService.defaultGradientDark;
} else {
dashboardState.tempLightGradientType =
CardColorService.defaultGradientLight;
}
dashboardState.editingPrimary = true;
});
setPanelState(() {});
@@ -116,8 +126,14 @@ class AccountColorPanel extends StatelessWidget {
onTap: () {
dashboardState.setState(() {
if (isSolid)
dashboardState.tempGradientType =
CardColorService.defaultGradient;
if (Theme.of(dashboardContext).brightness ==
Brightness.dark) {
dashboardState.tempDarkGradientType =
CardColorService.defaultGradientDark;
} else {
dashboardState.tempLightGradientType =
CardColorService.defaultGradientLight;
}
dashboardState.editingPrimary = false;
});
setPanelState(() {});
@@ -141,8 +157,14 @@ class AccountColorPanel extends StatelessWidget {
? null
: () {
dashboardState.setState(() {
dashboardState.tempGradientType =
GradientType.solid;
if (Theme.of(dashboardContext).brightness ==
Brightness.dark) {
dashboardState.tempDarkGradientType =
GradientType.solid;
} else {
dashboardState.tempLightGradientType =
GradientType.solid;
}
dashboardState.editingPrimary = true;
});
setPanelState(() {});
@@ -399,8 +421,7 @@ class AccountColorPanel extends StatelessWidget {
children: GradientType.values
.where((t) => t != GradientType.solid)
.map((type) {
final isSelected =
dashboardState.tempGradientType == type;
final isSelected = activeGradientType == type;
final label = switch (type) {
GradientType.linear => s.gradientLinear,
GradientType.linearReverse => s.gradientReverse,
@@ -424,8 +445,17 @@ class AccountColorPanel extends StatelessWidget {
child: GestureDetector(
onTap: () {
dashboardState.setState(
() => dashboardState.tempGradientType =
type,
() {
if (Theme.of(dashboardContext)
.brightness ==
Brightness.dark) {
dashboardState.tempDarkGradientType =
type;
} else {
dashboardState.tempLightGradientType =
type;
}
},
);
setPanelState(() {});
dashboardState.overlayEntry
@@ -516,8 +546,10 @@ class AccountColorPanel extends StatelessWidget {
);
dashboardState.tempSecondaryHSV =
HSVColor.fromColor(defS);
dashboardState.tempGradientType =
CardColorService.defaultGradient;
dashboardState.tempLightGradientType =
CardColorService.defaultGradientLight;
dashboardState.tempDarkGradientType =
CardColorService.defaultGradientDark;
});
setPanelState(() {});
dashboardState.overlayEntry?.markNeedsBuild();