Skip to content

Commit ce656a5

Browse files
committed
feat: integrates the localization extension into the CreateCategoryPage. I will update the DropdownButtonFormField to display the localized status names instead of the temporary placeholder text. I also noticed and removed a duplicated dropdown widget from this file to clean up the code.
1 parent f29fae5 commit ce656a5

File tree

1 file changed

+5
-31
lines changed

1 file changed

+5
-31
lines changed

lib/content_management/view/create_category_page.dart

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import 'package:ht_dashboard/content_management/bloc/content_management_bloc.dar
55
import 'package:ht_dashboard/content_management/bloc/create_category/create_category_bloc.dart';
66
import 'package:ht_dashboard/l10n/l10n.dart';
77
import 'package:ht_dashboard/shared/constants/pagination_constants.dart';
8+
import 'package:ht_dashboard/shared/extensions/content_status_l10n.dart';
89
import 'package:ht_dashboard/shared/shared.dart';
910
import 'package:ht_data_repository/ht_data_repository.dart';
1011
import 'package:ht_shared/ht_shared.dart';
@@ -152,41 +153,14 @@ class _CreateCategoryViewState extends State<_CreateCategoryView> {
152153
items: ContentStatus.values.map((status) {
153154
return DropdownMenuItem(
154155
value: status,
155-
child: Text(
156-
status.name.replaceFirst(
157-
status.name[0],
158-
status.name[0].toUpperCase(),
159-
),
160-
),
161-
);
162-
}).toList(),
163-
onChanged: (value) => context
164-
.read<CreateCategoryBloc>()
165-
.add(CreateCategoryStatusChanged(value!)),
166-
),
167-
const SizedBox(height: AppSpacing.lg),
168-
DropdownButtonFormField<ContentStatus>(
169-
value: state.contentStatus,
170-
decoration: InputDecoration(
171-
labelText: l10n.status,
172-
border: const OutlineInputBorder(),
173-
),
174-
items: ContentStatus.values.map((status) {
175-
return DropdownMenuItem(
176-
value: status,
177-
child: Text(
178-
status.name.replaceFirst(
179-
status.name[0],
180-
status.name[0].toUpperCase(),
181-
),
182-
),
156+
child: Text(status.l10n(context)),
183157
);
184158
}).toList(),
185159
onChanged: (value) {
186160
if (value == null) return;
187-
context.read<CreateCategoryBloc>().add(
188-
CreateCategoryStatusChanged(value),
189-
);
161+
context
162+
.read<CreateCategoryBloc>()
163+
.add(CreateCategoryStatusChanged(value));
190164
},
191165
),
192166
],

0 commit comments

Comments
 (0)