improved view insets handling
This commit is contained in:
parent
55ad742847
commit
033f979fb3
2 changed files with 45 additions and 55 deletions
|
@ -39,11 +39,7 @@ class ImageFullscreenPageState extends State<ImageFullscreenPage> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MediaQuery.removeViewInsets(
|
return Scaffold(
|
||||||
context: context,
|
|
||||||
// remove bottom view insets to paint underneath the translucent navigation bar
|
|
||||||
removeBottom: true,
|
|
||||||
child: Scaffold(
|
|
||||||
backgroundColor: Colors.black,
|
backgroundColor: Colors.black,
|
||||||
body: Stack(
|
body: Stack(
|
||||||
alignment: Alignment.bottomCenter,
|
alignment: Alignment.bottomCenter,
|
||||||
|
@ -78,6 +74,7 @@ class ImageFullscreenPageState extends State<ImageFullscreenPage> {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
resizeToAvoidBottomInset: false,
|
||||||
// Hero(
|
// Hero(
|
||||||
// tag: uri,
|
// tag: uri,
|
||||||
// child: Stack(
|
// child: Stack(
|
||||||
|
@ -106,7 +103,6 @@ class ImageFullscreenPageState extends State<ImageFullscreenPage> {
|
||||||
// ],
|
// ],
|
||||||
// ),
|
// ),
|
||||||
// ),
|
// ),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,22 +115,20 @@ class FullscreenOverlay extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
debugPrint('FullscreenOverlay MediaQuery.of(context)=${MediaQuery.of(context)}');
|
var viewInsets = MediaQuery.of(context).viewInsets;
|
||||||
// TODO TLAD find actual value from MediaQuery before insets removal
|
|
||||||
var viewInsetsBottom = 46.0;
|
|
||||||
var date = ImageEntry.getBestDate(entry);
|
var date = ImageEntry.getBestDate(entry);
|
||||||
return IgnorePointer(
|
return IgnorePointer(
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.all(8.0).add(EdgeInsets.only(bottom: viewInsetsBottom)),
|
padding: EdgeInsets.all(8.0).add(EdgeInsets.only(bottom: viewInsets.bottom)),
|
||||||
color: Colors.black45,
|
color: Colors.black45,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text('$index / $total - ${entry['title']}'),
|
Text('${index + 1} / $total - ${entry['title']}'),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(child: Text('${DateFormat.yMMMMd().format(date)} – ${DateFormat.Hm().format(date)}')),
|
Expanded(child: Text('${DateFormat.yMMMd().format(date)} – ${DateFormat.Hm().format(date)}')),
|
||||||
Expanded(child: Text('${entry['width']} × ${entry['height']}')),
|
Expanded(child: Text('${entry['width']} × ${entry['height']}')),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
@ -44,21 +44,17 @@ class _HomePageState extends State<HomePage> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
debugPrint('MediaQuery.of(context).viewInsets.bottom=${MediaQuery.of(context).viewInsets.bottom}');
|
return Scaffold(
|
||||||
|
|
||||||
return MediaQuery.removeViewInsets(
|
|
||||||
context: context,
|
|
||||||
// remove bottom view insets to paint underneath the translucent navigation bar
|
|
||||||
removeBottom: true,
|
|
||||||
child: Scaffold(
|
|
||||||
// fake app bar so that content is safe from status bar, even though we use a SliverAppBar
|
// fake app bar so that content is safe from status bar, even though we use a SliverAppBar
|
||||||
appBar: FakeAppBar(),
|
appBar: FakeAppBar(),
|
||||||
body: imageEntryList == null
|
body: Container(
|
||||||
|
child: imageEntryList == null
|
||||||
? Center(
|
? Center(
|
||||||
child: CircularProgressIndicator(),
|
child: CircularProgressIndicator(),
|
||||||
)
|
)
|
||||||
: ThumbnailCollection(imageEntryList),
|
: ThumbnailCollection(imageEntryList),
|
||||||
),
|
),
|
||||||
|
resizeToAvoidBottomInset: false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue