@@ -469,109 +469,9 @@ class _TransactionDetailsPageState extends State<TransactionDetailsPage> {
469
469
470
470
return Column (
471
471
children: [
472
- DefaultTextStyle .merge (
473
- style: TextStyle (
474
- color: Theme .of (context).colorScheme.onPrimary,
475
- ),
476
- child: Card (
477
- margin: const EdgeInsets .only (
478
- left: 16 , right: 16 , bottom: 8 , top: 16 ),
479
- elevation: 0 ,
480
- color: AppColors .of (context).light,
481
- child: Padding (
482
- padding: const EdgeInsets .all (16 ),
483
- child: Row (
484
- mainAxisAlignment: MainAxisAlignment .spaceBetween,
485
- children: [
486
- Flexible (
487
- child: Column (
488
- crossAxisAlignment: CrossAxisAlignment .start,
489
- children: [
490
- CurrencyDisplayer (
491
- amountToConvert: transaction.value,
492
- currency: transaction.account.currency,
493
- integerStyle: TextStyle (
494
- fontSize: 34 ,
495
- fontWeight: FontWeight .w600,
496
- color: transaction.status ==
497
- TransactionStatus .voided
498
- ? Colors .grey.shade400
499
- : transaction.type ==
500
- TransactionType .income
501
- ? AppColors .of (context).success
502
- : transaction.type ==
503
- TransactionType .expense
504
- ? AppColors .of (context).danger
505
- : null ,
506
- decoration: transaction.status ==
507
- TransactionStatus .voided
508
- ? TextDecoration .lineThrough
509
- : null ,
510
- ),
511
- ),
512
- Text (
513
- transaction.displayName (context),
514
- softWrap: true ,
515
- overflow: TextOverflow .fade,
516
- style: const TextStyle (
517
- fontSize: 16 ,
518
- fontWeight: FontWeight .w600,
519
- ),
520
- ),
521
- if (transaction.recurrentInfo.isNoRecurrent)
522
- Text (
523
- DateFormat .yMMMMd ()
524
- .add_Hm ()
525
- .format (transaction.date),
526
- )
527
- else
528
- Row (
529
- children: [
530
- Icon (
531
- Icons .repeat_rounded,
532
- size: 14 ,
533
- color: Theme .of (context)
534
- .colorScheme
535
- .primary,
536
- ),
537
- const SizedBox (width: 4 ),
538
- Text (
539
- transaction.recurrentInfo
540
- .formText (context),
541
- style: TextStyle (
542
- fontWeight: FontWeight .w300,
543
- color: Theme .of (context)
544
- .colorScheme
545
- .primary),
546
- ),
547
- ],
548
- ),
549
- ],
550
- ),
551
- ),
552
- const SizedBox (width: 24 ),
553
- Hero (
554
- tag: widget.heroTag ?? UniqueKey (),
555
- child: transaction.isIncomeOrExpense
556
- ? IconDisplayer .fromCategory (
557
- context,
558
- category: transaction.category! ,
559
- size: 42 ,
560
- isOutline: true ,
561
- borderRadius: 18 ,
562
- )
563
- : IconDisplayer (
564
- mainColor: transaction.color (context),
565
- icon: TransactionType .transfer.icon,
566
- size: 42 ,
567
- isOutline: true ,
568
- borderRadius: 18 ,
569
- ),
570
- ),
571
- ],
572
- ),
573
- ),
574
- ),
472
+ _TransactionDetailHeader (
473
+ transaction: transaction,
474
+ heroTag: widget.heroTag,
575
475
),
576
476
Expanded (
577
477
child: SingleChildScrollView (
@@ -809,3 +709,103 @@ class _TransactionDetailsPageState extends State<TransactionDetailsPage> {
809
709
});
810
710
}
811
711
}
712
+
713
+ class _TransactionDetailHeader extends StatelessWidget {
714
+ const _TransactionDetailHeader ({
715
+ super .key,
716
+ required this .transaction,
717
+ required this .heroTag,
718
+ });
719
+
720
+ final MoneyTransaction transaction;
721
+ final Object ? heroTag;
722
+
723
+ @override
724
+ Widget build (BuildContext context) {
725
+ return Card (
726
+ margin: const EdgeInsets .only (left: 16 , right: 16 , bottom: 8 , top: 16 ),
727
+ elevation: 0 ,
728
+ color: AppColors .of (context).light,
729
+ child: Padding (
730
+ padding: const EdgeInsets .all (16 ),
731
+ child: Row (
732
+ mainAxisAlignment: MainAxisAlignment .spaceBetween,
733
+ children: [
734
+ Flexible (
735
+ child: Column (
736
+ crossAxisAlignment: CrossAxisAlignment .start,
737
+ children: [
738
+ CurrencyDisplayer (
739
+ amountToConvert: transaction.value,
740
+ currency: transaction.account.currency,
741
+ integerStyle: TextStyle (
742
+ fontSize: 34 ,
743
+ fontWeight: FontWeight .w600,
744
+ color: transaction.status == TransactionStatus .voided
745
+ ? Colors .grey.shade400
746
+ : transaction.type == TransactionType .transfer
747
+ ? null
748
+ : transaction.type.color (context),
749
+ decoration: transaction.status == TransactionStatus .voided
750
+ ? TextDecoration .lineThrough
751
+ : null ,
752
+ ),
753
+ ),
754
+ Text (
755
+ transaction.displayName (context),
756
+ softWrap: true ,
757
+ overflow: TextOverflow .fade,
758
+ style: const TextStyle (
759
+ fontSize: 16 ,
760
+ fontWeight: FontWeight .w600,
761
+ ),
762
+ ),
763
+ if (transaction.recurrentInfo.isNoRecurrent)
764
+ Text (
765
+ DateFormat .yMMMMd ().add_Hm ().format (transaction.date),
766
+ )
767
+ else
768
+ Row (
769
+ children: [
770
+ Icon (
771
+ Icons .repeat_rounded,
772
+ size: 14 ,
773
+ color: Theme .of (context).colorScheme.primary,
774
+ ),
775
+ const SizedBox (width: 4 ),
776
+ Text (
777
+ transaction.recurrentInfo.formText (context),
778
+ style: TextStyle (
779
+ fontWeight: FontWeight .w300,
780
+ color: Theme .of (context).colorScheme.primary),
781
+ ),
782
+ ],
783
+ ),
784
+ ],
785
+ ),
786
+ ),
787
+ const SizedBox (width: 24 ),
788
+ Hero (
789
+ tag: heroTag ?? UniqueKey (),
790
+ child: transaction.isIncomeOrExpense
791
+ ? IconDisplayer .fromCategory (
792
+ context,
793
+ category: transaction.category! ,
794
+ size: 42 ,
795
+ isOutline: true ,
796
+ borderRadius: 18 ,
797
+ )
798
+ : IconDisplayer (
799
+ mainColor: transaction.color (context),
800
+ icon: TransactionType .transfer.icon,
801
+ size: 42 ,
802
+ isOutline: true ,
803
+ borderRadius: 18 ,
804
+ ),
805
+ ),
806
+ ],
807
+ ),
808
+ ),
809
+ );
810
+ }
811
+ }
0 commit comments