From 65e3724ce8a59a79c592febc153c5777e34963ab Mon Sep 17 00:00:00 2001 From: Vadim <44135514+vodemn@users.noreply.github.com> Date: Fri, 11 Jul 2025 22:50:54 +0200 Subject: [PATCH] made image preview full-width --- .../screen_logbook_photo_edit.dart | 53 ++++++++----------- .../shared/sliver_screen/screen_sliver.dart | 33 ++++++------ 2 files changed, 39 insertions(+), 47 deletions(-) diff --git a/lib/screens/logbook_photo_edit/screen_logbook_photo_edit.dart b/lib/screens/logbook_photo_edit/screen_logbook_photo_edit.dart index a7d8a1f..53d8dae 100644 --- a/lib/screens/logbook_photo_edit/screen_logbook_photo_edit.dart +++ b/lib/screens/logbook_photo_edit/screen_logbook_photo_edit.dart @@ -37,7 +37,6 @@ class _LogbookPhotoEditScreenState extends State { builder: (context, state) => IgnorePointer( ignoring: state.isLoading, child: SliverScreen( - title: Text(S.of(context).editPhotoTitle), appBarActions: [ BlocBuilder( buildWhen: (previous, current) => previous.canSave != current.canSave, @@ -59,34 +58,27 @@ class _LogbookPhotoEditScreenState extends State { ], slivers: [ SliverToBoxAdapter( - child: Padding( - padding: const EdgeInsets.fromLTRB( - Dimens.paddingM, - 0, - Dimens.paddingM, - Dimens.paddingM, - ), - child: Column( + child: Opacity( + opacity: state.isLoading ? Dimens.disabledOpacity : Dimens.enabledOpacity, + child: const Column( children: [ - const _PhotoPreviewBuilder(), - const SizedBox(height: Dimens.grid16), + _PhotoPreviewBuilder(), Card( + margin: EdgeInsets.all(Dimens.paddingM), child: Padding( - padding: const EdgeInsets.symmetric(vertical: Dimens.paddingM), - child: Opacity( - opacity: state.isLoading ? Dimens.disabledOpacity : Dimens.enabledOpacity, - child: const Column( - children: [ - _DateListTile(), - LogbookPhotoCoordinatesListTile(), - _NoteListTile(), - _EvListTile(), - _IsoListTile(), - _NdFilterListTile(), - _AperturePickerListTile(), - _ShutterSpeedPickerListTile(), - ], - ), + padding: EdgeInsets.symmetric(vertical: Dimens.paddingM), + child: Column( + children: [ + _DateListTile(), + //TODO: maybe make it edge to edge and add InterActiveViewer + LogbookPhotoCoordinatesListTile(), + _NoteListTile(), + _EvListTile(), + _IsoListTile(), + _NdFilterListTile(), + _AperturePickerListTile(), + _ShutterSpeedPickerListTile(), + ], ), ), ), @@ -113,12 +105,9 @@ class _PhotoPreviewBuilder extends StatelessWidget { aspectRatio: PlatformConfig.cameraPreviewAspectRatio, child: Hero( tag: state.id, - child: ClipRRect( - borderRadius: BorderRadius.circular(Dimens.borderRadiusM), - child: Image.file( - File(state.name), - fit: BoxFit.cover, - ), + child: Image.file( + File(state.name), + fit: BoxFit.cover, ), ), ), diff --git a/lib/screens/shared/sliver_screen/screen_sliver.dart b/lib/screens/shared/sliver_screen/screen_sliver.dart index fe52771..fd96546 100644 --- a/lib/screens/shared/sliver_screen/screen_sliver.dart +++ b/lib/screens/shared/sliver_screen/screen_sliver.dart @@ -4,13 +4,13 @@ import 'package:lightmeter/res/dimens.dart'; import 'package:lightmeter/utils/text_height.dart'; class SliverScreen extends StatelessWidget { - final Widget title; + final Widget? title; final List appBarActions; final PreferredSizeWidget? bottom; final List slivers; const SliverScreen({ - required this.title, + this.title, this.appBarActions = const [], this.bottom, required this.slivers, @@ -39,12 +39,12 @@ class SliverScreen extends StatelessWidget { } class _AppBar extends StatelessWidget { - final Widget title; + final Widget? title; final List appBarActions; final PreferredSizeWidget? bottom; const _AppBar({ - required this.title, + this.title, this.appBarActions = const [], this.bottom, }); @@ -53,20 +53,23 @@ class _AppBar extends StatelessWidget { Widget build(BuildContext context) { return SliverAppBar.large( automaticallyImplyLeading: false, - expandedHeight: Dimens.sliverAppBarExpandedHeight + (bottom?.preferredSize.height ?? 0.0), + expandedHeight: (title != null ? Dimens.sliverAppBarExpandedHeight : 0.0) + (bottom?.preferredSize.height ?? 0.0), flexibleSpace: FlexibleSpaceBar( centerTitle: false, titlePadding: const EdgeInsets.symmetric(horizontal: Dimens.paddingM), - title: DefaultTextStyle( - style: Theme.of(context).textTheme.headlineSmall!.copyWith(color: Theme.of(context).colorScheme.onSurface), - maxLines: 2, - overflow: TextOverflow.ellipsis, - child: _Title( - actionsCount: appBarActions.length + (Navigator.of(context).canPop() ? 1 : 0), - bottomSize: bottom?.preferredSize.height ?? 0.0, - child: title, - ), - ), + title: title != null + ? DefaultTextStyle( + style: + Theme.of(context).textTheme.headlineSmall!.copyWith(color: Theme.of(context).colorScheme.onSurface), + maxLines: 2, + overflow: TextOverflow.ellipsis, + child: _Title( + actionsCount: appBarActions.length + (Navigator.of(context).canPop() ? 1 : 0), + bottomSize: bottom?.preferredSize.height ?? 0.0, + child: title!, + ), + ) + : null, ), bottom: bottom, actions: [