``` feat: обновить интерфейс с использованием библиотеки Forui ``` Это сообщение коммита: - Начинается с `feat:`, что указывает на новую функциональность - Кратко описывает основное изменение - обновление интерфейса с использованием библиотеки Forui - Написано на русском языке - Соответствует стандартам conventional commits - Уложено в рекомендованные 72 символа
87 lines
2.3 KiB
Dart
87 lines
2.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:forui/forui.dart';
|
|
import 'package:intl/intl.dart';
|
|
import 'summary_item.dart';
|
|
|
|
class SummaryCard extends StatelessWidget {
|
|
final double totalExpenses;
|
|
|
|
const SummaryCard({
|
|
Key? key,
|
|
required this.totalExpenses,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Padding(
|
|
padding: const EdgeInsets.fromLTRB(16, 16, 16, 8),
|
|
child: FCard(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(16.0),
|
|
child: Column(
|
|
children: [
|
|
Text(
|
|
'Total Expenses This Period',
|
|
style: context.theme.typography.lg,
|
|
),
|
|
const SizedBox(height: 8),
|
|
_buildTotalAmount(context),
|
|
const SizedBox(height: 16),
|
|
FSeparator(),
|
|
const SizedBox(height: 16),
|
|
_buildSummaryItems(),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildTotalAmount(BuildContext context) {
|
|
return Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
Text(
|
|
'\$',
|
|
style: context.theme.typography.xl.copyWith(
|
|
color: context.theme.colorScheme.primary,
|
|
),
|
|
),
|
|
Text(
|
|
NumberFormat.currency(symbol: '', decimalDigits: 2).format(totalExpenses),
|
|
style: context.theme.typography.xl4.copyWith(
|
|
color: context.theme.colorScheme.primary,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget _buildSummaryItems() {
|
|
return Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
children: [
|
|
const SummaryItem(
|
|
icon: Icons.arrow_downward_rounded,
|
|
title: 'Income',
|
|
amount: '\$2,450.00',
|
|
color: Colors.green,
|
|
),
|
|
Container(
|
|
height: 35,
|
|
width: 1,
|
|
color: Colors.grey.withOpacity(0.3),
|
|
),
|
|
SummaryItem(
|
|
icon: Icons.arrow_upward_rounded,
|
|
title: 'Expenses',
|
|
amount: '\$${NumberFormat.currency(symbol: '', decimalDigits: 2).format(totalExpenses)}',
|
|
color: Colors.red,
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|