mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2025-09-18 16:56:38 +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 {
|
class AnimatedDialogState extends State<AnimatedDialog> with SingleTickerProviderStateMixin {
|
||||||
final GlobalKey _key = GlobalKey();
|
|
||||||
|
|
||||||
late Size _closedSize;
|
late Size _closedSize;
|
||||||
late Offset _closedOffset;
|
late Offset _closedOffset;
|
||||||
|
|
||||||
|
@ -129,7 +127,6 @@ class AnimatedDialogState extends State<AnimatedDialog> with SingleTickerProvide
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
key: _key,
|
|
||||||
onTap: _openDialog,
|
onTap: _openDialog,
|
||||||
child: Opacity(
|
child: Opacity(
|
||||||
opacity: _isDialogShown ? 0 : 1,
|
opacity: _isDialogShown ? 0 : 1,
|
||||||
|
@ -140,13 +137,13 @@ class AnimatedDialogState extends State<AnimatedDialog> with SingleTickerProvide
|
||||||
|
|
||||||
void _setClosedOffset() {
|
void _setClosedOffset() {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
final renderBox = _key.currentContext?.findRenderObject()! as RenderBox?;
|
final renderBox = context.findRenderObject()! as RenderBox?;
|
||||||
if (renderBox != null) {
|
if (renderBox != null) {
|
||||||
final size = MediaQuery.sizeOf(context);
|
final size = MediaQuery.sizeOf(context);
|
||||||
final padding = MediaQuery.paddingOf(context);
|
final padding = MediaQuery.paddingOf(context);
|
||||||
final maxWidth = size.width - padding.horizontal - Dimens.dialogMargin.horizontal;
|
final maxWidth = size.width - padding.horizontal - Dimens.dialogMargin.horizontal;
|
||||||
final maxHeight = size.height - padding.vertical - Dimens.dialogMargin.vertical;
|
final maxHeight = size.height - padding.vertical - Dimens.dialogMargin.vertical;
|
||||||
_closedSize = _key.currentContext!.size!;
|
_closedSize = context.size!;
|
||||||
_sizeTween = SizeTween(
|
_sizeTween = SizeTween(
|
||||||
begin: _closedSize,
|
begin: _closedSize,
|
||||||
end: Size(
|
end: Size(
|
||||||
|
@ -156,7 +153,16 @@ class AnimatedDialogState extends State<AnimatedDialog> with SingleTickerProvide
|
||||||
);
|
);
|
||||||
_sizeAnimation = _sizeTween.animate(_defaultCurvedAnimation);
|
_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(
|
_offsetAnimation = SizeTween(
|
||||||
begin: Size(
|
begin: Size(
|
||||||
_closedOffset.dx + _closedSize.width / 2,
|
_closedOffset.dx + _closedSize.width / 2,
|
||||||
|
|
|
@ -861,11 +861,11 @@ packages:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
path: "."
|
path: "."
|
||||||
ref: "v4.1.1"
|
ref: "v4.1.2"
|
||||||
resolved-ref: "2317ef3a1e93e06505a033ecbd5cee3758b2dbc0"
|
resolved-ref: "6bb16eb49232649eca02704b3a40890b0184d8b5"
|
||||||
url: "https://github.com/vodemn/m3_lightmeter_iap"
|
url: "https://github.com/vodemn/m3_lightmeter_iap"
|
||||||
source: git
|
source: git
|
||||||
version: "4.1.1+36"
|
version: "4.1.2+37"
|
||||||
m3_lightmeter_resources:
|
m3_lightmeter_resources:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
name: lightmeter
|
name: lightmeter
|
||||||
description: Lightmeter app inspired by Material 3 design system.
|
description: Lightmeter app inspired by Material 3 design system.
|
||||||
publish_to: "none"
|
publish_to: "none"
|
||||||
version: 2.0.0+62
|
version: 2.0.0+63
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=3.0.0 <4.0.0"
|
sdk: ">=3.0.0 <4.0.0"
|
||||||
|
@ -33,7 +33,7 @@ dependencies:
|
||||||
m3_lightmeter_iap:
|
m3_lightmeter_iap:
|
||||||
git:
|
git:
|
||||||
url: "https://github.com/vodemn/m3_lightmeter_iap"
|
url: "https://github.com/vodemn/m3_lightmeter_iap"
|
||||||
ref: v4.1.1
|
ref: v4.1.2
|
||||||
m3_lightmeter_resources:
|
m3_lightmeter_resources:
|
||||||
git:
|
git:
|
||||||
url: "https://github.com/vodemn/m3_lightmeter_resources"
|
url: "https://github.com/vodemn/m3_lightmeter_resources"
|
||||||
|
|
Loading…
Reference in a new issue