Added no items to reorder message

This commit is contained in:
Juan Gilsanz Polo 2024-02-07 19:55:44 +01:00
parent 5ca3c04c89
commit 11dd6b23bd
4 changed files with 25 additions and 9 deletions

View file

@ -771,5 +771,6 @@
"customRulesUpdatedSuccessfully": "Custom rules updated successfully",
"customRulesNotUpdated": "Custom rules could not be updated",
"reorder": "Reorder",
"showHide": "Show/hide"
"showHide": "Show/hide",
"noElementsReorderMessage": "Enable some elements on the show/hide tab to reorder them here."
}

View file

@ -771,5 +771,6 @@
"customRulesUpdatedSuccessfully": "Reglas personalizadas actualizadas correctamente",
"customRulesNotUpdated": "Las reglas personalizadas no pudieron ser actualizadas",
"reorder": "Reordenar",
"showHide": "Mostrar/ocultar"
"showHide": "Mostrar/ocultar",
"noElementsReorderMessage": "Activa algunos elementos en la pestaña de mostrar/ocultar para reordenarlos aquí."
}

View file

@ -370,7 +370,7 @@ class AppConfigProvider with ChangeNotifier {
_hideServerAddress = sharedPreferencesInstance.getBool('hideServerAddress') ?? false;
if (sharedPreferencesInstance.getStringList('homeTopItemsOrder') != null) {
try {
final itemsOrder = List<HomeTopItems>.from(
_homeTopItemsOrder = List<HomeTopItems>.from(
List<String>.from(sharedPreferencesInstance.getStringList('homeTopItemsOrder')!).map((e) {
switch (e) {
case 'queriedDomains':
@ -393,11 +393,6 @@ class AppConfigProvider with ChangeNotifier {
}
}).where((e) => e != null).toList()
);
final missingItems = homeTopItemsDefaultOrder.where((e) => !itemsOrder.contains(e));
_homeTopItemsOrder = [
...itemsOrder,
...missingItems
];
} catch (e) {
Sentry.captureException(e);
_homeTopItemsOrder = homeTopItemsDefaultOrder;

View file

@ -122,7 +122,26 @@ class _ReorderableTopItemsHomeState extends State<ReorderableTopItemsHome> {
),
),
),
reorderable_list.ReorderableList(
if (homeTopItemsList.isEmpty) Padding(
padding: const EdgeInsets.all(16),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
children: [
Center(
child: Text(
AppLocalizations.of(context)!.noElementsReorderMessage,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18,
color: Theme.of(context).colorScheme.onSurfaceVariant
),
),
),
],
),
),
if (homeTopItemsList.isNotEmpty) reorderable_list.ReorderableList(
onReorder: _reorderCallback,
onReorderDone: _reorderDone,
child: ListView.builder(