feat: Refactor color handling in NoGameDataScreen to utilize centralized color palette from WolfMenuPalette
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
@@ -53,35 +53,6 @@ class NoGameDataScreen extends StatelessWidget {
|
|||||||
/// Currently selected ready version.
|
/// Currently selected ready version.
|
||||||
final GameVersion? selectedReadyVersion;
|
final GameVersion? selectedReadyVersion;
|
||||||
|
|
||||||
static final Color _backgroundColor = Color(
|
|
||||||
ColorPalette.argbFromVgaIndex(WolfMenuPalette.backgroundIndex),
|
|
||||||
);
|
|
||||||
static final Color _panelColor = Color(
|
|
||||||
ColorPalette.argbFromVgaIndex(WolfMenuPalette.panelIndex),
|
|
||||||
);
|
|
||||||
static final Color _borderColor = Color(
|
|
||||||
ColorPalette.argbFromVgaIndex(WolfMenuPalette.borderIndex),
|
|
||||||
);
|
|
||||||
static final Color _titleColor = Color(
|
|
||||||
ColorPalette.argbFromVgaIndex(
|
|
||||||
WolfMenuPalette.headerTextIndex,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
static final Color _bodyColor = Color(
|
|
||||||
ColorPalette.argbFromVgaIndex(
|
|
||||||
WolfMenuPalette.unselectedTextIndex,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
static final Color _emphasisColor = Color(
|
|
||||||
ColorPalette.argbFromVgaIndex(WolfMenuPalette.emphasisIndex),
|
|
||||||
);
|
|
||||||
static final Color _warningColor = Color(
|
|
||||||
ColorPalette.argbFromVgaIndex(WolfMenuPalette.warningIndex),
|
|
||||||
);
|
|
||||||
static final Color _mutedColor = Color(
|
|
||||||
ColorPalette.argbFromVgaIndex(WolfMenuPalette.mutedIndex),
|
|
||||||
);
|
|
||||||
|
|
||||||
static String _stateLabel(GameDataVersionState state) {
|
static String _stateLabel(GameDataVersionState state) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case GameDataVersionState.incomplete:
|
case GameDataVersionState.incomplete:
|
||||||
@@ -96,22 +67,22 @@ class NoGameDataScreen extends StatelessWidget {
|
|||||||
static Color _stateColor(GameDataVersionState state) {
|
static Color _stateColor(GameDataVersionState state) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case GameDataVersionState.ready:
|
case GameDataVersionState.ready:
|
||||||
return _emphasisColor;
|
return Color(WolfMenuPalette.emphasisColor);
|
||||||
case GameDataVersionState.checksumWarning:
|
case GameDataVersionState.checksumWarning:
|
||||||
return _warningColor;
|
return Color(WolfMenuPalette.warningColor);
|
||||||
case GameDataVersionState.incomplete:
|
case GameDataVersionState.incomplete:
|
||||||
return _mutedColor;
|
return Color(WolfMenuPalette.mutedColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Color _fileStateColor(GameDataFileState state) {
|
static Color _fileStateColor(GameDataFileState state) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case GameDataFileState.ready:
|
case GameDataFileState.ready:
|
||||||
return _emphasisColor;
|
return Color(WolfMenuPalette.emphasisColor);
|
||||||
case GameDataFileState.warning:
|
case GameDataFileState.warning:
|
||||||
return _warningColor;
|
return Color(WolfMenuPalette.warningColor);
|
||||||
case GameDataFileState.missing:
|
case GameDataFileState.missing:
|
||||||
return _mutedColor;
|
return Color(WolfMenuPalette.mutedColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +92,7 @@ class NoGameDataScreen extends StatelessWidget {
|
|||||||
scanResult?.readyVersions ?? <GameDataVersionAnalysis>[];
|
scanResult?.readyVersions ?? <GameDataVersionAnalysis>[];
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: _backgroundColor,
|
backgroundColor: Color(WolfMenuPalette.backgroundColor),
|
||||||
body: LayoutBuilder(
|
body: LayoutBuilder(
|
||||||
builder: (BuildContext context, BoxConstraints viewportConstraints) {
|
builder: (BuildContext context, BoxConstraints viewportConstraints) {
|
||||||
return SingleChildScrollView(
|
return SingleChildScrollView(
|
||||||
@@ -135,8 +106,11 @@ class NoGameDataScreen extends StatelessWidget {
|
|||||||
constraints: const BoxConstraints(maxWidth: 640),
|
constraints: const BoxConstraints(maxWidth: 640),
|
||||||
child: DecoratedBox(
|
child: DecoratedBox(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: _panelColor,
|
color: Color(WolfMenuPalette.panelColor),
|
||||||
border: Border.all(color: _borderColor, width: 2),
|
border: Border.all(
|
||||||
|
color: Color(WolfMenuPalette.borderColor),
|
||||||
|
width: 2,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(20),
|
padding: const EdgeInsets.all(20),
|
||||||
@@ -147,7 +121,7 @@ class NoGameDataScreen extends StatelessWidget {
|
|||||||
Text(
|
Text(
|
||||||
'WOLF3D DATA NOT FOUND',
|
'WOLF3D DATA NOT FOUND',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: _titleColor,
|
color: Color(WolfMenuPalette.titleColor),
|
||||||
fontSize: 24,
|
fontSize: 24,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
@@ -157,7 +131,7 @@ class NoGameDataScreen extends StatelessWidget {
|
|||||||
'No game files were discovered.\n\n'
|
'No game files were discovered.\n\n'
|
||||||
'Select a game-data directory, or select one or more game-data files.',
|
'Select a game-data directory, or select one or more game-data files.',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: _bodyColor,
|
color: Color(WolfMenuPalette.bodyColor),
|
||||||
fontSize: 15,
|
fontSize: 15,
|
||||||
height: 1.4,
|
height: 1.4,
|
||||||
),
|
),
|
||||||
@@ -166,7 +140,7 @@ class NoGameDataScreen extends StatelessWidget {
|
|||||||
Text(
|
Text(
|
||||||
'A complete version can be loaded directly or imported into the app config folder.',
|
'A complete version can be loaded directly or imported into the app config folder.',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: _emphasisColor,
|
color: Color(WolfMenuPalette.emphasisColor),
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
height: 1.35,
|
height: 1.35,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
@@ -205,7 +179,7 @@ class NoGameDataScreen extends StatelessWidget {
|
|||||||
child: Text(
|
child: Text(
|
||||||
'Scanning selected locations...',
|
'Scanning selected locations...',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: _bodyColor,
|
color: Color(WolfMenuPalette.bodyColor),
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
height: 1.3,
|
height: 1.3,
|
||||||
),
|
),
|
||||||
@@ -214,8 +188,8 @@ class NoGameDataScreen extends StatelessWidget {
|
|||||||
if (scanResult != null) ...[
|
if (scanResult != null) ...[
|
||||||
const SizedBox(height: 18),
|
const SizedBox(height: 18),
|
||||||
_ScanSummary(
|
_ScanSummary(
|
||||||
bodyColor: _bodyColor,
|
bodyColor: Color(WolfMenuPalette.bodyColor),
|
||||||
mutedColor: _mutedColor,
|
mutedColor: Color(WolfMenuPalette.mutedColor),
|
||||||
scanResult: scanResult!,
|
scanResult: scanResult!,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
@@ -223,11 +197,15 @@ class NoGameDataScreen extends StatelessWidget {
|
|||||||
(GameDataVersionAnalysis analysis) => Padding(
|
(GameDataVersionAnalysis analysis) => Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 12),
|
padding: const EdgeInsets.only(bottom: 12),
|
||||||
child: _VersionCard(
|
child: _VersionCard(
|
||||||
panelColor: _backgroundColor,
|
panelColor: Color(
|
||||||
borderColor: _borderColor,
|
WolfMenuPalette.backgroundColor,
|
||||||
titleColor: _titleColor,
|
),
|
||||||
bodyColor: _bodyColor,
|
borderColor: Color(
|
||||||
mutedColor: _mutedColor,
|
WolfMenuPalette.borderColor,
|
||||||
|
),
|
||||||
|
titleColor: Color(WolfMenuPalette.titleColor),
|
||||||
|
bodyColor: Color(WolfMenuPalette.bodyColor),
|
||||||
|
mutedColor: Color(WolfMenuPalette.mutedColor),
|
||||||
analysis: analysis,
|
analysis: analysis,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -239,13 +217,19 @@ class NoGameDataScreen extends StatelessWidget {
|
|||||||
initialValue:
|
initialValue:
|
||||||
selectedReadyVersion ??
|
selectedReadyVersion ??
|
||||||
readyVersions.first.version,
|
readyVersions.first.version,
|
||||||
dropdownColor: _panelColor,
|
dropdownColor: Color(WolfMenuPalette.panelColor),
|
||||||
style: TextStyle(color: _bodyColor),
|
style: TextStyle(
|
||||||
|
color: Color(WolfMenuPalette.bodyColor),
|
||||||
|
),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: 'Complete version',
|
labelText: 'Complete version',
|
||||||
labelStyle: TextStyle(color: _bodyColor),
|
labelStyle: TextStyle(
|
||||||
|
color: Color(WolfMenuPalette.bodyColor),
|
||||||
|
),
|
||||||
enabledBorder: UnderlineInputBorder(
|
enabledBorder: UnderlineInputBorder(
|
||||||
borderSide: BorderSide(color: _borderColor),
|
borderSide: BorderSide(
|
||||||
|
color: Color(WolfMenuPalette.borderColor),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
items: readyVersions
|
items: readyVersions
|
||||||
@@ -291,7 +275,7 @@ class NoGameDataScreen extends StatelessWidget {
|
|||||||
child: Text(
|
child: Text(
|
||||||
pickerError!.trim(),
|
pickerError!.trim(),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: _emphasisColor,
|
color: Color(WolfMenuPalette.emphasisColor),
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
height: 1.3,
|
height: 1.3,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
@@ -305,7 +289,7 @@ class NoGameDataScreen extends StatelessWidget {
|
|||||||
child: Text(
|
child: Text(
|
||||||
'Configured data directory: ${configuredDataDirectory!.trim()}',
|
'Configured data directory: ${configuredDataDirectory!.trim()}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: _bodyColor,
|
color: Color(WolfMenuPalette.bodyColor),
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
height: 1.3,
|
height: 1.3,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -66,6 +66,25 @@ abstract class WolfMenuPalette {
|
|||||||
static int get headerTextIndex => _cachedHeaderTextIndex ??=
|
static int get headerTextIndex => _cachedHeaderTextIndex ??=
|
||||||
ColorPalette.findClosestPaletteIndex(_headerTargetRgb);
|
ColorPalette.findClosestPaletteIndex(_headerTargetRgb);
|
||||||
|
|
||||||
|
/// Standard ARGB colors (`0xAARRGGBB`) for UI consumers.
|
||||||
|
static int get backgroundColor =>
|
||||||
|
ColorPalette.argbFromVgaIndex(backgroundIndex);
|
||||||
|
|
||||||
|
static int get panelColor => ColorPalette.argbFromVgaIndex(panelIndex);
|
||||||
|
|
||||||
|
static int get borderColor => ColorPalette.argbFromVgaIndex(borderIndex);
|
||||||
|
|
||||||
|
static int get titleColor => ColorPalette.argbFromVgaIndex(headerTextIndex);
|
||||||
|
|
||||||
|
static int get bodyColor =>
|
||||||
|
ColorPalette.argbFromVgaIndex(unselectedTextIndex);
|
||||||
|
|
||||||
|
static int get emphasisColor => ColorPalette.argbFromVgaIndex(emphasisIndex);
|
||||||
|
|
||||||
|
static int get warningColor => ColorPalette.argbFromVgaIndex(warningIndex);
|
||||||
|
|
||||||
|
static int get mutedColor => ColorPalette.argbFromVgaIndex(mutedIndex);
|
||||||
|
|
||||||
static int get selectedTextColor => ColorPalette.vga32Bit[selectedTextIndex];
|
static int get selectedTextColor => ColorPalette.vga32Bit[selectedTextIndex];
|
||||||
|
|
||||||
static int get unselectedTextColor =>
|
static int get unselectedTextColor =>
|
||||||
|
|||||||
Reference in New Issue
Block a user