-
Notifications
You must be signed in to change notification settings - Fork 21
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 #113 from enrique-lozano/feat/account-display-order
Display order for accounts and tags
- Loading branch information
Showing
22 changed files
with
545 additions
and
244 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,3 +1,8 @@ | ||
DELETE FROM userSettings WHERE settingKey = 'transactionMobileMode'; | ||
|
||
ALTER TABLE accounts ADD COLUMN color TEXT; | ||
ALTER TABLE accounts ADD COLUMN color TEXT; | ||
ALTER TABLE accounts ADD COLUMN displayOrder INTEGER NOT NULL DEFAULT 0; | ||
|
||
ALTER TABLE tags ADD COLUMN displayOrder INTEGER NOT NULL DEFAULT 0; | ||
|
||
ALTER TABLE categories ADD COLUMN displayOrder INTEGER NOT NULL DEFAULT 0; |
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
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,55 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter/services.dart'; | ||
|
||
class MonekinReorderableList extends StatefulWidget { | ||
const MonekinReorderableList({ | ||
super.key, | ||
required this.itemBuilder, | ||
required this.onReorder, | ||
required this.totalItemCount, | ||
}); | ||
|
||
final Widget Function(BuildContext context, int index) itemBuilder; | ||
final void Function(int from, int to) onReorder; | ||
|
||
final int totalItemCount; | ||
|
||
@override | ||
State<MonekinReorderableList> createState() => _MonekinReorderableListState(); | ||
} | ||
|
||
class _MonekinReorderableListState extends State<MonekinReorderableList> { | ||
int? isOrderingItem; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return ReorderableListView.builder( | ||
shrinkWrap: true, | ||
physics: const NeverScrollableScrollPhysics(), | ||
itemBuilder: (context, index) => Opacity( | ||
key: Key(index.toString()), | ||
opacity: isOrderingItem == null || isOrderingItem == index ? 1 : 0.4, | ||
child: ReorderableDelayedDragStartListener( | ||
index: index, | ||
enabled: widget.totalItemCount > 1, | ||
child: widget.itemBuilder(context, index), | ||
), | ||
), | ||
buildDefaultDragHandles: false, | ||
itemCount: widget.totalItemCount, | ||
onReorder: (from, to) => widget.onReorder(from, to), | ||
onReorderStart: (index) { | ||
HapticFeedback.lightImpact(); | ||
|
||
setState(() { | ||
isOrderingItem = index; | ||
}); | ||
}, | ||
onReorderEnd: (index) { | ||
setState(() { | ||
isOrderingItem = null; | ||
}); | ||
}, | ||
); | ||
} | ||
} |
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
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.