|
@@ -1,7 +1,6 @@
|
1
|
1
|
// Copyright (c) 2018, the Zefyr project authors. Please see the AUTHORS file
|
2
|
2
|
// for details. All rights reserved. Use of this source code is governed by a
|
3
|
3
|
// BSD-style license that can be found in the LICENSE file.
|
4
|
|
-import 'dart:io';
|
5
|
4
|
|
6
|
5
|
import 'package:flutter/material.dart';
|
7
|
6
|
import 'package:flutter/widgets.dart';
|
|
@@ -67,6 +66,7 @@ class ZefyrThemeData {
|
67
|
66
|
final ZefyrToolbarTheme toolbarTheme;
|
68
|
67
|
|
69
|
68
|
factory ZefyrThemeData.fallback(BuildContext context) {
|
|
69
|
+ final ThemeData themeData = Theme.of(context);
|
70
|
70
|
final defaultStyle = DefaultTextStyle.of(context);
|
71
|
71
|
final paragraphStyle = defaultStyle.style.copyWith(
|
72
|
72
|
fontSize: 16.0,
|
|
@@ -87,7 +87,7 @@ class ZefyrThemeData {
|
87
|
87
|
paragraphTheme:
|
88
|
88
|
new StyleTheme(textStyle: paragraphStyle, padding: padding),
|
89
|
89
|
headingTheme: new HeadingTheme.fallback(),
|
90
|
|
- blockTheme: new BlockTheme.fallback(),
|
|
90
|
+ blockTheme: new BlockTheme.fallback(themeData),
|
91
|
91
|
selectionColor: Colors.lightBlueAccent.shade100,
|
92
|
92
|
cursorColor: Colors.black,
|
93
|
93
|
indentSize: 16.0,
|
|
@@ -224,8 +224,19 @@ class BlockTheme {
|
224
|
224
|
});
|
225
|
225
|
|
226
|
226
|
/// Creates fallback theme for blocks.
|
227
|
|
- factory BlockTheme.fallback() {
|
|
227
|
+ factory BlockTheme.fallback(ThemeData themeData) {
|
228
|
228
|
final padding = const EdgeInsets.only(bottom: 8.0);
|
|
229
|
+ String fontFamily;
|
|
230
|
+ switch (themeData.platform) {
|
|
231
|
+ case TargetPlatform.iOS:
|
|
232
|
+ fontFamily = 'Menlo';
|
|
233
|
+ break;
|
|
234
|
+ case TargetPlatform.android:
|
|
235
|
+ case TargetPlatform.fuchsia:
|
|
236
|
+ fontFamily = 'Roboto Mono';
|
|
237
|
+ break;
|
|
238
|
+ }
|
|
239
|
+
|
229
|
240
|
return new BlockTheme(
|
230
|
241
|
bulletList: new StyleTheme(padding: padding),
|
231
|
242
|
numberList: new StyleTheme(padding: padding),
|
|
@@ -236,7 +247,7 @@ class BlockTheme {
|
236
|
247
|
code: new StyleTheme(
|
237
|
248
|
textStyle: new TextStyle(
|
238
|
249
|
color: Colors.blueGrey.shade800,
|
239
|
|
- fontFamily: Platform.isIOS ? 'Menlo' : 'Roboto Mono',
|
|
250
|
+ fontFamily: fontFamily,
|
240
|
251
|
fontSize: 14.0,
|
241
|
252
|
height: 1.25,
|
242
|
253
|
),
|