editable label & color
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:krezus/domains/account/account_bloc.dart';
|
||||
import 'package:krezus/pages/common/editable_color.dart';
|
||||
import 'package:krezus/pages/common/editable_label.dart';
|
||||
import 'package:krezus/pages/common/titled_container.dart';
|
||||
import 'package:krezus/repositories/metadata/models/account.dart';
|
||||
|
||||
@@ -10,10 +12,9 @@ class AccountSettings extends StatelessWidget {
|
||||
List<Widget> _computeCategoryList(BuildContext context, List<Account> accounts) {
|
||||
return accounts.map((account) => Row(
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () {},
|
||||
icon: const Icon(Icons.palette),
|
||||
EditableColor(
|
||||
color: account.rgbToColor(),
|
||||
onChanged: (color) => context.read<AccountBloc>().add(AccountEditColor(account, color.value.toRadixString(16).toUpperCase().padLeft(8, '0'))),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () => context.read<AccountBloc>().add(AccountEditSaving(account, !account.saving)),
|
||||
@@ -22,11 +23,12 @@ class AccountSettings extends StatelessWidget {
|
||||
),
|
||||
Container(width: 5),
|
||||
Expanded(
|
||||
child: Text(account.label)
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {},
|
||||
icon: const Icon(Icons.edit),
|
||||
child: EditableLabel(
|
||||
initialValue: account.label,
|
||||
onChanged: (value) => context.read<AccountBloc>().add(AccountEditLabel(account, value)),
|
||||
hintText: 'Acount name',
|
||||
keyboardType: TextInputType.text,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () => context.read<AccountBloc>().add(AccountRemove(account)),
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:krezus/domains/category/category_bloc.dart';
|
||||
import 'package:krezus/pages/common/editable_color.dart';
|
||||
import 'package:krezus/pages/common/editable_label.dart';
|
||||
import 'package:krezus/pages/common/titled_container.dart';
|
||||
import 'package:krezus/repositories/metadata/models/category.dart';
|
||||
|
||||
@@ -10,10 +12,9 @@ class CategoriesSettings extends StatelessWidget {
|
||||
List<Widget> _computeCategoryList(BuildContext context, List<Category> categories) {
|
||||
return categories.map((category) => Row(
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () {},
|
||||
icon: const Icon(Icons.palette),
|
||||
EditableColor(
|
||||
color: category.rgbToColor(),
|
||||
onChanged: (color) => context.read<CategoryBloc>().add(CategoryEditColor(category, color.value.toRadixString(16).toUpperCase().padLeft(8, '0'))),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () => context.read<CategoryBloc>().add(CategoryEditTransfert(category, !category.transfert)),
|
||||
@@ -27,11 +28,12 @@ class CategoriesSettings extends StatelessWidget {
|
||||
),
|
||||
Container(width: 5),
|
||||
Expanded(
|
||||
child: Text(category.label)
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {},
|
||||
icon: const Icon(Icons.edit),
|
||||
child: EditableLabel(
|
||||
initialValue: category.label,
|
||||
onChanged: (value) => context.read<CategoryBloc>().add(CategoryEditLabel(category, value)),
|
||||
hintText: 'Acount name',
|
||||
keyboardType: TextInputType.text,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () => context.read<CategoryBloc>().add(CategoryRemove(category)),
|
||||
|
||||
@@ -16,7 +16,7 @@ class ImportSettings extends StatelessWidget {
|
||||
children: [
|
||||
FilledButton.icon(
|
||||
onPressed: () => context.read<AccountBloc>().add(const ClearData()),
|
||||
label: const Text('ClearData'),
|
||||
label: const Text('Clear all data'),
|
||||
icon: const Icon(Icons.delete_forever),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
|
||||
Reference in New Issue
Block a user