#551 collection: item size in list layout
This commit is contained in:
parent
847dfbdb98
commit
7db3160e1a
2 changed files with 39 additions and 26 deletions
|
@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
|
|||
### Added
|
||||
|
||||
- Collection: preview button when selecting items
|
||||
- Collection: item size in list layout
|
||||
- Vaults: custom pattern lock
|
||||
- Video: picture-in-picture
|
||||
- Video: handle skip next/previous media buttons
|
||||
|
|
|
@ -4,6 +4,7 @@ import 'package:aves/model/settings/settings.dart';
|
|||
import 'package:aves/theme/format.dart';
|
||||
import 'package:aves/theme/icons.dart';
|
||||
import 'package:aves/utils/constants.dart';
|
||||
import 'package:aves/utils/file_utils.dart';
|
||||
import 'package:aves/widgets/collection/grid/list_details_theme.dart';
|
||||
import 'package:aves/widgets/common/extensions/build_context.dart';
|
||||
import 'package:aves/widgets/common/fx/borders.dart';
|
||||
|
@ -50,46 +51,57 @@ class EntryListDetails extends StatelessWidget {
|
|||
);
|
||||
}
|
||||
|
||||
Widget _buildRow(List<InlineSpan> spans, TextStyle style) {
|
||||
return Text.rich(
|
||||
TextSpan(
|
||||
children: spans,
|
||||
),
|
||||
style: style,
|
||||
strutStyle: Constants.overflowStrutStyle,
|
||||
softWrap: false,
|
||||
overflow: TextOverflow.fade,
|
||||
);
|
||||
}
|
||||
|
||||
WidgetSpan _buildIconSpan(IconData icon, {EdgeInsetsDirectional padding = EdgeInsetsDirectional.zero}) {
|
||||
return WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.only(end: 8, bottom: 1) + padding,
|
||||
child: Icon(icon),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDateRow(BuildContext context, TextStyle style) {
|
||||
final locale = context.l10n.localeName;
|
||||
final use24hour = context.select<MediaQueryData, bool>((v) => v.alwaysUse24HourFormat);
|
||||
final date = entry.bestDate;
|
||||
final dateText = date != null ? formatDateTime(date, locale, use24hour) : Constants.overlayUnknown;
|
||||
|
||||
return Row(
|
||||
children: [
|
||||
const Icon(AIcons.date),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
dateText,
|
||||
style: style,
|
||||
strutStyle: Constants.overflowStrutStyle,
|
||||
softWrap: false,
|
||||
overflow: TextOverflow.fade,
|
||||
),
|
||||
),
|
||||
final size = entry.sizeBytes;
|
||||
final sizeText = size != null ? formatFileSize(locale, size) : Constants.overlayUnknown;
|
||||
|
||||
return _buildRow(
|
||||
[
|
||||
_buildIconSpan(AIcons.date),
|
||||
TextSpan(text: dateText),
|
||||
_buildIconSpan(AIcons.size, padding: const EdgeInsetsDirectional.only(start: 8)),
|
||||
TextSpan(text: sizeText),
|
||||
],
|
||||
style,
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildLocationRow(BuildContext context, TextStyle style) {
|
||||
final location = entry.hasAddress ? entry.shortAddress : settings.coordinateFormat.format(context.l10n, entry.latLng!);
|
||||
|
||||
return Row(
|
||||
children: [
|
||||
const Icon(AIcons.location),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
location,
|
||||
style: style,
|
||||
strutStyle: Constants.overflowStrutStyle,
|
||||
softWrap: false,
|
||||
overflow: TextOverflow.fade,
|
||||
),
|
||||
),
|
||||
return _buildRow(
|
||||
[
|
||||
_buildIconSpan(AIcons.location),
|
||||
TextSpan(text: location),
|
||||
],
|
||||
style,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue