54 lines
1.4 KiB
Dart
54 lines
1.4 KiB
Dart
|
import 'package:expansion_tile_card/expansion_tile_card.dart';
|
||
|
import 'package:flutter/cupertino.dart';
|
||
|
|
||
|
import '../../../../../packages/ambito_theme/ambito_theme.dart';
|
||
|
import '../../measure_detail_page.dart';
|
||
|
|
||
|
class CombinedCard extends StatelessWidget {
|
||
|
const CombinedCard({
|
||
|
super.key,
|
||
|
required this.title,
|
||
|
required this.elements,
|
||
|
});
|
||
|
|
||
|
final String title;
|
||
|
final List<Widget>? elements;
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
if (elements == null) {
|
||
|
return const SizedBox();
|
||
|
}
|
||
|
|
||
|
final AmbitoTheme theme = getTheme(context);
|
||
|
|
||
|
globalKeys.putIfAbsent(title, () => GlobalKey<ExpansionTileCardState>());
|
||
|
|
||
|
return ExpansionTileCard(
|
||
|
key: globalKeys[title],
|
||
|
initiallyExpanded: true,
|
||
|
contentPadding: const EdgeInsets.only(left: 16),
|
||
|
elevation: 0,
|
||
|
expandedTextColor: theme.currentColorScheme.outline,
|
||
|
baseColor: theme.currentColorScheme.outline.withOpacity(.1),
|
||
|
expandedColor: theme.currentColorScheme.outline.withOpacity(.1),
|
||
|
title: Text(
|
||
|
title,
|
||
|
style: theme.currentThemeData.textTheme.labelMedium
|
||
|
?.copyWith(fontWeight: FontWeight.bold),
|
||
|
),
|
||
|
children: [
|
||
|
Align(
|
||
|
alignment: Alignment.topLeft,
|
||
|
child: Padding(
|
||
|
padding: const EdgeInsets.only(left: 20, right: 20, bottom: 20),
|
||
|
child: Column(
|
||
|
children: elements!,
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
);
|
||
|
}
|
||
|
}
|