quid_faciam_hodie/lib/widgets/today_photo_button.dart
2022-08-16 11:39:52 +02:00

58 lines
1.4 KiB
Dart

import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:share_location/constants/spacing.dart';
import 'package:share_location/enums.dart';
import 'package:share_location/screens/timeline_screen.dart';
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);
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () async {
onLeave();
await Navigator.pushNamed(context, TimelineScreen.ID);
onComeBack();
},
child: Container(
width: 45,
height: 45,
decoration: BoxDecoration(
border: Border.all(
color: Colors.white,
width: 2,
),
borderRadius: BorderRadius.circular(SMALL_SPACE),
color: Colors.grey,
),
child: ClipRRect(
borderRadius: BorderRadius.circular(SMALL_SPACE),
child: (data == null || type == null)
? const SizedBox()
: RawMemoryDisplay(
data: data!,
type: type!,
),
),
),
);
}
}