Adds the Flutter inventory app source, cleaned up for a shared repo: generic package name, no hardcoded ERP endpoints (moved to gitignored local config), no dead auth code, no debug logging of session data.
90 lines
2.9 KiB
Dart
90 lines
2.9 KiB
Dart
import 'dart:typed_data';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:inventory_app/constants.dart';
|
|
import 'package:inventory_app/controllers/home_controller.dart';
|
|
import 'package:panorama_viewer/panorama_viewer.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
class Panoramic extends StatefulWidget {
|
|
const Panoramic({super.key});
|
|
|
|
@override
|
|
State<Panoramic> createState() => _PanoramicState();
|
|
}
|
|
|
|
class _PanoramicState extends State<Panoramic> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final controller = Get.put(HomeController());
|
|
Size size = MediaQuery.of(context).size;
|
|
|
|
return Stack(
|
|
children: [
|
|
Obx(() {
|
|
final depot = controller.selectedDepot.value;
|
|
if (depot?.picture != null) {
|
|
final pictureId = depot!.picture;
|
|
return FutureBuilder<Uint8List?>(
|
|
future: controller.fetchImageBytes(pictureId!.id!),
|
|
builder: (context, snapshot) {
|
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
|
return Center(
|
|
child: const Padding(
|
|
padding: EdgeInsets.all(16),
|
|
child: CircularProgressIndicator(),
|
|
),
|
|
);
|
|
} else if (snapshot.hasData) {
|
|
return Padding(
|
|
padding: const EdgeInsets.all(2.0),
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.circular(10),
|
|
child: PanoramaViewer(
|
|
child: Image.memory(
|
|
snapshot.data!,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
} else {
|
|
return const Padding(
|
|
padding: EdgeInsets.all(12.0),
|
|
child: Text('❌ Failed to load depot image'),
|
|
);
|
|
}
|
|
},
|
|
);
|
|
} else {
|
|
return const SizedBox.shrink(); // No image to show
|
|
}
|
|
}),
|
|
// PanoramaViewer(child: Image.asset("assets/desk.jpg")),
|
|
Positioned(
|
|
top: 50,
|
|
left: 10,
|
|
child: Container(
|
|
width: size.width - 20,
|
|
height: 100,
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.only(
|
|
topRight: Radius.circular(20),
|
|
bottomLeft: Radius.circular(20),
|
|
),
|
|
),
|
|
child: Obx(() {
|
|
return Center(
|
|
child: Text( controller.selectedDepot.value != null ?
|
|
controller.selectedDepot.value!.name.toString() : "Loading .....",
|
|
style: kLoginTitleStyle(Size(size.width, size.height * 0.3),color: Colors.blue),
|
|
),
|
|
);
|
|
}),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|