mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-07-22 06:08:54 -04:00
wallpapers and ui cleanup
This commit is contained in:
parent
77c68aa45f
commit
6bd60207d8
32 changed files with 17947 additions and 150 deletions
|
@ -1,7 +1,10 @@
|
|||
import 'package:change_case/change_case.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import '../../init.dart';
|
||||
import '../views/widget_helpers.dart';
|
||||
import 'contrast_generator.dart';
|
||||
import 'radix_generator.dart';
|
||||
|
@ -53,6 +56,7 @@ class ThemePreferences with _$ThemePreferences {
|
|||
BrightnessPreference brightnessPreference,
|
||||
@Default(ColorPreference.vapor) ColorPreference colorPreference,
|
||||
@Default(1) double displayScale,
|
||||
@Default(true) bool enableWallpaper,
|
||||
}) = _ThemePreferences;
|
||||
|
||||
factory ThemePreferences.fromJson(dynamic json) =>
|
||||
|
@ -62,6 +66,17 @@ class ThemePreferences with _$ThemePreferences {
|
|||
}
|
||||
|
||||
extension ThemePreferencesExt on ThemePreferences {
|
||||
/// Get wallpaper for existing theme
|
||||
Widget? wallpaper() {
|
||||
if (enableWallpaper) {
|
||||
final assetName = 'assets/images/wallpaper/${colorPreference.name}.svg';
|
||||
if (rootAssets.contains(assetName)) {
|
||||
return SvgPicture.asset(assetName, fit: BoxFit.cover);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Get material 'ThemeData' for existing theme
|
||||
ThemeData themeData() {
|
||||
late final Brightness brightness;
|
||||
|
@ -87,7 +102,8 @@ extension ThemePreferencesExt on ThemePreferences {
|
|||
scaleConfig: ScaleConfig(
|
||||
useVisualIndicators: true,
|
||||
preferBorders: false,
|
||||
borderRadiusScale: 1),
|
||||
borderRadiusScale: 1,
|
||||
wallpaperAlpha: 255),
|
||||
primaryFront: Colors.black,
|
||||
primaryBack: Colors.white,
|
||||
secondaryFront: Colors.black,
|
||||
|
@ -106,7 +122,8 @@ extension ThemePreferencesExt on ThemePreferences {
|
|||
scaleConfig: ScaleConfig(
|
||||
useVisualIndicators: true,
|
||||
preferBorders: true,
|
||||
borderRadiusScale: 0.2),
|
||||
borderRadiusScale: 0.2,
|
||||
wallpaperAlpha: 208),
|
||||
primaryFront: const Color(0xFF000000),
|
||||
primaryBack: const Color(0xFF00FF00),
|
||||
secondaryFront: const Color(0xFF000000),
|
||||
|
@ -123,7 +140,8 @@ extension ThemePreferencesExt on ThemePreferences {
|
|||
scaleConfig: ScaleConfig(
|
||||
useVisualIndicators: true,
|
||||
preferBorders: true,
|
||||
borderRadiusScale: 0.2),
|
||||
borderRadiusScale: 0.2,
|
||||
wallpaperAlpha: 192),
|
||||
primaryFront: const Color(0xFF000000),
|
||||
primaryBack: const Color(0xFF00FF00),
|
||||
secondaryFront: const Color(0xFF000000),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue