stack_wallet/lib/widgets/table_view/table_view_row.dart

84 lines
2.6 KiB
Dart
Raw Normal View History

import 'package:flutter/material.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/widgets/expandable.dart';
import 'package:stackwallet/widgets/table_view/table_view_cell.dart';
class TableViewRow extends StatelessWidget {
const TableViewRow({
Key? key,
required this.cells,
required this.expandingChild,
this.decoration,
this.onExpandChanged,
this.padding = const EdgeInsets.all(0),
this.spacing = 0.0,
2022-09-25 19:53:08 +00:00
this.crossAxisAlignment = CrossAxisAlignment.center,
}) : super(key: key);
final List<TableViewCell> cells;
final Widget? expandingChild;
final Decoration? decoration;
final void Function(ExpandableState)? onExpandChanged;
final EdgeInsetsGeometry padding;
final double spacing;
2022-09-25 19:53:08 +00:00
final CrossAxisAlignment crossAxisAlignment;
@override
Widget build(BuildContext context) {
return Container(
decoration: decoration,
child: expandingChild == null
? Padding(
padding: padding,
child: Row(
2022-09-25 19:53:08 +00:00
crossAxisAlignment: crossAxisAlignment,
children: [
for (int i = 0; i < cells.length; i++) ...[
2022-09-25 19:53:08 +00:00
if (i != 0 && i != cells.length)
SizedBox(
width: spacing,
),
Expanded(
flex: cells[i].flex,
child: cells[i],
),
],
],
),
)
: Expandable(
onExpandChanged: onExpandChanged,
header: Padding(
padding: padding,
child: Row(
children: [
for (int i = 0; i < cells.length; i++) ...[
2022-09-25 19:53:08 +00:00
if (i != 0 && i != cells.length)
SizedBox(
width: spacing,
),
Expanded(
flex: cells[i].flex,
child: cells[i],
),
],
],
),
),
body: Column(
children: [
Container(
color: Theme.of(context)
.extension<StackColors>()!
.buttonBackSecondary,
width: double.infinity,
height: 1,
),
expandingChild!,
],
),
),
);
}
}