fullscreen: fixed overlay layout

This commit is contained in:
Thibault Deckers 2019-07-27 18:37:08 +09:00
parent beb31f1f98
commit 4de4664f7c

View file

@ -1,3 +1,6 @@
import 'dart:math';
import 'dart:ui';
import 'package:aves/model/image_entry.dart'; import 'package:aves/model/image_entry.dart';
import 'package:aves/model/image_fetcher.dart'; import 'package:aves/model/image_fetcher.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -39,67 +42,77 @@ class _FullscreenOverlayState extends State<FullscreenOverlay> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final viewInsets = MediaQuery.of(context).viewInsets; var mediaQuery = MediaQuery.of(context);
final screenWidth = mediaQuery.size.width;
final viewInsets = mediaQuery.viewInsets;
final date = ImageEntry.getBestDate(entry); final date = ImageEntry.getBestDate(entry);
final subRowConstraints = BoxConstraints(maxWidth: 400); final subRowWidth = min(400.0, screenWidth);
return IgnorePointer( return ClipRect(
child: Container( child: BackdropFilter(
padding: EdgeInsets.all(8.0).add(EdgeInsets.only(bottom: viewInsets.bottom)), filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
color: Colors.black45, child: IgnorePointer(
child: DefaultTextStyle( child: Container(
style: TextStyle( padding: EdgeInsets.all(8.0).add(EdgeInsets.only(bottom: viewInsets.bottom)),
shadows: [ color: Colors.black26,
Shadow( child: DefaultTextStyle(
color: Colors.black87, style: TextStyle(
offset: Offset(0.0, 1.0), shadows: [
) Shadow(
], color: Colors.black87,
), offset: Offset(0.0, 1.0),
child: Column( )
mainAxisSize: MainAxisSize.min, ],
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'${widget.index + 1}/$total ${entry['title']}',
overflow: TextOverflow.ellipsis,
), ),
SizedBox(height: 4), child: Column(
ConstrainedBox( mainAxisSize: MainAxisSize.min,
constraints: subRowConstraints, crossAxisAlignment: CrossAxisAlignment.start,
child: Row( children: [
children: [ SizedBox(
Icon(Icons.calendar_today, size: 16), width: screenWidth,
SizedBox(width: 8), child: Text(
Expanded(child: Text('${DateFormat.yMMMd().format(date)} ${DateFormat.Hm().format(date)}')), '${widget.index + 1}/$total ${entry['title']}',
Expanded(child: Text('${entry['width']} × ${entry['height']}')), overflow: TextOverflow.ellipsis,
], ),
), ),
SizedBox(height: 4),
SizedBox(
width: subRowWidth,
child: Row(
children: [
Icon(Icons.calendar_today, size: 16),
SizedBox(width: 8),
Expanded(child: Text('${DateFormat.yMMMd().format(date)} ${DateFormat.Hm().format(date)}')),
Expanded(child: Text('${entry['width']} × ${entry['height']}')),
],
),
),
SizedBox(height: 4),
FutureBuilder(
future: _detailLoader,
builder: (futureContext, AsyncSnapshot<Map> snapshot) {
if (snapshot.connectionState == ConnectionState.done && !snapshot.hasError) {
_lastDetails = snapshot.data;
}
return (_lastDetails == null || _lastDetails.isEmpty)
? Text('')
: SizedBox(
width: subRowWidth,
child: Row(
children: [
Icon(Icons.camera, size: 16),
SizedBox(width: 8),
Expanded(child: Text((_lastDetails['aperture'] as String).replaceAll('f', 'ƒ'))),
Expanded(child: Text(_lastDetails['exposureTime'])),
Expanded(child: Text(_lastDetails['focalLength'])),
Expanded(child: Text(_lastDetails['iso'])),
],
),
);
},
)
],
), ),
SizedBox(height: 4), ),
FutureBuilder(
future: _detailLoader,
builder: (futureContext, AsyncSnapshot<Map> snapshot) {
if (snapshot.connectionState == ConnectionState.done && !snapshot.hasError) {
_lastDetails = snapshot.data;
}
return (_lastDetails == null || _lastDetails.isEmpty)
? Text('')
: ConstrainedBox(
constraints: subRowConstraints,
child: Row(
children: [
Icon(Icons.camera, size: 16),
SizedBox(width: 8),
Expanded(child: Text((_lastDetails['aperture'] as String).replaceAll('f', 'ƒ'))),
Expanded(child: Text(_lastDetails['exposureTime'])),
Expanded(child: Text(_lastDetails['focalLength'])),
Expanded(child: Text(_lastDetails['iso'])),
],
),
);
},
)
],
), ),
), ),
), ),