Skip to content

Commit d394321

Browse files
Add sepia theme
1 parent cb7127d commit d394321

8 files changed

Lines changed: 103 additions & 21 deletions

File tree

lib/common/enums.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@ enum ViewBy {
99
chapter,
1010
section,
1111
}
12+
13+
enum CurrentTheme {
14+
light,
15+
dark,
16+
sepia,
17+
}

lib/common/themes.dart

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,40 @@ class AppTheme {
260260
readerAddExtra: ReaderTextPalette.addExtraGreen,
261261
addCopulaPink: ReaderTextPalette.addCopulaPink,
262262
);
263+
264+
// Sepia theme
265+
static final sepia = ThemeData.light().copyWith(
266+
textSelectionTheme: const TextSelectionThemeData(
267+
cursorColor: Colors.white,
268+
selectionColor: Color(0xFF96BAD9),
269+
selectionHandleColor: LightThemePalette.mediumBlue,
270+
),
271+
extensions: [
272+
_sepiaAppColors,
273+
],
274+
);
275+
276+
static final _sepiaAppColors = AppColorsExtension(
277+
primary: SepiaThemePalette.mediumDarkBrown,
278+
secondary: SepiaThemePalette.mediumBrown,
279+
primaryOnDark: SepiaThemePalette.mediumDarkBrown,
280+
secondaryOnDark: SepiaThemePalette.mediumDarkBrown,
281+
primaryIcon: SepiaThemePalette.mediumDarkBrown,
282+
secondaryIcon: SepiaThemePalette.mediumBrown,
283+
appbarIcon: SepiaThemePalette.mediumDarkBrown,
284+
background: SepiaThemePalette.almostWhiteTan,
285+
appbarBackground: SepiaThemePalette.lightTan,
286+
popupBackground: SepiaThemePalette.lightTan,
287+
readerSelectorBackground: SepiaThemePalette.almostWhiteTan,
288+
switchBackground: SepiaThemePalette.mediumBrown,
289+
sliderAccent: SepiaThemePalette.mediumBrown,
290+
divider: SepiaThemePalette.lightTan,
291+
readerText: SepiaThemePalette.mediumGray,
292+
readerRedLetter: ReaderTextPalette.redLetterRed,
293+
readerAddArticle: ReaderTextPalette.addArticleOrange,
294+
readerAddExtra: ReaderTextPalette.addExtraGreen,
295+
addCopulaPink: ReaderTextPalette.addCopulaPink,
296+
);
263297
}
264298

265299
extension AppThemeExtension on ThemeData {

lib/main.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ class MainApp extends StatelessWidget {
2323
@override
2424
Widget build(BuildContext context) {
2525
return ThemeBuilder(
26-
defaultThemeMode: ThemeMode.light,
27-
lightTheme: AppTheme.light,
28-
darkTheme: AppTheme.dark,
26+
themes: [
27+
AppTheme.light,
28+
AppTheme.dark,
29+
AppTheme.sepia,
30+
],
2931
builder: (context, regularTheme, darkTheme, themeMode) => MaterialApp(
3032
title: 'Bibleside',
3133
debugShowCheckedModeBanner: false,

lib/ui/views/reader/widgets/reader_area_popup/reader_area_popup.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class ReaderAreaPopup extends StackedView<ReaderAreaPopupModel> {
5252
child: Container(
5353
width: 14.0,
5454
height: 7.0,
55-
color: Colors.white,
55+
color: context.theme.appColors.popupBackground,
5656
),
5757
),
5858
],
@@ -149,7 +149,7 @@ class ReaderAreaPopup extends StackedView<ReaderAreaPopupModel> {
149149
child: Container(
150150
width: 14.0,
151151
height: 7.0,
152-
color: Colors.white,
152+
color: context.theme.appColors.popupBackground,
153153
),
154154
),
155155
],

lib/ui/views/settings/settings_view.dart

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import 'package:phosphor_flutter/phosphor_flutter.dart';
33
import 'package:stacked/stacked.dart';
44
import 'package:stacked_themes/stacked_themes.dart';
55

6+
import '../../../common/enums.dart';
67
import '../../../common/themes.dart';
78
import '../../common/ui_helpers.dart';
89
import 'settings_viewmodel.dart';
@@ -243,22 +244,31 @@ class SettingsView extends StackedView<SettingsViewModel> {
243244
child: Row(
244245
children: [
245246
SettingsThemeItem(
246-
isSelected: !viewModel.isDarkTheme,
247-
theme: ThemeMode.light,
247+
isSelected: getThemeManager(context).selectedThemeIndex == 0,
248+
theme: CurrentTheme.light,
248249
onTap: () {
249250
var themeManger = getThemeManager(context);
250251
viewModel.setIsDarkTheme(false);
251-
themeManger.setThemeMode(ThemeMode.light);
252+
themeManger.selectThemeAtIndex(0);
252253
},
253254
),
254255
const SizedBox(width: 7.0),
255256
SettingsThemeItem(
256-
isSelected: viewModel.isDarkTheme,
257-
theme: ThemeMode.dark,
257+
isSelected: getThemeManager(context).selectedThemeIndex == 1,
258+
theme: CurrentTheme.dark,
258259
onTap: () {
259260
var themeManger = getThemeManager(context);
260261
viewModel.setIsDarkTheme(true);
261-
themeManger.setThemeMode(ThemeMode.dark);
262+
themeManger.selectThemeAtIndex(1);
263+
},
264+
),
265+
const SizedBox(width: 7.0),
266+
SettingsThemeItem(
267+
isSelected: getThemeManager(context).selectedThemeIndex == 2,
268+
theme: CurrentTheme.sepia,
269+
onTap: () {
270+
var themeManger = getThemeManager(context);
271+
themeManger.selectThemeAtIndex(2);
262272
},
263273
),
264274
],

lib/ui/views/settings/widgets/settings_theme_item/settings_theme_item.dart

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
22
import 'package:phosphor_flutter/phosphor_flutter.dart';
33
import 'package:stacked/stacked.dart';
44

5+
import '../../../../../common/enums.dart';
56
import '../../../../../common/themes.dart';
67
import 'settings_theme_item_model.dart';
78

@@ -14,7 +15,7 @@ class SettingsThemeItem extends StackedView<SettingsThemeItemModel> {
1415
});
1516

1617
final bool isSelected;
17-
final ThemeMode theme;
18+
final CurrentTheme theme;
1819
final Function() onTap;
1920

2021
@override
@@ -31,16 +32,16 @@ class SettingsThemeItem extends StackedView<SettingsThemeItemModel> {
3132
height: 134.0,
3233
padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 7.0),
3334
decoration: BoxDecoration(
34-
color: theme == ThemeMode.light ? Colors.white : const Color(0xFF1F2123),
35+
color: viewModel.getBackgroundColor(theme),
3536
border: Border.all(color: context.theme.appColors.divider),
3637
borderRadius: BorderRadius.circular(7.0),
3738
),
3839
child: Column(
3940
children: [
4041
Text(
41-
theme == ThemeMode.light ? 'Light' : 'Dark',
42+
theme == CurrentTheme.light ? 'Light' : theme == CurrentTheme.sepia ? 'Sepia' : 'Dark',
4243
style: TextStyle(
43-
color: theme == ThemeMode.light ? const Color(0xFF515358) : Colors.white,
44+
color: viewModel.getForegroundColor(theme),
4445
fontSize: 15.0,
4546
fontWeight: FontWeight.w500,
4647
),
@@ -49,25 +50,25 @@ class SettingsThemeItem extends StackedView<SettingsThemeItemModel> {
4950
Divider(
5051
height: 1.0,
5152
endIndent: 15.0,
52-
color: theme == ThemeMode.light ? const Color(0xFF515358) : Colors.white,
53+
color: viewModel.getForegroundColor(theme),
5354
),
5455
const SizedBox(height: 12.0),
5556
Divider(
5657
height: 1.0,
5758
endIndent: 35.0,
58-
color: theme == ThemeMode.light ? const Color(0xFF515358) : Colors.white,
59+
color: viewModel.getForegroundColor(theme),
5960
),
6061
const SizedBox(height: 12.0),
6162
Divider(
6263
height: 1.0,
6364
endIndent: 23.0,
64-
color: theme == ThemeMode.light ? const Color(0xFF515358) : Colors.white,
65+
color: viewModel.getForegroundColor(theme),
6566
),
6667
const SizedBox(height: 16.0),
6768
if (isSelected)
6869
PhosphorIcon(
6970
PhosphorIcons.checkCircle(PhosphorIconsStyle.regular),
70-
color: theme == ThemeMode.light ? const Color(0xFF515358) : Colors.white,
71+
color: viewModel.getForegroundColor(theme),
7172
size: 27.0,
7273
),
7374
],
Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
1+
import 'package:flutter/material.dart';
12
import 'package:stacked/stacked.dart';
3+
import '../../../../../common/enums.dart';
24

3-
class SettingsThemeItemModel extends BaseViewModel {}
5+
6+
class SettingsThemeItemModel extends BaseViewModel {
7+
Color getForegroundColor(CurrentTheme theme) {
8+
switch (theme) {
9+
case CurrentTheme.light:
10+
return const Color(0xFF515358);
11+
case CurrentTheme.dark:
12+
return Colors.white;
13+
case CurrentTheme.sepia:
14+
return const Color(0xFF655F49);
15+
default:
16+
return const Color(0xFF515358);
17+
}
18+
}
19+
20+
Color getBackgroundColor(CurrentTheme theme) {
21+
switch (theme) {
22+
case CurrentTheme.light:
23+
return Colors.white;
24+
case CurrentTheme.dark:
25+
return const Color(0xFF1F2123);
26+
case CurrentTheme.sepia:
27+
return const Color(0xFFC7C7AE);
28+
default:
29+
return Colors.white;
30+
}
31+
}
32+
}

lib/ui/widgets/common/side_navigation_drawer/side_navigation_drawer.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class SideNavigationDrawer extends StackedView<SideNavigationDrawerModel> {
3535
padding: const EdgeInsets.only(left: 2.0, right: 32.0),
3636
child: Image.asset(
3737
'assets/images/logo.png',
38-
color: Colors.white,
38+
color: context.theme.appColors.appbarIcon,
3939
height: 30.0,
4040
),
4141
),

0 commit comments

Comments
 (0)