update extension

null_safety
小赖 4 years ago
parent 074b48181e
commit 730d866283

@ -2,12 +2,10 @@ import 'package:flutter/material.dart';
import 'text_style_extension.dart';
extension TextExtension on Text {
Text get bold {
return Text(
Text get bold => Text(
this.data,
style: this.style?.bold ?? TextStyle().bold,
);
}
Text size(double size) {
return Text(
@ -22,4 +20,13 @@ extension TextExtension on Text {
style: this.style?.colorX(color) ?? TextStyle().colorX(color),
);
}
Text get white =>
Text(this.data, style: this.style?.white ?? TextStyle().white);
Text get black =>
Text(this.data, style: this.style?.black ?? TextStyle().black);
Text get black65 =>
Text(this.data, style: this.style?.black65 ?? TextStyle().black65);
}

@ -1,8 +1,21 @@
import 'package:ansu_ui/styles/as_colors.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
extension TextStyleExtension on TextStyle {
///Bold text
TextStyle get bold => this.copyWith(fontWeight: FontWeight.bold);
///size
TextStyle size(double size) => this.copyWith(fontSize: size.w);
///color
TextStyle colorX(Color color) => this.copyWith(color: color);
//specific values
TextStyle get white => this.copyWith(color: kLightTextColor);
TextStyle get black => this.copyWith(color: kTextColor);
TextStyle get black65 => this.copyWith(color: kTextSubColor);
}

Loading…
Cancel
Save