Migrate
This commit is contained in:
@@ -1,56 +0,0 @@
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:firebase_storage/firebase_storage.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:terepi_seged/models/seismic_records.dart';
|
||||
import 'package:terepi_seged/pages/measured_data/presentation/views/seismogram_viewer_dialog.dart';
|
||||
|
||||
class MeasuredDataController extends GetxController {
|
||||
final CollectionReference _seismicRecords =
|
||||
FirebaseFirestore.instance.collection('seismicRecords');
|
||||
|
||||
// late Query<Map<String, dynamic>> records = _seismicRecords.orderBy('field');
|
||||
late Stream<QuerySnapshot> seismicRecordSnapshot;
|
||||
|
||||
@override
|
||||
void onReady() async {
|
||||
super.onReady();
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
|
||||
seismicRecordSnapshot = _seismicRecords
|
||||
// .orderBy('sourcePoint', descending: true)
|
||||
.where('gpsDateTime', isGreaterThan: DateTime(2024, 2, 25, 0, 0, 0))
|
||||
.orderBy('gpsDateTime', descending: true)
|
||||
.snapshots();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() async {
|
||||
super.onClose();
|
||||
|
||||
// seismicRecordSnapshot.
|
||||
}
|
||||
|
||||
void showSeismicImage(int ffid) async {
|
||||
late Uint8List image;
|
||||
Reference reference =
|
||||
FirebaseStorage.instance.ref().child('bp-4/${ffid}.jpg');
|
||||
|
||||
await reference
|
||||
.getData()
|
||||
.then((value) => {image = value!})
|
||||
.catchError((error) => {});
|
||||
|
||||
Get.to(
|
||||
() => SeismogramViewerDialog(
|
||||
imageUrl: '',
|
||||
image: image,
|
||||
),
|
||||
transition: Transition.downToUp);
|
||||
}
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/src/widgets/framework.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:terepi_seged/pages/measured_data/presentation/controllers/measured_data_controller.dart';
|
||||
import 'package:terepi_seged/pages/measured_data/presentation/views/seismogram_viewer_dialog.dart';
|
||||
|
||||
class MeasuredDataView extends GetView<MeasuredDataController> {
|
||||
const MeasuredDataView({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
extendBody: true,
|
||||
appBar: AppBar(
|
||||
title: const Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Mérési adatok'),
|
||||
Text(
|
||||
"Budapest",
|
||||
style: TextStyle(fontSize: 12.0),
|
||||
)
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 20.0),
|
||||
child: GestureDetector(
|
||||
onTap: () => Get.to(() => {}, transition: Transition.downToUp),
|
||||
child: const Icon(
|
||||
Icons.more_vert,
|
||||
size: 26.0,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
body: Column(children: [
|
||||
Text("Mérési adatok"),
|
||||
StreamBuilder<QuerySnapshot>(
|
||||
stream: controller.seismicRecordSnapshot,
|
||||
builder:
|
||||
(BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
|
||||
if (snapshot.hasError) {
|
||||
return const Text('Hiba ...');
|
||||
}
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const Text('Adatbetöltés ...');
|
||||
}
|
||||
return Expanded(
|
||||
child: ListView(
|
||||
// shrinkWrap: true,
|
||||
children: snapshot.data!.docs
|
||||
.map((DocumentSnapshot document) {
|
||||
Map<String, dynamic> data =
|
||||
document.data()! as Map<String, dynamic>;
|
||||
return ListTile(
|
||||
title: Text(data['sourcePoint'].toString()),
|
||||
subtitle: Text(
|
||||
'${data['sourceLine'].toString()} - ${(data['gpsDateTime'] as Timestamp).toDate()}'),
|
||||
trailing: Wrap(spacing: -16, children: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
controller.showSeismicImage(data['ffid']);
|
||||
},
|
||||
icon: const Icon(Icons.image_outlined)),
|
||||
IconButton(
|
||||
onPressed: () {},
|
||||
icon:
|
||||
const Icon(Icons.arrow_forward_ios_sharp))
|
||||
]));
|
||||
})
|
||||
.toList()
|
||||
.cast(),
|
||||
),
|
||||
);
|
||||
},
|
||||
)
|
||||
]));
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:photo_view/photo_view.dart';
|
||||
import 'package:terepi_seged/pages/measured_data/presentation/controllers/measured_data_controller.dart';
|
||||
import 'package:widget_zoom/widget_zoom.dart';
|
||||
|
||||
class SeismogramViewerDialog extends StatelessWidget {
|
||||
final controller = Get.find<MeasuredDataController>();
|
||||
final String imageUrl;
|
||||
final Uint8List image;
|
||||
// final double sourcePoint;
|
||||
SeismogramViewerDialog(
|
||||
{required this.imageUrl, required this.image, super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: ListView(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
icon: const Icon(Icons.close)),
|
||||
TextButton(
|
||||
style: ButtonStyle(
|
||||
overlayColor:
|
||||
MaterialStateProperty.all(Colors.transparent)),
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
child: const Text(
|
||||
'Bezár',
|
||||
style: TextStyle(color: Colors.blue, fontSize: 14.0),
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 15.0),
|
||||
child: Text(
|
||||
'Felvétel megtekintése ()',
|
||||
style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 10.0),
|
||||
child: Center(
|
||||
child: WidgetZoom(
|
||||
zoomWidget: Image(image: MemoryImage(image)),
|
||||
heroAnimationTag: 'tag',
|
||||
maxScaleFullscreen: 8,
|
||||
maxScaleEmbeddedView: 8,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user