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", "showTopItemsChart": "Show top items chart",
"showTopItemsChartDescription": "Shows by default the ring chart on the top items sections. Only affects to the mobile view.", "showTopItemsChartDescription": "Shows by default the ring chart on the top items sections. Only affects to the mobile view.",
"openMenu": "Open menu", "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", "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.", "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ú", "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) { void openListDetails(Filter filter, String type) {
if (width > 900 || !(Platform.isAndroid || Platform.isIOS)) { showGeneralDialog(
showDialog( context: context,
context: context, barrierColor: !(width > 900 || !(Platform.isAndroid | Platform.isIOS))
builder: (context) => ListDetailsScreen( ?Colors.transparent
listId: filter.id, : Colors.black54,
type: type, transitionBuilder: (context, anim1, anim2, child) {
dialog: true, return SlideTransition(
), position: Tween(
barrierDismissible: false begin: const Offset(0, 1),
); end: const Offset(0, 0)
} ).animate(
else { CurvedAnimation(
Navigator.of(context).push( parent: anim1,
MaterialPageRoute( curve: Curves.easeInOutCubicEmphasized
builder: (context) => ListDetailsScreen( )
listId: filter.id, ),
type: type, child: child,
dialog: false, );
) },
) pageBuilder: (context, animation, secondaryAnimation) => ListDetailsScreen(
); listId: filter.id,
} type: type,
dialog: width > 900 || !(Platform.isAndroid | Platform.isIOS),
),
);
} }
List<Widget> actions() { List<Widget> actions() {

View file

@ -352,47 +352,52 @@ class _ListDetailsScreenState extends State<ListDetailsScreen> {
); );
} }
else { else {
return Scaffold( return Dialog.fullscreen(
appBar: AppBar( child: Scaffold(
title: Text(AppLocalizations.of(context)!.listDetails), appBar: AppBar(
actions: list != null ? actions() : null, leading: CloseButton(
), onPressed: () => Navigator.pop(context),
body: Stack(
children: [
if (list != null) ListView(
children: content(),
), ),
if (list == null) Center( title: Text(AppLocalizations.of(context)!.listDetails),
child: Text( actions: list != null ? actions() : null,
AppLocalizations.of(context)!.listNotAvailable, ),
style: const TextStyle( body: Stack(
fontSize: 24, 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(
if (list != null) AnimatedPositioned( duration: const Duration(milliseconds: 100),
duration: const Duration(milliseconds: 100), curve: Curves.easeInOut,
curve: Curves.easeInOut, bottom: fabVisible ?
bottom: fabVisible ? appConfigProvider.showingSnackbar
appConfigProvider.showingSnackbar ? 70 : (Platform.isIOS ? 40 : 20)
? 70 : (Platform.isIOS ? 40 : 20) : -70,
: -70, right: 20,
right: 20, child: FloatingActionButton(
child: FloatingActionButton( onPressed: () => updateList(
onPressed: () => updateList( action: list!.enabled == true
action: list!.enabled == true ? FilteringListActions.disable
? FilteringListActions.disable : FilteringListActions.enable,
: FilteringListActions.enable, filterList: list
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 // 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:flutter/material.dart';
import 'package:contextmenu/contextmenu.dart'; import 'package:contextmenu/contextmenu.dart';
import 'package:provider/provider.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/custom_list_tile.dart';
import 'package:adguard_home_manager/widgets/options_modal.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/functions/snackbar.dart';
import 'package:adguard_home_manager/models/filtering.dart'; import 'package:adguard_home_manager/models/filtering.dart';
import 'package:adguard_home_manager/providers/filtering_provider.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( child: Material(
color: Colors.transparent, color: Colors.transparent,
child: InkWell( child: InkWell(
onLongPress: () => showDialog( onLongPress: Platform.isAndroid || Platform.isIOS ? () => showDialog(
context: context, context: context,
builder: (context) => OptionsModal( builder: (context) => OptionsModal(
options: [ options: [
@ -117,9 +125,14 @@ class ListOptionsMenu extends StatelessWidget {
successMessage: AppLocalizations.of(context)!.listUrlCopied successMessage: AppLocalizations.of(context)!.listUrlCopied
) )
), ),
MenuOption(
title: AppLocalizations.of(context)!.openListUrl,
icon: Icons.open_in_browser_rounded,
action: () => openUrl(list.url)
),
] ]
) )
), ) : null,
child: child child: child
), ),
), ),