Skip to content

Commit

Permalink
Merge branch 'main' into prod/festapp
Browse files Browse the repository at this point in the history
  • Loading branch information
miakh committed Nov 15, 2024
2 parents e6fc817 + defcd30 commit fed13fd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
8 changes: 5 additions & 3 deletions lib/pages/SongDialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class _SongDialogState extends State<SongDialog> {

final ScrollController _scrollController = ScrollController();
double _buttonOpacity = 1;
BuildContext? themedContext;

@override
void initState() {
Expand All @@ -47,7 +48,7 @@ class _SongDialogState extends State<SongDialog> {
void _updateButtonOpacity() {
setState(() {
_buttonOpacity = _scrollController.position.pixels <= scrollThreshold
? buttonVisibleOpacity(context)
? buttonVisibleOpacity(themedContext??context)
: buttonHiddenOpacity;
});
}
Expand All @@ -62,6 +63,7 @@ class _SongDialogState extends State<SongDialog> {
data: themeData,
child: Builder(
builder: (BuildContext context) {
themedContext = context;
return Dialog(
insetPadding: EdgeInsets.zero, // Remove default padding
child: Container(
Expand Down Expand Up @@ -106,7 +108,7 @@ class _SongDialogState extends State<SongDialog> {
});
},
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 20),
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 15),
backgroundColor: ThemeConfig.songButtonColor(context).withOpacity(buttonVisibleOpacity(context)),
shadowColor: Colors.transparent,
elevation: 0,
Expand All @@ -128,7 +130,7 @@ class _SongDialogState extends State<SongDialog> {
});
},
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 20),
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 15),
backgroundColor: ThemeConfig.songButtonColor(context).withOpacity(buttonVisibleOpacity(context)),
shadowColor: Colors.transparent,
elevation: 0,
Expand Down
12 changes: 7 additions & 5 deletions lib/pages/SongPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ class SongPage extends StatefulWidget {

class _SongPageState extends State<SongPage> {
List<InformationModel>? _informationList;
static bool isDarkMode = false; // Static variable to persist within app lifecycle
static bool? isDarkMode; // Independent theme state for the page
static bool isDarkModeDefault = false; // Independent theme state for the page

// Define light and dark themes for this page
final ThemeData lightTheme = ThemeConfig.baseTheme();
Expand All @@ -37,8 +38,9 @@ class _SongPageState extends State<SongPage> {

@override
Widget build(BuildContext context) {
isDarkMode = isDarkMode ?? ThemeConfig.isDarkMode(context);
return Theme(
data: isDarkMode ? darkTheme : lightTheme,
data: isDarkMode ?? isDarkModeDefault ? darkTheme : lightTheme,
child: Scaffold(
appBar: AppBar(
title: Text(
Expand All @@ -54,7 +56,7 @@ class _SongPageState extends State<SongPage> {
children: [
Icon(Icons.wb_sunny, color: Colors.grey),
Switch(
value: isDarkMode,
value: isDarkMode ?? isDarkModeDefault,
onChanged: (value) {
setState(() {
isDarkMode = value;
Expand All @@ -81,7 +83,7 @@ class _SongPageState extends State<SongPage> {
// Add extra space above the first item
return Column(
children: [
SizedBox(height: 16), // Extra space below the AppBar
SizedBox(height: 16), // Extra space below the AppBar
buildListItem(index),
],
);
Expand All @@ -104,7 +106,7 @@ class _SongPageState extends State<SongPage> {
builder: (context) => SongDialog(
title: _informationList![index].title ?? "",
description: _informationList![index].description ?? "",
isDarkMode: isDarkMode, // Pass theme setting to dialog
isDarkMode: isDarkMode ?? isDarkModeDefault, // Pass theme setting to dialog
),
);
},
Expand Down

0 comments on commit fed13fd

Please sign in to comment.