mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: set the default font family to Poppins on mobile (#3810)
This commit is contained in:
parent
59e0a1325e
commit
a2f2cdebb7
@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/inline_math_equation/inline_math_equation.dart';
|
import 'package:appflowy/plugins/document/presentation/editor_plugins/inline_math_equation/inline_math_equation.dart';
|
||||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/mention/mention_block.dart';
|
import 'package:appflowy/plugins/document/presentation/editor_plugins/mention/mention_block.dart';
|
||||||
import 'package:appflowy/plugins/document/presentation/more/cubit/document_appearance_cubit.dart';
|
import 'package:appflowy/plugins/document/presentation/more/cubit/document_appearance_cubit.dart';
|
||||||
@ -33,7 +35,7 @@ class EditorStyleCustomizer {
|
|||||||
final fontFamily = context.read<DocumentAppearanceCubit>().state.fontFamily;
|
final fontFamily = context.read<DocumentAppearanceCubit>().state.fontFamily;
|
||||||
final defaultTextDirection =
|
final defaultTextDirection =
|
||||||
context.read<DocumentAppearanceCubit>().state.defaultTextDirection;
|
context.read<DocumentAppearanceCubit>().state.defaultTextDirection;
|
||||||
|
final codeFontSize = max(0.0, fontSize - 2);
|
||||||
return EditorStyle.desktop(
|
return EditorStyle.desktop(
|
||||||
padding: padding,
|
padding: padding,
|
||||||
cursorColor: theme.colorScheme.primary,
|
cursorColor: theme.colorScheme.primary,
|
||||||
@ -60,9 +62,9 @@ class EditorStyleCustomizer {
|
|||||||
color: theme.colorScheme.primary,
|
color: theme.colorScheme.primary,
|
||||||
decoration: TextDecoration.underline,
|
decoration: TextDecoration.underline,
|
||||||
),
|
),
|
||||||
code: GoogleFonts.arefRuqaaInk(
|
code: GoogleFonts.robotoMono(
|
||||||
textStyle: baseTextStyle(fontFamily).copyWith(
|
textStyle: baseTextStyle(fontFamily).copyWith(
|
||||||
fontSize: fontSize,
|
fontSize: codeFontSize,
|
||||||
fontWeight: FontWeight.normal,
|
fontWeight: FontWeight.normal,
|
||||||
fontStyle: FontStyle.italic,
|
fontStyle: FontStyle.italic,
|
||||||
color: Colors.red,
|
color: Colors.red,
|
||||||
@ -75,8 +77,44 @@ class EditorStyleCustomizer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EditorStyle mobile() {
|
EditorStyle mobile() {
|
||||||
|
final theme = Theme.of(context);
|
||||||
|
const fontSize = 14.0;
|
||||||
|
final fontFamily = GoogleFonts.poppins().fontFamily ?? 'Poppins';
|
||||||
|
final codeFontSize = max(0.0, fontSize - 2);
|
||||||
return EditorStyle.mobile(
|
return EditorStyle.mobile(
|
||||||
padding: padding,
|
padding: padding,
|
||||||
|
textStyleConfiguration: TextStyleConfiguration(
|
||||||
|
text: baseTextStyle(fontFamily).copyWith(
|
||||||
|
fontSize: fontSize,
|
||||||
|
color: theme.colorScheme.onBackground,
|
||||||
|
height: 1.5,
|
||||||
|
),
|
||||||
|
bold: baseTextStyle(fontFamily, fontWeight: FontWeight.bold).copyWith(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
italic: baseTextStyle(fontFamily).copyWith(
|
||||||
|
fontStyle: FontStyle.italic,
|
||||||
|
),
|
||||||
|
underline: baseTextStyle(fontFamily).copyWith(
|
||||||
|
decoration: TextDecoration.underline,
|
||||||
|
),
|
||||||
|
strikethrough: baseTextStyle(fontFamily).copyWith(
|
||||||
|
decoration: TextDecoration.lineThrough,
|
||||||
|
),
|
||||||
|
href: baseTextStyle(fontFamily).copyWith(
|
||||||
|
color: theme.colorScheme.primary,
|
||||||
|
decoration: TextDecoration.underline,
|
||||||
|
),
|
||||||
|
code: GoogleFonts.robotoMono(
|
||||||
|
textStyle: baseTextStyle(fontFamily).copyWith(
|
||||||
|
fontSize: codeFontSize,
|
||||||
|
fontWeight: FontWeight.normal,
|
||||||
|
fontStyle: FontStyle.italic,
|
||||||
|
color: Colors.red,
|
||||||
|
backgroundColor: Colors.grey.withOpacity(0.3),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
textSpanDecorator: customizeAttributeDecorator,
|
textSpanDecorator: customizeAttributeDecorator,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user