add text extension

null_safety
小赖 4 years ago
parent 272fc56de8
commit 80d919f5df

@ -48,6 +48,7 @@ export 'utils/screen_adapter.dart';
export 'extension/num_extension.dart';
export 'extension/widget_extension.dart';
export 'extension/string_extension.dart';
export 'extension/text_style_extension.dart';
//`BOTTOM` is external lib
export 'package:flutter_screenutil/flutter_screenutil.dart';

@ -1,3 +1,5 @@
import 'package:flutter/material.dart';
extension PhoneExt on String {
List get _parsePhone {
if (this.length < 11)
@ -28,4 +30,6 @@ extension PhoneExt on String {
else
return '${_parsePhone[0]}****${_parsePhone[2]}';
}
Widget get text => Text(this);
}

@ -0,0 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
extension TextStyleExtension on TextStyle {
TextStyle get bold => this.copyWith(fontWeight: FontWeight.bold);
TextStyle size(double size) => this.copyWith(fontSize: size.w);
TextStyle color(Color color) => this.copyWith(color: color);
}
Loading…
Cancel
Save