Skip to content

Commit 1ad8072

Browse files
Update text-scaling setting for the webview implementation
1 parent 09d05af commit 1ad8072

5 files changed

Lines changed: 48 additions & 43 deletions

File tree

lib/models/bibles/oet_lv_bible.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import '../json_to_bible.dart';
77
class OETLiteralBibleImpl extends JsonToBible {
88
OETLiteralBibleImpl(Map<String, dynamic> json) : super(json: json);
99

10-
// TODO: currently removes all ' marks.
10+
// TODO: currently replaces all ' marks with ’.
1111
@override
1212
String getBook(String bookCode, ViewBy viewBy) {
1313
String htmlText = '';
@@ -102,12 +102,12 @@ class OETLiteralBibleImpl extends JsonToBible {
102102

103103
if (isSection == true && isNext == true) {
104104
htmlText +=
105-
"""<p class="p"><div class="section-box"><p><sup id="$bookCode$chapterNumber:$sectionVerseReference">$chapterNumber:$sectionVerseReference</sup> ${sectionText.replaceAll("'", "")}</p></div><span>$chapterNumberHtml<sup>$sectionVerseReference</sup>${verseText.replaceAll("'", "")}</span>""";
105+
"""<p class="p"><div class="section-box"><p><sup id="$bookCode$chapterNumber:$sectionVerseReference">$chapterNumber:$sectionVerseReference</sup> ${sectionText.replaceAll("'", "")}</p></div><span>$chapterNumberHtml<sup>$sectionVerseReference</sup>${verseText.replaceAll("'", "")}</span>""";
106106

107107
isSection = false;
108108
isNext = false;
109109
} else {
110-
htmlText += "${verseText.replaceAll("'", "")}</span>";
110+
htmlText += "${verseText.replaceAll("'", "")}</span>";
111111
}
112112
}
113113
}

lib/models/bibles/oet_rv_bible.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import '../json_to_bible.dart';
77
class OETReadersBibleImpl extends JsonToBible {
88
OETReadersBibleImpl(Map<String, dynamic> json) : super(json: json);
99

10-
// TODO: currently removes all ' marks.
10+
// TODO: currently replaces all ' marks with ’.
1111
@override
1212
String getBook(String bookCode, ViewBy viewBy) {
1313
String htmlText = '';
@@ -102,19 +102,19 @@ class OETReadersBibleImpl extends JsonToBible {
102102

103103
if (isSection == true && isNext == true) {
104104
htmlText +=
105-
"""<p class="p"><div class="section-box"><p><sup id="$bookCode$chapterNumber:$sectionVerseReference">$chapterNumber:$sectionVerseReference</sup> ${sectionText.replaceAll("'", "")}</p></div><span>$chapterNumberHtml<sup>$sectionVerseReference</sup>${verseText.replaceAll("'", "")}</span>""";
105+
"""<p class="p"><div class="section-box"><p><sup id="$bookCode$chapterNumber:$sectionVerseReference">$chapterNumber:$sectionVerseReference</sup> ${sectionText.replaceAll("'", "")}</p></div><span>$chapterNumberHtml<sup>$sectionVerseReference</sup>${verseText.replaceAll("'", "")}</span>""";
106106

107107
isSection = false;
108108
isNext = false;
109109
} else {
110-
htmlText += "${verseText.replaceAll("'", "")}</span>";
110+
htmlText += "${verseText.replaceAll("'", "")}</span>";
111111
}
112112
}
113113
}
114114
}
115115
}
116116

117-
log(htmlText);
117+
//log(htmlText);
118118
return htmlText;
119119
}
120120
}

