77 lines
2.2 KiB
Dart
77 lines
2.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:rogapp/pages/destination/destination_controller.dart';
|
|
|
|
class CameraPage extends StatelessWidget {
|
|
CameraPage({Key? key}) : super(key: key);
|
|
DestinationController destinationController = Get.find<DestinationController>();
|
|
|
|
ImageProvider getFinishImage(){
|
|
if(destinationController.photos.isNotEmpty){
|
|
return FileImage(destinationController.photos[0]);
|
|
}
|
|
else{
|
|
return AssetImage('assets/images/empty_image.png');
|
|
}
|
|
}
|
|
|
|
// void finishRog(){
|
|
// destinationController.addToRogaining(destinationController.current_lat, destinationController.current_lon, destination_id)
|
|
// }
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: Text("finishing_rogaining".tr),
|
|
),
|
|
body: Column(
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
children: [
|
|
Padding(
|
|
padding: EdgeInsets.all(8.0),
|
|
child: Center(
|
|
child: Obx(() =>
|
|
Container(
|
|
width: MediaQuery.of(context).size.width,
|
|
height: 370,
|
|
decoration: BoxDecoration(
|
|
image:
|
|
DecorationImage(
|
|
image: getFinishImage(),
|
|
fit: BoxFit.cover
|
|
)
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
children: [
|
|
ElevatedButton(
|
|
onPressed: (){
|
|
destinationController.openCamera(context);
|
|
},
|
|
child: Text("take_photo of the clock".tr)
|
|
),
|
|
Obx(() =>
|
|
destinationController.photos.isNotEmpty ?
|
|
ElevatedButton(
|
|
style: ElevatedButton.styleFrom(
|
|
primary: Colors.red
|
|
),
|
|
onPressed: (){
|
|
|
|
},
|
|
child: Text("finish_goal".tr)
|
|
):
|
|
Container()
|
|
)
|
|
],
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
} |