fullscreen: fixed overlay padding

This commit is contained in:
Thibault Deckers 2019-07-28 13:11:47 +09:00
parent d63e560e7d
commit 345fc71ceb
2 changed files with 18 additions and 16 deletions

View file

@ -94,17 +94,17 @@ class _FullscreenBottomOverlayState extends State<FullscreenBottomOverlay> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var mediaQuery = MediaQuery.of(context); final innerPadding = EdgeInsets.all(8.0);
final screenWidth = mediaQuery.size.width; final mediaQuery = MediaQuery.of(context);
final viewInsets = mediaQuery.viewInsets; final overlayContentMaxWidth = mediaQuery.size.width - mediaQuery.viewPadding.horizontal - innerPadding.horizontal;
final date = entry.getBestDate(); final date = entry.getBestDate();
final subRowWidth = min(400.0, screenWidth); final subRowWidth = min(400.0, overlayContentMaxWidth);
return Blurred( return Blurred(
child: IgnorePointer( child: IgnorePointer(
child: Padding( child: Padding(
padding: EdgeInsets.only(bottom: viewInsets.bottom), padding: mediaQuery.viewInsets + mediaQuery.viewPadding.copyWith(top: 0),
child: Container( child: Container(
padding: EdgeInsets.all(8.0), padding: innerPadding,
color: kOverlayBackground, color: kOverlayBackground,
child: DefaultTextStyle( child: DefaultTextStyle(
style: TextStyle( style: TextStyle(
@ -120,7 +120,7 @@ class _FullscreenBottomOverlayState extends State<FullscreenBottomOverlay> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SizedBox( SizedBox(
width: screenWidth, width: overlayContentMaxWidth,
child: Text( child: Text(
entry.title, entry.title,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,

View file

@ -17,15 +17,17 @@ class ImageDecodeService {
static Future<Uint8List> getImageBytes(ImageEntry entry, int width, int height) async { static Future<Uint8List> getImageBytes(ImageEntry entry, int width, int height) async {
debugPrint('getImageBytes with uri=${entry.uri}'); debugPrint('getImageBytes with uri=${entry.uri}');
try { if (width > 0 && height > 0) {
final result = await platform.invokeMethod('getImageBytes', <String, dynamic>{ try {
'entry': entry.toMap(), final result = await platform.invokeMethod('getImageBytes', <String, dynamic>{
'width': width, 'entry': entry.toMap(),
'height': height, 'width': width,
}); 'height': height,
return result as Uint8List; });
} on PlatformException catch (e) { return result as Uint8List;
debugPrint('getImageBytes failed with exception=${e.message}'); } on PlatformException catch (e) {
debugPrint('getImageBytes failed with exception=${e.message}');
}
} }
return Uint8List(0); return Uint8List(0);
} }