@@ -1123,110 +1123,102 @@ class _MatchWithdrawalsState extends State<_MatchWithdrawals> {
1123
1123
),
1124
1124
),
1125
1125
ListDivider (),
1126
- Expanded (
1127
- child: Column (
1128
- children: [
1129
- Row (
1130
- children: [
1131
- Expanded (
1132
- child: Padding (
1133
- padding: const EdgeInsets .only (
1134
- left: 22 , top: 12 , right: 10 , bottom: 12 ),
1135
- child: SearchText (
1136
- filterController: _categoryFilterController,
1137
- focusNode: _categoryFocusNode,
1138
- onChanged: (value) {
1139
- setState (() {
1140
- updateCategoryList ();
1141
- });
1142
- },
1143
- onCleared: () {
1144
- setState (() {
1145
- _categoryFilterController.text = '' ;
1146
- updateCategoryList ();
1147
- });
1148
- },
1149
- placeholder: localization.searchCategories
1150
- .replaceFirst (':count ' , '' )),
1151
- ),
1152
- ),
1153
- IconButton (
1154
- onPressed: () {
1155
- final completer =
1156
- snackBarCompleter <ExpenseCategoryEntity >(
1157
- context,
1158
- localization.createdExpenseCategory);
1159
- createEntity (
1160
- context: context,
1161
- entity: ExpenseCategoryEntity (
1162
- state: viewModel.state),
1163
- force: true ,
1164
- completer: completer,
1165
- cancelCompleter: Completer <Null >()
1166
- ..future.then ((_) {
1167
- store.dispatch (UpdateCurrentRoute (
1168
- TransactionScreen .route));
1169
- }));
1170
- completer.future
1171
- .then ((SelectableEntity category) {
1172
- store.dispatch (SaveTransactionSuccess (
1173
- transaction.rebuild ((b) =>
1174
- b..pendingCategoryId = category.id)));
1175
- store.dispatch (UpdateCurrentRoute (
1176
- TransactionScreen .route));
1126
+ Row (
1127
+ children: [
1128
+ Expanded (
1129
+ child: Padding (
1130
+ padding: const EdgeInsets .only (
1131
+ left: 22 , top: 12 , right: 10 , bottom: 12 ),
1132
+ child: SearchText (
1133
+ filterController: _categoryFilterController,
1134
+ focusNode: _categoryFocusNode,
1135
+ onChanged: (value) {
1136
+ setState (() {
1137
+ updateCategoryList ();
1177
1138
});
1178
1139
},
1179
- icon: Icon (Icons .add),
1180
- ),
1181
- SizedBox (width: 8 ),
1182
- ],
1183
- ),
1184
- ListDivider (),
1185
- Expanded (
1186
- child: Scrollbar (
1187
- thumbVisibility: true ,
1188
- controller: _categoryScrollController,
1189
- child: ListView .separated (
1190
- controller: _categoryScrollController,
1191
- separatorBuilder: (context, index) => ListDivider (),
1192
- itemCount: _categories.length,
1193
- itemBuilder: (BuildContext context, int index) {
1194
- final category = _categories[index];
1195
- return ExpenseCategoryListItem (
1196
- expenseCategory: category,
1197
- showCheck: true ,
1198
- isChecked: _selectedCategory? .id == category.id,
1199
- onTap: () => setState (() {
1200
- if (_selectedCategory? .id == category.id) {
1201
- _selectedCategory = null ;
1202
- } else {
1203
- _selectedCategory = category;
1204
- }
1205
- updateCategoryList ();
1206
- store.dispatch (SaveTransactionSuccess (
1207
- transaction.rebuild ((b) => b
1208
- ..pendingCategoryId =
1209
- _selectedCategory? .id)));
1210
- }),
1211
- );
1140
+ onCleared: () {
1141
+ setState (() {
1142
+ _categoryFilterController.text = '' ;
1143
+ updateCategoryList ();
1144
+ });
1212
1145
},
1213
- ),
1214
- ),
1146
+ placeholder : localization.searchCategories
1147
+ . replaceFirst ( ':count ' , '' ) ),
1215
1148
),
1216
- if (transaction.category.isNotEmpty &&
1217
- _selectedCategory == null )
1218
- Padding (
1219
- padding: const EdgeInsets .symmetric (
1220
- horizontal: 16 , vertical: 12 ),
1221
- child: Text (
1222
- '${localization .defaultCategory }: ${transaction .category }' ,
1223
- textAlign: TextAlign .center,
1224
- style: TextStyle (color: Colors .grey),
1225
- ),
1226
- ),
1227
- ],
1149
+ ),
1150
+ IconButton (
1151
+ onPressed: () {
1152
+ final completer =
1153
+ snackBarCompleter <ExpenseCategoryEntity >(
1154
+ context, localization.createdExpenseCategory);
1155
+ createEntity (
1156
+ context: context,
1157
+ entity:
1158
+ ExpenseCategoryEntity (state: viewModel.state),
1159
+ force: true ,
1160
+ completer: completer,
1161
+ cancelCompleter: Completer <Null >()
1162
+ ..future.then ((_) {
1163
+ store.dispatch (UpdateCurrentRoute (
1164
+ TransactionScreen .route));
1165
+ }));
1166
+ completer.future.then ((SelectableEntity category) {
1167
+ store.dispatch (SaveTransactionSuccess (
1168
+ transaction.rebuild (
1169
+ (b) => b..pendingCategoryId = category.id)));
1170
+ store.dispatch (
1171
+ UpdateCurrentRoute (TransactionScreen .route));
1172
+ });
1173
+ },
1174
+ icon: Icon (Icons .add),
1175
+ ),
1176
+ SizedBox (width: 8 ),
1177
+ ],
1178
+ ),
1179
+ ListDivider (),
1180
+ Expanded (
1181
+ child: Scrollbar (
1182
+ thumbVisibility: true ,
1183
+ controller: _categoryScrollController,
1184
+ child: ListView .separated (
1185
+ controller: _categoryScrollController,
1186
+ separatorBuilder: (context, index) => ListDivider (),
1187
+ itemCount: _categories.length,
1188
+ itemBuilder: (BuildContext context, int index) {
1189
+ final category = _categories[index];
1190
+ return ExpenseCategoryListItem (
1191
+ expenseCategory: category,
1192
+ showCheck: true ,
1193
+ isChecked: _selectedCategory? .id == category.id,
1194
+ onTap: () => setState (() {
1195
+ if (_selectedCategory? .id == category.id) {
1196
+ _selectedCategory = null ;
1197
+ } else {
1198
+ _selectedCategory = category;
1199
+ }
1200
+ updateCategoryList ();
1201
+ store.dispatch (SaveTransactionSuccess (
1202
+ transaction.rebuild ((b) => b
1203
+ ..pendingCategoryId =
1204
+ _selectedCategory? .id)));
1205
+ }),
1206
+ );
1207
+ },
1208
+ ),
1228
1209
),
1229
1210
),
1211
+ if (transaction.category.isNotEmpty &&
1212
+ _selectedCategory == null )
1213
+ Padding (
1214
+ padding: const EdgeInsets .symmetric (
1215
+ horizontal: 16 , vertical: 12 ),
1216
+ child: Text (
1217
+ '${localization .defaultCategory }: ${transaction .category }' ,
1218
+ textAlign: TextAlign .center,
1219
+ style: TextStyle (color: Colors .grey),
1220
+ ),
1221
+ ),
1230
1222
],
1231
1223
),
1232
1224
),
0 commit comments