Merge pull request #1518 from richardshiue/deprecate-textstyle-getters

chore: remove unused getters for TextStyles
This commit is contained in:
Nathan.fooo 2022-12-01 19:05:49 +08:00 committed by GitHub
commit be4222a62f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,78 +1,7 @@
import 'package:flowy_infra/size.dart';
import 'package:flutter/material.dart';
// preserved until deprecation
class Fonts {
static String general = "Poppins";
static String monospace = "SF Mono";
static String emoji = "Noto Color Emoji";
}
class TextStyles {
// preserved until deprecation
static TextStyle general({
double? fontSize,
FontWeight fontWeight = FontWeight.w500,
Color? color,
}) =>
TextStyle(
fontFamily: Fonts.general,
fontSize: fontSize ?? FontSizes.s12,
color: color,
fontWeight: fontWeight,
fontFamilyFallback: [Fonts.emoji],
letterSpacing: (fontSize ?? FontSizes.s12) * 0.005,
);
static TextStyle monospace({
String? fontFamily,
double? fontSize,
FontWeight fontWeight = FontWeight.w400,
}) =>
TextStyle(
fontFamily: fontFamily ?? Fonts.monospace,
fontSize: fontSize ?? FontSizes.s12,
fontWeight: fontWeight,
fontFamilyFallback: [Fonts.emoji],
);
static TextStyle get title => general(
fontSize: FontSizes.s18,
fontWeight: FontWeight.w600,
);
static TextStyle get subheading => general(
fontSize: FontSizes.s16,
fontWeight: FontWeight.w600,
);
static TextStyle get subtitle => general(
fontSize: FontSizes.s16,
fontWeight: FontWeight.w600,
);
static TextStyle get body1 => general(
fontSize: FontSizes.s12,
fontWeight: FontWeight.w500,
);
static TextStyle get body2 => general(
fontSize: FontSizes.s12,
fontWeight: FontWeight.w400,
);
static TextStyle get callout => general(
fontSize: FontSizes.s11,
fontWeight: FontWeight.w600,
);
static TextStyle get caption => general(
fontSize: FontSizes.s11,
fontWeight: FontWeight.w400,
);
final String font;
final Color color;