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.
87 lines
3.1 KiB
Dart
87 lines
3.1 KiB
Dart
import 'package:hmg_patient_app/config/size_config.dart';
|
|
import 'package:hmg_patient_app/core/viewModels/project_view_model.dart';
|
|
import 'package:hmg_patient_app/theme/colors.dart';
|
|
import 'package:hmg_patient_app/uitl/font_utils.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
// OWNER : Ibrahim albitar
|
|
// DATE : 12-04-2020
|
|
// DESCRIPTION : Customization for Texts in app
|
|
|
|
class AppText extends StatefulWidget {
|
|
final String data;
|
|
final Color? color;
|
|
final FontWeight fontWeight;
|
|
final double? fontSize;
|
|
final String? fontFamily;
|
|
final double? margin;
|
|
final double marginTop;
|
|
final double marginRight;
|
|
final double marginBottom;
|
|
final double marginLeft;
|
|
final bool visibility;
|
|
final TextAlign? textAlign;
|
|
final Color backGroundcolor;
|
|
final bool underline;
|
|
final double? height;
|
|
final double? letterSpacing;
|
|
|
|
AppText(this.data,
|
|
{this.color,
|
|
this.fontWeight = FontWeight.normal,
|
|
this.fontSize,
|
|
// this.fontFamily = 'WorkSans',
|
|
this.fontFamily,
|
|
this.margin,
|
|
this.marginTop = 0,
|
|
this.marginRight = 0,
|
|
this.marginBottom = 0,
|
|
this.marginLeft = 0,
|
|
this.visibility = true,
|
|
this.textAlign,
|
|
this.underline = false,
|
|
this.letterSpacing,
|
|
this.height,
|
|
this.backGroundcolor = Colors.white});
|
|
|
|
@override
|
|
_AppTextState createState() => _AppTextState();
|
|
}
|
|
|
|
class _AppTextState extends State<AppText> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
return Visibility(
|
|
visible: widget.visibility,
|
|
child: Container(
|
|
margin: widget.margin != null ? EdgeInsets.all(widget.margin!) : EdgeInsets.only(top: widget.marginTop, right: widget.marginRight, bottom: widget.marginBottom, left: widget.marginLeft),
|
|
child: Text(
|
|
widget.data,
|
|
textAlign: widget.textAlign,
|
|
overflow: TextOverflow.clip,
|
|
style: context.dynamicTextStyle(
|
|
color: widget.color == null ? CustomColors.black : widget.color,
|
|
fontWeight: widget.fontWeight,
|
|
fontSize: widget.fontSize ?? (SizeConfig.textMultiplier! * 2),
|
|
height: widget.height,
|
|
// fontFamily: widget.fontFamily ?? Theme.of(context).textTheme.bodyLarge?.fontFamily,
|
|
letterSpacing: widget.letterSpacing,
|
|
decoration: widget.underline == true ? TextDecoration.underline : TextDecoration.none),
|
|
// style: TextStyle(
|
|
// color: widget.color == null ? CustomColors.black : widget.color,
|
|
// fontWeight: widget.fontWeight,
|
|
// fontSize: widget.fontSize ?? (SizeConfig.textMultiplier! * 2),
|
|
// height: widget.height,
|
|
// fontFamily: widget.fontFamily ?? Theme.of(context).textTheme.bodyLarge?.fontFamily,
|
|
// letterSpacing: widget.letterSpacing,
|
|
// decoration: widget.underline == true ? TextDecoration.underline : TextDecoration.none
|
|
// ),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|