made image preview full-width

This commit is contained in:
Vadim 2025-07-11 22:50:54 +02:00
parent b2c0b7a551
commit 65e3724ce8
2 changed files with 39 additions and 47 deletions

View file

@ -37,7 +37,6 @@ class _LogbookPhotoEditScreenState extends State<LogbookPhotoEditScreen> {
builder: (context, state) => IgnorePointer( builder: (context, state) => IgnorePointer(
ignoring: state.isLoading, ignoring: state.isLoading,
child: SliverScreen( child: SliverScreen(
title: Text(S.of(context).editPhotoTitle),
appBarActions: [ appBarActions: [
BlocBuilder<LogbookPhotoEditBloc, LogbookPhotoEditState>( BlocBuilder<LogbookPhotoEditBloc, LogbookPhotoEditState>(
buildWhen: (previous, current) => previous.canSave != current.canSave, buildWhen: (previous, current) => previous.canSave != current.canSave,
@ -59,34 +58,27 @@ class _LogbookPhotoEditScreenState extends State<LogbookPhotoEditScreen> {
], ],
slivers: [ slivers: [
SliverToBoxAdapter( SliverToBoxAdapter(
child: Padding( child: Opacity(
padding: const EdgeInsets.fromLTRB( opacity: state.isLoading ? Dimens.disabledOpacity : Dimens.enabledOpacity,
Dimens.paddingM, child: const Column(
0,
Dimens.paddingM,
Dimens.paddingM,
),
child: Column(
children: [ children: [
const _PhotoPreviewBuilder(), _PhotoPreviewBuilder(),
const SizedBox(height: Dimens.grid16),
Card( Card(
margin: EdgeInsets.all(Dimens.paddingM),
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(vertical: Dimens.paddingM), padding: EdgeInsets.symmetric(vertical: Dimens.paddingM),
child: Opacity( child: Column(
opacity: state.isLoading ? Dimens.disabledOpacity : Dimens.enabledOpacity, children: [
child: const Column( _DateListTile(),
children: [ //TODO: maybe make it edge to edge and add InterActiveViewer
_DateListTile(), LogbookPhotoCoordinatesListTile(),
LogbookPhotoCoordinatesListTile(), _NoteListTile(),
_NoteListTile(), _EvListTile(),
_EvListTile(), _IsoListTile(),
_IsoListTile(), _NdFilterListTile(),
_NdFilterListTile(), _AperturePickerListTile(),
_AperturePickerListTile(), _ShutterSpeedPickerListTile(),
_ShutterSpeedPickerListTile(), ],
],
),
), ),
), ),
), ),
@ -113,12 +105,9 @@ class _PhotoPreviewBuilder extends StatelessWidget {
aspectRatio: PlatformConfig.cameraPreviewAspectRatio, aspectRatio: PlatformConfig.cameraPreviewAspectRatio,
child: Hero( child: Hero(
tag: state.id, tag: state.id,
child: ClipRRect( child: Image.file(
borderRadius: BorderRadius.circular(Dimens.borderRadiusM), File(state.name),
child: Image.file( fit: BoxFit.cover,
File(state.name),
fit: BoxFit.cover,
),
), ),
), ),
), ),

View file

@ -4,13 +4,13 @@ import 'package:lightmeter/res/dimens.dart';
import 'package:lightmeter/utils/text_height.dart'; import 'package:lightmeter/utils/text_height.dart';
class SliverScreen extends StatelessWidget { class SliverScreen extends StatelessWidget {
final Widget title; final Widget? title;
final List<Widget> appBarActions; final List<Widget> appBarActions;
final PreferredSizeWidget? bottom; final PreferredSizeWidget? bottom;
final List<Widget> slivers; final List<Widget> slivers;
const SliverScreen({ const SliverScreen({
required this.title, this.title,
this.appBarActions = const [], this.appBarActions = const [],
this.bottom, this.bottom,
required this.slivers, required this.slivers,
@ -39,12 +39,12 @@ class SliverScreen extends StatelessWidget {
} }
class _AppBar extends StatelessWidget { class _AppBar extends StatelessWidget {
final Widget title; final Widget? title;
final List<Widget> appBarActions; final List<Widget> appBarActions;
final PreferredSizeWidget? bottom; final PreferredSizeWidget? bottom;
const _AppBar({ const _AppBar({
required this.title, this.title,
this.appBarActions = const [], this.appBarActions = const [],
this.bottom, this.bottom,
}); });
@ -53,20 +53,23 @@ class _AppBar extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SliverAppBar.large( return SliverAppBar.large(
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
expandedHeight: Dimens.sliverAppBarExpandedHeight + (bottom?.preferredSize.height ?? 0.0), expandedHeight: (title != null ? Dimens.sliverAppBarExpandedHeight : 0.0) + (bottom?.preferredSize.height ?? 0.0),
flexibleSpace: FlexibleSpaceBar( flexibleSpace: FlexibleSpaceBar(
centerTitle: false, centerTitle: false,
titlePadding: const EdgeInsets.symmetric(horizontal: Dimens.paddingM), titlePadding: const EdgeInsets.symmetric(horizontal: Dimens.paddingM),
title: DefaultTextStyle( title: title != null
style: Theme.of(context).textTheme.headlineSmall!.copyWith(color: Theme.of(context).colorScheme.onSurface), ? DefaultTextStyle(
maxLines: 2, style:
overflow: TextOverflow.ellipsis, Theme.of(context).textTheme.headlineSmall!.copyWith(color: Theme.of(context).colorScheme.onSurface),
child: _Title( maxLines: 2,
actionsCount: appBarActions.length + (Navigator.of(context).canPop() ? 1 : 0), overflow: TextOverflow.ellipsis,
bottomSize: bottom?.preferredSize.height ?? 0.0, child: _Title(
child: title, actionsCount: appBarActions.length + (Navigator.of(context).canPop() ? 1 : 0),
), bottomSize: bottom?.preferredSize.height ?? 0.0,
), child: title!,
),
)
: null,
), ),
bottom: bottom, bottom: bottom,
actions: [ actions: [