improvements

This commit is contained in:
Myzel394 2022-08-16 11:39:52 +02:00
parent 391be909a7
commit 4b3442e50d
3 changed files with 52 additions and 25 deletions

View File

@ -308,6 +308,7 @@ class _MainScreenState extends AuthRequiredState<MainScreen> with Loadable {
opacityDuration: DEFAULT_OPACITY_DURATION *
SECONDARY_BUTTONS_DURATION_MULTIPLIER,
child: ChangeCameraButton(
disabled: lockCamera,
onChangeCamera: () {
final currentCameraIndex = GlobalValuesManager
.cameras
@ -348,11 +349,17 @@ class _MainScreenState extends AuthRequiredState<MainScreen> with Loadable {
SECONDARY_BUTTONS_DURATION_MULTIPLIER,
opacityDuration: DEFAULT_OPACITY_DURATION *
SECONDARY_BUTTONS_DURATION_MULTIPLIER,
child: lastPhoto == null
? const TodayPhotoButton()
: TodayPhotoButton(
data: lastPhoto![0],
type: lastPhoto![1],
child: TodayPhotoButton(
data: lastPhoto == null ? null : lastPhoto![0],
type: lastPhoto == null ? null : lastPhoto![1],
onLeave: () {
controller!.setFlashMode(FlashMode.off);
},
onComeBack: () {
if (isTorchEnabled) {
controller!.setFlashMode(FlashMode.torch);
}
},
),
),
],
@ -362,7 +369,11 @@ class _MainScreenState extends AuthRequiredState<MainScreen> with Loadable {
),
),
expandableContent: Padding(
padding: const EdgeInsets.all(LARGE_SPACE),
padding: const EdgeInsets.only(
left: LARGE_SPACE,
right: LARGE_SPACE,
bottom: MEDIUM_SPACE,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
@ -403,8 +414,7 @@ class _MainScreenState extends AuthRequiredState<MainScreen> with Loadable {
: () {
final newZoomLevelIndex =
((currentZoomLevelIndex + 1) %
zoomLevels!.length)
.toInt();
zoomLevels!.length);
controller!
.setZoomLevel(zoomLevels![newZoomLevelIndex]);

View File

@ -3,10 +3,12 @@ import 'package:flutter/services.dart';
class ChangeCameraButton extends StatelessWidget {
final VoidCallback onChangeCamera;
final bool disabled;
const ChangeCameraButton({
Key? key,
required this.onChangeCamera,
this.disabled = false,
}) : super(key: key);
@override
@ -15,9 +17,15 @@ class ChangeCameraButton extends StatelessWidget {
enableFeedback: false,
highlightColor: Colors.transparent,
onTap: () {
if (disabled) {
return;
}
HapticFeedback.heavyImpact();
onChangeCamera();
},
child: Opacity(
opacity: disabled ? 0.5 : 1.0,
child: Stack(
alignment: Alignment.center,
children: <Widget>[
@ -26,13 +34,14 @@ class ChangeCameraButton extends StatelessWidget {
size: 60,
color: Colors.white.withOpacity(.2),
),
Icon(
const Icon(
Icons.camera_alt,
size: 30,
color: Colors.white,
),
],
),
),
);
}
}

View File

@ -10,9 +10,13 @@ import 'raw_memory_display.dart';
class TodayPhotoButton extends StatelessWidget {
final Uint8List? data;
final MemoryType? type;
final VoidCallback onLeave;
final VoidCallback onComeBack;
const TodayPhotoButton({
Key? key,
required this.onLeave,
required this.onComeBack,
this.data,
this.type,
}) : super(key: key);
@ -20,8 +24,12 @@ class TodayPhotoButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () {
Navigator.pushNamed(context, TimelineScreen.ID);
onTap: () async {
onLeave();
await Navigator.pushNamed(context, TimelineScreen.ID);
onComeBack();
},
child: Container(
width: 45,