added themeMode to shareable paints
This commit is contained in:
parent
076d6a12a2
commit
cccda1aadb
@ -12,6 +12,7 @@ import 'package:filcnaplo/models/shared_theme.dart';
|
|||||||
import 'package:filcnaplo/models/supporter.dart';
|
import 'package:filcnaplo/models/supporter.dart';
|
||||||
import 'package:filcnaplo_kreta_api/models/school.dart';
|
import 'package:filcnaplo_kreta_api/models/school.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||||
|
|
||||||
@ -235,6 +236,9 @@ class FilcAPI {
|
|||||||
theme.json['accent_color'] = theme.accentColor.value.toString();
|
theme.json['accent_color'] = theme.accentColor.value.toString();
|
||||||
theme.json['icon_color'] = theme.iconColor.value.toString();
|
theme.json['icon_color'] = theme.iconColor.value.toString();
|
||||||
theme.json['shadow_effect'] = theme.shadowEffect.toString();
|
theme.json['shadow_effect'] = theme.shadowEffect.toString();
|
||||||
|
theme.json['theme_mode'] = theme.themeMode == ThemeMode.dark
|
||||||
|
? 'dark'
|
||||||
|
: (theme.themeMode == ThemeMode.light ? 'light' : null.toString());
|
||||||
|
|
||||||
// set linked grade colors
|
// set linked grade colors
|
||||||
theme.json['grade_colors_id'] = theme.gradeColors.id;
|
theme.json['grade_colors_id'] = theme.gradeColors.id;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import 'dart:ui';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class SharedTheme {
|
class SharedTheme {
|
||||||
Map json;
|
Map json;
|
||||||
@ -12,6 +12,7 @@ class SharedTheme {
|
|||||||
bool shadowEffect;
|
bool shadowEffect;
|
||||||
SharedGradeColors gradeColors;
|
SharedGradeColors gradeColors;
|
||||||
String displayName;
|
String displayName;
|
||||||
|
ThemeMode? themeMode;
|
||||||
|
|
||||||
SharedTheme({
|
SharedTheme({
|
||||||
required this.json,
|
required this.json,
|
||||||
@ -25,6 +26,7 @@ class SharedTheme {
|
|||||||
required this.shadowEffect,
|
required this.shadowEffect,
|
||||||
required this.gradeColors,
|
required this.gradeColors,
|
||||||
this.displayName = 'displayName',
|
this.displayName = 'displayName',
|
||||||
|
this.themeMode,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory SharedTheme.fromJson(Map json, SharedGradeColors gradeColors) {
|
factory SharedTheme.fromJson(Map json, SharedGradeColors gradeColors) {
|
||||||
@ -39,6 +41,10 @@ class SharedTheme {
|
|||||||
iconColor: Color(json['icon_color']),
|
iconColor: Color(json['icon_color']),
|
||||||
shadowEffect: json['shadow_effect'] ?? true,
|
shadowEffect: json['shadow_effect'] ?? true,
|
||||||
gradeColors: gradeColors,
|
gradeColors: gradeColors,
|
||||||
|
displayName: json['display_name'] ?? 'no_name',
|
||||||
|
themeMode: json['theme_mode'] == 'dark'
|
||||||
|
? ThemeMode.dark
|
||||||
|
: (json['theme_mode'] == 'light' ? ThemeMode.light : null),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import 'package:filcnaplo/models/settings.dart';
|
|||||||
import 'package:filcnaplo/models/shared_theme.dart';
|
import 'package:filcnaplo/models/shared_theme.dart';
|
||||||
// import 'package:filcnaplo/models/shared_theme.dart';
|
// import 'package:filcnaplo/models/shared_theme.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:uuid/uuid.dart';
|
import 'package:uuid/uuid.dart';
|
||||||
|
|
||||||
@ -47,6 +48,9 @@ class ShareProvider extends ChangeNotifier {
|
|||||||
?.value ??
|
?.value ??
|
||||||
const Color(0x00000000).value,
|
const Color(0x00000000).value,
|
||||||
'shadow_effect': settings.shadowEffect,
|
'shadow_effect': settings.shadowEffect,
|
||||||
|
'theme_mode': settings.theme == ThemeMode.dark
|
||||||
|
? 'dark'
|
||||||
|
: (settings.theme == ThemeMode.light ? 'light' : null)
|
||||||
};
|
};
|
||||||
|
|
||||||
SharedTheme theme = SharedTheme.fromJson(themeJson, gradeColors);
|
SharedTheme theme = SharedTheme.fromJson(themeJson, gradeColors);
|
||||||
|
@ -543,6 +543,9 @@ class PaintListScreenState extends State<PaintListScreen>
|
|||||||
// changing shadow effect
|
// changing shadow effect
|
||||||
settingsProvider.update(shadowEffect: newThemeByID!.shadowEffect);
|
settingsProvider.update(shadowEffect: newThemeByID!.shadowEffect);
|
||||||
|
|
||||||
|
// changing theme mode
|
||||||
|
settingsProvider.update(theme: newThemeByID!.themeMode);
|
||||||
|
|
||||||
// changing theme
|
// changing theme
|
||||||
settingsProvider.update(
|
settingsProvider.update(
|
||||||
customBackgroundColor: newThemeByID!.backgroundColor,
|
customBackgroundColor: newThemeByID!.backgroundColor,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user