TIF_E41202535/lib/presentation/components/table/table_row_custom.dart

73 lines
2.1 KiB
Dart

import 'package:flutter/material.dart';
import 'package:she_healthy_desktop/utils/string_ext.dart';
import '../../../core/theme/app_primary_theme.dart';
import '../../../utils/tooltip_message.dart';
import '../generic/custom_arrow.dart';
import '../generic/custom_arrow_tooltip.dart';
class TableRowCustom extends StatelessWidget {
final String? property, val1, val2, val3, val4, tooltipMessage;
final bool? ignoreEmptyProperties;
const TableRowCustom(
{Key? key,
this.property,
this.val1,
this.val2,
this.val3,
this.val4,
this.tooltipMessage,
this.ignoreEmptyProperties})
: super(key: key);
@override
Widget build(BuildContext context) {
return LayoutBuilder(
builder: (context, constraint) {
double widthCell = constraint.maxWidth * 0.2;
return Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
SizedBox(
width: widthCell,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0),
child: Text(property ?? 'a',
style: const TextStyle(fontWeight: FontWeight.w500),
textAlign: TextAlign.center),
),
),
SizedBox(
width: widthCell,
child: Text(_getValue(val1),
textAlign: TextAlign.center)),
SizedBox(
width: widthCell,
child: Text(_getValue(val2),
textAlign: TextAlign.center)),
SizedBox(
width: widthCell,
child: Text(_getValue(val3),
textAlign: TextAlign.center)),
SizedBox(
width: widthCell,
child: Text(_getValue(val4),
textAlign: TextAlign.center)),
],
);
},
);
}
String _getValue(String? value){
if (ignoreEmptyProperties == true){
return '';
}
return value.removeChars() ?? '-';
}
}