settings: show location/raw/duration on thumbnails
This commit is contained in:
parent
0dc429efc5
commit
981ad62502
4 changed files with 82 additions and 22 deletions
|
@ -33,6 +33,9 @@ class Settings extends ChangeNotifier {
|
||||||
static const collectionGroupFactorKey = 'collection_group_factor';
|
static const collectionGroupFactorKey = 'collection_group_factor';
|
||||||
static const collectionSortFactorKey = 'collection_sort_factor';
|
static const collectionSortFactorKey = 'collection_sort_factor';
|
||||||
static const collectionTileExtentKey = 'collection_tile_extent';
|
static const collectionTileExtentKey = 'collection_tile_extent';
|
||||||
|
static const showThumbnailLocationKey = 'show_thumbnail_location';
|
||||||
|
static const showThumbnailRawKey = 'show_thumbnail_raw';
|
||||||
|
static const showThumbnailVideoDurationKey = 'show_thumbnail_video_duration';
|
||||||
|
|
||||||
// filter grids
|
// filter grids
|
||||||
static const albumSortFactorKey = 'album_sort_factor';
|
static const albumSortFactorKey = 'album_sort_factor';
|
||||||
|
@ -108,6 +111,18 @@ class Settings extends ChangeNotifier {
|
||||||
|
|
||||||
set collectionTileExtent(double newValue) => setAndNotify(collectionTileExtentKey, newValue);
|
set collectionTileExtent(double newValue) => setAndNotify(collectionTileExtentKey, newValue);
|
||||||
|
|
||||||
|
bool get showThumbnailLocation => getBoolOrDefault(showThumbnailLocationKey, true);
|
||||||
|
|
||||||
|
set showThumbnailLocation(bool newValue) => setAndNotify(showThumbnailLocationKey, newValue);
|
||||||
|
|
||||||
|
bool get showThumbnailRaw => getBoolOrDefault(showThumbnailRawKey, true);
|
||||||
|
|
||||||
|
set showThumbnailRaw(bool newValue) => setAndNotify(showThumbnailRawKey, newValue);
|
||||||
|
|
||||||
|
bool get showThumbnailVideoDuration => getBoolOrDefault(showThumbnailVideoDurationKey, true);
|
||||||
|
|
||||||
|
set showThumbnailVideoDuration(bool newValue) => setAndNotify(showThumbnailVideoDurationKey, newValue);
|
||||||
|
|
||||||
// filter grids
|
// filter grids
|
||||||
|
|
||||||
ChipSortFactor get albumSortFactor => getEnumOrDefault(albumSortFactorKey, ChipSortFactor.name, ChipSortFactor.values);
|
ChipSortFactor get albumSortFactor => getEnumOrDefault(albumSortFactorKey, ChipSortFactor.name, ChipSortFactor.values);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:aves/model/image_entry.dart';
|
import 'package:aves/model/image_entry.dart';
|
||||||
|
import 'package:aves/model/settings/settings.dart';
|
||||||
import 'package:aves/model/source/collection_lens.dart';
|
import 'package:aves/model/source/collection_lens.dart';
|
||||||
import 'package:aves/model/source/enums.dart';
|
import 'package:aves/model/source/enums.dart';
|
||||||
import 'package:aves/utils/durations.dart';
|
import 'package:aves/utils/durations.dart';
|
||||||
|
@ -8,6 +9,7 @@ import 'package:aves/widgets/common/fx/sweeper.dart';
|
||||||
import 'package:aves/widgets/common/icons.dart';
|
import 'package:aves/widgets/common/icons.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:tuple/tuple.dart';
|
||||||
|
|
||||||
class ThumbnailEntryOverlay extends StatelessWidget {
|
class ThumbnailEntryOverlay extends StatelessWidget {
|
||||||
final ImageEntry entry;
|
final ImageEntry entry;
|
||||||
|
@ -23,26 +25,32 @@ class ThumbnailEntryOverlay extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final fontSize = min(14.0, (extent / 8)).roundToDouble();
|
final fontSize = min(14.0, (extent / 8)).roundToDouble();
|
||||||
final iconSize = fontSize * 2;
|
final iconSize = fontSize * 2;
|
||||||
return Column(
|
return Selector<Settings, Tuple3<bool, bool, bool>>(
|
||||||
mainAxisSize: MainAxisSize.min,
|
selector: (context, s) => Tuple3(s.showThumbnailLocation, s.showThumbnailRaw, s.showThumbnailVideoDuration),
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
builder: (context, s, child) {
|
||||||
children: [
|
return Column(
|
||||||
if (entry.hasGps) GpsIcon(iconSize: iconSize),
|
mainAxisSize: MainAxisSize.min,
|
||||||
if (entry.isAnimated)
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
AnimatedImageIcon(iconSize: iconSize)
|
children: [
|
||||||
else if (entry.isVideo)
|
if (entry.hasGps && settings.showThumbnailLocation) GpsIcon(iconSize: iconSize),
|
||||||
DefaultTextStyle(
|
if (entry.isRaw && settings.showThumbnailRaw) RawIcon(iconSize: iconSize),
|
||||||
style: TextStyle(
|
if (entry.isAnimated)
|
||||||
color: Colors.grey[200],
|
AnimatedImageIcon(iconSize: iconSize)
|
||||||
fontSize: fontSize,
|
else if (entry.isVideo)
|
||||||
),
|
DefaultTextStyle(
|
||||||
child: VideoIcon(
|
style: TextStyle(
|
||||||
entry: entry,
|
color: Colors.grey[200],
|
||||||
iconSize: iconSize,
|
fontSize: fontSize,
|
||||||
),
|
),
|
||||||
),
|
child: VideoIcon(
|
||||||
],
|
entry: entry,
|
||||||
);
|
iconSize: iconSize,
|
||||||
|
showDuration: settings.showThumbnailVideoDuration,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ class AIcons {
|
||||||
static const IconData disc = Icons.fiber_manual_record;
|
static const IconData disc = Icons.fiber_manual_record;
|
||||||
static const IconData error = Icons.error_outline;
|
static const IconData error = Icons.error_outline;
|
||||||
static const IconData location = Icons.place_outlined;
|
static const IconData location = Icons.place_outlined;
|
||||||
|
static const IconData raw = Icons.camera_outlined;
|
||||||
static const IconData shooting = Icons.camera_outlined;
|
static const IconData shooting = Icons.camera_outlined;
|
||||||
static const IconData removableStorage = Icons.sd_storage_outlined;
|
static const IconData removableStorage = Icons.sd_storage_outlined;
|
||||||
static const IconData settings = Icons.settings_outlined;
|
static const IconData settings = Icons.settings_outlined;
|
||||||
|
@ -70,15 +71,21 @@ class AIcons {
|
||||||
class VideoIcon extends StatelessWidget {
|
class VideoIcon extends StatelessWidget {
|
||||||
final ImageEntry entry;
|
final ImageEntry entry;
|
||||||
final double iconSize;
|
final double iconSize;
|
||||||
|
final bool showDuration;
|
||||||
|
|
||||||
const VideoIcon({Key key, this.entry, this.iconSize}) : super(key: key);
|
const VideoIcon({
|
||||||
|
Key key,
|
||||||
|
this.entry,
|
||||||
|
this.iconSize,
|
||||||
|
this.showDuration,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return OverlayIcon(
|
return OverlayIcon(
|
||||||
icon: AIcons.play,
|
icon: AIcons.play,
|
||||||
size: iconSize,
|
size: iconSize,
|
||||||
text: entry.durationText,
|
text: showDuration ? entry.durationText : null,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,6 +119,20 @@ class GpsIcon extends StatelessWidget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class RawIcon extends StatelessWidget {
|
||||||
|
final double iconSize;
|
||||||
|
|
||||||
|
const RawIcon({Key key, this.iconSize}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return OverlayIcon(
|
||||||
|
icon: AIcons.raw,
|
||||||
|
size: iconSize,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class OverlayIcon extends StatelessWidget {
|
class OverlayIcon extends StatelessWidget {
|
||||||
final IconData icon;
|
final IconData icon;
|
||||||
final double size;
|
final double size;
|
||||||
|
|
|
@ -94,6 +94,22 @@ class SettingsPage extends StatelessWidget {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
SectionTitle('Thumbnails'),
|
||||||
|
SwitchListTile(
|
||||||
|
value: settings.showThumbnailLocation,
|
||||||
|
onChanged: (v) => settings.showThumbnailLocation = v,
|
||||||
|
title: Text('Show location icon'),
|
||||||
|
),
|
||||||
|
SwitchListTile(
|
||||||
|
value: settings.showThumbnailRaw,
|
||||||
|
onChanged: (v) => settings.showThumbnailRaw = v,
|
||||||
|
title: Text('Show raw icon'),
|
||||||
|
),
|
||||||
|
SwitchListTile(
|
||||||
|
value: settings.showThumbnailVideoDuration,
|
||||||
|
onChanged: (v) => settings.showThumbnailVideoDuration = v,
|
||||||
|
title: Text('Show video duration'),
|
||||||
|
),
|
||||||
SectionTitle('Privacy'),
|
SectionTitle('Privacy'),
|
||||||
SwitchListTile(
|
SwitchListTile(
|
||||||
value: settings.isCrashlyticsEnabled,
|
value: settings.isCrashlyticsEnabled,
|
||||||
|
|
Loading…
Reference in a new issue