From 588b9b3b4cc2d287cff467421fefde7cc770372d Mon Sep 17 00:00:00 2001 From: laiiihz Date: Tue, 22 Dec 2020 13:10:46 +0800 Subject: [PATCH] text ext add height --- lib/extension/text_extension.dart | 5 +++++ lib/extension/text_style_extension.dart | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/extension/text_extension.dart b/lib/extension/text_extension.dart index e5108e1..a56dcdf 100644 --- a/lib/extension/text_extension.dart +++ b/lib/extension/text_extension.dart @@ -21,6 +21,11 @@ extension TextExtension on Text { ); } + Text height(double height) => Text( + this.data, + style: this.style?.heightX(height) ?? TextStyle().heightX(height), + ); + Text get white => Text(this.data, style: this.style?.white ?? TextStyle().white); diff --git a/lib/extension/text_style_extension.dart b/lib/extension/text_style_extension.dart index 50d9b6d..f6155b2 100644 --- a/lib/extension/text_style_extension.dart +++ b/lib/extension/text_style_extension.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:ansu_ui/styles/as_colors.dart'; - extension TextStyleExtension on TextStyle { ///Bold text TextStyle get bold => this.copyWith(fontWeight: FontWeight.bold); @@ -22,4 +21,6 @@ extension TextStyleExtension on TextStyle { ///FontWeight:w300 TextStyle get light => this.copyWith(fontWeight: FontWeight.w300); + + TextStyle heightX(double height) => this.copyWith(height: height); }