Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
enrique-lozano committed May 19, 2024
2 parents 97ac79b + 225dcab commit d2cff8a
Show file tree
Hide file tree
Showing 95 changed files with 1,969 additions and 1,324 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ android {
applicationId "com.monekin.app"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 19
minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand Down
482 changes: 233 additions & 249 deletions lib/app/accounts/account_form.dart

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions lib/app/accounts/account_selector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:monekin/core/database/app_db.dart';
import 'package:monekin/core/database/services/account/account_service.dart';
import 'package:monekin/core/extensions/color.extensions.dart';
import 'package:monekin/core/models/account/account.dart';
import 'package:monekin/core/models/supported-icon/icon_displayer.dart';
import 'package:monekin/core/presentation/app_colors.dart';
import 'package:monekin/core/presentation/theme.dart';
import 'package:monekin/core/presentation/widgets/bottomSheetFooter.dart';
import 'package:monekin/core/presentation/widgets/modal_container.dart';
import 'package:monekin/core/utils/color_utils.dart';
import 'package:monekin/i18n/translations.g.dart';

import '../../core/presentation/widgets/icon_displayer_widgets.dart';
Expand Down Expand Up @@ -237,7 +238,7 @@ class _AccountSelectorState extends State<AccountSelector> {
padding: widget.params.iconPadding,
isOutline: selectedAccounts == null,
secondaryColor: AppColors.of(context).background.darken(
Theme.of(context).brightness == Brightness.dark ? 0.6 : 0.1,
isAppInDarkBrightness(context) ? 0.6 : 0.1,
),
mainColor: AppColors.of(context).onBackground,
onTap: () {
Expand Down
4 changes: 2 additions & 2 deletions lib/app/accounts/details/account_details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import 'package:monekin/core/database/services/account/account_service.dart';
import 'package:monekin/core/database/services/exchange-rate/exchange_rate_service.dart';
import 'package:monekin/core/database/services/transaction/transaction_service.dart';
import 'package:monekin/core/models/account/account.dart';
import 'package:monekin/core/models/transaction/transaction_status.dart';
import 'package:monekin/core/models/transaction/transaction_status.enum.dart';
import 'package:monekin/core/presentation/app_colors.dart';
import 'package:monekin/core/presentation/widgets/bottomSheetFooter.dart';
import 'package:monekin/core/presentation/widgets/card_with_header.dart';
import 'package:monekin/core/presentation/widgets/date_form_field/date_form_field.dart';
import 'package:monekin/core/presentation/widgets/form_fields/date_form_field.dart';
import 'package:monekin/core/presentation/widgets/inline_info_card.dart';
import 'package:monekin/core/presentation/widgets/modal_container.dart';
import 'package:monekin/core/presentation/widgets/monekin_quick_actions_buttons.dart';
Expand Down
3 changes: 2 additions & 1 deletion lib/app/accounts/details/account_details_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import 'package:monekin/app/accounts/details/account_details.dart';
import 'package:monekin/app/transactions/form/transaction_form.page.dart';
import 'package:monekin/core/database/services/account/account_service.dart';
import 'package:monekin/core/models/account/account.dart';
import 'package:monekin/core/models/transaction/transaction.dart';
import 'package:monekin/core/presentation/widgets/confirm_dialog.dart';
import 'package:monekin/core/routes/route_utils.dart';
import 'package:monekin/core/utils/list_tile_action_item.dart';
import 'package:monekin/i18n/translations.g.dart';

import '../../../core/models/transaction/transaction_type.enum.dart';

abstract class AccountDetailsActions {
static List<ListTileActionItem> getAccountDetailsActions(
BuildContext context, {
Expand Down
30 changes: 4 additions & 26 deletions lib/app/budgets/budget_form_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import 'package:monekin/core/database/services/currency/currency_service.dart';
import 'package:monekin/core/models/budget/budget.dart';
import 'package:monekin/core/models/category/category.dart';
import 'package:monekin/core/models/date-utils/periodicity.dart';
import 'package:monekin/core/presentation/widgets/date_form_field/date_field.dart';
import 'package:monekin/core/presentation/widgets/date_form_field/date_form_field.dart';
import 'package:monekin/core/presentation/widgets/form_fields/date_field.dart';
import 'package:monekin/core/presentation/widgets/form_fields/date_form_field.dart';
import 'package:monekin/core/presentation/widgets/icon_displayer_widgets.dart';
import 'package:monekin/core/utils/text_field_utils.dart';
import 'package:monekin/core/utils/uuid.dart';
import 'package:monekin/i18n/translations.g.dart';
import 'package:uuid/uuid.dart';

import '../../core/models/account/account.dart';
import '../../core/presentation/widgets/persistent_footer_button.dart';
Expand Down Expand Up @@ -48,28 +48,6 @@ class _BudgetFormPageState extends State<BudgetFormPage> {
DateTime startDate = DateTime.now();
DateTime? endDate;

Widget selector({
required String title,
required String? inputValue,
required Function onClick,
}) {
return TextFormField(
controller: TextEditingController(text: inputValue ?? ''),
readOnly: true,
onTap: () => onClick(),
validator: (value) {
if (inputValue == null) {
return 'Please, specify at least one item here';
}

return null;
},
decoration: InputDecoration(
labelText: title,
suffixIcon: const Icon(Icons.arrow_drop_down),
));
}

submitForm() {
final t = Translations.of(context);

Expand All @@ -92,7 +70,7 @@ class _BudgetFormPageState extends State<BudgetFormPage> {
final Budget toPush;

toPush = Budget(
id: isEditMode ? widget.budgetToEdit!.id : const Uuid().v4(),
id: isEditMode ? widget.budgetToEdit!.id : generateUUID(),
name: nameController.text,
limitAmount: valueToNumber!,
intervalPeriod: intervalPeriod,
Expand Down
2 changes: 1 addition & 1 deletion lib/app/budgets/components/budget_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:monekin/core/presentation/widgets/number_ui_formatters/currency_
import 'package:monekin/core/presentation/widgets/skeleton.dart';
import 'package:monekin/core/presentation/widgets/tappable.dart';
import 'package:monekin/core/routes/route_utils.dart';
import 'package:monekin/core/utils/color_utils.dart';
import 'package:monekin/core/extensions/color.extensions.dart';
import 'package:monekin/i18n/translations.g.dart';

class BudgetCard extends StatelessWidget {
Expand Down
3 changes: 1 addition & 2 deletions lib/app/budgets/components/budget_evolution_chart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:monekin/app/stats/widgets/fund_evolution_line_chart.dart';
import 'package:monekin/core/models/budget/budget.dart';
import 'package:monekin/core/utils/color_utils.dart';
import 'package:monekin/i18n/translations.g.dart';

import '../../../core/presentation/app_colors.dart';
Expand Down Expand Up @@ -85,7 +84,7 @@ class BudgetEvolutionChart extends StatelessWidget {
]),
lineTouchData: LineTouchData(
touchTooltipData: LineTouchTooltipData(
tooltipBgColor: AppColors.of(context).background,
getTooltipColor: (spot) => AppColors.of(context).background,
tooltipHorizontalAlignment: FLHorizontalAlignment.right,
tooltipMargin: -10,
getTooltipItems: (touchedSpots) {
Expand Down
12 changes: 5 additions & 7 deletions lib/app/categories/categories_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ import 'package:monekin/app/categories/category_selector.dart';
import 'package:monekin/app/categories/form/category_form.dart';
import 'package:monekin/app/categories/subcategory_selector.dart';
import 'package:monekin/core/database/services/category/category_service.dart';
import 'package:monekin/core/extensions/color.extensions.dart';
import 'package:monekin/core/models/category/category.dart';
import 'package:monekin/core/presentation/theme.dart';
import 'package:monekin/core/presentation/widgets/icon_displayer_widgets.dart';
import 'package:monekin/core/presentation/widgets/persistent_footer_button.dart';
import 'package:monekin/core/routes/route_utils.dart';
import 'package:monekin/core/utils/color_utils.dart';
import 'package:monekin/i18n/translations.g.dart';

import '../../core/presentation/app_colors.dart';
Expand Down Expand Up @@ -231,18 +232,15 @@ class _CategoriesListState extends State<CategoriesList> {
),
TabBar(
labelColor:
Theme.of(context).brightness == Brightness.light &&
widget.mode.isModal
isAppInLightBrightness(context) && widget.mode.isModal
? AppColors.of(context).primary
: null,
unselectedLabelColor:
Theme.of(context).brightness == Brightness.light &&
widget.mode.isModal
isAppInLightBrightness(context) && widget.mode.isModal
? AppColors.of(context).onBackground.lighten(0.3)
: null,
indicatorColor:
Theme.of(context).brightness == Brightness.light &&
widget.mode.isModal
isAppInLightBrightness(context) && widget.mode.isModal
? AppColors.of(context).primary
: null,
tabs: [
Expand Down
6 changes: 4 additions & 2 deletions lib/app/categories/category_selector.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:monekin/core/extensions/color.extensions.dart';
import 'package:monekin/core/models/category/category.dart';
import 'package:monekin/core/models/supported-icon/icon_displayer.dart';
import 'package:monekin/core/presentation/app_colors.dart';
import 'package:monekin/core/utils/color_utils.dart';
import 'package:monekin/core/presentation/theme.dart';
import 'package:monekin/i18n/translations.g.dart';

import '../../core/presentation/widgets/icon_displayer_widgets.dart';
Expand Down Expand Up @@ -91,9 +92,10 @@ class _CategorySelectorState extends State<CategorySelector> {
icon: Icons.select_all,
size: widget.params.iconSize,
padding: widget.params.iconPadding,
borderRadius: 99999,
isOutline: selectedCategories == null,
secondaryColor: AppColors.of(context).background.darken(
Theme.of(context).brightness == Brightness.dark ? 0.6 : 0.1,
isAppInDarkBrightness(context) ? 0.6 : 0.1,
),
mainColor: AppColors.of(context).onBackground,
onTap: () {
Expand Down
122 changes: 48 additions & 74 deletions lib/app/categories/form/category_form.dart
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import 'package:drift/drift.dart' as drift;
import 'package:flutter/material.dart';
import 'package:monekin/app/categories/form/category_form_functions.dart';
import 'package:monekin/app/categories/form/icon_and_color_selector.dart';
import 'package:monekin/core/database/app_db.dart';
import 'package:monekin/core/database/services/category/category_service.dart';
import 'package:monekin/core/extensions/color.extensions.dart';
import 'package:monekin/core/extensions/lists.extensions.dart';
import 'package:monekin/core/models/category/category.dart';
import 'package:monekin/core/models/supported-icon/icon_displayer.dart';
import 'package:monekin/core/models/supported-icon/supported_icon.dart';
import 'package:monekin/core/presentation/widgets/color_picker.dart';
import 'package:monekin/core/presentation/widgets/icon_selector_modal.dart';
import 'package:monekin/core/presentation/widgets/color_picker/color_picker.dart';
import 'package:monekin/core/presentation/widgets/persistent_footer_button.dart';
import 'package:monekin/core/services/supported_icon/supported_icon_service.dart';
import 'package:monekin/core/utils/color_utils.dart';
import 'package:monekin/core/utils/constants.dart';
import 'package:monekin/core/utils/text_field_utils.dart';
import 'package:monekin/core/utils/uuid.dart';
import 'package:monekin/i18n/translations.g.dart';
import 'package:uuid/uuid.dart';

class CategoryFormPage extends StatefulWidget {
const CategoryFormPage({super.key, this.categoryUUID});
Expand All @@ -33,9 +33,8 @@ class _CategoryFormPageState extends State<CategoryFormPage> {

final TextEditingController _nameController = TextEditingController();

SupportedIcon _icon = SupportedIconService.instance.defaultSupportedIcon;

String _color = '000000';
SupportedIcon _icon = Category.unkown().icon;
String _color = defaultColorPickerOptions.randomItem();
CategoryType _type = CategoryType.E;

@override
Expand Down Expand Up @@ -109,7 +108,7 @@ class _CategoryFormPageState extends State<CategoryFormPage> {

await CategoryService.instance
.insertCategory(CategoryInDB(
id: const Uuid().v4(),
id: generateUUID(),
name: _nameController.text,
iconId: _icon.id,
displayOrder: 10,
Expand Down Expand Up @@ -211,59 +210,45 @@ class _CategoryFormPageState extends State<CategoryFormPage> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
IconDisplayer(
mainColor: ColorHex.get(_color).lighten(
Theme.of(context).brightness ==
Brightness.dark
? 0.8
: 0),
secondaryColor: ColorHex.get(_color).lighten(
Theme.of(context).brightness ==
Brightness.dark
? 0
: 0.8),
supportedIcon: _icon,
size: 48,
isOutline: true,
outlineWidth: 1,
padding: 6,
borderRadius: 4,
onTap: () {
showIconSelectorModal(
context,
IconSelectorModal(
preselectedIconID: _icon.id,
subtitle: t
.icon_selector.select_category_icon,
onIconSelected: (selectedIcon) {
setState(() {
_icon = selectedIcon;
});
},
),
);
},
IconAndColorSelector(
iconSelectorModalSubtitle:
t.icon_selector.select_category_icon,
iconDisplayer: IconDisplayer.fromCategory(
context,
category: Category.fromDB(
Category.unkown().copyWith(
iconId: _icon.id,
color: drift.Value(_color)),
null,
),
const SizedBox(width: 10),
Expanded(
child: TextFormField(
controller: _nameController,
maxLength: maxLabelLenghtForDisplayNames,
decoration: InputDecoration(
labelText: '${t.categories.name} *',
hintText: 'Ex.: Food',
),
validator: (value) =>
fieldValidator(value, isRequired: true),
autovalidateMode:
AutovalidateMode.onUserInteraction,
textInputAction: TextInputAction.next,
),
)
],
isOutline: true,
size: 48,
padding: 6,
),
onDataChange: ((data) {
setState(() {
_icon = data.icon;
_color = data.color.toHex();
});
}),
data: (
color: ColorHex.get(_color),
icon: _icon,
),
),
const SizedBox(height: 20),
TextFormField(
controller: _nameController,
maxLength: maxLabelLenghtForDisplayNames,
decoration: InputDecoration(
labelText: '${t.categories.name} *',
hintText: 'Ex.: Food',
),
validator: (value) =>
fieldValidator(value, isRequired: true),
autovalidateMode:
AutovalidateMode.onUserInteraction,
textInputAction: TextInputAction.next,
),
const SizedBox(height: 14),
DropdownButtonFormField<CategoryType>(
Expand Down Expand Up @@ -293,22 +278,11 @@ class _CategoryFormPageState extends State<CategoryFormPage> {
});
},
),
const SizedBox(height: 24),
Text(t.icon_selector.color)
const SizedBox(height: 16),
],
),
),
),
ColorPicker(
colorOptions: colorOptions,
selectedColor: _color,
onColorSelected: (selectedColor) {
setState(() {
_color = selectedColor;
});
},
),
const SizedBox(height: 6),
if (widget.categoryUUID != null) ...[
Padding(
padding: const EdgeInsets.symmetric(
Expand Down Expand Up @@ -415,7 +389,7 @@ class _CategoryFormPageState extends State<CategoryFormPage> {
color: _color, onSubmit: (name, icon) {
CategoryService.instance.insertCategory(
CategoryInDB(
id: const Uuid().v4(),
id: generateUUID(),
displayOrder: 10,
name: name,
iconId: icon.id,
Expand Down
Loading

0 comments on commit d2cff8a

Please sign in to comment.