-
Notifications
You must be signed in to change notification settings - Fork 2
Feature/transaction bottomsheet #102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
3dd523b
fix: remove duplicate AccountSetupCubit registration in GetIt
marah222 badd909
refactor: use iconCancel from AppAssets in MBottomSheet
marah222 aeebbff
feat: add TransactionTypeCard widget
marah222 f945899
feat: add Add Transaction bottom sheet
marah222 ea3d769
feat: localize Add Transaction bottom sheet
marah222 fb9019f
feat: add transaction assets
marah222 ba2b4b6
feat: add icon size
marah222 862c35e
feat: add categories filter bottom sheet
marah222 6fa811f
feat: add category filtering to transactions
marah222 6ea23b4
feat: add localization strings for categories filter
marah222 ae71095
Merge branch 'dev' into feature/transaction-bottomsheet
marah222 2ac9af8
feat: add localization strings for categories filter
marah222 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
lib/presentation/transactions/widget/add_transaction_bottom_sheet.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:moneyplus/core/l10n/app_localizations.dart'; | ||
| import 'package:moneyplus/design_system/assets/app_assets.dart'; | ||
| import 'package:moneyplus/design_system/constants/design_constants.dart'; | ||
| import 'package:moneyplus/design_system/theme/money_extension_context.dart'; | ||
| import 'package:moneyplus/design_system/widgets/bottom_sheet.dart'; | ||
| import 'package:moneyplus/design_system/widgets/buttons/button/default_button.dart'; | ||
| import 'package:moneyplus/domain/entity/transaction_type.dart'; | ||
| import 'package:moneyplus/presentation/navigation/routes.dart'; | ||
| import 'package:moneyplus/presentation/transactions/widget/transaction_type_card.dart'; | ||
| import 'package:moneyplus/utils/extenstions/show_bottom_sheet.dart'; | ||
|
|
||
| class AddTransactionBottomSheet extends StatefulWidget { | ||
| final BuildContext parentContext; | ||
|
|
||
| const AddTransactionBottomSheet({ | ||
| super.key, | ||
| required this.parentContext, | ||
| }); | ||
|
|
||
| @override | ||
| State<AddTransactionBottomSheet> createState() => | ||
| _AddTransactionBottomSheetState(); | ||
| } | ||
|
|
||
| class _AddTransactionBottomSheetState extends State<AddTransactionBottomSheet> { | ||
| TransactionType? _selectedType; | ||
|
|
||
| void _selectType(TransactionType type) { | ||
| setState(() { | ||
| _selectedType = type; | ||
| }); | ||
| } | ||
|
|
||
| void _onContinue() { | ||
| final selected = _selectedType; | ||
| if (selected == null) return; | ||
|
|
||
| Navigator.of(context).pop(); | ||
| if (selected == TransactionType.income) { | ||
| AddIncomeRoute().push(widget.parentContext); | ||
| } else { | ||
| AddExpenseRoute().push(widget.parentContext); | ||
| } | ||
| } | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| final typography = context.typography; | ||
| final colors = context.colors; | ||
| final l10n = AppLocalizations.of(context)!; | ||
|
|
||
| return MBottomSheet( | ||
| title: l10n.add_transaction, | ||
| content: Column( | ||
| crossAxisAlignment: CrossAxisAlignment.stretch, | ||
| children: [ | ||
| Text( | ||
| l10n.add_transaction_sheet_subtitle, | ||
| style: typography.body.small.copyWith(color: colors.body), | ||
| ), | ||
| const SizedBox(height: DesignConstants.spacingLarge), | ||
| Row( | ||
| children: [ | ||
| Expanded( | ||
| child: TransactionTypeCard( | ||
| label: l10n.addIncome, | ||
| iconPath: AppAssets.icAddAmount, | ||
| selected: _selectedType == TransactionType.income, | ||
| onTap: () => _selectType(TransactionType.income), | ||
| ), | ||
| ), | ||
| const SizedBox(width: DesignConstants.spacingSmall), | ||
| Expanded( | ||
| child: TransactionTypeCard( | ||
| label: l10n.make_expense, | ||
| iconPath: AppAssets.icAddExpense, | ||
| selected: _selectedType == TransactionType.expense, | ||
| onTap: () => _selectType(TransactionType.expense), | ||
| ), | ||
| ), | ||
| ], | ||
| ), | ||
| ], | ||
| ), | ||
| actionButtons: [ | ||
| DefaultButton( | ||
| text: l10n.continueButton, | ||
| isEnabled: _selectedType != null, | ||
| onPressed: _selectedType != null ? _onContinue : null, | ||
| ), | ||
| ], | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| void showAddTransactionBottomSheet(BuildContext context) { | ||
| context.showBlurBottomSheet( | ||
| AddTransactionBottomSheet(parentContext: context), | ||
| ); | ||
| } | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't have end point for current user categories?