Files
fcs/lib/pages/widgets/local_text.dart
phyothandar 079c9a135d null safety
2021-09-10 14:25:37 +06:30

62 lines
2.2 KiB
Dart

import 'package:fcs/localization/app_translations.dart';
import 'package:fcs/pages/main/model/language_model.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:fcs/helpers/theme.dart';
class LocalText extends Text {
final BuildContext context;
LocalText(this.context, String translationKey,
{Color? color,
double? fontSize,
FontWeight? fontWeight,
List<String>? translationVariables,
String? text,
bool underline = false})
: super(
text ??
AppTranslations.of(context)!.text(translationKey,
translationVariables: translationVariables),
style: Provider.of<LanguageModel>(context, listen: false).isEng
? newLabelStyle(
color: color!,
fontSize: fontSize!,
fontWeight: fontWeight!,
underline: underline)
: newLabelStyleMM(
color: color!,
fontSize: fontSize!,
fontWeight: fontWeight!,
underline: underline));
}
class LocalLargeTitle extends Text {
final BuildContext context;
LocalLargeTitle(
this.context,
String translationKey, {
Color? color,
List<String>? translationVariables,
}) : super(
AppTranslations.of(context)!.text(translationKey,
translationVariables: translationVariables),
style: Provider.of<LanguageModel>(context).isEng
? TextStyle(color: color)
: TextStyle(color: color, fontFamily: "Myanmar3"));
}
class TextLocalStyle extends Text {
final BuildContext context;
TextLocalStyle(this.context, String text,
{Color? color, double? fontSize, FontWeight? fontWeight})
: super(text,
style: Provider.of<LanguageModel>(context).isEng
? TextStyle(
color: color, fontSize: fontSize, fontWeight: fontWeight)
: TextStyle(
color: color,
fontFamily: "Myanmar3",
fontSize: fontSize,
fontWeight: fontWeight));
}