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.
40 lines
1.3 KiB
Dart
40 lines
1.3 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;
|
|
}
|
|
}
|