fix public card issues
parent
7dfc700d26
commit
2981eb3236
@ -0,0 +1,19 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
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,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -1,281 +0,0 @@
|
|||||||
import 'package:diplomaticquarterapp/config/config.dart';
|
|
||||||
import 'package:diplomaticquarterapp/config/size_config.dart';
|
|
||||||
import 'package:diplomaticquarterapp/config/size_config.dart';
|
|
||||||
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
|
|
||||||
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
|
|
||||||
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
||||||
import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart';
|
|
||||||
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
|
|
||||||
import 'package:diplomaticquarterapp/pages/pharmacies/compare-list.dart';
|
|
||||||
import 'package:diplomaticquarterapp/routes.dart';
|
|
||||||
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
||||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
||||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
|
||||||
import 'package:diplomaticquarterapp/widgets/others/bottom_bar.dart';
|
|
||||||
import 'package:diplomaticquarterapp/widgets/progress_indicator/app_loader_widget.dart';
|
|
||||||
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
|
|
||||||
import '../../locator.dart';
|
|
||||||
import 'floating_button_search.dart';
|
|
||||||
import '../progress_indicator/app_loader_widget.dart';
|
|
||||||
import 'arrow_back.dart';
|
|
||||||
import 'network_base_view.dart';
|
|
||||||
import 'not_auh_page.dart';
|
|
||||||
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
|
|
||||||
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart';
|
|
||||||
|
|
||||||
class DetailPageScafold extends StatefulWidget {
|
|
||||||
final String appBarTitle;
|
|
||||||
final Widget body;
|
|
||||||
final Widget bottomSheet;
|
|
||||||
final bool isLoading;
|
|
||||||
final bool isShowAppBar;
|
|
||||||
final bool hasAppBarParam;
|
|
||||||
final BaseViewModel baseViewModel;
|
|
||||||
final bool isBottomBar;
|
|
||||||
final Widget floatingActionButton;
|
|
||||||
final bool isPharmacy;
|
|
||||||
final String title;
|
|
||||||
final String description;
|
|
||||||
final String image;
|
|
||||||
final bool isShowDecPage;
|
|
||||||
final List<String> infoList;
|
|
||||||
final Color backgroundColor;
|
|
||||||
final double preferredSize;
|
|
||||||
final List<Widget> appBarIcons;
|
|
||||||
final PreferredSizeWidget appBarWidget;
|
|
||||||
|
|
||||||
DetailPageScafold(
|
|
||||||
{@required this.body,
|
|
||||||
this.appBarTitle = '',
|
|
||||||
this.isLoading = false,
|
|
||||||
this.isShowAppBar = false,
|
|
||||||
this.hasAppBarParam,
|
|
||||||
this.bottomSheet,
|
|
||||||
this.baseViewModel,
|
|
||||||
this.floatingActionButton,
|
|
||||||
this.isPharmacy = false,
|
|
||||||
this.title,
|
|
||||||
this.description,
|
|
||||||
this.isShowDecPage = true,
|
|
||||||
this.isBottomBar,
|
|
||||||
this.backgroundColor,
|
|
||||||
this.preferredSize = 0.0,
|
|
||||||
this.appBarIcons,
|
|
||||||
this.appBarWidget,
|
|
||||||
this.image,
|
|
||||||
this.infoList});
|
|
||||||
|
|
||||||
@override
|
|
||||||
_DetailPageScafoldState createState() => _DetailPageScafoldState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _DetailPageScafoldState extends State<DetailPageScafold> {
|
|
||||||
AuthenticatedUserObject authenticatedUserObject =
|
|
||||||
locator<AuthenticatedUserObject>();
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
AppGlobal.context = context;
|
|
||||||
PreferredSizeWidget appBar;
|
|
||||||
|
|
||||||
if (this.widget.appBarWidget == null) {
|
|
||||||
PreferredSizeWidget appBarWidget = AppBarWidget(
|
|
||||||
widget.appBarTitle,
|
|
||||||
widget.appBarIcons,
|
|
||||||
widget.isShowAppBar,
|
|
||||||
isPharmacy: widget.isPharmacy,
|
|
||||||
isShowDecPage: widget.isShowDecPage,
|
|
||||||
image: widget.image,
|
|
||||||
);
|
|
||||||
appBar = widget.preferredSize == 0
|
|
||||||
? appBarWidget
|
|
||||||
: PreferredSize(
|
|
||||||
child: appBarWidget,
|
|
||||||
preferredSize: Size.fromHeight(widget.preferredSize));
|
|
||||||
} else {
|
|
||||||
appBar = this.widget.appBarWidget;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Scaffold(
|
|
||||||
backgroundColor:
|
|
||||||
widget.backgroundColor ?? Theme.of(context).scaffoldBackgroundColor,
|
|
||||||
appBar: appBar,
|
|
||||||
body: (!Provider.of<ProjectViewModel>(context, listen: false).isLogin &&
|
|
||||||
widget.isShowDecPage)
|
|
||||||
? NotAutPage(
|
|
||||||
title: widget.appBarTitle,
|
|
||||||
description: widget.description,
|
|
||||||
infoList: widget.infoList,
|
|
||||||
)
|
|
||||||
: widget.baseViewModel != null
|
|
||||||
? NetworkBaseView(
|
|
||||||
child: buildBodyWidget(),
|
|
||||||
baseViewModel: widget.baseViewModel,
|
|
||||||
)
|
|
||||||
: buildBodyWidget(),
|
|
||||||
bottomSheet: widget.bottomSheet,
|
|
||||||
//floatingActionButton: floatingActionButton ?? floatingActionButton,
|
|
||||||
// bottomNavigationBar:
|
|
||||||
// this.isBottomBar == true ? BottomBarSearch() : SizedBox()
|
|
||||||
// floatingActionButton: FloatingSearchButton(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
buildAppLoaderWidget(bool isLoading) {
|
|
||||||
return isLoading ? AppLoaderWidget() : Container();
|
|
||||||
}
|
|
||||||
|
|
||||||
buildBodyWidget() {
|
|
||||||
// return body; //Stack(children: <Widget>[body, buildAppLoaderWidget(isLoading)]);
|
|
||||||
return Stack(children: <Widget>[
|
|
||||||
widget.body, /*FloatingSearchButton()*/
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class AppBarWidget extends StatelessWidget with PreferredSizeWidget {
|
|
||||||
final AuthenticatedUserObject authenticatedUserObject =
|
|
||||||
locator<AuthenticatedUserObject>();
|
|
||||||
|
|
||||||
final String appBarTitle;
|
|
||||||
final List<Widget> appBarIcons;
|
|
||||||
final bool isShowAppBar;
|
|
||||||
final bool isPharmacy;
|
|
||||||
final bool isShowDecPage;
|
|
||||||
final String image;
|
|
||||||
|
|
||||||
AppBarWidget(this.appBarTitle, this.appBarIcons, this.isShowAppBar,
|
|
||||||
{this.isPharmacy = true, this.isShowDecPage = true, this.image});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return buildAppBar(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget buildAppBar(BuildContext context) {
|
|
||||||
return isShowAppBar
|
|
||||||
? AppBar(
|
|
||||||
elevation: 0,
|
|
||||||
backgroundColor: Colors.white,
|
|
||||||
// isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color,
|
|
||||||
textTheme: TextTheme(
|
|
||||||
headline6:
|
|
||||||
TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
|
|
||||||
),
|
|
||||||
title: Texts(
|
|
||||||
authenticatedUserObject.isLogin || !isShowDecPage
|
|
||||||
? appBarTitle.toUpperCase()
|
|
||||||
: TranslationBase.of(context).serviceInformationTitle,
|
|
||||||
color: Colors.white,
|
|
||||||
bold: true,
|
|
||||||
),
|
|
||||||
leading: Builder(
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return GestureDetector(
|
|
||||||
behavior: HitTestBehavior.opaque,
|
|
||||||
onTap: () => Navigator.pop(context),
|
|
||||||
child: Icon(Icons.arrow_back_ios, color: Colors.grey),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
centerTitle: true,
|
|
||||||
actions: <Widget>[
|
|
||||||
/// TODO Elham* fix this
|
|
||||||
if(isPharmacy)
|
|
||||||
IconButton(
|
|
||||||
icon: Icon(Icons.shopping_cart),
|
|
||||||
color: Colors.grey,
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => CartOrderPage()),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
image != null
|
|
||||||
? InkWell(
|
|
||||||
onTap: () => Navigator.push(
|
|
||||||
context,
|
|
||||||
FadePage(
|
|
||||||
page: InsuranceUpdate(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: Image.asset(
|
|
||||||
image,
|
|
||||||
height: SizeConfig.heightMultiplier * 5,
|
|
||||||
width: SizeConfig.heightMultiplier * 5,
|
|
||||||
color: Colors.grey,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: IconButton(
|
|
||||||
icon: Icon(FontAwesomeIcons.ellipsisV),
|
|
||||||
color: Colors.grey,
|
|
||||||
onPressed: () {
|
|
||||||
settingModalBottomSheet(context);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
if (appBarIcons != null) ...appBarIcons
|
|
||||||
],
|
|
||||||
)
|
|
||||||
: Container(
|
|
||||||
height: 0,
|
|
||||||
width: 0,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Size get preferredSize => Size(double.maxFinite, 60);
|
|
||||||
|
|
||||||
|
|
||||||
settingModalBottomSheet(context) {
|
|
||||||
showModalBottomSheet(
|
|
||||||
context: context,
|
|
||||||
builder: (BuildContext bc) {
|
|
||||||
return Container(
|
|
||||||
child: new Wrap(
|
|
||||||
children: <Widget>[
|
|
||||||
new ListTile(
|
|
||||||
leading: Icon(Icons.shopping_cart),
|
|
||||||
title: Text(
|
|
||||||
TranslationBase.of(context).addToCart,
|
|
||||||
),
|
|
||||||
onTap: () => {
|
|
||||||
if (price > 0)
|
|
||||||
{addToCartFunction(price, itemID, context)}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
AppToast.showErrorToast(
|
|
||||||
message: "you should add quantity")
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
ListTile(
|
|
||||||
leading: Icon(Icons.favorite_border),
|
|
||||||
title: Text(
|
|
||||||
TranslationBase.of(context).addToWishlist,
|
|
||||||
),
|
|
||||||
onTap: () => {addToWishlistFunction(itemID)},
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
leading: Icon(Icons.compare),
|
|
||||||
title: Text(
|
|
||||||
TranslationBase.of(context).compare,
|
|
||||||
),
|
|
||||||
onTap: () => {
|
|
||||||
Provider.of<CompareList>(context, listen: false)
|
|
||||||
.addItem(specificationData),
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue