|
|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/config/size_config.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
|
|
|
|
|
@ -14,6 +15,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scafold_detail_page.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|
|
|
|
@ -46,13 +48,16 @@ class ProductDetailPage extends StatefulWidget {
|
|
|
|
|
__ProductDetailPageState createState() => __ProductDetailPageState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class __ProductDetailPageState extends State<ProductDetailPage> {
|
|
|
|
|
class __ProductDetailPageState extends State<ProductDetailPage>
|
|
|
|
|
with SingleTickerProviderStateMixin {
|
|
|
|
|
TabController _tabController;
|
|
|
|
|
AppSharedPreferences sharedPref = AppSharedPreferences();
|
|
|
|
|
|
|
|
|
|
bool isTrue = true;
|
|
|
|
|
bool isDetails = true;
|
|
|
|
|
bool isReviews = false;
|
|
|
|
|
bool isAvailability = false;
|
|
|
|
|
int _activeTab = 0;
|
|
|
|
|
|
|
|
|
|
checkWishlist() async {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
@ -74,10 +79,18 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
|
|
|
|
|
void initState() {
|
|
|
|
|
price = 1;
|
|
|
|
|
specificationData = widget.product;
|
|
|
|
|
_tabController = TabController(length: 3, vsync: this);
|
|
|
|
|
|
|
|
|
|
userInfo();
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void dispose() {
|
|
|
|
|
_tabController.dispose();
|
|
|
|
|
super.dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void userInfo() async {
|
|
|
|
|
print(specificationData);
|
|
|
|
|
customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
|
|
|
|
|
@ -90,6 +103,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
|
|
|
|
|
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
|
|
|
final screenSize = MediaQuery.of(context).size;
|
|
|
|
|
|
|
|
|
|
return customerId != null
|
|
|
|
|
? DetailPageScafold(
|
|
|
|
|
@ -153,15 +167,87 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 6,
|
|
|
|
|
),
|
|
|
|
|
// Container(
|
|
|
|
|
// height: 500,
|
|
|
|
|
// color: Colors.white,
|
|
|
|
|
// child: Scaffold(
|
|
|
|
|
// backgroundColor: Colors.white,
|
|
|
|
|
// extendBodyBehindAppBar: false,
|
|
|
|
|
// appBar: PreferredSize(
|
|
|
|
|
// preferredSize: Size.fromHeight(
|
|
|
|
|
// MediaQuery.of(context).size.height * 0.070),
|
|
|
|
|
// child: Container(
|
|
|
|
|
// height: MediaQuery.of(context).size.height * 0.070,
|
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
|
// border: Border(
|
|
|
|
|
// bottom: BorderSide(
|
|
|
|
|
// color: Theme.of(context).dividerColor,
|
|
|
|
|
// width: 0.5), //width: 0.7
|
|
|
|
|
// ),
|
|
|
|
|
// color: Colors.white),
|
|
|
|
|
// child: Center(
|
|
|
|
|
// child: TabBar(
|
|
|
|
|
// isScrollable: false,
|
|
|
|
|
// controller: _tabController,
|
|
|
|
|
// // indicatorColor: Colors.transparent,
|
|
|
|
|
// indicatorWeight: 1.0,
|
|
|
|
|
// indicatorSize: TabBarIndicatorSize.tab,
|
|
|
|
|
// indicatorColor:Colors.green,
|
|
|
|
|
// labelColor: Theme.of(context).primaryColor,
|
|
|
|
|
// labelPadding: EdgeInsets.only(
|
|
|
|
|
// top: 0, left: 0, right: 0, bottom: 0),
|
|
|
|
|
// unselectedLabelColor: Colors.grey[800],
|
|
|
|
|
// tabs: [
|
|
|
|
|
// tabWidget(screenSize, _activeTab == 0,
|
|
|
|
|
// TranslationBase.of(context).details,
|
|
|
|
|
// ),
|
|
|
|
|
// tabWidget(screenSize, _activeTab == 1,
|
|
|
|
|
// TranslationBase.of(context).review,
|
|
|
|
|
// ),
|
|
|
|
|
// tabWidget(screenSize, _activeTab == 2,
|
|
|
|
|
// TranslationBase.of(context).availability),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// body: Column(
|
|
|
|
|
// children: [
|
|
|
|
|
// Expanded(
|
|
|
|
|
// child: TabBarView(
|
|
|
|
|
// physics: BouncingScrollPhysics(),
|
|
|
|
|
// controller: _tabController,
|
|
|
|
|
// children: [
|
|
|
|
|
// DetailsInfo(
|
|
|
|
|
// product: widget.product,
|
|
|
|
|
// ),
|
|
|
|
|
// ReviewsInfo(
|
|
|
|
|
// product: widget.product,
|
|
|
|
|
// ),
|
|
|
|
|
// AvailabilityInfo()
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
//
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 6,
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
//TODO Elham* Remove this
|
|
|
|
|
Container(
|
|
|
|
|
width: 500,
|
|
|
|
|
// width: 500,
|
|
|
|
|
margin: EdgeInsets.only(bottom: 6),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
children: [
|
|
|
|
|
@ -181,13 +267,9 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
|
|
|
|
|
),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
isDetails
|
|
|
|
|
? Container(
|
|
|
|
|
width: 100,
|
|
|
|
|
height: 5,
|
|
|
|
|
color: Colors.green,
|
|
|
|
|
)
|
|
|
|
|
: Container()
|
|
|
|
|
CustomDivider(
|
|
|
|
|
color: isDetails ? Colors.green : Colors.transparent,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
@ -211,13 +293,9 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
|
|
|
|
|
),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
isReviews
|
|
|
|
|
? Container(
|
|
|
|
|
width: 100,
|
|
|
|
|
height: 5,
|
|
|
|
|
color: Colors.green,
|
|
|
|
|
)
|
|
|
|
|
: Container(),
|
|
|
|
|
CustomDivider(
|
|
|
|
|
color: isReviews ? Colors.green : Colors.transparent,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
@ -241,13 +319,9 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
|
|
|
|
|
),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
isAvailability
|
|
|
|
|
? Container(
|
|
|
|
|
width: 100,
|
|
|
|
|
height: 5,
|
|
|
|
|
color: Colors.green,
|
|
|
|
|
)
|
|
|
|
|
: Container(),
|
|
|
|
|
CustomDivider(
|
|
|
|
|
color: isAvailability ? Colors.green : Colors.transparent,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
@ -795,6 +869,24 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class CustomDivider extends StatelessWidget {
|
|
|
|
|
const CustomDivider({
|
|
|
|
|
Key key,
|
|
|
|
|
this.color,
|
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
final Color color;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Container(
|
|
|
|
|
width: 120,
|
|
|
|
|
height: 2,
|
|
|
|
|
color: color,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
convertCityName(txt) {
|
|
|
|
|
String stringTxt;
|
|
|
|
|
String newTxt;
|
|
|
|
|
@ -828,3 +920,27 @@ deleteFromWishlistFunction(itemID) async {
|
|
|
|
|
isInWishList = false;
|
|
|
|
|
await x.deletWishlistData(itemID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//TODO Elham* move to file
|
|
|
|
|
Widget tabWidget(
|
|
|
|
|
Size screenSize,
|
|
|
|
|
bool isActive,
|
|
|
|
|
String title,
|
|
|
|
|
) {
|
|
|
|
|
return Center(
|
|
|
|
|
child: Container(
|
|
|
|
|
height: screenSize.height * 0.070,
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
AppText(
|
|
|
|
|
title,
|
|
|
|
|
fontSize: SizeConfig.textMultiplier * 1.5,
|
|
|
|
|
// color: Color(0xFF2B353E),
|
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|