Files
fcs/lib/pages/widgets/local_text.dart

62 lines
2.2 KiB
Dart
Raw Normal View History

2020-10-07 02:33:06 +06:30
import 'package:fcs/localization/app_translations.dart';
import 'package:fcs/pages/main/model/language_model.dart';
2020-09-04 15:30:10 +06:30
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
2020-10-07 02:33:06 +06:30
import 'package:fcs/helpers/theme.dart';
2020-09-04 15:30:10 +06:30
class LocalText extends Text {
final BuildContext context;
LocalText(this.context, String translationKey,
2021-09-11 16:56:20 +06:30
{Color color = secondaryColor,
double fontSize = 13,
FontWeight fontWeight = FontWeight.w500,
2021-09-10 14:25:37 +06:30
List<String>? translationVariables,
String? text,
2020-09-04 15:30:10 +06:30
bool underline = false})
: super(
2020-09-18 21:33:41 +06:30
text ??
2021-09-10 14:25:37 +06:30
AppTranslations.of(context)!.text(translationKey,
2020-09-18 21:33:41 +06:30
translationVariables: translationVariables),
2020-09-16 02:29:50 +06:30
style: Provider.of<LanguageModel>(context, listen: false).isEng
2020-09-04 15:30:10 +06:30
? newLabelStyle(
2021-09-11 16:56:20 +06:30
color: color,
fontSize: fontSize,
fontWeight: fontWeight,
2020-09-04 15:30:10 +06:30
underline: underline)
: newLabelStyleMM(
2021-09-11 16:56:20 +06:30
color: color,
fontSize: fontSize,
fontWeight: fontWeight,
2020-09-04 15:30:10 +06:30
underline: underline));
}
2020-09-07 16:05:28 +06:30
class LocalLargeTitle extends Text {
final BuildContext context;
LocalLargeTitle(
this.context,
String translationKey, {
2021-09-10 14:25:37 +06:30
Color? color,
List<String>? translationVariables,
2020-09-07 16:05:28 +06:30
}) : super(
2021-09-10 14:25:37 +06:30
AppTranslations.of(context)!.text(translationKey,
2020-09-07 16:05:28 +06:30
translationVariables: translationVariables),
style: Provider.of<LanguageModel>(context).isEng
? TextStyle(color: color)
2020-10-07 02:33:06 +06:30
: TextStyle(color: color, fontFamily: "Myanmar3"));
2020-09-07 16:05:28 +06:30
}
class TextLocalStyle extends Text {
final BuildContext context;
2020-09-16 02:29:50 +06:30
TextLocalStyle(this.context, String text,
2021-09-10 14:25:37 +06:30
{Color? color, double? fontSize, FontWeight? fontWeight})
2020-09-07 16:05:28 +06:30
: super(text,
style: Provider.of<LanguageModel>(context).isEng
2020-09-16 02:29:50 +06:30
? TextStyle(
color: color, fontSize: fontSize, fontWeight: fontWeight)
2020-09-07 16:05:28 +06:30
: TextStyle(
color: color,
2020-10-07 02:33:06 +06:30
fontFamily: "Myanmar3",
2020-09-16 02:29:50 +06:30
fontSize: fontSize,
fontWeight: fontWeight));
2020-09-07 16:05:28 +06:30
}