From d49fa29dfb5f7584274fb0fdd9e97757f0f1a980 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Mon, 21 Apr 2025 12:14:08 +0300 Subject: [PATCH] feat(finance): #332 --- .../pages/user_finance_screen.dart | 165 ++++++++++++------ 1 file changed, 107 insertions(+), 58 deletions(-) diff --git a/lib/features/my_finance/presentation/pages/user_finance_screen.dart b/lib/features/my_finance/presentation/pages/user_finance_screen.dart index 7d80011d..3eecb395 100644 --- a/lib/features/my_finance/presentation/pages/user_finance_screen.dart +++ b/lib/features/my_finance/presentation/pages/user_finance_screen.dart @@ -1,3 +1,5 @@ +import 'package:collection/collection.dart'; +import 'package:eatvio_app/core/theme/custom_text_style.dart'; import 'package:eatvio_app/core/theme/theme_helper.dart'; import 'package:eatvio_app/core/utils/date_time_utils.dart'; import 'package:eatvio_app/core/widgets/custom_drop_down_button.dart'; @@ -6,16 +8,23 @@ import 'package:eatvio_app/features/my_finance/presentation/pages/card_settings. import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; -class UserFinanceScreen extends StatelessWidget { +class UserFinanceScreen extends StatefulWidget { const UserFinanceScreen({super.key}); + @override + State createState() => _UserFinanceScreenState(); +} + +class _UserFinanceScreenState extends State { + final List periods = ['За всё время', 'За месяц', 'За неделю']; + @override Widget build(BuildContext context) { return Scaffold( backgroundColor: const Color(0xFFF0F2F5), appBar: AppBar( shape: const RoundedRectangleBorder(borderRadius: BorderRadiusDirectional.vertical(bottom: Radius.circular(12))), - title: const Text('История операций'), + title: const Text('Финансы'), centerTitle: true, ), body: SingleChildScrollView( @@ -49,73 +58,113 @@ class UserFinanceScreen extends StatelessWidget { physics: const NeverScrollableScrollPhysics(), child: Column( children: [ - CustomDropDownButton(items: const [], onChanged: (value) {}), + CustomDropDownButton( + items: periods + .mapIndexed( + (index, value) => DropdownMenuItem( + value: periods[index], + child: Text( + periods[index], + style: TextStyles.textMMedium.copyWith(color: appTheme.black), + ), + ), + ) + .toList(), + onChanged: (value) {}, + value: periods.first, + ), const SizedBox(height: 12), ListView.separated( shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), - itemBuilder: - (context, index) => Material( - color: const Color(0xFFF6F6F6), - borderRadius: BorderRadius.circular(20), - child: Padding( - padding: const EdgeInsets.all(12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + itemBuilder: (context, index) => Material( + color: const Color(0xFFF6F6F6), + borderRadius: BorderRadius.circular(20), + child: Padding( + padding: const EdgeInsets.all(12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - testFinanceEntity.consultationsList[index].id, - style: const TextStyle(color: Color(0xFF323F4B), height: 1, fontWeight: FontWeight.w500), - ), - Text( - testFinanceEntity.consultationsList[index].date.format('dd.MM.yyy', 'RU'), - style: const TextStyle(color: Color(0xFF6D6F71), height: 1, fontWeight: FontWeight.w500), - ), - ], + Tooltip( + message: testFinanceEntity.consultationsList[index].id, + triggerMode: TooltipTriggerMode.tap, + textStyle: const TextStyle( + color: Colors.black, + fontSize: 16, + fontWeight: FontWeight.w500, + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(4), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha((255 * 0.2).toInt()), + blurRadius: 32, + ) + ], + ), + child: Text( + testFinanceEntity.consultationsList[index].id, + style: const TextStyle(color: Color(0xFF323F4B), height: 1, fontWeight: FontWeight.w500), + ), ), - const SizedBox(height: 8), Text( - testFinanceEntity.consultationsList[index].title, - style: TextStyle(color: appTheme.blueA400, height: 1, fontSize: 18, fontWeight: FontWeight.w600), - ), - const SizedBox(height: 8), - Text( - 'Покупатель: ${testFinanceEntity.consultationsList[index].clientName}', - style: const TextStyle(color: Color(0xFF323F4B), height: 1, fontSize: 14, fontWeight: FontWeight.w500), - ), - const SizedBox(height: 8), - Text( - '${testFinanceEntity.consultationsList[index].planDuration} дней', - style: const TextStyle(color: Color(0xFF323F4B), height: 1, fontSize: 14, fontWeight: FontWeight.w500), - ), - const SizedBox(height: 8), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - '${testFinanceEntity.consultationsList[index].price} ₽', - style: const TextStyle(color: Color(0xFF323F4B), height: 1, fontSize: 18, fontWeight: FontWeight.w600), - ), - Material( - color: const Color(0xFF0BB450).withAlpha(11), - borderRadius: BorderRadius.circular(8), - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), - child: Text( - testFinanceEntity.consultationsList[index].status.name, - style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: Color(0xFF0BB450), height: 1), - ), - ), - ), - ], + testFinanceEntity.consultationsList[index].date.format('dd.MM.yyy', 'RU'), + style: const TextStyle(color: Color(0xFF6D6F71), height: 1, fontWeight: FontWeight.w500), ), ], ), - ), + const SizedBox(height: 8), + Text( + testFinanceEntity.consultationsList[index].title, + style: TextStyle(color: appTheme.blueA400, height: 1, fontSize: 18, fontWeight: FontWeight.w600), + ), + const SizedBox(height: 8), + Text( + 'Покупатель: ${testFinanceEntity.consultationsList[index].clientName}', + style: const TextStyle(color: Color(0xFF323F4B), height: 1, fontSize: 14, fontWeight: FontWeight.w500), + ), + const SizedBox(height: 8), + Text( + '${testFinanceEntity.consultationsList[index].planDuration} дней', + style: const TextStyle(color: Color(0xFF323F4B), height: 1, fontSize: 14, fontWeight: FontWeight.w500), + ), + const SizedBox(height: 8), + Container( + height: 1, + width: double.infinity, + decoration: const BoxDecoration( + color: Color(0xFFDEDEDF), + ), + ), + const SizedBox(height: 8), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + '${testFinanceEntity.consultationsList[index].price} ₽', + style: const TextStyle(color: Color(0xFF323F4B), height: 1, fontSize: 18, fontWeight: FontWeight.w600), + ), + Material( + color: const Color(0xFF0BB450).withAlpha(11), + borderRadius: BorderRadius.circular(8), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), + child: Text( + testFinanceEntity.consultationsList[index].status.name, + style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: Color(0xFF0BB450), height: 1), + ), + ), + ), + ], + ), + ], ), + ), + ), separatorBuilder: (context, index) => const SizedBox(height: 12), itemCount: testFinanceEntity.consultationsList.length, ),