mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2025-08-05 04:36:41 +00:00
made image preview full-width
This commit is contained in:
parent
b2c0b7a551
commit
65e3724ce8
2 changed files with 39 additions and 47 deletions
|
@ -37,7 +37,6 @@ class _LogbookPhotoEditScreenState extends State<LogbookPhotoEditScreen> {
|
|||
builder: (context, state) => IgnorePointer(
|
||||
ignoring: state.isLoading,
|
||||
child: SliverScreen(
|
||||
title: Text(S.of(context).editPhotoTitle),
|
||||
appBarActions: [
|
||||
BlocBuilder<LogbookPhotoEditBloc, LogbookPhotoEditState>(
|
||||
buildWhen: (previous, current) => previous.canSave != current.canSave,
|
||||
|
@ -59,25 +58,19 @@ class _LogbookPhotoEditScreenState extends State<LogbookPhotoEditScreen> {
|
|||
],
|
||||
slivers: [
|
||||
SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(
|
||||
Dimens.paddingM,
|
||||
0,
|
||||
Dimens.paddingM,
|
||||
Dimens.paddingM,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
const _PhotoPreviewBuilder(),
|
||||
const SizedBox(height: Dimens.grid16),
|
||||
Card(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: Dimens.paddingM),
|
||||
child: Opacity(
|
||||
opacity: state.isLoading ? Dimens.disabledOpacity : Dimens.enabledOpacity,
|
||||
child: const Column(
|
||||
children: [
|
||||
_PhotoPreviewBuilder(),
|
||||
Card(
|
||||
margin: EdgeInsets.all(Dimens.paddingM),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: Dimens.paddingM),
|
||||
child: Column(
|
||||
children: [
|
||||
_DateListTile(),
|
||||
//TODO: maybe make it edge to edge and add InterActiveViewer
|
||||
LogbookPhotoCoordinatesListTile(),
|
||||
_NoteListTile(),
|
||||
_EvListTile(),
|
||||
|
@ -89,7 +82,6 @@ class _LogbookPhotoEditScreenState extends State<LogbookPhotoEditScreen> {
|
|||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -113,15 +105,12 @@ 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,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<Widget> appBarActions;
|
||||
final PreferredSizeWidget? bottom;
|
||||
final List<Widget> 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<Widget> 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),
|
||||
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,
|
||||
),
|
||||
child: title!,
|
||||
),
|
||||
)
|
||||
: null,
|
||||
),
|
||||
bottom: bottom,
|
||||
actions: [
|
||||
|
|
Loading…
Reference in a new issue