112 lines
4.1 KiB
Dart
112 lines
4.1 KiB
Dart
|
import 'package:cached_network_image/cached_network_image.dart';
|
||
|
import 'package:flutter/material.dart';
|
||
|
import 'package:intl/intl.dart';
|
||
|
import 'package:medcify/components/button.dart';
|
||
|
import 'package:medcify/constants.dart';
|
||
|
import 'package:medcify/models/medicine_item.dart';
|
||
|
import 'package:medcify/models/order_item.dart';
|
||
|
import 'package:medcify/models/pincode_item.dart';
|
||
|
|
||
|
import '../../../components/alert.dart';
|
||
|
import '../../../navigation/navigation.dart';
|
||
|
|
||
|
class PincodeCard extends StatelessWidget {
|
||
|
PincodeItem item;
|
||
|
Function(String) deletePincode;
|
||
|
Function(PincodeItem) editPincode;
|
||
|
PincodeCard({required this.item, required this.deletePincode, required this.editPincode});
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return Container(
|
||
|
decoration: BoxDecoration(
|
||
|
borderRadius: BorderRadius.circular(8),
|
||
|
color: Colors.white,
|
||
|
border: Border.all(color: Colors.grey.shade200)
|
||
|
),
|
||
|
margin: const EdgeInsets.only(bottom: 12),
|
||
|
padding: const EdgeInsets.symmetric(horizontal: 16,vertical: 16),
|
||
|
child: Column(
|
||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
children: [
|
||
|
Row(
|
||
|
children: [
|
||
|
Expanded(
|
||
|
child: Column(
|
||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
children: [
|
||
|
const Text("PINCODE",style: TextStyle(color: Constants.secondaryTextColor,fontSize: 11, fontWeight: FontWeight.w500),),
|
||
|
const SizedBox(height: 4,),
|
||
|
Text("${item.pincode}",style: const TextStyle(color: Colors.black,fontSize: 12.5,),),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
const SizedBox(width: 16,),
|
||
|
Expanded(
|
||
|
child: Column(
|
||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
children: [
|
||
|
const Text("DELIVERY FEE",style: TextStyle(color: Constants.secondaryTextColor,fontSize: 11, fontWeight: FontWeight.w500),),
|
||
|
const SizedBox(height: 4,),
|
||
|
Text("\u{20B9}${item.deliveryFee}",style: const TextStyle(color: Colors.black,fontSize: 12.5,),),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
const SizedBox(height: 24,),
|
||
|
Column(
|
||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
children: [
|
||
|
const Text("FREE ABOVE",style: TextStyle(color: Constants.secondaryTextColor,fontSize: 11, fontWeight: FontWeight.w500),),
|
||
|
const SizedBox(height: 4,),
|
||
|
Text("\u{20B9}${item.freeAbove}",style: const TextStyle(color: Colors.black,fontSize: 12.5,),),
|
||
|
],
|
||
|
),
|
||
|
const SizedBox(height: 24,),
|
||
|
SizedBox(
|
||
|
height: 32,
|
||
|
child: Row(
|
||
|
children: [
|
||
|
Expanded(
|
||
|
flex: 1,
|
||
|
child: Button(
|
||
|
onPressed: (){
|
||
|
editPincode(item);
|
||
|
},
|
||
|
text: "Edit",
|
||
|
color: Colors.blue,
|
||
|
),
|
||
|
),
|
||
|
const SizedBox(width: 16,),
|
||
|
Expanded(
|
||
|
flex: 1,
|
||
|
child: Button(
|
||
|
onPressed: (){
|
||
|
AlertX.instance.showAlert(
|
||
|
title: "Delete",
|
||
|
msg: "Are you sure, Do you want to delete?",
|
||
|
positiveButtonText: "Yes",
|
||
|
positiveButtonPressed: () async{
|
||
|
Navigation.instance.goBack();
|
||
|
deletePincode("${item.id ?? 0}");
|
||
|
},
|
||
|
negativeButtonText: "No",
|
||
|
negativeButtonPressed: (){
|
||
|
Navigation.instance.goBack();
|
||
|
}
|
||
|
);
|
||
|
},
|
||
|
text: "Delete",
|
||
|
color: Colors.red,
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|