diff --git a/budget/lib/pages/creditDebtTransactionsPage.dart b/budget/lib/pages/creditDebtTransactionsPage.dart index 4c98df79..a0b098bc 100644 --- a/budget/lib/pages/creditDebtTransactionsPage.dart +++ b/budget/lib/pages/creditDebtTransactionsPage.dart @@ -10,6 +10,7 @@ import 'package:budget/struct/databaseGlobal.dart'; import 'package:budget/struct/settings.dart'; import 'package:budget/widgets/animatedExpanded.dart'; import 'package:budget/widgets/button.dart'; +import 'package:budget/widgets/dropdownSelect.dart'; import 'package:budget/widgets/extraInfoBoxes.dart'; import 'package:budget/widgets/fab.dart'; import 'package:budget/widgets/framework/popupFramework.dart'; @@ -321,214 +322,253 @@ class CreditDebtTransactionsState extends State }, child: Stack( children: [ - PageFramework( - key: pageState, - scrollController: _scrollController, - resizeToAvoidBottomInset: true, - floatingActionButton: AnimateFABDelayed( - enabled: true, - fab: AddFAB( - tooltip: isCredit == true || isCredit == null - ? "add-credit".tr() - : "add-debt".tr(), - onTap: () { - openBottomSheet( - context, - AddLoanPopup( - selectedTransactionType: - isCredit == true || isCredit == null - ? TransactionSpecialType.credit - : TransactionSpecialType.debt, - ), - ); - }, + StreamBuilder>( + stream: database.watchAllObjectives( + objectiveType: ObjectiveType.loan, + hideArchived: true, + showDifferenceLoans: null, ), - ), - listID: pageId, - title: "loans".tr(), - dragDownToDismiss: true, - bodyBuilder: (scrollController, scrollPhysics, sliverAppBar) { - return StreamBuilder>( - stream: database.watchAllObjectives( - objectiveType: ObjectiveType.loan, - hideArchived: true, - showDifferenceLoans: null, - ), - builder: (context, snapshot) { - if (snapshot.hasData == false) return SizedBox.shrink(); - if ((snapshot.data?.length ?? 0) <= 0) { - numberLongTerm = 0; - _tabController.index = 0; - return CustomScrollView( + builder: (context, allLoanObjectivesSnapshot) { + return PageFramework( + key: pageState, + scrollController: _scrollController, + resizeToAvoidBottomInset: true, + actions: [ + (allLoanObjectivesSnapshot.data?.length ?? 0) <= 0 + ? StreamBuilder>( + stream: database.watchAllObjectives( + objectiveType: ObjectiveType.loan, + hideArchived: false, + showDifferenceLoans: null, + limit: 1), + builder: (context, snapshot) { + if (snapshot.hasData == false) + return SizedBox.shrink(); + if ((snapshot.data?.length ?? 0) <= 0) + return SizedBox.shrink(); + return CustomPopupMenuButton( + showButtons: enableDoubleColumn(context), + keepOutFirst: true, + items: [ + DropdownItemMenu( + id: "edit-loans", + label: "edit".tr(), + icon: appStateSettings["outlinedIcons"] + ? Icons.edit_outlined + : Icons.edit_rounded, + action: () { + pushRoute( + context, + EditObjectivesPage( + objectiveType: ObjectiveType.loan, + ), + ); + }, + ), + ], + ); + }, + ) + : SizedBox.shrink(), + ], + floatingActionButton: AnimateFABDelayed( + enabled: true, + fab: AddFAB( + tooltip: isCredit == true || isCredit == null + ? "add-credit".tr() + : "add-debt".tr(), + onTap: () { + openBottomSheet( + context, + AddLoanPopup( + selectedTransactionType: + isCredit == true || isCredit == null + ? TransactionSpecialType.credit + : TransactionSpecialType.debt, + ), + ); + }, + ), + ), + listID: pageId, + title: "loans".tr(), + dragDownToDismiss: true, + bodyBuilder: (scrollController, scrollPhysics, sliverAppBar) { + if (allLoanObjectivesSnapshot.hasData == false) + return SizedBox.shrink(); + if ((allLoanObjectivesSnapshot.data?.length ?? 0) <= 0) { + numberLongTerm = 0; + _tabController.index = 0; + return CustomScrollView( + controller: _scrollController, + slivers: [ + sliverAppBar, + ...loanInfoAppBar, + ...oneTimeLoanList(false) + ], + ); + } + // Set the tab to long term if none were added previously, but one was added + if (numberLongTerm == 0) { + _tabController.index = 1; + numberLongTerm = + allLoanObjectivesSnapshot.data?.length ?? 0; + } + return NestedScrollView( controller: _scrollController, - slivers: [ - sliverAppBar, - ...loanInfoAppBar, - ...oneTimeLoanList(false) - ], - ); - } - // Set the tab to long term if none were added previously, but one was added - if (numberLongTerm == 0) { - _tabController.index = 1; - numberLongTerm = snapshot.data?.length ?? 0; - } - return NestedScrollView( - controller: _scrollController, - headerSliverBuilder: - (BuildContext contextHeader, bool innerBoxIsScrolled) { - return [ - SliverOverlapAbsorber( - handle: - NestedScrollView.sliverOverlapAbsorberHandleFor( - contextHeader), - sliver: MultiSliver( - children: [ - sliverAppBar, - SliverToBoxAdapter( - child: Padding( - padding: EdgeInsets.only(bottom: 13), + headerSliverBuilder: (BuildContext contextHeader, + bool innerBoxIsScrolled) { + return [ + SliverOverlapAbsorber( + handle: + NestedScrollView.sliverOverlapAbsorberHandleFor( + contextHeader), + sliver: MultiSliver( + children: [ + sliverAppBar, + SliverToBoxAdapter( child: Padding( - padding: EdgeInsets.symmetric( - horizontal: - getHorizontalPaddingConstrained( - context, - enabled: enableDoubleColumn( - context) == - false, - ) + - 13, - ), + padding: EdgeInsets.only(bottom: 13), child: Padding( padding: EdgeInsets.symmetric( horizontal: getHorizontalPaddingConstrained( - context), + context, + enabled: enableDoubleColumn( + context) == + false, + ) + + 13, ), - child: Row( - children: [ - Expanded( - child: IncomeExpenseTabSelector( - hasBorderRadius: true, - onTabChanged: (_) {}, - initialTabIsIncome: false, - showIcons: false, - tabController: _tabController, - expenseLabel: "one-time".tr(), - expenseCustomIcon: Icon( - appStateSettings[ - "outlinedIcons"] - ? Icons - .event_available_outlined - : Icons - .event_available_rounded, - ), - incomeLabel: "long-term".tr(), - incomeCustomIcon: Icon( - appStateSettings[ - "outlinedIcons"] - ? Icons.av_timer_outlined - : Icons.av_timer_rounded, + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: + getHorizontalPaddingConstrained( + context), + ), + child: Row( + children: [ + Expanded( + child: IncomeExpenseTabSelector( + hasBorderRadius: true, + onTabChanged: (_) {}, + initialTabIsIncome: false, + showIcons: false, + tabController: _tabController, + expenseLabel: "one-time".tr(), + expenseCustomIcon: Icon( + appStateSettings[ + "outlinedIcons"] + ? Icons + .event_available_outlined + : Icons + .event_available_rounded, + ), + incomeLabel: "long-term".tr(), + incomeCustomIcon: Icon( + appStateSettings[ + "outlinedIcons"] + ? Icons.av_timer_outlined + : Icons.av_timer_rounded, + ), ), ), - ), - AnimatedBuilder( - animation: - _tabController.animation!, - builder: (BuildContext context, - Widget? child) { - return ClipRRect( - borderRadius: - BorderRadius.circular(15), - child: SizeTransition( - sizeFactor: - _tabController.animation!, - axis: Axis.horizontal, - child: FadeTransition( - opacity: _tabController + AnimatedBuilder( + animation: + _tabController.animation!, + builder: (BuildContext context, + Widget? child) { + return ClipRRect( + borderRadius: + BorderRadius.circular(15), + child: SizeTransition( + sizeFactor: _tabController .animation!, - child: Padding( - padding: - const EdgeInsets.only( - left: 7), - child: ButtonIcon( - size: 48, - iconPadding: 25, - key: ValueKey(2), - onTap: () { - pushRoute( - context, - EditObjectivesPage( - objectiveType: - ObjectiveType - .loan, - ), - ); - }, - icon: appStateSettings[ - "outlinedIcons"] - ? Icons - .edit_outlined - : Icons - .edit_rounded, + axis: Axis.horizontal, + child: FadeTransition( + opacity: _tabController + .animation!, + child: Padding( + padding: + const EdgeInsets + .only(left: 7), + child: ButtonIcon( + size: 48, + iconPadding: 25, + key: ValueKey(2), + onTap: () { + pushRoute( + context, + EditObjectivesPage( + objectiveType: + ObjectiveType + .loan, + ), + ); + }, + icon: appStateSettings[ + "outlinedIcons"] + ? Icons + .edit_outlined + : Icons + .edit_rounded, + ), ), ), ), - ), - ); - }, - ), - ], + ); + }, + ), + ], + ), ), ), ), ), - ), - ...loanInfoAppBar, - ], - ), - ), - ]; - }, - body: Builder( - builder: (contextPageView) { - return TabBarView( - controller: _tabController, - children: [ - CustomScrollView( - slivers: [ - SliverPinnedOverlapInjector( - handle: NestedScrollView - .sliverOverlapAbsorberHandleFor( - contextPageView, - ), - ), - ...oneTimeLoanList(true) + ...loanInfoAppBar, ], ), - CustomScrollView( - slivers: [ - SliverPinnedOverlapInjector( - handle: NestedScrollView - .sliverOverlapAbsorberHandleFor( - contextPageView, - ), - ), - ObjectiveListDifferenceLoan( - searchFor: searchValue, - ), - ...longTermLoansList - ], - ), - ], - ); + ), + ]; }, - ), - ); - }, - ); - }, - ), + body: Builder( + builder: (contextPageView) { + return TabBarView( + controller: _tabController, + children: [ + CustomScrollView( + slivers: [ + SliverPinnedOverlapInjector( + handle: NestedScrollView + .sliverOverlapAbsorberHandleFor( + contextPageView, + ), + ), + ...oneTimeLoanList(true) + ], + ), + CustomScrollView( + slivers: [ + SliverPinnedOverlapInjector( + handle: NestedScrollView + .sliverOverlapAbsorberHandleFor( + contextPageView, + ), + ), + ObjectiveListDifferenceLoan( + searchFor: searchValue, + ), + ...longTermLoansList + ], + ), + ], + ); + }, + ), + ); + }, + ); + }), SelectedTransactionsAppBar( pageID: pageId, enableSettleAllButton: true, diff --git a/budget/lib/pages/debugPage.dart b/budget/lib/pages/debugPage.dart index 9153214d..61fc1b69 100644 --- a/budget/lib/pages/debugPage.dart +++ b/budget/lib/pages/debugPage.dart @@ -43,7 +43,6 @@ class DebugPage extends StatelessWidget { fontWeight: FontWeight.bold, fontSize: 20, maxLines: 5, - textAlign: TextAlign.center, ), subtitleAlignment: Alignment.bottomLeft, subtitleSize: 10, diff --git a/budget/lib/widgets/showChangelog.dart b/budget/lib/widgets/showChangelog.dart index 7ca6d96d..6e8a3a85 100644 --- a/budget/lib/widgets/showChangelog.dart +++ b/budget/lib/widgets/showChangelog.dart @@ -37,6 +37,7 @@ String getChangelogString() { Added info point about next repetitive transaction will be generated after current marked as paid Titles with the same category and name are automatically deleted Manual adding/editing of associated title can be configured to subcategory + Add hint text about editing homepage sections Fix associated titles order priority when recommending title Fix upcoming transactions not marked as paid when notification activated Fix if decimal precision limit empty when entering amount, default to 2 instead of 0