explorer fixes

This commit is contained in:
Thibault Deckers 2024-06-26 22:13:27 +02:00
parent d78a897326
commit 0f1d8ec760
16 changed files with 119 additions and 95 deletions

View file

@ -233,13 +233,13 @@ class _PackageLicensePageState extends State<_PackageLicensePage> {
if (!mounted) return;
setState(() {
_licenses.add(const Padding(
padding: EdgeInsets.all(18.0),
padding: EdgeInsets.all(18),
child: Divider(),
));
for (final LicenseParagraph paragraph in paragraphs) {
if (paragraph.indent == LicenseParagraph.centeredIndent) {
_licenses.add(Padding(
padding: const EdgeInsets.only(top: 16.0),
padding: const EdgeInsets.only(top: 16),
child: Text(
paragraph.text,
style: const TextStyle(fontWeight: FontWeight.bold),
@ -249,7 +249,7 @@ class _PackageLicensePageState extends State<_PackageLicensePage> {
} else {
assert(paragraph.indent >= 0);
_licenses.add(Padding(
padding: EdgeInsetsDirectional.only(top: 8.0, start: 16.0 * paragraph.indent),
padding: EdgeInsetsDirectional.only(top: 8, start: 16.0 * paragraph.indent),
child: Text(paragraph.text),
));
}
@ -278,7 +278,7 @@ class _PackageLicensePageState extends State<_PackageLicensePage> {
..._licenses,
if (!_loaded)
const Padding(
padding: EdgeInsets.symmetric(vertical: 24.0),
padding: EdgeInsets.symmetric(vertical: 24),
child: Center(
child: CircularProgressIndicator(),
),

View file

@ -121,7 +121,7 @@ mixin FeedbackMixin {
static double snackBarHorizontalPadding(SnackBarThemeData snackBarTheme) {
final isFloatingSnackBar = (snackBarTheme.behavior ?? SnackBarBehavior.fixed) == SnackBarBehavior.floating;
final horizontalPadding = isFloatingSnackBar ? 16.0 : 24.0;
final double horizontalPadding = isFloatingSnackBar ? 16.0 : 24.0;
return horizontalPadding;
}
@ -181,9 +181,9 @@ class _ReportOverlayState<T> extends State<ReportOverlay<T>> with SingleTickerPr
Stream<T> get opStream => widget.opStream;
static const fontSize = 18.0;
static const diameter = 160.0;
static const strokeWidth = 8.0;
static const double fontSize = 18.0;
static const double diameter = 160.0;
static const double strokeWidth = 8.0;
@override
void initState() {

View file

@ -212,7 +212,7 @@ class _OverlaySnackBarState extends State<OverlaySnackBar> {
final IconButton? iconButton = showCloseIcon
? IconButton(
icon: const Icon(Icons.close),
iconSize: 24.0,
iconSize: 24,
color: widget.closeIconColor ?? snackBarTheme.closeIconColor ?? defaults.closeIconColor,
onPressed: () => ScaffoldMessenger.of(context).hideCurrentSnackBar(reason: SnackBarClosedReason.dismiss),
tooltip: MaterialLocalizations.of(context).closeButtonTooltip,

View file

@ -10,7 +10,7 @@ class ArrowClipper extends CustomClipper<Path> {
path.lineTo(0.0, 0.0);
path.close();
const arrowWidth = 8.0;
const double arrowWidth = 8.0;
final startPointX = (size.width - arrowWidth) / 2;
var startPointY = size.height / 2 - arrowWidth / 2;
path.moveTo(startPointX, startPointY);

View file

@ -30,7 +30,7 @@ class LinkChip extends StatelessWidget {
borderRadius: borderRadius,
onTap: onTap ?? () => AvesApp.launchUrl(urlString),
child: Padding(
padding: const EdgeInsets.all(8.0),
padding: const EdgeInsets.all(8),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [

View file

@ -11,7 +11,7 @@ class AvesPopupMenuButton<T> extends PopupMenuButton<T> {
super.onCanceled,
super.tooltip,
super.elevation,
super.padding = const EdgeInsets.all(8.0),
super.padding = const EdgeInsets.all(8),
super.child,
super.icon,
super.offset = Offset.zero,

View file

@ -29,7 +29,7 @@ class GridTheme extends StatelessWidget {
return ProxyProvider2<Settings, MediaQueryData, GridThemeData>(
update: (context, settings, mq, previous) {
final margin = OverlayIcon.defaultMargin.vertical;
var iconSize = min(24.0, ((extent - margin) / 5).floorToDouble() - margin);
var iconSize = min<double>(24.0, ((extent - margin) / 5).floorToDouble() - margin);
final fontSize = (iconSize * .7).floorToDouble();
iconSize = mq.textScaler.scale(iconSize);
final highlightBorderWidth = extent * .1;

View file

@ -100,8 +100,11 @@ class AvesFilterChip extends StatefulWidget {
static Future<void> showDefaultLongPressMenu(BuildContext context, CollectionFilter filter, Offset tapPosition) async {
if (context.read<ValueNotifier<AppMode>>().value.canNavigate) {
final actions = [
if (filter is AlbumFilter) ChipAction.goToAlbumPage,
final actions = <ChipAction>[
if (filter is AlbumFilter) ...[
ChipAction.goToAlbumPage,
ChipAction.goToExplorerPage,
],
if ((filter is LocationFilter && filter.level == LocationLevel.country)) ChipAction.goToCountryPage,
if ((filter is LocationFilter && filter.level == LocationLevel.place)) ChipAction.goToPlacePage,
if (filter is TagFilter) ChipAction.goToTagPage,

View file

@ -194,12 +194,19 @@ class _ExplorerPageState extends State<ExplorerPage> {
}
}
return Center(
return SafeArea(
top: false,
bottom: false,
child: Padding(
padding: const EdgeInsets.all(8),
child: Center(
child: EmptyContent(
icon: AIcons.folder,
text: '',
bottom: bottom,
),
),
),
);
},
);
@ -215,21 +222,25 @@ class _ExplorerPageState extends State<ExplorerPage> {
final album = _getAlbumPath(source, content);
final baseIconTheme = IconTheme.of(context);
const leadingDim = AvesFilterChip.minChipWidth;
return ListTile(
leading: const Icon(AIcons.folder),
title: Text('${Unicode.FSI}${pContext.split(content.path).last}${Unicode.PDI}'),
trailing: album != null
leading: album != null
? IconTheme.merge(
data: baseIconTheme,
child: AvesFilterChip(
filter: AlbumFilter(album, source.getAlbumDisplayName(context, album)),
showText: false,
maxWidth: AvesFilterChip.minChipWidth,
maxWidth: leadingDim,
onTap: (filter) => _goToCollectionPage(context, filter),
onLongPress: null,
),
)
: null,
: const SizedBox(
width: leadingDim,
height: leadingDim,
child: Icon(AIcons.folder),
),
title: Text('${Unicode.FSI}${pContext.split(content.path).last}${Unicode.PDI}'),
onTap: () => _goTo(content.path),
);
}

View file

@ -53,11 +53,17 @@ class ChipActionDelegate with FeedbackMixin, VaultAwareMixin {
case ChipAction.goToTagPage:
_goTo(context, filter, TagListPage.routeName, (context) => const TagListPage());
case ChipAction.goToExplorerPage:
if (filter is PathFilter) {
String? path;
if (filter is AlbumFilter) {
path = filter.album;
} else if (filter is PathFilter) {
path = filter.path;
}
if (path != null) {
Navigator.maybeOf(context)?.pushAndRemoveUntil(
MaterialPageRoute(
settings: const RouteSettings(name: ExplorerPage.routeName),
builder: (context) => ExplorerPage(path: filter.path),
builder: (context) => ExplorerPage(path: path),
),
(route) => false,
);

View file

@ -98,7 +98,7 @@ class _QuickActionEditorBodyState<T extends Object> extends State<QuickActionEdi
// as dragging a button against axis direction messes index resolution while items pop in and out
bool _reordering = false;
static const quickActionVerticalPadding = 16.0;
static const double quickActionVerticalPadding = 16.0;
@override
void initState() {

View file

@ -60,14 +60,8 @@ class _CrumbLineState extends State<CrumbLine> {
directory.getVolumeDescription(context),
...pContext.split(directory.relativeDir),
];
final crumbStyle = Theme.of(context).textTheme.bodyMedium;
final crumbColor = crumbStyle!.color!.withOpacity(.4);
return DefaultTextStyle(
style: crumbStyle.copyWith(
color: crumbColor,
fontWeight: FontWeight.w500,
),
child: ListView.builder(
final crumbColor = DefaultTextStyle.of(context).style.color;
return ListView.builder(
scrollDirection: Axis.horizontal,
controller: _scrollController,
padding: const EdgeInsets.symmetric(horizontal: 8),
@ -116,7 +110,6 @@ class _CrumbLineState extends State<CrumbLine> {
);
},
itemCount: parts.length,
),
);
}
}

View file

@ -101,16 +101,7 @@ class _FilePickerPageState extends State<FilePickerPage> {
body: SafeArea(
child: Column(
children: [
SizedBox(
height: kMinInteractiveDimension,
child: CrumbLine(
directory: _directory,
onTap: (path) {
_goTo(path);
setState(() {});
},
),
),
_buildCrumbLine(context),
const Divider(height: 0),
Expanded(
child: visibleContents == null
@ -144,6 +135,26 @@ class _FilePickerPageState extends State<FilePickerPage> {
);
}
Widget _buildCrumbLine(BuildContext context) {
final crumbStyle = Theme.of(context).textTheme.bodyMedium!;
return SizedBox(
height: kMinInteractiveDimension,
child: DefaultTextStyle(
style: crumbStyle.copyWith(
color: crumbStyle.color!.withOpacity(.4),
fontWeight: FontWeight.w500,
),
child: CrumbLine(
directory: _directory,
onTap: (path) {
_goTo(path);
setState(() {});
},
),
),
);
}
String _getTitle(BuildContext context) {
if (_directory.relativeDir.isEmpty) {
return _directory.getVolumeDescription(context);

View file

@ -63,7 +63,7 @@ class _ColorSectionSliverState extends State<ColorSectionSliver> {
const SectionRow(icon: AIcons.palette),
...colors.map(
(v) => Padding(
padding: const EdgeInsets.all(8.0),
padding: const EdgeInsets.all(8),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [

View file

@ -302,7 +302,7 @@ class ExtraBottomOverlay extends StatelessWidget {
Widget build(BuildContext context) {
final viewInsets = this.viewInsets ?? MediaQuery.viewInsetsOf(context);
final viewPadding = this.viewPadding ?? MediaQuery.viewPaddingOf(context);
final safePadding = (viewInsets + viewPadding).copyWith(bottom: 8) + const EdgeInsets.symmetric(horizontal: 8.0);
final safePadding = (viewInsets + viewPadding).copyWith(bottom: 8) + const EdgeInsets.symmetric(horizontal: 8);
return Padding(
padding: safePadding,

View file

@ -137,7 +137,7 @@ class _WelcomePageState extends State<WelcomePage> {
context.l10n.welcomeMessage,
style: Theme.of(context).textTheme.headlineSmall,
);
final padding = isPortrait ? 16.0 : 8.0;
final double padding = isPortrait ? 16.0 : 8.0;
return [
SizedBox(height: padding),
...(isPortrait