fixed most reported bugs

This commit is contained in:
Kima
2023-05-30 19:27:16 +02:00
parent f5682e9137
commit d1507f5eae
23 changed files with 1570 additions and 1124 deletions

View File

@@ -13,10 +13,10 @@ import 'package:filcnaplo_premium/ui/mobile/flutter_colorpicker/block_picker.dar
import 'package:filcnaplo_premium/ui/mobile/flutter_colorpicker/palette.dart';
import 'package:filcnaplo_premium/ui/mobile/flutter_colorpicker/utils.dart';
import 'package:filcnaplo_premium/ui/mobile/settings/theme.dart';
import 'package:filcnaplo_premium/ui/mobile/settings/theme.i18n.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:filcnaplo/theme/colors/colors.dart';
import 'package:filcnaplo_mobile_ui/common/widgets/custom_switch.dart';
class FilcColorPicker extends StatefulWidget {
const FilcColorPicker({
@@ -29,9 +29,16 @@ class FilcColorPicker extends StatefulWidget {
this.onHsvColorChanged,
this.paletteType = PaletteType.hsvWithHue,
this.enableAlpha = true,
@Deprecated('Use empty list in [labelTypes] to disable label.') this.showLabel = true,
this.labelTypes = const [ColorLabelType.rgb, ColorLabelType.hsv, ColorLabelType.hsl],
@Deprecated('Use Theme.of(context).textTheme.bodyText1 & 2 to alter text style.') this.labelTextStyle,
@Deprecated('Use empty list in [labelTypes] to disable label.')
this.showLabel = true,
this.labelTypes = const [
ColorLabelType.rgb,
ColorLabelType.hsv,
ColorLabelType.hsl
],
@Deprecated(
'Use Theme.of(context).textTheme.bodyText1 & 2 to alter text style.')
this.labelTextStyle,
this.displayThumbColor = false,
this.portraitOnly = false,
this.colorPickerWidth = 300.0,
@@ -75,7 +82,9 @@ class _FilcColorPickerState extends State<FilcColorPicker> {
@override
void initState() {
currentHsvColor = (widget.pickerHsvColor != null) ? widget.pickerHsvColor as HSVColor : HSVColor.fromColor(widget.pickerColor);
currentHsvColor = (widget.pickerHsvColor != null)
? widget.pickerHsvColor as HSVColor
: HSVColor.fromColor(widget.pickerColor);
// If there's no initial text in `hexInputController`,
if (widget.hexInputController?.text.isEmpty == true) {
// set it to the current's color HEX value.
@@ -95,7 +104,9 @@ class _FilcColorPickerState extends State<FilcColorPicker> {
@override
void didUpdateWidget(FilcColorPicker oldWidget) {
super.didUpdateWidget(oldWidget);
currentHsvColor = (widget.pickerHsvColor != null) ? widget.pickerHsvColor as HSVColor : HSVColor.fromColor(widget.pickerColor);
currentHsvColor = (widget.pickerHsvColor != null)
? widget.pickerHsvColor as HSVColor
: HSVColor.fromColor(widget.pickerColor);
}
void colorPickerTextInputListener() {
@@ -104,14 +115,17 @@ class _FilcColorPickerState extends State<FilcColorPicker> {
if (widget.hexInputController == null) return;
// If a user is inserting/typing any text — try to get the color value from it,
// and interpret its transparency, dependent on the widget's settings.
final Color? color = colorFromHex(widget.hexInputController!.text, enableAlpha: widget.enableAlpha);
final Color? color = colorFromHex(widget.hexInputController!.text,
enableAlpha: widget.enableAlpha);
// If it's the valid color:
if (color != null) {
// set it as the current color and
setState(() => currentHsvColor = HSVColor.fromColor(color));
// notify with a callback.
widget.onColorChanged(color);
if (widget.onHsvColorChanged != null) widget.onHsvColorChanged!(currentHsvColor);
if (widget.onHsvColorChanged != null) {
widget.onHsvColorChanged!(currentHsvColor);
}
}
}
@@ -127,17 +141,24 @@ class _FilcColorPickerState extends State<FilcColorPicker> {
currentHsvColor,
(HSVColor color) {
// Update text in `hexInputController` if provided.
widget.hexInputController?.text = colorToHex(color.toColor(), enableAlpha: widget.enableAlpha);
widget.hexInputController?.text =
colorToHex(color.toColor(), enableAlpha: widget.enableAlpha);
setState(() => currentHsvColor = color);
widget.onColorChanged(currentHsvColor.toColor());
if (widget.onHsvColorChanged != null) widget.onHsvColorChanged!(currentHsvColor);
if (widget.onHsvColorChanged != null) {
widget.onHsvColorChanged!(currentHsvColor);
}
},
() => widget.onColorChangeEnd(currentHsvColor.toColor()),
(p) {
ScaffoldMessenger.of(context).clearSnackBars();
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text("Move the ${p == 0 ? 'Saturation (second)' : 'Value (third)'} slider first.",
textAlign: TextAlign.center, style: TextStyle(color: AppColors.of(context).text, fontWeight: FontWeight.w600)),
content: Text(
"Move the ${p == 0 ? 'Saturation (second)' : 'Value (third)'} slider first.",
textAlign: TextAlign.center,
style: TextStyle(
color: AppColors.of(context).text,
fontWeight: FontWeight.w600)),
backgroundColor: AppColors.of(context).background));
},
displayThumbColor: widget.displayThumbColor,
@@ -146,15 +167,19 @@ class _FilcColorPickerState extends State<FilcColorPicker> {
void onColorChanging(HSVColor color) {
// Update text in `hexInputController` if provided.
widget.hexInputController?.text = colorToHex(color.toColor(), enableAlpha: widget.enableAlpha);
widget.hexInputController?.text =
colorToHex(color.toColor(), enableAlpha: widget.enableAlpha);
setState(() => currentHsvColor = color);
widget.onColorChanged(currentHsvColor.toColor());
if (widget.onHsvColorChanged != null) widget.onHsvColorChanged!(currentHsvColor);
if (widget.onHsvColorChanged != null) {
widget.onHsvColorChanged!(currentHsvColor);
}
}
@override
Widget build(BuildContext context) {
if (MediaQuery.of(context).orientation == Orientation.portrait || widget.portraitOnly) {
if (MediaQuery.of(context).orientation == Orientation.portrait ||
widget.portraitOnly) {
return Column(
children: [
if (widget.colorMode != CustomColorMode.theme)
@@ -198,7 +223,9 @@ class _FilcColorPickerState extends State<FilcColorPicker> {
(Color color) {
setState(() => currentHsvColor = HSVColor.fromColor(color));
widget.onColorChanged(currentHsvColor.toColor());
if (widget.onHsvColorChanged != null) widget.onHsvColorChanged!(currentHsvColor);
if (widget.onHsvColorChanged != null) {
widget.onHsvColorChanged!(currentHsvColor);
}
},
enableAlpha: false,
embeddedText: false,
@@ -211,26 +238,42 @@ class _FilcColorPickerState extends State<FilcColorPicker> {
layoutBuilder: (context, colors, child) {
return GridView.count(
shrinkWrap: true,
crossAxisCount: widget.colorMode == CustomColorMode.theme ? 2 : 1,
crossAxisCount:
widget.colorMode == CustomColorMode.theme ? 2 : 1,
scrollDirection: Axis.horizontal,
crossAxisSpacing: 15,
physics: const BouncingScrollPhysics(),
mainAxisSpacing: 15,
padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0),
children: List.generate(colors.toSet().length + (widget.colorMode == CustomColorMode.theme ? 1 : 0), (index) {
padding: const EdgeInsets.symmetric(
horizontal: 12.0, vertical: 8.0),
children: List.generate(
colors.toSet().length +
(widget.colorMode == CustomColorMode.theme ? 1 : 0),
(index) {
if (widget.colorMode == CustomColorMode.theme) {
if (index == 0) {
return GestureDetector(
onTap: () => widget.onColorChangeEnd(Colors.transparent, adaptive: true),
child: ColorIndicator(HSVColor.fromColor(const Color.fromARGB(255, 255, 238, 177)),
icon: CupertinoIcons.wand_stars, currentHsvColor: currentHsvColor, width: 30, height: 30, adaptive: true),
onTap: () => widget.onColorChangeEnd(
Colors.transparent,
adaptive: true),
child: ColorIndicator(
HSVColor.fromColor(
const Color.fromARGB(255, 255, 238, 177)),
icon: CupertinoIcons.wand_stars,
currentHsvColor: currentHsvColor,
width: 30,
height: 30,
adaptive: true),
);
}
index--;
}
return GestureDetector(
onTap: () => widget.onColorChangeEnd(colors[index]),
child: ColorIndicator(HSVColor.fromColor(colors[index]), currentHsvColor: currentHsvColor, width: 30, height: 30),
child: ColorIndicator(HSVColor.fromColor(colors[index]),
currentHsvColor: currentHsvColor,
width: 30,
height: 30),
);
}),
);
@@ -249,22 +292,25 @@ class _FilcColorPickerState extends State<FilcColorPicker> {
isAdvancedView = !isAdvancedView;
}),
child: Padding(
padding: const EdgeInsets.only(left: 8.0, right: 8.0, top: 8.0),
padding:
const EdgeInsets.only(left: 8.0, right: 8.0, top: 8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
CustomSwitch(
Switch(
onChanged: (v) => setState(() => isAdvancedView = v),
value: isAdvancedView,
),
const SizedBox(width: 12.0),
Text(
"Advanced",
"advanced".i18n,
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 16.0,
color: AppColors.of(context).text.withOpacity(isAdvancedView ? 1.0 : .5),
color: AppColors.of(context)
.text
.withOpacity(isAdvancedView ? 1.0 : .5),
),
),
],
@@ -285,7 +331,8 @@ class _FilcColorPickerState extends State<FilcColorPicker> {
const SizedBox(width: 20.0),
GestureDetector(
onTap: () => setState(() {
if (widget.onHistoryChanged != null && !colorHistory.contains(currentHsvColor.toColor())) {
if (widget.onHistoryChanged != null &&
!colorHistory.contains(currentHsvColor.toColor())) {
colorHistory.add(currentHsvColor.toColor());
widget.onHistoryChanged!(colorHistory);
}
@@ -295,7 +342,11 @@ class _FilcColorPickerState extends State<FilcColorPicker> {
Column(
children: <Widget>[
//SizedBox(height: 40.0, width: 260.0, child: sliderByPaletteType()),
if (widget.enableAlpha) SizedBox(height: 40.0, width: 260.0, child: colorPickerSlider(TrackType.alpha)),
if (widget.enableAlpha)
SizedBox(
height: 40.0,
width: 260.0,
child: colorPickerSlider(TrackType.alpha)),
],
),
const SizedBox(width: 10.0),
@@ -305,26 +356,30 @@ class _FilcColorPickerState extends State<FilcColorPicker> {
SizedBox(
width: widget.colorPickerWidth,
height: 50,
child: ListView(scrollDirection: Axis.horizontal, children: <Widget>[
for (Color color in colorHistory)
Padding(
key: Key(color.hashCode.toString()),
padding: const EdgeInsets.fromLTRB(15, 18, 0, 0),
child: Center(
child: GestureDetector(
onTap: () => onColorChanging(HSVColor.fromColor(color)),
onLongPress: () {
if (colorHistory.remove(color)) {
widget.onHistoryChanged!(colorHistory);
setState(() {});
}
},
child: ColorIndicator(HSVColor.fromColor(color), width: 30, height: 30),
child: ListView(
scrollDirection: Axis.horizontal,
children: <Widget>[
for (Color color in colorHistory)
Padding(
key: Key(color.hashCode.toString()),
padding: const EdgeInsets.fromLTRB(15, 18, 0, 0),
child: Center(
child: GestureDetector(
onTap: () =>
onColorChanging(HSVColor.fromColor(color)),
onLongPress: () {
if (colorHistory.remove(color)) {
widget.onHistoryChanged!(colorHistory);
setState(() {});
}
},
child: ColorIndicator(HSVColor.fromColor(color),
width: 30, height: 30),
),
),
),
),
),
const SizedBox(width: 15),
]),
const SizedBox(width: 15),
]),
),
const SizedBox(height: 20.0),
if (widget.hexInputBar)
@@ -333,7 +388,9 @@ class _FilcColorPickerState extends State<FilcColorPicker> {
(Color color) {
setState(() => currentHsvColor = HSVColor.fromColor(color));
widget.onColorChanged(currentHsvColor.toColor());
if (widget.onHsvColorChanged != null) widget.onHsvColorChanged!(currentHsvColor);
if (widget.onHsvColorChanged != null) {
widget.onHsvColorChanged!(currentHsvColor);
}
},
enableAlpha: widget.enableAlpha,
embeddedText: false,

View File

@@ -24,12 +24,15 @@ class PremiumCustomAccentColorSetting extends StatefulWidget {
const PremiumCustomAccentColorSetting({Key? key}) : super(key: key);
@override
State<PremiumCustomAccentColorSetting> createState() => _PremiumCustomAccentColorSettingState();
State<PremiumCustomAccentColorSetting> createState() =>
_PremiumCustomAccentColorSettingState();
}
enum CustomColorMode { theme, accent, background, highlight }
enum CustomColorMode { theme, saved, accent, background, highlight }
class _PremiumCustomAccentColorSettingState extends State<PremiumCustomAccentColorSetting> with TickerProviderStateMixin {
class _PremiumCustomAccentColorSettingState
extends State<PremiumCustomAccentColorSetting>
with TickerProviderStateMixin {
late final SettingsProvider settings;
bool colorSelection = false;
bool customColorMenu = false;
@@ -41,42 +44,48 @@ class _PremiumCustomAccentColorSettingState extends State<PremiumCustomAccentCol
late TabController _colorsTabController;
late AnimationController _openAnimController;
late final Animation<double> backgroundAnimation = Tween<double>(begin: 0, end: 1).animate(
late final Animation<double> backgroundAnimation =
Tween<double>(begin: 0, end: 1).animate(
CurvedAnimation(
parent: _openAnimController,
curve: const Interval(0.2, 1.0, curve: Curves.easeInOut),
),
);
late final Animation<double> fullPageAnimation = Tween<double>(begin: 0, end: 1).animate(
late final Animation<double> fullPageAnimation =
Tween<double>(begin: 0, end: 1).animate(
CurvedAnimation(
parent: _openAnimController,
curve: const Interval(0.0, 0.6, curve: Curves.easeInOut),
),
);
late final Animation<double> backContainerAnimation = Tween<double>(begin: 100, end: 0).animate(
late final Animation<double> backContainerAnimation =
Tween<double>(begin: 100, end: 0).animate(
CurvedAnimation(
parent: _openAnimController,
curve: const Interval(0.0, 0.9, curve: Curves.easeInOut),
),
);
late final Animation<double> backContentAnimation = Tween<double>(begin: 100, end: 0).animate(
late final Animation<double> backContentAnimation =
Tween<double>(begin: 100, end: 0).animate(
CurvedAnimation(
parent: _openAnimController,
curve: const Interval(0.2, 1.0, curve: Curves.easeInOut),
),
);
late final Animation<double> backContentScaleAnimation = Tween<double>(begin: 0.8, end: 0.9).animate(
late final Animation<double> backContentScaleAnimation =
Tween<double>(begin: 0.8, end: 0.9).animate(
CurvedAnimation(
parent: _openAnimController,
curve: const Interval(0.45, 1.0, curve: Curves.easeInOut),
),
);
late final Animation<double> pickerContainerAnimation = Tween<double>(begin: 0, end: 1).animate(
late final Animation<double> pickerContainerAnimation =
Tween<double>(begin: 0, end: 1).animate(
CurvedAnimation(
parent: _openAnimController,
curve: const Interval(0.25, 0.8, curve: Curves.easeInOut),
@@ -90,7 +99,8 @@ class _PremiumCustomAccentColorSettingState extends State<PremiumCustomAccentCol
_testTabController = TabController(length: 4, vsync: this);
settings = Provider.of<SettingsProvider>(context, listen: false);
_openAnimController = AnimationController(vsync: this, duration: const Duration(milliseconds: 750));
_openAnimController = AnimationController(
vsync: this, duration: const Duration(milliseconds: 750));
_openAnimController.forward();
}
@@ -102,13 +112,20 @@ class _PremiumCustomAccentColorSettingState extends State<PremiumCustomAccentCol
void setTheme(ThemeMode mode, bool store) async {
await settings.update(theme: mode, store: store);
Provider.of<ThemeModeObserver>(context, listen: false).changeTheme(mode, updateNavbarColor: false);
Provider.of<ThemeModeObserver>(context, listen: false)
.changeTheme(mode, updateNavbarColor: false);
}
Color? getCustomColor() {
dynamic getCustomColor() {
switch (colorMode) {
case CustomColorMode.theme:
return accentColorMap[settings.accentColor];
case CustomColorMode.saved:
return [
settings.customBackgroundColor,
settings.customHighlightColor,
settings.customAccentColor
];
case CustomColorMode.background:
return settings.customBackgroundColor;
case CustomColorMode.highlight:
@@ -118,16 +135,30 @@ class _PremiumCustomAccentColorSettingState extends State<PremiumCustomAccentCol
}
}
void updateCustomColor(Color v, bool store) {
if (colorMode != CustomColorMode.theme) settings.update(accentColor: AccentColor.custom, store: store);
void updateCustomColor(dynamic v, bool store) {
if (colorMode != CustomColorMode.theme) {
settings.update(accentColor: AccentColor.custom, store: store);
}
switch (colorMode) {
case CustomColorMode.theme:
settings.update(
accentColor: accentColorMap.keys.firstWhere((element) => accentColorMap[element] == v, orElse: () => AccentColor.filc), store: store);
settings.update(customBackgroundColor: AppColors.of(context).background, store: store);
settings.update(customHighlightColor: AppColors.of(context).highlight, store: store);
accentColor: accentColorMap.keys.firstWhere(
(element) => accentColorMap[element] == v,
orElse: () => AccentColor.filc),
store: store);
settings.update(
customBackgroundColor: AppColors.of(context).background,
store: store);
settings.update(
customHighlightColor: AppColors.of(context).highlight,
store: store);
settings.update(customAccentColor: v, store: store);
break;
case CustomColorMode.saved:
settings.update(customBackgroundColor: v[0], store: store);
settings.update(customHighlightColor: v[1], store: store);
settings.update(customAccentColor: v[3], store: store);
break;
case CustomColorMode.background:
settings.update(customBackgroundColor: v, store: store);
break;
@@ -142,14 +173,19 @@ class _PremiumCustomAccentColorSettingState extends State<PremiumCustomAccentCol
@override
Widget build(BuildContext context) {
bool hasAccess = Provider.of<PremiumProvider>(context).hasScope(PremiumScopes.customColors);
bool isBackgroundDifferent = Theme.of(context).colorScheme.background != AppColors.of(context).background;
bool hasAccess = Provider.of<PremiumProvider>(context)
.hasScope(PremiumScopes.customColors);
bool isBackgroundDifferent = Theme.of(context).colorScheme.background !=
AppColors.of(context).background;
ThemeMode currentTheme = Theme.of(context).brightness == Brightness.light ? ThemeMode.light : ThemeMode.dark;
ThemeMode currentTheme = Theme.of(context).brightness == Brightness.light
? ThemeMode.light
: ThemeMode.dark;
return WillPopScope(
onWillPop: () async {
Provider.of<ThemeModeObserver>(context, listen: false).changeTheme(settings.theme, updateNavbarColor: true);
Provider.of<ThemeModeObserver>(context, listen: false)
.changeTheme(settings.theme, updateNavbarColor: true);
return true;
},
child: AnimatedBuilder(
@@ -158,7 +194,9 @@ class _PremiumCustomAccentColorSettingState extends State<PremiumCustomAccentCol
final backgroundGradientBottomColor = isBackgroundDifferent
? Theme.of(context).colorScheme.background
: HSVColor.fromColor(Theme.of(context).colorScheme.background)
.withValue(currentTheme == ThemeMode.dark ? 0.1 * _openAnimController.value : 1.0 - (0.1 * _openAnimController.value))
.withValue(currentTheme == ThemeMode.dark
? 0.1 * _openAnimController.value
: 1.0 - (0.1 * _openAnimController.value))
.withAlpha(1.0)
.toColor();
@@ -174,13 +212,15 @@ class _PremiumCustomAccentColorSettingState extends State<PremiumCustomAccentCol
stops: const [0.0, 0.75],
colors: isBackgroundDifferent
? [
Theme.of(context)
.colorScheme
.background
.withOpacity(1 - ((currentTheme == ThemeMode.dark ? 0.65 : 0.45) * backgroundAnimation.value)),
Theme.of(context).colorScheme.background.withOpacity(1 -
((currentTheme == ThemeMode.dark ? 0.65 : 0.45) *
backgroundAnimation.value)),
backgroundGradientBottomColor,
]
: [backgroundGradientBottomColor, backgroundGradientBottomColor],
: [
backgroundGradientBottomColor,
backgroundGradientBottomColor
],
),
),
child: Opacity(
@@ -191,7 +231,7 @@ class _PremiumCustomAccentColorSettingState extends State<PremiumCustomAccentCol
surfaceTintColor: Theme.of(context).scaffoldBackgroundColor,
leading: BackButton(color: AppColors.of(context).text),
title: Text(
"Preview",
"theme_prev".i18n,
style: TextStyle(color: AppColors.of(context).text),
),
backgroundColor: Colors.transparent,
@@ -208,20 +248,32 @@ class _PremiumCustomAccentColorSettingState extends State<PremiumCustomAccentCol
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(24),
gradient: LinearGradient(begin: Alignment.topCenter, end: Alignment.bottomCenter, stops: const [
0.35,
0.75
], colors: [
Theme.of(context).colorScheme.background,
isBackgroundDifferent
? HSVColor.fromColor(Theme.of(context).colorScheme.background)
.withSaturation(
(HSVColor.fromColor(Theme.of(context).colorScheme.background).saturation - 0.15).clamp(0.0, 1.0))
.toColor()
: backgroundGradientBottomColor,
]),
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
stops: const [
0.35,
0.75
],
colors: [
Theme.of(context).colorScheme.background,
isBackgroundDifferent
? HSVColor.fromColor(Theme.of(context)
.colorScheme
.background)
.withSaturation((HSVColor.fromColor(
Theme.of(context)
.colorScheme
.background)
.saturation -
0.15)
.clamp(0.0, 1.0))
.toColor()
: backgroundGradientBottomColor,
]),
),
margin: const EdgeInsets.symmetric(vertical: 30, horizontal: 20),
margin: const EdgeInsets.symmetric(
vertical: 30, horizontal: 20),
),
),
),
@@ -236,13 +288,15 @@ class _PremiumCustomAccentColorSettingState extends State<PremiumCustomAccentCol
child: SingleChildScrollView(
physics: const BouncingScrollPhysics(),
child: Transform.translate(
offset: Offset(0, -24 + backContentAnimation.value),
offset:
Offset(0, -24 + backContentAnimation.value),
child: Transform.scale(
scale: backContentScaleAnimation.value,
child: Column(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 32.0, vertical: 6.0),
padding: const EdgeInsets.symmetric(
horizontal: 32.0, vertical: 6.0),
child: FilterBar(
items: const [
Tab(text: "All"),
@@ -256,26 +310,35 @@ class _PremiumCustomAccentColorSettingState extends State<PremiumCustomAccentCol
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 18.0, vertical: 8.0),
padding: const EdgeInsets.symmetric(
horizontal: 18.0, vertical: 8.0),
child: NewGradesSurprise(
[
Grade.fromJson(
{
"Uid": "0,Ertekeles",
"RogzitesDatuma": "2022-01-01T23:00:00Z",
"KeszitesDatuma": "2022-01-01T23:00:00Z",
"RogzitesDatuma":
"2022-01-01T23:00:00Z",
"KeszitesDatuma":
"2022-01-01T23:00:00Z",
"LattamozasDatuma": null,
"Tantargy": {
"Uid": "0",
"Nev": "reFilc szakirodalom",
"Kategoria": {"Uid": "0,_", "Nev": "_", "Leiras": "Nem mondom meg"},
"Kategoria": {
"Uid": "0,_",
"Nev": "_",
"Leiras": "Nem mondom meg"
},
"SortIndex": 2
},
"Tema": "Kupak csomag vásárlás vizsga",
"Tema":
"Kupak csomag vásárlás vizsga",
"Tipus": {
"Uid": "0,_",
"Nev": "_",
"Leiras": "Évközi jegy/értékelés",
"Leiras":
"Évközi jegy/értékelés",
},
"Mod": {
"Uid": "0,_",
@@ -285,14 +348,16 @@ class _PremiumCustomAccentColorSettingState extends State<PremiumCustomAccentCol
"ErtekFajta": {
"Uid": "1,Osztalyzat",
"Nev": "Osztalyzat",
"Leiras": "Elégtelen (1) és Jeles (5) között az öt alapértelmezett érték"
"Leiras":
"Elégtelen (1) és Jeles (5) között az öt alapértelmezett érték"
},
"ErtekeloTanarNeve": "Premium",
"Jelleg": "Ertekeles",
"SzamErtek": 5,
"SzovegesErtek": "Jeles(5)",
"SulySzazalekErteke": 100,
"SzovegesErtekelesRovidNev": null,
"SzovegesErtekelesRovidNev":
null,
"OsztalyCsoport": {"Uid": "0"},
"SortIndex": 2
},
@@ -302,26 +367,35 @@ class _PremiumCustomAccentColorSettingState extends State<PremiumCustomAccentCol
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 6.0),
padding: const EdgeInsets.symmetric(
horizontal: 24.0, vertical: 6.0),
child: Panel(
child: GradeTile(
Grade.fromJson(
{
"Uid": "0,Ertekeles",
"RogzitesDatuma": "2022-01-01T23:00:00Z",
"KeszitesDatuma": "2022-01-01T23:00:00Z",
"RogzitesDatuma":
"2022-01-01T23:00:00Z",
"KeszitesDatuma":
"2022-01-01T23:00:00Z",
"LattamozasDatuma": null,
"Tantargy": {
"Uid": "0",
"Nev": "reFilc szakosztály",
"Kategoria": {"Uid": "0,_", "Nev": "_", "Leiras": "Nem mondom meg"},
"Kategoria": {
"Uid": "0,_",
"Nev": "_",
"Leiras": "Nem mondom meg"
},
"SortIndex": 2
},
"Tema": "Kupak csomag vásárlás vizsga",
"Tema":
"Kupak csomag vásárlás vizsga",
"Tipus": {
"Uid": "0,_",
"Nev": "_",
"Leiras": "Évközi jegy/értékelés",
"Leiras":
"Évközi jegy/értékelés",
},
"Mod": {
"Uid": "0,_",
@@ -331,14 +405,16 @@ class _PremiumCustomAccentColorSettingState extends State<PremiumCustomAccentCol
"ErtekFajta": {
"Uid": "1,Osztalyzat",
"Nev": "Osztalyzat",
"Leiras": "Elégtelen (1) és Jeles (5) között az öt alapértelmezett érték"
"Leiras":
"Elégtelen (1) és Jeles (5) között az öt alapértelmezett érték"
},
"ErtekeloTanarNeve": "Premium",
"Jelleg": "Ertekeles",
"SzamErtek": 5,
"SzovegesErtek": "Jeles(5)",
"SulySzazalekErteke": 100,
"SzovegesErtekelesRovidNev": null,
"SzovegesErtekelesRovidNev":
null,
"OsztalyCsoport": {"Uid": "0"},
"SortIndex": 2
},
@@ -349,7 +425,8 @@ class _PremiumCustomAccentColorSettingState extends State<PremiumCustomAccentCol
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 6.0),
padding: const EdgeInsets.symmetric(
horizontal: 24.0, vertical: 6.0),
child: Panel(
child: HomeworkTile(
Homework.fromJson(
@@ -357,22 +434,31 @@ class _PremiumCustomAccentColorSettingState extends State<PremiumCustomAccentCol
"Uid": "0",
"Tantargy": {
"Uid": "0",
"Nev": "reFilc premium előnyei",
"Nev":
"reFilc premium előnyei",
"Kategoria": {
"Uid": "0,_",
"Nev": "_",
"Leiras": "reFilc premium előnyei",
"Leiras":
"reFilc premium előnyei",
},
"SortIndex": 0
},
"TantargyNeve": "reFilc premium előnyei",
"RogzitoTanarNeve": "Kupak János",
"Szoveg": "45 perc filctollal való rajzolás",
"FeladasDatuma": "2022-01-01T23:00:00Z",
"HataridoDatuma": "2022-01-01T23:00:00Z",
"RogzitesIdopontja": "2022-01-01T23:00:00Z",
"TantargyNeve":
"reFilc premium előnyei",
"RogzitoTanarNeve":
"Kupak János",
"Szoveg":
"45 perc filctollal való rajzolás",
"FeladasDatuma":
"2022-01-01T23:00:00Z",
"HataridoDatuma":
"2022-01-01T23:00:00Z",
"RogzitesIdopontja":
"2022-01-01T23:00:00Z",
"IsTanarRogzitette": true,
"IsTanuloHaziFeladatEnabled": false,
"IsTanuloHaziFeladatEnabled":
false,
"IsMegoldva": false,
"IsBeadhato": false,
"OsztalyCsoport": {"Uid": "0"},
@@ -385,7 +471,8 @@ class _PremiumCustomAccentColorSettingState extends State<PremiumCustomAccentCol
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 6.0),
padding: const EdgeInsets.symmetric(
horizontal: 24.0, vertical: 6.0),
child: Panel(
child: MessageTile(
Message.fromJson(
@@ -396,18 +483,22 @@ class _PremiumCustomAccentColorSettingState extends State<PremiumCustomAccentCol
"tipus": {
"azonosito": 1,
"kod": "BEERKEZETT",
"rovidNev": "Beérkezett üzenet",
"rovidNev":
"Beérkezett üzenet",
"nev": "Beérkezett üzenet",
"leiras": "Beérkezett üzenet"
},
"uzenet": {
"azonosito": 0,
"kuldesDatum": "2022-01-01T23:00:00",
"kuldesDatum":
"2022-01-01T23:00:00",
"feladoNev": "reFilc",
"feladoTitulus": "Nagyon magas szintű személy",
"feladoTitulus":
"Nagyon magas szintű személy",
"szoveg":
"<p>Kedves Felhasználó!</p><p><br></p><p>A prémium vásárlásakor kapott filctollal 90%-al több esély van jó jegyek szerzésére.</p>",
"targy": "Filctoll használati útmutató",
"targy":
"Filctoll használati útmutató",
"statusz": {
"azonosito": 2,
"kod": "KIKULDVE",
@@ -430,7 +521,10 @@ class _PremiumCustomAccentColorSettingState extends State<PremiumCustomAccentCol
},
],
"csatolmanyok": [
{"azonosito": 0, "fajlNev": "Filctoll.doc"}
{
"azonosito": 0,
"fajlNev": "Filctoll.doc"
}
]
}
},
@@ -462,68 +556,110 @@ class _PremiumCustomAccentColorSettingState extends State<PremiumCustomAccentCol
boxShadow: [
BoxShadow(
color: backgroundGradientBottomColor,
offset: const Offset(0, -4),
offset: const Offset(0, -8),
blurRadius: 16,
spreadRadius: 12,
spreadRadius: 18,
),
],
gradient: LinearGradient(begin: Alignment.topCenter, end: Alignment.bottomCenter, stops: const [
0.0,
0.175
], colors: [
backgroundGradientBottomColor,
backgroundGradientBottomColor,
]),
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
stops: const [
0.0,
0.175
],
colors: [
backgroundGradientBottomColor,
backgroundGradientBottomColor,
]),
),
child: Column(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
padding: const EdgeInsets.symmetric(
horizontal: 8.0),
child: FilterBar(
items: [
ColorTab(
color: accentColorMap[settings.accentColor] ?? unknownColor,
tab: Tab(text: "colorpicker_presets".i18n)),
color: accentColorMap[
settings.accentColor] ??
unknownColor,
tab: Tab(
text: "colorpicker_presets"
.i18n)),
/*ColorTab(
color:
settings.customAccentColor ??
unknownColor,
tab: Tab(
text: "colorpicker_saved"
.i18n)),*/
ColorTab(
unlocked: hasAccess,
color: settings.customBackgroundColor ?? unknownColor,
tab: Tab(text: "colorpicker_background".i18n)),
color: settings
.customBackgroundColor ??
unknownColor,
tab: Tab(
text: "colorpicker_background"
.i18n)),
ColorTab(
unlocked: hasAccess,
color: settings.customHighlightColor ?? unknownColor,
tab: Tab(text: "colorpicker_panels".i18n)),
color: settings
.customHighlightColor ??
unknownColor,
tab: Tab(
text: "colorpicker_panels"
.i18n)),
ColorTab(
unlocked: hasAccess,
color: settings.customAccentColor ?? unknownColor,
tab: Tab(text: "colorpicker_accent".i18n)),
color:
settings.customAccentColor ??
unknownColor,
tab: Tab(
text: "colorpicker_accent"
.i18n)),
],
onTap: (index) {
if (!hasAccess) {
index = 0;
_colorsTabController.animateTo(0, duration: Duration.zero);
_colorsTabController.animateTo(0,
duration: Duration.zero);
PremiumLockedFeatureUpsell.show(context: context, feature: PremiumFeature.customcolors);
PremiumLockedFeatureUpsell.show(
context: context,
feature: PremiumFeature
.customcolors);
}
switch (index) {
case 0:
setState(() {
colorMode = CustomColorMode.theme;
colorMode =
CustomColorMode.theme;
});
break;
/*case 1:
setState(() {
colorMode =
CustomColorMode.saved;
});
break;*/
case 1:
setState(() {
colorMode = CustomColorMode.background;
colorMode =
CustomColorMode.background;
});
break;
case 2:
setState(() {
colorMode = CustomColorMode.highlight;
colorMode =
CustomColorMode.highlight;
});
break;
case 3:
setState(() {
colorMode = CustomColorMode.accent;
colorMode =
CustomColorMode.accent;
});
break;
}
@@ -533,17 +669,29 @@ class _PremiumCustomAccentColorSettingState extends State<PremiumCustomAccentCol
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0),
padding: const EdgeInsets.symmetric(
horizontal: 12.0),
child: SafeArea(
child: FilcColorPicker(
colorMode: colorMode,
pickerColor: colorMode == CustomColorMode.accent
? settings.customAccentColor ?? unknownColor
: colorMode == CustomColorMode.background
? settings.customBackgroundColor ?? unknownColor
: colorMode == CustomColorMode.theme
? (accentColorMap[settings.accentColor] ?? AppColors.of(context).text) // idk what else
: settings.customHighlightColor ?? unknownColor,
pickerColor: colorMode ==
CustomColorMode.accent
? settings.customAccentColor ??
unknownColor
: colorMode ==
CustomColorMode.background
? settings
.customBackgroundColor ??
unknownColor
: colorMode ==
CustomColorMode.theme
? (accentColorMap[settings
.accentColor] ??
AppColors.of(context)
.text) // idk what else
: settings
.customHighlightColor ??
unknownColor,
onColorChanged: (c) {
setState(() {
updateCustomColor(c, false);
@@ -553,9 +701,19 @@ class _PremiumCustomAccentColorSettingState extends State<PremiumCustomAccentCol
onColorChangeEnd: (c, {adaptive}) {
setState(() {
if (adaptive == true) {
settings.update(accentColor: AccentColor.adaptive);
settings.update(customBackgroundColor: AppColors.of(context).background, store: true);
settings.update(customHighlightColor: AppColors.of(context).highlight, store: true);
settings.update(
accentColor:
AccentColor.adaptive);
settings.update(
customBackgroundColor:
AppColors.of(context)
.background,
store: true);
settings.update(
customHighlightColor:
AppColors.of(context)
.highlight,
store: true);
} else {
updateCustomColor(c, true);
}
@@ -585,7 +743,9 @@ class _PremiumCustomAccentColorSettingState extends State<PremiumCustomAccentCol
}
class ColorTab extends StatelessWidget {
const ColorTab({Key? key, required this.tab, required this.color, this.unlocked = true}) : super(key: key);
const ColorTab(
{Key? key, required this.tab, required this.color, this.unlocked = true})
: super(key: key);
final Tab tab;
final Color color;
@@ -610,7 +770,8 @@ class ColorTab extends StatelessWidget {
)
: const Padding(
padding: EdgeInsets.symmetric(horizontal: 2),
child: Icon(Icons.lock, color: Color.fromARGB(255, 82, 82, 82), size: 18),
child: Icon(Icons.lock,
color: Color.fromARGB(255, 82, 82, 82), size: 18),
),
),
tab
@@ -620,7 +781,9 @@ class ColorTab extends StatelessWidget {
}
class PremiumColorPickerItem extends StatelessWidget {
const PremiumColorPickerItem({Key? key, required this.label, this.onTap, required this.color}) : super(key: key);
const PremiumColorPickerItem(
{Key? key, required this.label, this.onTap, required this.color})
: super(key: key);
final String label;
final void Function()? onTap;
@@ -639,13 +802,16 @@ class PremiumColorPickerItem extends StatelessWidget {
Expanded(
child: Text(
label,
style: TextStyle(color: AppColors.of(context).text, fontWeight: FontWeight.w500),
style: TextStyle(
color: AppColors.of(context).text,
fontWeight: FontWeight.w500),
),
),
Container(
width: 30,
height: 30,
decoration: BoxDecoration(color: color, shape: BoxShape.circle, border: Border.all()),
decoration: BoxDecoration(
color: color, shape: BoxShape.circle, border: Border.all()),
),
],
),

View File

@@ -4,25 +4,32 @@ extension SettingsLocalization on String {
static final _t = Translations.byLocale("hu_hu") +
{
"en_en": {
"theme_prev": "Preview",
"colorpicker_presets": "Presets",
"colorpicker_background": "Background",
"colorpicker_panels": "Panels",
"colorpicker_accent": "Accent",
"need_sub": "You need Kupak subscription to use modify this.",
"advanced": "Advanced",
},
"hu_hu": {
"theme_prev": "Előnézet",
"colorpicker_presets": "Téma",
"colorpicker_background": "Háttér",
"colorpicker_panels": "Panelek",
"colorpicker_accent": "Színtónus",
"need_sub": "A módosításhoz Kupak szintű támogatás szükséges.",
"advanced": "Fejlett",
},
"de_de": {
"theme_prev": "Vorschau",
"colorpicker_presets": "Farben",
"colorpicker_background": "Hintergrund",
"colorpicker_panels": "Tafeln",
"colorpicker_accent": "Akzent",
"need_sub": "Sie benötigen ein Kupak-Abonnement, um diese Funktion zu ändern.",
"need_sub":
"Sie benötigen ein Kupak-Abonnement, um diese Funktion zu ändern.",
"advanced": "Fortschrittlich",
},
};