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.
cloudsolutions-atoms/lib/views/widgets/item_views/info_text_widget.dart

51 lines
1.7 KiB
Dart

import 'package:flutter/material.dart';
import 'package:test_sa/extensions/text_extensions.dart';
import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/new_views/app_style/app_color.dart';
class InfoTextWidget extends StatelessWidget {
String? value;
final String label;
final bool showEmptyValue;
final bool showArrow;
final bool isMsg;
InfoTextWidget({required this.label, this.value, this.showEmptyValue = false, this.showArrow = false, this.isMsg = false, Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
Widget text;
String aLabel = label + (isMsg ? "" : ":");
if (showEmptyValue) {
text = Text('$aLabel ${value ?? ""}', style: AppTextStyles.bodyText2.copyWith(color: AppColor.lightTextColor(context)));
} else if (value?.isNotEmpty ?? false) {
text = Text('$aLabel $value', style: AppTextStyles.bodyText2.copyWith(color: AppColor.lightTextColor(context)));
} else {
text = const SizedBox();
}
if (showArrow) {
text = Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
text.expanded,
const SizedBox(width: 4),
"arrow_right".toSvgAsset(width: 17, color: AppColor.primary10),
],
);
}
return text;
}
}
class InfoTextLabelWidget extends StatelessWidget {
final String label;
InfoTextLabelWidget({required this.label, Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
Widget text;
text = Text(label, style: AppTextStyles.bodyText2.copyWith(color: AppColor.lightTextColor(context)));
return text;
}
}