ambito/lib/src/pages/actions/detail/cards/_main_card.dart

51 lines
1.5 KiB
Dart
Raw Normal View History

import 'package:ambito/src/extensions/extensions.dart';
import 'package:ambito/src/pages/actions/detail/action_detail_page.dart';
import 'package:expansion_tile_card/expansion_tile_card.dart';
import 'package:flutter/material.dart';
import '../../../../entity/entities.dart';
import '../../../../packages/ambito_theme/ambito_theme.dart';
class MainCard extends StatelessWidget {
const MainCard(
{super.key,
required this.massnahme,
required this.title,
required this.content});
final Measure massnahme;
final String title;
final Widget content;
@override
Widget build(BuildContext context) {
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(
context.translate(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: content,
),
),
],
);
}
}