You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
289 lines
12 KiB
Dart
289 lines
12 KiB
Dart
4 years ago
|
import 'package:carousel_slider/carousel_slider.dart';
|
||
|
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-viewmodel.dart';
|
||
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||
|
import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart';
|
||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||
|
import 'package:flutter/material.dart';
|
||
|
|
||
|
class LakumBannerWidget extends StatefulWidget {
|
||
|
final LacumViewModel model;
|
||
|
final MediaQueryData mediaQuery;
|
||
|
final bool isLacumHomePage;
|
||
|
|
||
|
LakumBannerWidget(this.model, this.mediaQuery, this.isLacumHomePage);
|
||
|
|
||
|
@override
|
||
|
_LakumBannerWidgetState createState() => _LakumBannerWidgetState();
|
||
|
}
|
||
|
|
||
|
class _LakumBannerWidgetState extends State<LakumBannerWidget> {
|
||
|
int _current = 0;
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return Container(
|
||
|
child: Stack(
|
||
|
children: [
|
||
|
CarouselSlider(
|
||
|
options: CarouselOptions(
|
||
|
enableInfiniteScroll: false,
|
||
|
enlargeCenterPage: false,
|
||
|
viewportFraction: 1.0,
|
||
|
scrollPhysics: widget.isLacumHomePage
|
||
|
? ScrollPhysics()
|
||
|
: NeverScrollableScrollPhysics(),
|
||
|
initialPage: 0,
|
||
|
onPageChanged: (index, reason) {
|
||
|
setState(() {
|
||
|
_current = index;
|
||
|
});
|
||
|
},
|
||
|
),
|
||
|
items: [
|
||
|
Container(
|
||
|
decoration: BoxDecoration(
|
||
|
shape: BoxShape.rectangle,
|
||
|
borderRadius: BorderRadius.circular(4),
|
||
|
border: Border.fromBorderSide(BorderSide(
|
||
|
color: Colors.grey,
|
||
|
width: 0.4,
|
||
|
)),
|
||
|
),
|
||
|
margin: EdgeInsets.symmetric(horizontal: 16),
|
||
|
child: Stack(
|
||
|
children: [
|
||
|
Image.asset(
|
||
|
"assets/images/pharmacy_module/lakum/lakum_card_front_bg.png",
|
||
|
fit: BoxFit.fill,
|
||
|
width: widget.mediaQuery.size.width * 1.0,
|
||
|
height: widget.mediaQuery.size.width * 1.0,
|
||
|
),
|
||
|
Container(
|
||
|
margin: EdgeInsets.fromLTRB(12, 70, 12, 4),
|
||
|
child: Column(
|
||
|
children: [
|
||
|
Row(
|
||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||
|
children: [
|
||
|
Column(
|
||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
children: [
|
||
|
Texts(
|
||
|
widget.model.lacumGroupInformation.lakumInquiryInformationObjVersion.memberName,
|
||
|
fontSize: 14,
|
||
|
fontWeight: FontWeight.bold,
|
||
|
color: Colors.black,
|
||
|
),
|
||
|
Texts(
|
||
|
"${widget.model.lacumInformation.yahalaAccountNo}",
|
||
|
fontSize: 16,
|
||
|
fontWeight: FontWeight.normal,
|
||
|
color: Colors.black,
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
BorderedButton(
|
||
|
widget.model.lacumGroupInformation.lakumInquiryInformationObjVersion.accountStatus == "Active"
|
||
|
? TranslationBase.of(context).active
|
||
|
: TranslationBase.of(context).inactive,
|
||
|
textColor: widget.model.lacumInformation
|
||
|
.accountStatus ==
|
||
|
1
|
||
|
? Colors.green
|
||
|
: Colors.red,
|
||
|
hasBorder: true,
|
||
|
borderColor: widget.model.lacumInformation
|
||
|
.accountStatus ==
|
||
|
1
|
||
|
? Colors.green
|
||
|
: Colors.red,
|
||
|
radius: 16,
|
||
|
rPadding: 16,
|
||
|
icon: widget.model.lacumInformation
|
||
|
.accountStatus ==
|
||
|
1
|
||
|
? Icon(
|
||
|
Icons.check_circle,
|
||
|
size: 25,
|
||
|
color: Colors.green,
|
||
|
)
|
||
|
: Image.asset(
|
||
|
"assets/images/pharmacy_module/lakum/inactive_cross.png",
|
||
|
fit: BoxFit.fill,
|
||
|
width: 25,
|
||
|
height: 25,
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
SizedBox(
|
||
|
height: 10,
|
||
|
),
|
||
|
Row(
|
||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||
|
children: [
|
||
|
Column(
|
||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
children: [
|
||
|
Texts(
|
||
|
"IDENTIFICATION #",
|
||
|
fontSize: 14,
|
||
|
fontWeight: FontWeight.bold,
|
||
|
color: Colors.black,
|
||
|
),
|
||
|
Texts(
|
||
|
widget.model.lacumInformation
|
||
|
.identificationNo,
|
||
|
fontSize: 16,
|
||
|
fontWeight: FontWeight.normal,
|
||
|
color: Colors.black,
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
Column(
|
||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||
|
children: [
|
||
|
Texts(
|
||
|
"MEMBER SINCE",
|
||
|
fontSize: 14,
|
||
|
fontWeight: FontWeight.bold,
|
||
|
color: Colors.black,
|
||
|
),
|
||
|
Texts(
|
||
|
widget.model.formatCreatedDateToString(),
|
||
|
fontSize: 16,
|
||
|
fontWeight: FontWeight.normal,
|
||
|
color: Colors.black,
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
SizedBox(
|
||
|
height: 10,
|
||
|
),
|
||
|
Row(
|
||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||
|
children: [
|
||
|
Column(
|
||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
children: [
|
||
|
Texts(
|
||
|
"MOBILE #",
|
||
|
fontSize: 14,
|
||
|
fontWeight: FontWeight.bold,
|
||
|
color: Colors.black,
|
||
|
),
|
||
|
Texts(
|
||
|
widget.model.lacumGroupInformation.lakumInquiryInformationObjVersion.mobileNumber,
|
||
|
fontSize: 16,
|
||
|
fontWeight: FontWeight.normal,
|
||
|
color: Colors.black,
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
Column(
|
||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||
|
children: [
|
||
|
Texts(
|
||
|
TranslationBase.of(context).language,
|
||
|
fontSize: 14,
|
||
|
fontWeight: FontWeight.bold,
|
||
|
color: Colors.black,
|
||
|
),
|
||
|
Texts(
|
||
|
widget.model.lacumInformation.prefLang ==
|
||
|
"1"
|
||
|
? TranslationBase.of(context).lanEnglish
|
||
|
: TranslationBase.of(context).lanArabic,
|
||
|
fontSize: 16,
|
||
|
fontWeight: FontWeight.normal,
|
||
|
color: Colors.black,
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
widget.isLacumHomePage
|
||
|
? Container(
|
||
|
decoration: BoxDecoration(
|
||
|
shape: BoxShape.rectangle,
|
||
|
borderRadius: BorderRadius.circular(4),
|
||
|
border: Border.fromBorderSide(BorderSide(
|
||
|
color: Colors.grey,
|
||
|
width: 0.4,
|
||
|
)),
|
||
|
),
|
||
|
margin: EdgeInsets.symmetric(horizontal: 16),
|
||
|
child: Stack(
|
||
|
children: [
|
||
|
Image.asset(
|
||
|
"assets/images/pharmacy_module/lakum/lakum_card_front_bg.png",
|
||
|
fit: BoxFit.fill,
|
||
|
width: widget.mediaQuery.size.width * 1.0,
|
||
|
height: widget.mediaQuery.size.width * 1.0,
|
||
|
),
|
||
|
Container(
|
||
|
margin: EdgeInsets.fromLTRB(12, 70, 12, 4),
|
||
|
child: widget.model.convertBase64ToBarCodeImage() !=
|
||
|
null
|
||
|
? Image.memory(
|
||
|
widget.model.convertBase64ToBarCodeImage())
|
||
|
: Container(),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
)
|
||
|
: Container(),
|
||
|
],
|
||
|
),
|
||
|
widget.isLacumHomePage
|
||
|
? Positioned(
|
||
|
bottom: 1,
|
||
|
left: 1,
|
||
|
right: 1,
|
||
|
child: Padding(
|
||
|
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||
|
child: Row(
|
||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||
|
children: [
|
||
|
Container(
|
||
|
width: _current == 0 ? 12.0 : 8.0,
|
||
|
height: 4.0,
|
||
|
margin: EdgeInsets.symmetric(
|
||
|
vertical: 0.0, horizontal: 2.0),
|
||
|
decoration: BoxDecoration(
|
||
|
shape: BoxShape.rectangle,
|
||
|
color: _current == 0
|
||
|
? Color(0xff5ab145)
|
||
|
: Color.fromRGBO(0, 0, 0, 0.4),
|
||
|
),
|
||
|
),
|
||
|
Container(
|
||
|
width: _current == 1 ? 12.0 : 8.0,
|
||
|
height: 4.0,
|
||
|
margin: EdgeInsets.symmetric(
|
||
|
vertical: 0.0, horizontal: 2.0),
|
||
|
decoration: BoxDecoration(
|
||
|
shape: BoxShape.rectangle,
|
||
|
color: _current == 1
|
||
|
? Color(0xff5ab145)
|
||
|
: Color.fromRGBO(0, 0, 0, 0.4),
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
)
|
||
|
: Container(),
|
||
|
],
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|