mirror of
https://github.com/Myzel394/quid_faciam_hodie.git
synced 2025-06-19 07:35:26 +02:00
fixed photo animation
This commit is contained in:
parent
e884527d85
commit
171633c907
@ -192,6 +192,7 @@ class _MainScreenState extends AuthRequiredState<MainScreen> with Loadable {
|
||||
} finally {
|
||||
setState(() {
|
||||
lockCamera = false;
|
||||
uploadingPhotoAnimation = null;
|
||||
});
|
||||
}
|
||||
|
||||
@ -257,39 +258,29 @@ class _MainScreenState extends AuthRequiredState<MainScreen> with Loadable {
|
||||
color: Colors.black,
|
||||
child: ExpandableBottomSheet(
|
||||
background: SafeArea(
|
||||
child: SizedBox(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: MediaQuery.of(context).size.height,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: <Widget>[
|
||||
Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: AnimateInBuilder(
|
||||
builder: (showPreview) => AnimatedOpacity(
|
||||
opacity: showPreview ? 1.0 : 0.0,
|
||||
duration: const Duration(milliseconds: 1100),
|
||||
curve: Curves.easeOutQuad,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(SMALL_SPACE),
|
||||
child: AspectRatio(
|
||||
aspectRatio: 1 / controller!.value.aspectRatio,
|
||||
child: controller!.buildPreview(),
|
||||
),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: AnimateInBuilder(
|
||||
builder: (showPreview) => AnimatedOpacity(
|
||||
opacity: showPreview ? 1.0 : 0.0,
|
||||
duration: const Duration(milliseconds: 1100),
|
||||
curve: Curves.easeOutQuad,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(SMALL_SPACE),
|
||||
child: AspectRatio(
|
||||
aspectRatio: 1 / controller!.value.aspectRatio,
|
||||
child: Stack(
|
||||
children: <Widget>[
|
||||
controller!.buildPreview(),
|
||||
if (uploadingPhotoAnimation != null)
|
||||
UploadingPhoto(
|
||||
data: uploadingPhotoAnimation!,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
if (uploadingPhotoAnimation != null)
|
||||
UploadingPhoto(
|
||||
data: uploadingPhotoAnimation!,
|
||||
onDone: () {
|
||||
setState(() {
|
||||
uploadingPhotoAnimation = null;
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -2,16 +2,13 @@ import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:share_location/constants/spacing.dart';
|
||||
import 'package:share_location/constants/values.dart';
|
||||
|
||||
class UploadingPhoto extends StatefulWidget {
|
||||
final Uint8List data;
|
||||
final VoidCallback onDone;
|
||||
|
||||
const UploadingPhoto({
|
||||
Key? key,
|
||||
required this.data,
|
||||
required this.onDone,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
@ -38,16 +35,6 @@ class _UploadingPhotoState extends State<UploadingPhoto>
|
||||
),
|
||||
);
|
||||
|
||||
controller.addStatusListener((status) {
|
||||
if (status == AnimationStatus.completed) {
|
||||
Future.delayed(PHOTO_SHOW_AFTER_CREATION_DURATION, () {
|
||||
if (mounted) {
|
||||
widget.onDone();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
controller.forward();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user