mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-02-02 14:56:20 +01:00
Refactoring
This commit is contained in:
parent
058320ffe4
commit
8f8b5c2319
2 changed files with 38 additions and 47 deletions
|
@ -178,9 +178,33 @@ class _ViewerState extends State<Viewer> {
|
|||
? 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),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -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: <Widget>[
|
||||
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<Widget> children;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue