122 lines
3.5 KiB
Dart
122 lines
3.5 KiB
Dart
import 'dart:developer';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:gap/gap.dart';
|
|
import 'package:pharmacy_mobile/tables/ref_medicines.dart';
|
|
import 'package:pharmacy_mobile/tables/storage.dart';
|
|
import 'package:pharmacy_mobile/widgets/button_widget.dart';
|
|
import 'package:pharmacy_mobile/widgets/input_widget.dart';
|
|
import 'package:pharmacy_mobile/widgets/page_background_widget.dart';
|
|
import 'package:pharmacy_mobile/widgets/title_widget.dart';
|
|
|
|
class CustomerSearchPage extends StatefulWidget {
|
|
// final NotchBottomBarController? controller;
|
|
// final
|
|
const CustomerSearchPage({super.key});
|
|
|
|
@override
|
|
State<CustomerSearchPage> createState() => _CustomerSearchPageState();
|
|
}
|
|
|
|
class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
|
final _searchController = TextEditingController();
|
|
final _storage = Storage();
|
|
final _refMedicines = RefMedicines();
|
|
late String imageUrl = '';
|
|
// List<String> imageUrl = [];
|
|
|
|
void getURL() async {
|
|
final image = await _storage.getPublicURL('ref_medicines_images', 'cb6eafdb-d86f-460a-9571-44446570d4cb.webp');
|
|
log(image);
|
|
setState(() {
|
|
imageUrl = image;
|
|
});
|
|
|
|
final meds = await _refMedicines.getList2();
|
|
log(meds.toString());
|
|
}
|
|
|
|
// void getURLs() async {
|
|
// try {
|
|
// for (int i = 1; i <= 4; i++) {
|
|
// final image = await _storage.getPublicURL(
|
|
// context,
|
|
// 'ref_medicines_images',
|
|
// 'ca3e2949-4964-4d25-a274-2a18608b7bdb.webp', // Replace with your actual image path
|
|
// );
|
|
// log(image);
|
|
// setState(() {
|
|
// imageUrl.add(image);
|
|
// });
|
|
// }
|
|
// } catch (e, stackTrace) {
|
|
// log('Error getting URLs: $e', stackTrace: stackTrace);
|
|
// }
|
|
// }
|
|
|
|
void _filterList() {}
|
|
|
|
@override
|
|
void initState() {
|
|
getURL();
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_searchController.dispose();
|
|
imageUrl = '';
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: PageBackgroundWidget(
|
|
child: Column(
|
|
children: [
|
|
Column(
|
|
children: [
|
|
const Gap(96),
|
|
const TitleWidget(
|
|
firstTextSize: 14,
|
|
secondTextSize: 24,
|
|
logoSize: 90,
|
|
),
|
|
const Gap(32),
|
|
Container(
|
|
padding: EdgeInsets.only(left: 32, right: 32),
|
|
child: Column(
|
|
children: [
|
|
InputWidget(label: '', controller: _searchController),
|
|
const Gap(8),
|
|
ButtonWidget(
|
|
text: 'Search',
|
|
onPressed: _filterList,
|
|
width: 160,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
const Gap(32),
|
|
Center(
|
|
child: imageUrl.isNotEmpty
|
|
? ClipRRect(
|
|
borderRadius: BorderRadius.circular(12), // Add your desired border radius here
|
|
child: Image.network(imageUrl,
|
|
fit: BoxFit.cover,
|
|
width: 250,
|
|
height: 250,
|
|
cacheWidth: (250 * MediaQuery.of(context).devicePixelRatio).round()))
|
|
: const CircularProgressIndicator(
|
|
color: Colors.white,
|
|
strokeWidth: 4,
|
|
padding: EdgeInsets.all(8),
|
|
),
|
|
)
|
|
],
|
|
)
|
|
],
|
|
)));
|
|
}
|
|
}
|