fix: move new category button to the top
This commit is contained in:
parent
131ebfb8ce
commit
771f7a3555
2 changed files with 47 additions and 47 deletions
|
@ -120,6 +120,27 @@ class _EditCategoriesViewState extends State<EditCategoriesView> {
|
|||
AppLocalizations.of(context).setupCategoriesEditHint,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
selectedWallet!.categories.add(
|
||||
WalletCategory(
|
||||
name: AppLocalizations.of(context)
|
||||
.setupWalletNamePlaceholder,
|
||||
id: selectedWallet!.nextCategoryId,
|
||||
icon: IconData(
|
||||
Icons.question_mark.codePoint,
|
||||
fontFamily: 'MaterialIcons',
|
||||
),
|
||||
color: Colors.blueGrey.harmonizeWith(
|
||||
Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
);
|
||||
await WalletManager.saveWallet(selectedWallet!);
|
||||
setState(() {});
|
||||
},
|
||||
icon: const Icon(Icons.add),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.64,
|
||||
child: ListView.builder(
|
||||
|
@ -260,27 +281,6 @@ class _EditCategoriesViewState extends State<EditCategoriesView> {
|
|||
itemCount: selectedWallet!.categories.length,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
selectedWallet!.categories.add(
|
||||
WalletCategory(
|
||||
name: AppLocalizations.of(context)
|
||||
.setupWalletNamePlaceholder,
|
||||
id: selectedWallet!.nextCategoryId,
|
||||
icon: IconData(
|
||||
Icons.question_mark.codePoint,
|
||||
fontFamily: 'MaterialIcons',
|
||||
),
|
||||
color: Colors.blueGrey.harmonizeWith(
|
||||
Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
);
|
||||
await WalletManager.saveWallet(selectedWallet!);
|
||||
setState(() {});
|
||||
},
|
||||
icon: const Icon(Icons.add),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
|
@ -303,6 +303,32 @@ class _SetupViewState extends State<SetupView> {
|
|||
AppLocalizations.of(context).setupCategoriesEditHint,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
var id = 0;
|
||||
while (categories
|
||||
.where((element) => element.id == id)
|
||||
.isNotEmpty) {
|
||||
id++; // create unique ID
|
||||
}
|
||||
categories.add(
|
||||
WalletCategory(
|
||||
name: AppLocalizations.of(context)
|
||||
.setupWalletNamePlaceholder,
|
||||
id: id,
|
||||
icon: IconData(
|
||||
Icons.question_mark.codePoint,
|
||||
fontFamily: 'MaterialIcons',
|
||||
),
|
||||
color: Colors.blueGrey.harmonizeWith(
|
||||
Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
);
|
||||
setState(() {});
|
||||
},
|
||||
icon: const Icon(Icons.add),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.64,
|
||||
child: ListView.builder(
|
||||
|
@ -439,32 +465,6 @@ class _SetupViewState extends State<SetupView> {
|
|||
itemCount: categories.length,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
var id = 0;
|
||||
while (categories
|
||||
.where((element) => element.id == id)
|
||||
.isNotEmpty) {
|
||||
id++; // create unique ID
|
||||
}
|
||||
categories.add(
|
||||
WalletCategory(
|
||||
name: AppLocalizations.of(context)
|
||||
.setupWalletNamePlaceholder,
|
||||
id: id,
|
||||
icon: IconData(
|
||||
Icons.question_mark.codePoint,
|
||||
fontFamily: 'MaterialIcons',
|
||||
),
|
||||
color: Colors.blueGrey.harmonizeWith(
|
||||
Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
);
|
||||
setState(() {});
|
||||
},
|
||||
icon: const Icon(Icons.add),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue