mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2025-09-18 10:46:39 +00:00
Compare commits
3 commits
49d0a2175f
...
3aa0014b6a
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3aa0014b6a | ||
![]() |
ece25cf128 | ||
![]() |
872f279637 |
3 changed files with 17 additions and 11 deletions
|
@ -29,8 +29,6 @@ class AnimatedDialog extends StatefulWidget {
|
|||
}
|
||||
|
||||
class AnimatedDialogState extends State<AnimatedDialog> with SingleTickerProviderStateMixin {
|
||||
final GlobalKey _key = GlobalKey();
|
||||
|
||||
late Size _closedSize;
|
||||
late Offset _closedOffset;
|
||||
|
||||
|
@ -129,7 +127,6 @@ class AnimatedDialogState extends State<AnimatedDialog> with SingleTickerProvide
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
key: _key,
|
||||
onTap: _openDialog,
|
||||
child: Opacity(
|
||||
opacity: _isDialogShown ? 0 : 1,
|
||||
|
@ -140,13 +137,13 @@ class AnimatedDialogState extends State<AnimatedDialog> with SingleTickerProvide
|
|||
|
||||
void _setClosedOffset() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
final renderBox = _key.currentContext?.findRenderObject()! as RenderBox?;
|
||||
final renderBox = context.findRenderObject()! as RenderBox?;
|
||||
if (renderBox != null) {
|
||||
final size = MediaQuery.sizeOf(context);
|
||||
final padding = MediaQuery.paddingOf(context);
|
||||
final maxWidth = size.width - padding.horizontal - Dimens.dialogMargin.horizontal;
|
||||
final maxHeight = size.height - padding.vertical - Dimens.dialogMargin.vertical;
|
||||
_closedSize = _key.currentContext!.size!;
|
||||
_closedSize = context.size!;
|
||||
_sizeTween = SizeTween(
|
||||
begin: _closedSize,
|
||||
end: Size(
|
||||
|
@ -156,7 +153,16 @@ class AnimatedDialogState extends State<AnimatedDialog> with SingleTickerProvide
|
|||
);
|
||||
_sizeAnimation = _sizeTween.animate(_defaultCurvedAnimation);
|
||||
|
||||
_closedOffset = renderBox.localToGlobal(Offset.zero);
|
||||
final globalOffset = renderBox.localToGlobal(Offset.zero);
|
||||
try {
|
||||
_closedOffset = Offset(
|
||||
//TODO: when updating layout or changing one of selected picker values, X offset is negative for some reason
|
||||
globalOffset.dx > 0 ? globalOffset.dx : _closedOffset.dx,
|
||||
globalOffset.dy,
|
||||
);
|
||||
} catch (_) {
|
||||
_closedOffset = globalOffset;
|
||||
}
|
||||
_offsetAnimation = SizeTween(
|
||||
begin: Size(
|
||||
_closedOffset.dx + _closedSize.width / 2,
|
||||
|
|
|
@ -861,11 +861,11 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
path: "."
|
||||
ref: "v4.1.1"
|
||||
resolved-ref: "2317ef3a1e93e06505a033ecbd5cee3758b2dbc0"
|
||||
ref: "v4.1.2"
|
||||
resolved-ref: "6bb16eb49232649eca02704b3a40890b0184d8b5"
|
||||
url: "https://github.com/vodemn/m3_lightmeter_iap"
|
||||
source: git
|
||||
version: "4.1.1+36"
|
||||
version: "4.1.2+37"
|
||||
m3_lightmeter_resources:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
name: lightmeter
|
||||
description: Lightmeter app inspired by Material 3 design system.
|
||||
publish_to: "none"
|
||||
version: 2.0.0+62
|
||||
version: 2.0.0+63
|
||||
|
||||
environment:
|
||||
sdk: ">=3.0.0 <4.0.0"
|
||||
|
@ -33,7 +33,7 @@ dependencies:
|
|||
m3_lightmeter_iap:
|
||||
git:
|
||||
url: "https://github.com/vodemn/m3_lightmeter_iap"
|
||||
ref: v4.1.1
|
||||
ref: v4.1.2
|
||||
m3_lightmeter_resources:
|
||||
git:
|
||||
url: "https://github.com/vodemn/m3_lightmeter_resources"
|
||||
|
|
Loading…
Reference in a new issue