lib/ui/views/reader/reader_viewmodel.dart

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class ReaderViewModel extends ReactiveViewModel {
6464
PlatformWebViewControllerCreationParams params = const PlatformWebViewControllerCreationParams();
6565
webviewController = WebViewController.fromPlatformCreationParams(params)
6666
..setBackgroundColor(context.theme.appColors.background)
67+
..enableZoom(false)
6768
..setJavaScriptMode(JavaScriptMode.unrestricted)
6869
..addJavaScriptChannel(
6970
'OnEvent',
@@ -129,6 +130,7 @@ class ReaderViewModel extends ReactiveViewModel {
129130
<html lang="en">
130131
<head>
131132
<title></title>
133+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
132134
</head>
133135
<body class="$themeName">
134136
<style>
@@ -194,22 +196,23 @@ class ReaderViewModel extends ReactiveViewModel {
194196
195197
#primaryReader {
196198
font-family: 'Merriweather';
197-
font-size: 43px;
198-
letter-spacing: 0.5px;
199+
font-size: ${0.9 * textScaling}rem;
200+
letter-spacing: 0.3px;
199201
line-height: 155%;
200202
height: 50vh;
201-
margin-left: 57px;
202-
margin-right: 57px;
203+
padding-top: 0.3rem;
204+
margin-left: 0.8rem;
205+
margin-right: 0.8rem;
203206
}
204207
205208
#secondaryReader {
206209
font-family: 'Merriweather';
207-
font-size: 43px;
208-
letter-spacing: 0.5px;
210+
font-size: ${0.9 * textScaling}rem;
211+
letter-spacing: 0.3px;
209212
line-height: 155%;
210213
height: 50vh;
211-
margin-left: 57px;
212-
margin-right: 57px;
214+
margin-left: 0.8rem;
215+
margin-right: 0.8rem;
213216
}
214217
215218
.container.hidden #primaryReader {
@@ -226,8 +229,8 @@ class ReaderViewModel extends ReactiveViewModel {
226229
}
227230
228231
hr {
229-
margin-top: 12px;
230-
margin-bottom: 12px;
232+
margin-top: 8px;
233+
margin-bottom: 8px;
231234
width: 100%;
232235
}
233236
@@ -248,21 +251,21 @@ class ReaderViewModel extends ReactiveViewModel {
248251
}
249252
250253
p.p {
251-
text-indent: 0.5em;
252-
margin-top: 0.2em;
253-
margin-bottom: 0.2em;
254+
text-indent: 0.5rem;
255+
margin-top: 0.2rem;
256+
margin-bottom: 0.2rem;
254257
}
255258
256259
sup {
257-
font-size: 28px;
258-
margin-left: 1.2rem;
259-
margin-right: 0.4rem;
260+
font-size: ${0.6 * textScaling}rem;
261+
margin-left: 0.4rem;
262+
margin-right: 0.2rem;
260263
}
261264
262265
.c {
263-
font-size: 70px;
264-
margin-right: 0.5rem;
265-
margin-left: 0.5rem;
266+
font-size: ${1.6 * textScaling}rem;
267+
margin-right: 0.3rem;
268+
margin-left: 0.2rem;
266269
}
267270
268271
a {
@@ -274,19 +277,19 @@ class ReaderViewModel extends ReactiveViewModel {
274277
width: 40%;
275278
border-width: 2px;
276279
border-style: solid;
277-
padding: 0.2em;
278-
font-size: 38px;
280+
padding: 0.2rem;
281+
font-size: ${0.8 * textScaling}rem;
279282
font-weight: bold;
280283
line-height: normal;
281-
padding: 1rem;
282-
margin-left: 0.4rem;
283-
border-radius: 7px;
284+
padding: 0.6rem;
285+
margin-left: 0.3rem;
286+
border-radius: 2px;
284287
}
285288
286289
.section-box sup {
287-
font-size: 26px;
290+
font-size: ${0.6 * textScaling}rem;
288291
margin-left: 0rem;
289-
margin-right: 0.2rem;
292+
margin-right: 0.1rem;
290293
}
291294
292295
.section-box p {
@@ -296,7 +299,7 @@ class ReaderViewModel extends ReactiveViewModel {
296299
}
297300
298301
.light .section-box {
299-
border-color: var(--light-theme-medium-slate);
302+
border-color: var(--light-theme-medium-slate-10);
300303
}
301304
302305
.dark .section-box {

lib/ui/views/settings/settings_view.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class SettingsView extends StackedView<SettingsViewModel> {
126126
child: Slider(
127127
value: viewModel.textScaling,
128128
min: 1.0,
129-
max: 2.0,
129+
max: 1.5,
130130
onChanged: viewModel.changeTextScaling,
131131
),
132132
),

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,18 @@ class SettingsTextPreview extends StackedView<SettingsTextPreviewModel> {
3131
style: TextStyle(
3232
color: context.theme.appColors.readerText,
3333
fontFamily: 'Merriweather',
34-
fontSize: 15.0,
35-
letterSpacing: -0.1,
36-
height: 1.7,
34+
fontSize: 16.0,
35+
letterSpacing: 0.3,
36+
height: 1.6,
3737
),
38-
children: [
39-
// TODO: use actual text
40-
TextSpan(text: '1 ', style: TextStyle(fontSize: 20.0)),
38+
children: const [
4139
TextSpan(
42-
text:
43-
'In the beginning was the message, and the message was with God, and the message was and is God')
40+
text: '1 ',
41+
style: TextStyle(fontSize: 26.0),
42+
),
43+
TextSpan(
44+
text: 'In the beginning was the message, and the message was with God, and the message was and is God.',
45+
),
4446
],
4547
),
4648
),

0 commit comments

Comments
 (0)