update
This commit is contained in:
parent
6f54a6f9fc
commit
a208763a67
13 changed files with 232 additions and 117 deletions
|
|
@ -6,7 +6,9 @@ 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/item_card_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/page_background_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/text_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/title_widget.dart';
|
||||
|
||||
class CustomerSearchPage extends StatefulWidget {
|
||||
|
|
@ -21,19 +23,18 @@ class CustomerSearchPage extends StatefulWidget {
|
|||
class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
||||
final _searchController = TextEditingController();
|
||||
final _storage = Storage();
|
||||
final _refMedicines = RefMedicines();
|
||||
// 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());
|
||||
// final meds = await _refMedicines.getList2();
|
||||
// log(meds.toString());
|
||||
}
|
||||
|
||||
// void getURLs() async {
|
||||
|
|
@ -71,6 +72,8 @@ class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
const double imageSize = 180;
|
||||
|
||||
return Scaffold(
|
||||
body: PageBackgroundWidget(
|
||||
child: Column(
|
||||
|
|
@ -85,7 +88,7 @@ class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
|||
),
|
||||
const Gap(32),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 32, right: 32),
|
||||
padding: EdgeInsets.only(left: 64, right: 64),
|
||||
child: Column(
|
||||
children: [
|
||||
InputWidget(label: '', controller: _searchController),
|
||||
|
|
@ -99,20 +102,44 @@ class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
|||
),
|
||||
),
|
||||
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),
|
||||
),
|
||||
// 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),
|
||||
// ),
|
||||
// )
|
||||
Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 8, 0, 8),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
ItemCardWidget(
|
||||
imageUrl: imageUrl,
|
||||
text: 'sample',
|
||||
price: 500,
|
||||
quantity: 15,
|
||||
),
|
||||
ItemCardWidget(
|
||||
imageUrl: imageUrl,
|
||||
text: 'sample',
|
||||
price: 20,
|
||||
quantity: 85,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -8,8 +8,10 @@ class InputWidget extends StatelessWidget {
|
|||
final TextEditingController controller;
|
||||
final bool? password;
|
||||
final OnChangedCallback? onChanged;
|
||||
final String? placeholder;
|
||||
|
||||
const InputWidget({super.key, required this.label, required this.controller, this.password, this.onChanged});
|
||||
const InputWidget(
|
||||
{super.key, required this.label, required this.controller, this.password, this.onChanged, this.placeholder});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
@ -29,7 +31,9 @@ class InputWidget extends StatelessWidget {
|
|||
filled: true,
|
||||
fillColor: const Color.fromRGBO(255, 255, 255, 1),
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(8)),
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 10, horizontal: 24)),
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 2, horizontal: 24),
|
||||
prefixIcon: placeholder != null ? Icon(Icons.search, color: Colors.grey) : null,
|
||||
hintText: placeholder),
|
||||
style: GoogleFonts.outfit(textStyle: const TextStyle(color: Color.fromRGBO(0, 0, 0, 1), fontSize: 16)),
|
||||
obscureText: password ?? false,
|
||||
onChanged: onChanged,
|
||||
|
|
|
|||
83
lib/widgets/item_card_widget.dart
Normal file
83
lib/widgets/item_card_widget.dart
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:pharmacy_mobile/widgets/text_widget.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class ItemCardWidget extends StatelessWidget {
|
||||
final String imageUrl;
|
||||
final String text;
|
||||
final double price;
|
||||
final double quantity;
|
||||
|
||||
const ItemCardWidget(
|
||||
{super.key, required this.imageUrl, required this.text, required this.price, required this.quantity});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
const double imageSize = 180;
|
||||
const Color fontColor = Color.fromRGBO(0, 0, 0, 1);
|
||||
|
||||
return Card(
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Image.network(imageUrl,
|
||||
fit: BoxFit.cover,
|
||||
width: imageSize,
|
||||
height: imageSize / 1.4,
|
||||
cacheWidth: (imageSize * MediaQuery.of(context).devicePixelRatio).round()),
|
||||
const Gap(8),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextWidget(
|
||||
text: text,
|
||||
size: 10,
|
||||
color: Colors.black,
|
||||
bold: true,
|
||||
),
|
||||
TextWidget(
|
||||
text: text,
|
||||
size: 16,
|
||||
color: Colors.black,
|
||||
)
|
||||
],
|
||||
),
|
||||
const Gap(
|
||||
92,
|
||||
color: Colors.red,
|
||||
),
|
||||
TextWidget(
|
||||
text: quantity.toStringAsFixed(0),
|
||||
size: 12,
|
||||
color: const Color.fromRGBO(39, 39, 39, 1),
|
||||
)
|
||||
]),
|
||||
),
|
||||
const Gap(8),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset('assets/php_logo.webp',
|
||||
fit: BoxFit.cover, height: 12, cacheWidth: (10 * MediaQuery.of(context).devicePixelRatio).round()),
|
||||
const Gap(4),
|
||||
TextWidget(
|
||||
text: NumberFormat.currency(locale: "en_US", symbol: "").format(price),
|
||||
size: 14,
|
||||
bold: true,
|
||||
color: fontColor,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue