diff --git a/lib/widget/viewer.dart b/lib/widget/viewer.dart index 0bed9364..380f1301 100644 --- a/lib/widget/viewer.dart +++ b/lib/widget/viewer.dart @@ -178,9 +178,33 @@ class _ViewerState extends State { ? k.animationDurationNormal : const Duration(milliseconds: 1), child: ViewerBottomAppBar( - onSharePressed: () => _onSharePressed(context), - onDownloadPressed: () => _onDownloadPressed(context), - onDeletePressed: () => _onDeletePressed(context), + children: [ + if (platform_k.isAndroid) + IconButton( + icon: Icon( + Icons.share_outlined, + color: Colors.white.withOpacity(.87), + ), + tooltip: L10n.of(context).shareTooltip, + onPressed: () => _onSharePressed(context), + ), + IconButton( + icon: Icon( + Icons.download_outlined, + color: Colors.white.withOpacity(.87), + ), + tooltip: L10n.of(context).downloadTooltip, + onPressed: () => _onDownloadPressed(context), + ), + IconButton( + icon: Icon( + Icons.delete_outlined, + color: Colors.white.withOpacity(.87), + ), + tooltip: L10n.of(context).deleteTooltip, + onPressed: () => _onDeletePressed(context), + ), + ], ), ), ), diff --git a/lib/widget/viewer_bottom_app_bar.dart b/lib/widget/viewer_bottom_app_bar.dart index 0f1ffb7b..542c9caa 100644 --- a/lib/widget/viewer_bottom_app_bar.dart +++ b/lib/widget/viewer_bottom_app_bar.dart @@ -1,13 +1,12 @@ import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; -import 'package:nc_photos/app_localizations.dart'; -import 'package:nc_photos/platform/k.dart' as platform_k; +/// Button bar near the bottom of viewer +/// +/// Buttons are spread evenly across the horizontal axis class ViewerBottomAppBar extends StatelessWidget { ViewerBottomAppBar({ - this.onSharePressed, - this.onDownloadPressed, - this.onDeletePressed, + required this.children, }); @override @@ -28,47 +27,15 @@ class ViewerBottomAppBar extends StatelessWidget { child: Row( mainAxisAlignment: MainAxisAlignment.center, mainAxisSize: MainAxisSize.max, - children: [ - if (platform_k.isAndroid) - Expanded( - flex: 1, - child: IconButton( - icon: Icon( - Icons.share_outlined, - color: Colors.white.withOpacity(.87), - ), - tooltip: L10n.of(context).shareTooltip, - onPressed: onSharePressed, - ), - ), - Expanded( - flex: 1, - child: IconButton( - icon: Icon( - Icons.download_outlined, - color: Colors.white.withOpacity(.87), - ), - tooltip: L10n.of(context).downloadTooltip, - onPressed: onDownloadPressed, - ), - ), - Expanded( - flex: 1, - child: IconButton( - icon: Icon( - Icons.delete_outlined, - color: Colors.white.withOpacity(.87), - ), - tooltip: L10n.of(context).deleteTooltip, - onPressed: onDeletePressed, - ), - ), - ], + children: children + .map((e) => Expanded( + flex: 1, + child: e, + )) + .toList(), ), ); } - final VoidCallback? onSharePressed; - final VoidCallback? onDownloadPressed; - final VoidCallback? onDeletePressed; + final List children; }