Formatting
This commit is contained in:
parent
d4e57f493e
commit
fe4726986f
|
@ -98,7 +98,7 @@ class ContactListState extends ChangeNotifier {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
//} </todo>
|
//} </todo>
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateLastMessageReceivedTime(int forIdentifier, DateTime newMessageTime) {
|
void updateLastMessageReceivedTime(int forIdentifier, DateTime newMessageTime) {
|
||||||
var contact = getContact(forIdentifier);
|
var contact = getContact(forIdentifier);
|
||||||
if (contact == null) return;
|
if (contact == null) return;
|
||||||
|
|
|
@ -24,7 +24,7 @@ LoadAssetThemes() async {
|
||||||
themes = await loadYamlThemes();
|
themes = await loadYamlThemes();
|
||||||
}
|
}
|
||||||
|
|
||||||
OpaqueThemeType getTheme(String themeId, String mode) {
|
OpaqueThemeType getTheme(String themeId, String mode) {
|
||||||
if (themeId == "") {
|
if (themeId == "") {
|
||||||
themeId = cwtch_theme;
|
themeId = cwtch_theme;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,6 @@ import 'package:flutter/services.dart';
|
||||||
import 'package:yaml/yaml.dart';
|
import 'package:yaml/yaml.dart';
|
||||||
import 'package:path/path.dart' as path;
|
import 'package:path/path.dart' as path;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Future<Map<String, Map<String, OpaqueThemeType>>> loadYamlThemes() async {
|
Future<Map<String, Map<String, OpaqueThemeType>>> loadYamlThemes() async {
|
||||||
final manifestJson = await rootBundle.loadString('AssetManifest.json');
|
final manifestJson = await rootBundle.loadString('AssetManifest.json');
|
||||||
final themesList = json.decode(manifestJson).keys.where((String key) => key.startsWith('assets/themes'));
|
final themesList = json.decode(manifestJson).keys.where((String key) => key.startsWith('assets/themes'));
|
||||||
|
@ -17,7 +15,7 @@ Future<Map<String, Map<String, OpaqueThemeType>>> loadYamlThemes() async {
|
||||||
Map<String, Map<String, OpaqueThemeType>> themes = Map();
|
Map<String, Map<String, OpaqueThemeType>> themes = Map();
|
||||||
|
|
||||||
for (String themefile in themesList) {
|
for (String themefile in themesList) {
|
||||||
if (themefile.substring(themefile.length-4) != ".yml") {
|
if (themefile.substring(themefile.length - 4) != ".yml") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,16 +75,16 @@ class YmlTheme extends OpaqueThemeType {
|
||||||
|
|
||||||
Color? getColor(String name) {
|
Color? getColor(String name) {
|
||||||
var val = yml["themes"][mode]["theme"][name];
|
var val = yml["themes"][mode]["theme"][name];
|
||||||
if (! (val is int)) {
|
if (!(val is int)) {
|
||||||
val = yml["themes"][mode]["theme"][val] ?? val;
|
val = yml["themes"][mode]["theme"][val] ?? val;
|
||||||
}
|
}
|
||||||
if (! (val is int)) {
|
if (!(val is int)) {
|
||||||
val = yml["themes"][mode]?["colors"][val] ?? val;
|
val = yml["themes"][mode]?["colors"][val] ?? val;
|
||||||
}
|
}
|
||||||
if (! (val is int)) {
|
if (!(val is int)) {
|
||||||
val = yml["colors"]?[val];
|
val = yml["colors"]?[val];
|
||||||
}
|
}
|
||||||
if (! (val is int)) {
|
if (!(val is int)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return Color(0xFF000000 + val as int);
|
return Color(0xFF000000 + val as int);
|
||||||
|
@ -95,7 +93,7 @@ class YmlTheme extends OpaqueThemeType {
|
||||||
String? getImage(String name) {
|
String? getImage(String name) {
|
||||||
var val = yml["themes"][mode]["theme"]?[name];
|
var val = yml["themes"][mode]["theme"]?[name];
|
||||||
if (val != null) {
|
if (val != null) {
|
||||||
return path.join("assets", "themes", yml["themes"]["name"], val);
|
return path.join("assets", "themes", yml["themes"]["name"], val);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -137,4 +135,4 @@ class YmlTheme extends OpaqueThemeType {
|
||||||
// Images
|
// Images
|
||||||
|
|
||||||
get chatImage => getImage("chatImage") ?? fallbackTheme.chatImage;
|
get chatImage => getImage("chatImage") ?? fallbackTheme.chatImage;
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,8 +116,8 @@ class _MessageListState extends State<MessageList> {
|
||||||
// Only show broken heart is the contact is offline...
|
// Only show broken heart is the contact is offline...
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
image: Provider.of<ContactInfoState>(outerContext).isOnline()
|
image: Provider.of<ContactInfoState>(outerContext).isOnline()
|
||||||
? (Provider.of<Settings>(context).theme.chatImage != null) ?
|
? (Provider.of<Settings>(context).theme.chatImage != null)
|
||||||
DecorationImage(
|
? DecorationImage(
|
||||||
repeat: ImageRepeat.repeat,
|
repeat: ImageRepeat.repeat,
|
||||||
image: AssetImage(Provider.of<Settings>(context).theme.chatImage),
|
image: AssetImage(Provider.of<Settings>(context).theme.chatImage),
|
||||||
colorFilter: ColorFilter.mode(Provider.of<Settings>(context).theme.hilightElementColor.withOpacity(0.15), BlendMode.srcIn))
|
colorFilter: ColorFilter.mode(Provider.of<Settings>(context).theme.hilightElementColor.withOpacity(0.15), BlendMode.srcIn))
|
||||||
|
|
Loading…
Reference in New Issue