update
This commit is contained in:
parent
9d5a392db3
commit
c41c19b469
10 changed files with 299 additions and 181 deletions
|
|
@ -3,10 +3,12 @@ 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/stocks.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/logo_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';
|
||||
|
|
@ -23,18 +25,20 @@ class CustomerSearchPage extends StatefulWidget {
|
|||
class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
||||
final _searchController = TextEditingController();
|
||||
final _storage = Storage();
|
||||
final _stocks = Stocks();
|
||||
// final _refMedicines = RefMedicines();
|
||||
late String imageUrl = '';
|
||||
// List<String> imageUrl = [];
|
||||
late List _stockList = [];
|
||||
|
||||
void getURL() async {
|
||||
final image = await _storage.getPublicURL('ref_medicines_images', 'cb6eafdb-d86f-460a-9571-44446570d4cb.webp');
|
||||
Future<void> _getURL() async {
|
||||
final image = await _storage.getPublicURL('ref_medicines_images', 'a3e430fe-86c1-4d46-9c6a-aed2dae57fef.webp');
|
||||
setState(() {
|
||||
imageUrl = image;
|
||||
});
|
||||
}
|
||||
|
||||
// final meds = await _refMedicines.getList2();
|
||||
// log(meds.toString());
|
||||
Future<void> _getAllStocks() async {
|
||||
_stockList = await _stocks.getList();
|
||||
}
|
||||
|
||||
// void getURLs() async {
|
||||
|
|
@ -57,9 +61,14 @@ class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
|||
|
||||
void _filterList() {}
|
||||
|
||||
void autoRun() async {
|
||||
await _getAllStocks();
|
||||
await _getURL();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
getURL();
|
||||
autoRun();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
|
|
@ -67,6 +76,7 @@ class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
|||
void dispose() {
|
||||
_searchController.dispose();
|
||||
imageUrl = '';
|
||||
_stockList = [];
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
|
@ -76,103 +86,106 @@ class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
|||
|
||||
return Scaffold(
|
||||
body: PageBackgroundWidget(
|
||||
dark: true,
|
||||
// height: MediaQuery.of(context).size.height * 2,
|
||||
child: Column(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
const Gap(96),
|
||||
const TitleWidget(
|
||||
firstTextSize: 14,
|
||||
secondTextSize: 24,
|
||||
logoSize: 90,
|
||||
),
|
||||
const Gap(32),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 64, right: 64),
|
||||
child: Column(
|
||||
children: [
|
||||
InputWidget(
|
||||
label: '',
|
||||
controller: _searchController,
|
||||
placeholder: 'Search for medicine',
|
||||
),
|
||||
// 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),
|
||||
// ),
|
||||
// )
|
||||
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,
|
||||
Column(
|
||||
children: [
|
||||
const Gap(96),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
const Gap(16),
|
||||
const LogoWidget(size: 56),
|
||||
],
|
||||
),
|
||||
const Gap(8),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 64, right: 64),
|
||||
child: Column(
|
||||
children: [
|
||||
InputWidget(
|
||||
label: '',
|
||||
controller: _searchController,
|
||||
placeholder: 'Search for medicine',
|
||||
),
|
||||
// const Gap(8),
|
||||
// ButtonWidget(
|
||||
// text: 'Search',
|
||||
// onPressed: _filterList,
|
||||
// width: 160,
|
||||
// )
|
||||
],
|
||||
),
|
||||
ItemCardWidget(
|
||||
imageUrl: imageUrl,
|
||||
text: 'sample',
|
||||
price: 20,
|
||||
quantity: 85,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
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),
|
||||
// ),
|
||||
// )
|
||||
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,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
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,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
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,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
)));
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue