Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
org.benoitharrault.scrobbles
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
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
android
org.benoitharrault.scrobbles
Commits
45525f83
Commit
45525f83
authored
1 year ago
by
Benoît Harrault
Browse files
Options
Downloads
Patches
Plain Diff
Add light/dart theme setting
parent
787c4b1d
No related branches found
No related tags found
1 merge request
!60
Resolve "Add light/dark theme selector"
Pipeline
#5469
passed
1 year ago
Stage: build-debug
Changes
23
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/ui/widgets/settings_form.dart
+31
-0
31 additions, 0 deletions
lib/ui/widgets/settings_form.dart
lib/ui/widgets/theme_card.dart
+45
-0
45 additions, 0 deletions
lib/ui/widgets/theme_card.dart
pubspec.yaml
+1
-1
1 addition, 1 deletion
pubspec.yaml
with
77 additions
and
1 deletion
lib/ui/widgets/settings_form.dart
+
31
−
0
View file @
45525f83
import
'package:easy_localization/easy_localization.dart'
;
import
'package:easy_localization/easy_localization.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:scrobbles/ui/widgets/theme_card.dart'
;
import
'package:unicons/unicons.dart'
;
import
'package:unicons/unicons.dart'
;
import
'package:scrobbles/config/default_settings.dart'
;
import
'package:scrobbles/config/default_settings.dart'
;
...
@@ -99,6 +100,36 @@ class _SettingsFormState extends State<SettingsForm> {
...
@@ -99,6 +100,36 @@ class _SettingsFormState extends State<SettingsForm> {
mainAxisSize:
MainAxisSize
.
max
,
mainAxisSize:
MainAxisSize
.
max
,
children:
<
Widget
>[
children:
<
Widget
>[
const
SizedBox
(
height:
8
),
const
SizedBox
(
height:
8
),
// Light/dark theme
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
<
Widget
>[
const
Text
(
'settings_label_theme'
)
.
tr
(),
const
Row
(
mainAxisAlignment:
MainAxisAlignment
.
end
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
[
ThemeCard
(
mode:
ThemeMode
.
system
,
icon:
UniconsLine
.
cog
,
),
ThemeCard
(
mode:
ThemeMode
.
light
,
icon:
UniconsLine
.
sun
,
),
ThemeCard
(
mode:
ThemeMode
.
dark
,
icon:
UniconsLine
.
moon
,
)
],
),
],
),
const
SizedBox
(
height:
16
),
AppTitle2
(
text:
tr
(
'settings_title_global'
)),
AppTitle2
(
text:
tr
(
'settings_title_global'
)),
// Username
// Username
...
...
This diff is collapsed.
Click to expand it.
lib/ui/widgets/theme_card.dart
0 → 100644
+
45
−
0
View file @
45525f83
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:scrobbles/cubit/theme_cubit.dart'
;
class
ThemeCard
extends
StatelessWidget
{
const
ThemeCard
({
super
.
key
,
required
this
.
mode
,
required
this
.
icon
,
});
final
IconData
icon
;
final
ThemeMode
mode
;
@override
Widget
build
(
BuildContext
context
)
{
return
BlocBuilder
<
ThemeCubit
,
ThemeModeState
>(
builder:
(
BuildContext
context
,
ThemeModeState
state
)
{
return
Card
(
elevation:
2
,
shadowColor:
Theme
.
of
(
context
)
.
colorScheme
.
shadow
,
color:
state
.
themeMode
==
mode
?
Theme
.
of
(
context
)
.
colorScheme
.
primary
:
Theme
.
of
(
context
)
.
colorScheme
.
surface
,
shape:
const
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
12
)),
),
margin:
const
EdgeInsets
.
all
(
5
),
child:
InkWell
(
onTap:
()
=
>
BlocProvider
.
of
<
ThemeCubit
>(
context
)
.
getTheme
(
ThemeModeState
(
themeMode:
mode
),
),
borderRadius:
const
BorderRadius
.
all
(
Radius
.
circular
(
12
)),
child:
Icon
(
icon
,
size:
32
,
color:
state
.
themeMode
!=
mode
?
Theme
.
of
(
context
)
.
colorScheme
.
primary
:
Colors
.
white
,
),
),
);
});
}
}
This diff is collapsed.
Click to expand it.
pubspec.yaml
+
1
−
1
View file @
45525f83
...
@@ -3,7 +3,7 @@ description: Display scrobbles data and charts
...
@@ -3,7 +3,7 @@ description: Display scrobbles data and charts
publish_to
:
'
none'
publish_to
:
'
none'
version
:
0.0.5
6
+5
6
version
:
0.0.5
7
+5
7
environment
:
environment
:
sdk
:
'
^3.0.0'
sdk
:
'
^3.0.0'
...
...
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
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