Skip to content

Commit 4272c25

Browse files
authored
Merge pull request #25 from SifAa/update-web
Update ts-toolkit version
2 parents 0644fe7 + c3e2a95 commit 4272c25

File tree

8 files changed

+64
-77
lines changed

8 files changed

+64
-77
lines changed

bin/forAll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ fi
1111
dir=(
1212
"./flutter_readium"
1313
"./flutter_readium_platform_interface"
14-
"./flutter_readium_web"
1514
)
1615
for i in "${dir[@]}"; do
1716
echo -e "\033[35;1m=== $@ $i ===\033[0m"

flutter_readium/example/lib/widgets/theme_selector.widget.dart

Lines changed: 41 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:flutter/material.dart';
2+
import 'package:flutter/gestures.dart';
23
import 'package:flutter_bloc/flutter_bloc.dart';
34

45
import '../extensions/index.dart';
@@ -16,42 +17,50 @@ class ThemeSelectorWidget extends StatelessWidget {
1617

1718
@override
1819
Widget build(final BuildContext context) => BlocBuilder<TextSettingsBloc, TextSettingsState>(
19-
builder: (final context, final state) => SingleChildScrollView(
20-
scrollDirection: Axis.horizontal,
21-
child: ToggleButtons(
22-
isSelected: themes
23-
.map(
24-
(final itemTheme) => itemTheme == (isHighlight ? state.highlight : state.theme),
25-
)
26-
.toList(),
27-
selectedBorderColor: (isHighlight ? state.highlight : state.theme).textColor,
28-
borderWidth: 4.0,
29-
borderColor: Colors.transparent,
30-
onPressed: (final index) {
31-
if (isHighlight) {
32-
context.read<TextSettingsBloc>().add(ChangeHighlight(themes[index]));
33-
} else {
34-
context.read<TextSettingsBloc>().add(ChangeTheme(themes[index]));
35-
}
20+
builder: (final context, final state) => ScrollConfiguration(
21+
behavior: const MaterialScrollBehavior().copyWith(
22+
dragDevices: {
23+
PointerDeviceKind.touch,
24+
PointerDeviceKind.mouse, // Enables mouse drag
3625
},
37-
children: themes
38-
.map(
39-
(final itemTheme) => Container(
40-
width: 80,
41-
height: 80,
42-
color: itemTheme.backgroundColor,
43-
child: Center(
44-
child: Text(
45-
'Aa',
46-
style: TextStyle(
47-
color: itemTheme.textColor,
48-
fontSize: 20,
26+
),
27+
child: SingleChildScrollView(
28+
scrollDirection: Axis.horizontal,
29+
child: ToggleButtons(
30+
isSelected: themes
31+
.map(
32+
(final itemTheme) => itemTheme == (isHighlight ? state.highlight : state.theme),
33+
)
34+
.toList(),
35+
selectedBorderColor: (isHighlight ? state.highlight : state.theme).textColor,
36+
borderWidth: 4.0,
37+
borderColor: Colors.transparent,
38+
onPressed: (final index) {
39+
if (isHighlight) {
40+
context.read<TextSettingsBloc>().add(ChangeHighlight(themes[index]));
41+
} else {
42+
context.read<TextSettingsBloc>().add(ChangeTheme(themes[index]));
43+
}
44+
},
45+
children: themes
46+
.map(
47+
(final itemTheme) => Container(
48+
width: 80,
49+
height: 80,
50+
color: itemTheme.backgroundColor,
51+
child: Center(
52+
child: Text(
53+
'Aa',
54+
style: TextStyle(
55+
color: itemTheme.textColor,
56+
fontSize: 20,
57+
),
4958
),
5059
),
5160
),
52-
),
53-
)
54-
.toList(),
61+
)
62+
.toList(),
63+
),
5564
),
5665
),
5766
);

flutter_readium/example/pubspec.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ dev_dependencies:
3535

3636
flutter:
3737
uses-material-design: true
38-
disable-swift-package-manager: true
38+
config:
39+
enable-swift-package-manager: false
3940
assets:
4041
- assets/pubs/
4142
- assets/webManifestList.json

flutter_readium/example/web/readiumReader.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flutter_readium/lib/helpers/readiumReader.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flutter_readium/package-lock.json

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flutter_readium/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"dependencies": {
33
"@material/web": "^2.3.0",
4-
"@readium/navigator": "^2.0.0",
5-
"@readium/navigator-html-injectables": "^2.0.0",
6-
"@readium/shared": "^2.0.0"
4+
"@readium/navigator": "^2.1.1",
5+
"@readium/navigator-html-injectables": "^2.1.1",
6+
"@readium/shared": "^2.1.1"
77
},
88
"devDependencies": {
99
"css-loader": "^7.1.2",

flutter_readium/web/_scripts/preferences.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {
22
TextAlignment,
3-
Theme,
43
IEpubPreferences,
54
IEpubDefaults,
65
EpubNavigator,
@@ -13,10 +12,6 @@ export function initializePreferencesFromString(
1312

1413
convertVerticalScroll(prefs);
1514

16-
if (prefs.theme != null) {
17-
prefs.theme = _themeFromJson(prefs.theme);
18-
}
19-
2015
if (prefs.textAlign != null) {
2116
prefs.textAlign = _textAlignFromJson(prefs.textAlign);
2217
}
@@ -56,7 +51,6 @@ export function initializePreferencesFromString(
5651
textAlign: prefs.textAlign ?? null,
5752
textColor: prefs.textColor ?? null,
5853
textNormalization: prefs.textNormalization ?? null,
59-
theme: prefs.theme ?? null,
6054
visitedColor: prefs.visitedColor ?? null,
6155
wordSpacing: prefs.wordSpacing ?? null,
6256
};
@@ -87,23 +81,10 @@ export const defaults: IEpubDefaults = {
8781
textAlign: TextAlignment.justify,
8882
textColor: null,
8983
textNormalization: true,
90-
theme: Theme.custom,
9184
visitedColor: '#551a8b',
9285
wordSpacing: 0,
9386
};
9487

95-
function _themeFromJson(themeString: string): Theme {
96-
switch (themeString) {
97-
case 'sepia':
98-
return Theme.sepia;
99-
case 'night':
100-
return Theme.night;
101-
case 'custom':
102-
default:
103-
return Theme.custom;
104-
}
105-
}
106-
10788
function _textAlignFromJson(textAlignString: string): TextAlignment {
10889
switch (textAlignString) {
10990
case 'left':
@@ -160,9 +141,6 @@ export function setPreferencesFromString(
160141

161142
convertVerticalScroll(newPreferences);
162143

163-
if (newPreferences.theme != null) {
164-
newPreferences.theme = _themeFromJson(newPreferences.theme);
165-
}
166144
if (newPreferences.textAlign != null) {
167145
newPreferences.textAlign = _textAlignFromJson(newPreferences.textAlign);
168146
}

0 commit comments

Comments
 (0)