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.
diplomatic-quarter/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart

374 lines
15 KiB
Dart

5 years ago
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/AddAddress.dart';
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/pharmacyAddress_service.dart';
5 years ago
class PharmacyAddressesPage extends StatefulWidget{
@override
_PharmacyAddressesState createState() => _PharmacyAddressesState();
}
class _PharmacyAddressesState extends State<PharmacyAddressesPage>{
int selectedRadio;
bool _value = false;
AppSharedPreferences sharedPref = AppSharedPreferences();
5 years ago
@override
void initState(){
WidgetsBinding.instance.addPostFrameCallback((_) => getAllAddress());
5 years ago
super.initState();
selectedRadio=0;
}
setSelectedRadio(int val){
setState(() {
selectedRadio = val;
});
}
Widget build (BuildContext context){
return Scaffold(
appBar: AppBar(
centerTitle: true,
title: Text(TranslationBase.of(context).changeAddress, style: TextStyle(color:Colors.white)),
backgroundColor: Colors.green,
),
body: Container(
child:SingleChildScrollView(
child: Column(
children:<Widget>[
ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: ScrollPhysics(),
itemCount: 5 ,
5 years ago
itemBuilder: (context, index){
return Container(
child: Padding(
padding:EdgeInsets.only(top:10.0, left:5.0, right:5.0, bottom:5.0,),
5 years ago
child: Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children:<Widget> [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children:<Widget> [
InkWell(
onTap: () {
setState(() {
_value = !_value;
});
},
child: Container(
margin: EdgeInsets.only(right: 20),
child: Padding(
padding: const EdgeInsets.all(5.0),
child: _value
? Container(
child: SvgPicture.asset(
'assets/images/pharmacy/check_icon.svg',
height: 25,
width: 25,),
)
: Container(
child: SvgPicture.asset(
'assets/images/pharmacy/check_icon.svg',
height: 23,
width: 23,
color: Colors.transparent,
),
decoration: BoxDecoration(
border: Border.all(
color: Colors.grey,
style: BorderStyle.solid,
width: 1.0
),
color: Colors.transparent,
borderRadius: BorderRadius.circular(50.0)
),
),
),
),
),
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children:<Widget> [
Text('NAME',
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold,
),
),
SizedBox(
height: 5,),
Text('Address',
style: TextStyle(fontSize: 15.0, color: Colors.grey,
),
),
SizedBox(
height: 5,),
Row(
children:<Widget> [
Container(
margin: EdgeInsets.only(bottom: 8),
child: SvgPicture.asset(
'assets/images/pharmacy/mobile_number_icon.svg',
height: 13,),
),
Container(
margin: EdgeInsets.only(left: 10, bottom: 8),
child: Text('588888778',
style: TextStyle(fontSize: 15.0,
),
),
),
],
),
SizedBox(
height: 15,),
Row(
children:<Widget> [
Column(
children: <Widget> [
InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return AddAddressPage();
}),
);
},
child: Row(
children:<Widget> [
Container(
margin: EdgeInsets.only(right:10, bottom: 15),
child: SvgPicture.asset(
'assets/images/pharmacy/edit_icon.svg',
height: 15,),
),
Container(
margin: EdgeInsets.only(right:5, bottom: 15),
padding: EdgeInsets.only(right: 10.0),
child: Text(TranslationBase.of(context).edit,
style: TextStyle(fontSize: 15.0,
color: Colors.blue,
),
),
decoration: BoxDecoration(
border: Border(
right: BorderSide(
color: Colors.grey,
width: 1.0,
),
),
),
),
],
),
),
],
),
Column(
children: <Widget> [
InkWell(
onTap: () {
// confirmDelete(snapshot.data[index]["id"]);
confirmDelete("address");
},
5 years ago
child: Row(
children:<Widget> [
Container(
margin: EdgeInsets.only(left: 15, right: 10, bottom: 15),
child: SvgPicture.asset(
'assets/images/pharmacy/delete_red_icon.svg',
height: 15,),
),
Container(
margin: EdgeInsets.only(bottom: 15),
child: Text(TranslationBase.of(context).delete,
style: TextStyle(fontSize: 15.0,
color: Colors.redAccent,
),
),
),
],
),
),
],
)
],
),
],
),
SizedBox(
height: 10,
),
],
),
Divider(
color: Colors.grey[350],
height: 20,
thickness: 6,
indent: 0,
endIndent: 0,
),
],
),
),
);
}
),
SizedBox(
height: 10,
),
InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return AddAddressPage();
}),
);
},
child: Container(
margin: EdgeInsets.only(bottom: 100.0),
5 years ago
height: 50.0,
color: Colors.transparent,
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: Colors.green,
style: BorderStyle.solid,
width: 1.0
),
color: Colors.transparent,
borderRadius: BorderRadius.circular(5.0)
),
child: Center(
child: Text(
TranslationBase.of(context).addAddress,
style: TextStyle(
color: Colors.green,
fontWeight: FontWeight.bold,
),
),
),
),
),
),
],
),
),
),
bottomSheet: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return AddAddressPage();
}),
);
},
child: Container(
height: 50.0,
color: Colors.green,
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: Colors.green,
style: BorderStyle.solid,
width: 1.0
),
color: Colors.green,
borderRadius: BorderRadius.circular(5.0)
),
child: Center(
child: Text(TranslationBase.of(context).confirmAddress,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
),
),
),
5 years ago
);
}
confirmDelete(address){
showDialog(
context: context,
builder: (BuildContext context)=> AlertDialog(
title: Text(TranslationBase.of(context).confirmDeleteMsg,
style: TextStyle(
fontWeight: FontWeight.bold,
),),
content: Text("address"),
actions:[
FlatButton(
child: Text(TranslationBase.of(context).cancel,
style: TextStyle(
color: Colors.red,
fontWeight: FontWeight.bold,
fontSize: 16,
),),
onPressed: (){
Navigator.pop(context);
},
),
FlatButton(
child: Text(TranslationBase.of(context).confirmDelete,
style: TextStyle(
color: Colors.grey,
fontWeight: FontWeight.bold,
fontSize: 16,
),),
onPressed: (){
// http.delete("https://uat.hmgwebservices.com/epharmacy/api/Customers/272843?fields=addresses/$id");
Navigator.push(context,
MaterialPageRoute(builder: (context)=> PharmacyAddressesPage() ));
},
),
],
)
);
}
}
getAllAddress() {
print("ADDRESSES");
PharmacyAddressService service = new PharmacyAddressService();
service.getAddress(AppGlobal.context).then((res) {
print(res);
});
}
getConfirmAddress(){
}
getEditAddress(){
}
getDeleteAddress(){
5 years ago
}