-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #154 from enrique-lozano/feat/input-styles
Pick a color for each account and new style for the app inputs
- Loading branch information
Showing
23 changed files
with
724 additions
and
637 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 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,95 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:monekin/core/extensions/color.extensions.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/app_colors.dart'; | ||
import 'package:monekin/core/presentation/widgets/color_picker/color_picker.dart'; | ||
import 'package:monekin/core/presentation/widgets/color_picker/color_picker_modal.dart'; | ||
import 'package:monekin/core/presentation/widgets/icon_selector_modal.dart'; | ||
import 'package:monekin/core/presentation/widgets/tappable.dart'; | ||
import 'package:monekin/i18n/translations.g.dart'; | ||
|
||
class IconAndColorSelector extends StatelessWidget { | ||
const IconAndColorSelector( | ||
{super.key, | ||
required this.iconSelectorModalSubtitle, | ||
required this.iconDisplayer, | ||
required this.onDataChange, | ||
required this.data}); | ||
|
||
final String iconSelectorModalSubtitle; | ||
|
||
final void Function(({SupportedIcon icon, Color color}) data) onDataChange; | ||
|
||
final ({SupportedIcon icon, Color color}) data; | ||
final IconDisplayer iconDisplayer; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final t = Translations.of(context); | ||
|
||
return Container( | ||
clipBehavior: Clip.hardEdge, | ||
decoration: BoxDecoration( | ||
color: AppColors.of(context).inputFill, | ||
borderRadius: BorderRadius.circular(12), | ||
), | ||
child: Row( | ||
children: [ | ||
Padding( | ||
padding: const EdgeInsets.symmetric(vertical: 0, horizontal: 16), | ||
child: iconDisplayer, | ||
), | ||
Flexible( | ||
child: Column( | ||
children: [ | ||
Tappable( | ||
onTap: () { | ||
showIconSelectorModal( | ||
context, | ||
IconSelectorModal( | ||
preselectedIconID: data.icon.id, | ||
subtitle: iconSelectorModalSubtitle, | ||
onIconSelected: (selectedIcon) { | ||
onDataChange((color: data.color, icon: selectedIcon)); | ||
}, | ||
), | ||
); | ||
}, | ||
bgColor: AppColors.of(context).inputFill, | ||
child: ListTile( | ||
title: Text(t.icon_selector.icon), | ||
trailing: | ||
const Icon(Icons.arrow_forward_ios_rounded, size: 12), | ||
), | ||
), | ||
Divider(color: AppColors.of(context).inputFill.darken()), | ||
Tappable( | ||
onTap: () => showColorPickerModal( | ||
context, | ||
ColorPickerModal( | ||
colorOptions: defaultColorPickerOptions, | ||
selectedColor: data.color.toHex(), | ||
), | ||
).then((selColor) { | ||
if (selColor == null) return; | ||
|
||
onDataChange((color: selColor, icon: data.icon)); | ||
}), | ||
bgColor: AppColors.of(context).inputFill, | ||
child: ListTile( | ||
title: Text(t.icon_selector.color), | ||
trailing: Icon( | ||
Icons.circle, | ||
color: data.color, | ||
), | ||
), | ||
), | ||
], | ||
), | ||
) | ||
], | ||
), | ||
); | ||
} | ||
} |
This file contains 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
Oops, something went wrong.