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

90 lines
2.5 KiB
Dart
Raw Normal View History

2020-10-07 02:33:06 +06:30
import 'package:fcs/helpers/theme.dart';
2020-10-07 18:19:12 +06:30
import 'package:fcs/localization/app_translations.dart';
2020-10-07 02:33:06 +06:30
import 'package:fcs/pages/main/model/language_model.dart';
2020-09-13 21:49:39 +06:30
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class DisplayText extends StatelessWidget {
2021-09-10 12:00:08 +06:30
final String? text;
final String? text1;
2021-09-10 12:00:08 +06:30
final String? labelTextKey;
final IconData? iconData;
final int? maxLines;
final bool? withBorder;
final Color? borderColor;
final Widget? icon;
2020-09-13 21:49:39 +06:30
const DisplayText({
2021-09-10 12:00:08 +06:30
Key? key,
2020-09-13 21:49:39 +06:30
this.text,
this.text1,
2020-10-08 03:32:52 +06:30
this.labelTextKey,
2020-09-13 21:49:39 +06:30
this.iconData,
this.maxLines = 1,
this.withBorder = false,
this.borderColor,
2020-09-18 04:04:21 +06:30
this.icon,
2020-09-13 21:49:39 +06:30
}) : super(key: key);
@override
Widget build(BuildContext context) {
var languageModel = Provider.of<LanguageModel>(context);
var labelStyle = languageModel.isEng
? TextStyle(
color: Colors.black54,
)
: TextStyle(color: Colors.black54, fontFamily: "Myanmar3");
var textStyle = languageModel.isEng
2024-02-01 18:07:40 +06:30
? TextStyle(color: Colors.black)
: TextStyle(color: Colors.black, fontFamily: "Myanmar3");
2020-09-13 21:49:39 +06:30
return Padding(
padding: const EdgeInsets.only(top: 8.0, bottom: 8),
child: Row(
children: [
2020-09-16 02:29:50 +06:30
iconData == null
2021-09-10 12:00:08 +06:30
? icon == null
? Container()
: icon!
2020-09-16 02:29:50 +06:30
: Padding(
2020-10-07 18:19:12 +06:30
padding: const EdgeInsets.only(
left: .0, right: 15, top: 8.0, bottom: 8.0),
2020-09-16 02:29:50 +06:30
child: Icon(
iconData,
color: primaryColor,
),
),
2020-09-13 21:49:39 +06:30
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
2020-10-08 03:32:52 +06:30
labelTextKey == null
2020-09-15 07:13:41 +06:30
? Container()
: Text(
2021-09-10 14:25:37 +06:30
AppTranslations.of(context)!.text(labelTextKey!),
2020-09-15 07:13:41 +06:30
style: labelStyle,
),
2020-10-11 02:17:23 +06:30
text == null
? Container()
: Text(
2021-09-10 12:00:08 +06:30
text!,
2020-10-11 02:17:23 +06:30
style: textStyle,
),
text1 == null
? Container()
: Text(
text1!,
style: textStyle,
),
2020-09-13 21:49:39 +06:30
],
),
),
],
),
);
}
}