added goal feature
This commit is contained in:
77
lib/pages/camera/camera_page.dart
Normal file
77
lib/pages/camera/camera_page.dart
Normal file
@ -0,0 +1,77 @@
|
||||
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()
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user