You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
125 lines
3.1 KiB
Dart
125 lines
3.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
extension TextStyles on String {
|
|
Text get heading1 => getTextWithStyle(this, AppTextStyles.heading1);
|
|
|
|
Text get heading2 => getTextWithStyle(this, AppTextStyles.heading2);
|
|
|
|
Text get heading3 => getTextWithStyle(this, AppTextStyles.heading3);
|
|
|
|
Text get heading4 => getTextWithStyle(this, AppTextStyles.heading4);
|
|
|
|
Text get heading5 => getTextWithStyle(this, AppTextStyles.heading5);
|
|
|
|
Text get heading6 => getTextWithStyle(this, AppTextStyles.heading6);
|
|
|
|
Text get bodyText => getTextWithStyle(this, AppTextStyles.bodyText);
|
|
|
|
Text get bodyText2 => getTextWithStyle(this, AppTextStyles.bodyText2);
|
|
|
|
Text get tinyFont => getTextWithStyle(this, AppTextStyles.tinyFont);
|
|
|
|
Text get overline => getTextWithStyle(this, AppTextStyles.overline);
|
|
|
|
Text getTextWithStyle(String string, TextStyle style) => Text(string, style: style);
|
|
}
|
|
|
|
extension customText on Text {
|
|
Text custom({Color color, FontWeight fontWeight, TextAlign align}) {
|
|
return Text(
|
|
data,
|
|
textAlign: align,
|
|
style: style.copyWith(
|
|
color: color,
|
|
fontWeight: fontWeight,
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
abstract class AppTextStyles {
|
|
static const TextStyle heading1 = TextStyle(
|
|
fontSize: 54,
|
|
fontWeight: FontWeight.w500,
|
|
height: 0.89,
|
|
letterSpacing: -0.81,
|
|
fontStyle: FontStyle.normal,
|
|
decoration: TextDecoration.none,
|
|
);
|
|
|
|
static const TextStyle heading2 = TextStyle(
|
|
fontSize: 28,
|
|
fontWeight: FontWeight.w700,
|
|
height: 1.5,
|
|
letterSpacing: -0.56,
|
|
fontStyle: FontStyle.normal,
|
|
decoration: TextDecoration.none,
|
|
);
|
|
|
|
static const TextStyle heading3 = TextStyle(
|
|
fontSize: 24,
|
|
fontWeight: FontWeight.w700,
|
|
height: 1.5,
|
|
letterSpacing: -0.12,
|
|
fontStyle: FontStyle.normal,
|
|
decoration: TextDecoration.none,
|
|
);
|
|
|
|
static const TextStyle heading4 = TextStyle(
|
|
fontSize: 21,
|
|
fontWeight: FontWeight.w500,
|
|
height: 1.48,
|
|
fontStyle: FontStyle.normal,
|
|
decoration: TextDecoration.none,
|
|
);
|
|
|
|
static const TextStyle heading5 = TextStyle(
|
|
fontSize: 19,
|
|
fontWeight: FontWeight.w500,
|
|
height: 1.47,
|
|
fontStyle: FontStyle.normal,
|
|
decoration: TextDecoration.none,
|
|
);
|
|
|
|
static const TextStyle heading6 = TextStyle(
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w500,
|
|
height: 1.5,
|
|
fontStyle: FontStyle.normal,
|
|
decoration: TextDecoration.none,
|
|
);
|
|
|
|
static const TextStyle bodyText = TextStyle(
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.w500,
|
|
height: 1.5,
|
|
fontStyle: FontStyle.normal,
|
|
decoration: TextDecoration.none,
|
|
);
|
|
|
|
static const TextStyle bodyText2 = TextStyle(
|
|
fontSize: 12,
|
|
fontWeight: FontWeight.w500,
|
|
height: 1.5,
|
|
fontStyle: FontStyle.normal,
|
|
decoration: TextDecoration.none,
|
|
);
|
|
|
|
static const TextStyle tinyFont = TextStyle(
|
|
fontSize: 11,
|
|
fontWeight: FontWeight.w500,
|
|
height: 1.45,
|
|
fontStyle: FontStyle.normal,
|
|
decoration: TextDecoration.none,
|
|
);
|
|
|
|
static const TextStyle overline = TextStyle(
|
|
fontSize: 9,
|
|
fontWeight: FontWeight.w500,
|
|
height: 1.56,
|
|
letterSpacing: 0.05,
|
|
fontStyle: FontStyle.normal,
|
|
decoration: TextDecoration.none,
|
|
);
|
|
}
|