Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Ambient
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Daniel Furaev
Ambient
Commits
716ce677
Commit
716ce677
authored
2 years ago
by
MagicalSpyto
Browse files
Options
Downloads
Patches
Plain Diff
color fix
parent
25eaec15
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/moodpage.dart
+18
-17
18 additions, 17 deletions
lib/moodpage.dart
with
18 additions
and
17 deletions
lib/moodpage.dart
+
18
−
17
View file @
716ce677
...
...
@@ -53,6 +53,7 @@ class MoodPage extends State<StateMoodPage> {
Moods
?
currentMood
=
selectedMoodAsEnum
;
String
imagePath
=
""
;
//besorgt ein image file aus der galarie
_getFromGallery
()
async
{
try
{
XFile
?
pickedFile
=
await
_picker
.
pickImage
(
...
...
@@ -71,14 +72,14 @@ class MoodPage extends State<StateMoodPage> {
print
(
e
);
}
}
//sendet den befehl music zum passenden genre rauszusuchen
_changeMusic
()
async
{
//code zum musik ändern
String
hexcode
=
selectedMood
.
red
.
toRadixString
(
16
)
+
selectedMood
.
green
.
toRadixString
(
16
)
+
selectedMood
.
blue
.
toRadixString
(
16
);
String
genre
=
await
changeFirebase
()
.
getGenreByHex
(
hexcode
);
print
(
"genre = "
+
genre
);
}
//vergleicht zwei farben auf ähnlichkeit
_getColorDistance
(
Color
c1
,
Color
c2
)
{
LabColor
labC1
=
LabColor
.
fromColor
(
c1
);
LabColor
labC2
=
LabColor
.
fromColor
(
c2
);
...
...
@@ -127,22 +128,21 @@ class MoodPage extends State<StateMoodPage> {
}
_updateColorPalete
(
Color
col
){
if
(
!
usesPicture
){
col
=
Color
.
fromARGB
(
col
.
alpha
-
100
,
col
.
red
,
col
.
green
,
col
.
blue
);
//col = darken(col, 0.05);
if
(
col
.
value
!=
Color
.
fromARGB
(
255
,
0
,
0
,
0
)
.
value
){
col
=
ligten
(
col
,
0.2
);
}
primaryColor
=
col
;
backGroundColor
=
Color
.
fromARGB
(
col
.
alpha
-
140
,
col
.
red
,
col
.
green
,
col
.
blue
);
}
else
{
backGroundColor
=
Color
.
fromARGB
(
col
.
alpha
-
240
,
col
.
red
,
col
.
green
,
col
.
blue
);
}
backGroundColor
=
Color
.
fromARGB
(
col
.
alpha
-
230
,
col
.
red
,
col
.
green
,
col
.
blue
);
primaryColor
=
col
;
onPrimary
=
darken
(
col
,
0.
2
);
onPrimary
=
darken
(
col
,
0.
5
);
Color
shiftedColor
=
Color
.
fromARGB
(
col
.
alpha
-
100
,
col
.
red
,
col
.
green
,
col
.
blue
);
Color
shiftedColor
=
ligten
(
col
,
0.1
);
;
primaryContainer
=
shiftedColor
;
onPrimaryContainer
=
darken
(
shiftedColor
,
0.
2
);
onPrimaryContainer
=
darken
(
shiftedColor
,
0.
5
);
}
//returend die liste mit den moods
_getMoodList
(){
return
Column
(
children:
<
Widget
>[
...
...
@@ -230,6 +230,7 @@ class MoodPage extends State<StateMoodPage> {
});
},
),
RadioListTile
<
Moods
>(
title:
const
Text
(
"Happy"
,
...
...
@@ -358,7 +359,7 @@ class MoodPage extends State<StateMoodPage> {
),
]);
}
// setzt das bild(falls vorhanden) in einem container ein der sich and die bildschirmgröße anpasst
_getContainerTodisplay
()
{
BoxDecoration
deco
=
new
BoxDecoration
();
var
image
;
...
...
@@ -386,7 +387,7 @@ class MoodPage extends State<StateMoodPage> {
),
);
}
//generiert ein image aus dem imagefile
_getImageTodisplay
()
{
var
imageToShow
;
try
{
...
...
@@ -396,7 +397,7 @@ class MoodPage extends State<StateMoodPage> {
return
null
;
}
}
// generiert einen paletegenerator vom aktiellen image
Future
<
PaletteGenerator
>
_updatePaletteGenerator
()
async
{
if
(
imagePath
!=
""
)
{
paletteGenerator
=
await
PaletteGenerator
.
fromImageProvider
(
...
...
@@ -405,8 +406,8 @@ class MoodPage extends State<StateMoodPage> {
}
return
paletteGenerator
;
}
_getCollorIndicator
()
{
//gibt dem widged den colorindicator zur momentan generierten Primärfarbe und die Moodliste mit dem aktuell auszuwählenden Mood zurück
_getCollorIndicator
AndMoodList
()
{
return
FutureBuilder
<
PaletteGenerator
>(
future:
_updatePaletteGenerator
(),
// async work
builder:
...
...
@@ -456,7 +457,7 @@ class MoodPage extends State<StateMoodPage> {
child:
Column
(
children:
<
Widget
>[
_getContainerTodisplay
(),
_getCollorIndicator
(),
_getCollorIndicator
AndMoodList
(),
//_getMoodList(),
],
),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment