selfprivacy.org.app/lib/ui/molecules/cards/providers_page_card.dart
2024-11-11 04:10:55 +03:00

73 lines
2.3 KiB
Dart

import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:selfprivacy/logic/models/state_types.dart';
import 'package:selfprivacy/ui/atoms/masks/icon_status_mask.dart';
class ProvidersPageCard extends StatelessWidget {
const ProvidersPageCard({
required this.state,
required this.icon,
required this.title,
required this.subtitle,
this.onTap,
super.key,
});
final Function()? onTap;
final StateType state;
final IconData icon;
final String title;
final String subtitle;
@override
Widget build(final BuildContext context) => Card(
clipBehavior: Clip.antiAlias,
child: InkResponse(
highlightShape: BoxShape.rectangle,
onTap: onTap,
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
IconStatusMask(
status: state,
icon: Icon(icon, size: 32, color: Colors.white),
),
const Gap(8),
Expanded(
child: Text(
title,
style: Theme.of(context).textTheme.headlineMedium,
),
),
if (state != StateType.uninitialized)
IconStatusMask(
status: state,
icon: Icon(
state == StateType.stable
? Icons.check_circle_outline
: state == StateType.warning
? Icons.warning_amber_outlined
: Icons.error_outline,
color: Colors.white,
),
),
],
),
const SizedBox(height: 8),
if (state != StateType.uninitialized)
Text(
subtitle,
style: Theme.of(context).textTheme.bodyLarge,
),
],
),
),
),
);
}