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(
|
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,25 +58,19 @@ class _LogbookPhotoEditScreenState extends State<LogbookPhotoEditScreen> {
|
||||||
],
|
],
|
||||||
slivers: [
|
slivers: [
|
||||||
SliverToBoxAdapter(
|
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(
|
child: Opacity(
|
||||||
opacity: state.isLoading ? Dimens.disabledOpacity : Dimens.enabledOpacity,
|
opacity: state.isLoading ? Dimens.disabledOpacity : Dimens.enabledOpacity,
|
||||||
child: const Column(
|
child: const Column(
|
||||||
|
children: [
|
||||||
|
_PhotoPreviewBuilder(),
|
||||||
|
Card(
|
||||||
|
margin: EdgeInsets.all(Dimens.paddingM),
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.symmetric(vertical: Dimens.paddingM),
|
||||||
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
_DateListTile(),
|
_DateListTile(),
|
||||||
|
//TODO: maybe make it edge to edge and add InterActiveViewer
|
||||||
LogbookPhotoCoordinatesListTile(),
|
LogbookPhotoCoordinatesListTile(),
|
||||||
_NoteListTile(),
|
_NoteListTile(),
|
||||||
_EvListTile(),
|
_EvListTile(),
|
||||||
|
@ -89,7 +82,6 @@ class _LogbookPhotoEditScreenState extends State<LogbookPhotoEditScreen> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -113,15 +105,12 @@ class _PhotoPreviewBuilder extends StatelessWidget {
|
||||||
aspectRatio: PlatformConfig.cameraPreviewAspectRatio,
|
aspectRatio: PlatformConfig.cameraPreviewAspectRatio,
|
||||||
child: Hero(
|
child: Hero(
|
||||||
tag: state.id,
|
tag: state.id,
|
||||||
child: ClipRRect(
|
|
||||||
borderRadius: BorderRadius.circular(Dimens.borderRadiusM),
|
|
||||||
child: Image.file(
|
child: Image.file(
|
||||||
File(state.name),
|
File(state.name),
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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(
|
||||||
|
style:
|
||||||
|
Theme.of(context).textTheme.headlineSmall!.copyWith(color: Theme.of(context).colorScheme.onSurface),
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
child: _Title(
|
child: _Title(
|
||||||
actionsCount: appBarActions.length + (Navigator.of(context).canPop() ? 1 : 0),
|
actionsCount: appBarActions.length + (Navigator.of(context).canPop() ? 1 : 0),
|
||||||
bottomSize: bottom?.preferredSize.height ?? 0.0,
|
bottomSize: bottom?.preferredSize.height ?? 0.0,
|
||||||
child: title,
|
child: title!,
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
)
|
||||||
|
: null,
|
||||||
),
|
),
|
||||||
bottom: bottom,
|
bottom: bottom,
|
||||||
actions: [
|
actions: [
|
||||||
|
|
Loading…
Reference in a new issue