Changed list details modal opening

This commit is contained in:
Juan Gilsanz Polo 2023-11-15 18:28:10 +01:00
parent 1ea71265e2
commit ad42438ce3
5 changed files with 87 additions and 64 deletions

View file

@ -669,5 +669,6 @@
"showTopItemsChart": "Show top items chart",
"showTopItemsChartDescription": "Shows by default the ring chart on the top items sections. Only affects to the mobile view.",
"openMenu": "Open menu",
"closeMenu": "Close menu"
"closeMenu": "Close menu",
"openListUrl": "Open list URL"
}

View file

@ -669,5 +669,6 @@
"showTopItemsChart": "Mostrar gráfico en top de items",
"showTopItemsChartDescription": "Muestra por defecto el gráfico de anillo en las secciones de top de items. Sólo afecta a la vista móvil.",
"openMenu": "Abrir menú",
"closeMenu": "Cerrar menú"
"closeMenu": "Cerrar menú",
"openListUrl": "Abrir URL de lista"
}

View file

@ -190,28 +190,31 @@ class _FiltersState extends State<Filters> {
}
void openListDetails(Filter filter, String type) {
if (width > 900 || !(Platform.isAndroid || Platform.isIOS)) {
showDialog(
context: context,
builder: (context) => ListDetailsScreen(
listId: filter.id,
type: type,
dialog: true,
),
barrierDismissible: false
);
}
else {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => ListDetailsScreen(
listId: filter.id,
type: type,
dialog: false,
)
)
);
}
showGeneralDialog(
context: context,
barrierColor: !(width > 900 || !(Platform.isAndroid | Platform.isIOS))
?Colors.transparent
: Colors.black54,
transitionBuilder: (context, anim1, anim2, child) {
return SlideTransition(
position: Tween(
begin: const Offset(0, 1),
end: const Offset(0, 0)
).animate(
CurvedAnimation(
parent: anim1,
curve: Curves.easeInOutCubicEmphasized
)
),
child: child,
);
},
pageBuilder: (context, animation, secondaryAnimation) => ListDetailsScreen(
listId: filter.id,
type: type,
dialog: width > 900 || !(Platform.isAndroid | Platform.isIOS),
),
);
}
List<Widget> actions() {

View file

@ -352,47 +352,52 @@ class _ListDetailsScreenState extends State<ListDetailsScreen> {
);
}
else {
return Scaffold(
appBar: AppBar(
title: Text(AppLocalizations.of(context)!.listDetails),
actions: list != null ? actions() : null,
),
body: Stack(
children: [
if (list != null) ListView(
children: content(),
return Dialog.fullscreen(
child: Scaffold(
appBar: AppBar(
leading: CloseButton(
onPressed: () => Navigator.pop(context),
),
if (list == null) Center(
child: Text(
AppLocalizations.of(context)!.listNotAvailable,
style: const TextStyle(
fontSize: 24,
title: Text(AppLocalizations.of(context)!.listDetails),
actions: list != null ? actions() : null,
),
body: Stack(
children: [
if (list != null) ListView(
children: content(),
),
if (list == null) Center(
child: Text(
AppLocalizations.of(context)!.listNotAvailable,
style: const TextStyle(
fontSize: 24,
),
),
),
),
if (list != null) AnimatedPositioned(
duration: const Duration(milliseconds: 100),
curve: Curves.easeInOut,
bottom: fabVisible ?
appConfigProvider.showingSnackbar
? 70 : (Platform.isIOS ? 40 : 20)
: -70,
right: 20,
child: FloatingActionButton(
onPressed: () => updateList(
action: list!.enabled == true
? FilteringListActions.disable
: FilteringListActions.enable,
filterList: list
if (list != null) AnimatedPositioned(
duration: const Duration(milliseconds: 100),
curve: Curves.easeInOut,
bottom: fabVisible ?
appConfigProvider.showingSnackbar
? 70 : (Platform.isIOS ? 40 : 20)
: -70,
right: 20,
child: FloatingActionButton(
onPressed: () => updateList(
action: list!.enabled == true
? FilteringListActions.disable
: FilteringListActions.enable,
filterList: list
),
child: Icon(
list.enabled == true
? Icons.gpp_bad_rounded
: Icons.verified_user_rounded,
),
),
child: Icon(
list.enabled == true
? Icons.gpp_bad_rounded
: Icons.verified_user_rounded,
),
),
)
],
)
],
),
),
);
}

View file

@ -1,6 +1,7 @@
// ignore_for_file: use_build_context_synchronously
import 'package:adguard_home_manager/classes/process_modal.dart';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:contextmenu/contextmenu.dart';
import 'package:provider/provider.dart';
@ -9,6 +10,8 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:adguard_home_manager/widgets/custom_list_tile.dart';
import 'package:adguard_home_manager/widgets/options_modal.dart';
import 'package:adguard_home_manager/functions/open_url.dart';
import 'package:adguard_home_manager/classes/process_modal.dart';
import 'package:adguard_home_manager/functions/snackbar.dart';
import 'package:adguard_home_manager/models/filtering.dart';
import 'package:adguard_home_manager/providers/filtering_provider.dart';
@ -92,11 +95,16 @@ class ListOptionsMenu extends StatelessWidget {
);
}
),
CustomListTile(
title: AppLocalizations.of(context)!.openListUrl,
icon: Icons.open_in_browser_rounded,
onTap: () => openUrl(list.url)
),
],
child: Material(
color: Colors.transparent,
child: InkWell(
onLongPress: () => showDialog(
onLongPress: Platform.isAndroid || Platform.isIOS ? () => showDialog(
context: context,
builder: (context) => OptionsModal(
options: [
@ -117,9 +125,14 @@ class ListOptionsMenu extends StatelessWidget {
successMessage: AppLocalizations.of(context)!.listUrlCopied
)
),
MenuOption(
title: AppLocalizations.of(context)!.openListUrl,
icon: Icons.open_in_browser_rounded,
action: () => openUrl(list.url)
),
]
)
),
) : null,
child: child
),
),