Initial commit for complete UI
This commit is contained in:
97
lib/widgets/assign_serviceboy_dialog.dart
Normal file
97
lib/widgets/assign_serviceboy_dialog.dart
Normal file
@@ -0,0 +1,97 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../models/serviceboy_model.dart';
|
||||
import '../provider/serviceboy_provider.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
class AssignServiceBoyDialog extends StatelessWidget {
|
||||
final List<ServiceBoy> serviceBoys;
|
||||
|
||||
const AssignServiceBoyDialog({super.key, required this.serviceBoys});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ChangeNotifierProvider(
|
||||
create: (_) => ServiceBoyProvider(),
|
||||
child: Consumer<ServiceBoyProvider>(
|
||||
builder: (context, assignProvider, _) {
|
||||
return AlertDialog(
|
||||
backgroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
|
||||
title: const Text("Select Service Boy", style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
content: SizedBox(
|
||||
height: 200,
|
||||
width: double.maxFinite,
|
||||
child: ListView.builder(
|
||||
itemCount: serviceBoys.length,
|
||||
itemBuilder: (context, index) {
|
||||
final boy = serviceBoys[index];
|
||||
final isSelected = assignProvider.selectedBoy == boy;
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () => assignProvider.selectBoy(boy),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
margin: const EdgeInsets.symmetric(vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected ? Color.fromRGBO(0, 80, 170, 1) : Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
boy.name,
|
||||
style: TextStyle(
|
||||
color: isSelected ? Colors.white : Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
"Phone: ${boy.phone}",
|
||||
style: TextStyle(
|
||||
color: isSelected ? Colors.white70 : Colors.grey[700],
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: Text("CANCEL",style: GoogleFonts.poppins(
|
||||
fontSize: 14,color: Color.fromRGBO(25, 25, 112, 1)
|
||||
,fontWeight: FontWeight.w400
|
||||
),),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop(); // return null
|
||||
},
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: assignProvider.selectedBoy != null
|
||||
? () {
|
||||
Navigator.of(context).pop(assignProvider.selectedBoy);
|
||||
}
|
||||
: null,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Color(0xFF1B1464),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(30)),
|
||||
),
|
||||
child: Text("Assign",style: GoogleFonts.inter(
|
||||
fontSize: 12,color: Colors.white
|
||||
,fontWeight: FontWeight.w500
|
||||
),),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
138
lib/widgets/order_card.dart
Normal file
138
lib/widgets/order_card.dart
Normal file
@@ -0,0 +1,138 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import '../models/order_model.dart';
|
||||
import '../models/serviceboy_model.dart';
|
||||
import 'assign_serviceboy_dialog.dart';
|
||||
|
||||
class OrderCard extends StatefulWidget {
|
||||
final Order order;
|
||||
|
||||
OrderCard({required this.order});
|
||||
|
||||
@override
|
||||
State<OrderCard> createState() => _OrderCardState();
|
||||
}
|
||||
|
||||
class _OrderCardState extends State<OrderCard> {
|
||||
ServiceBoy? assignedBoy;
|
||||
|
||||
List<ServiceBoy> serviceBoys = [
|
||||
ServiceBoy(name: 'John Doe', phone: '9875643210'),
|
||||
ServiceBoy(name: 'Amit Raj', phone: '9765432180'),
|
||||
ServiceBoy(name: 'Manoj Sinha', phone: '9543219876'),
|
||||
];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
color: Colors.white,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
|
||||
margin: EdgeInsets.all(12),
|
||||
elevation: 4,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("Order Details", style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600)),
|
||||
SizedBox(height: 12),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Image.asset(widget.order.imagePath, width: 100, height: 100, fit: BoxFit.contain),
|
||||
SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
_buildRow("Customer Name", widget.order.customerName),
|
||||
_buildRow("Mobile Number", widget.order.mobileNumber),
|
||||
_buildRow("Service Type", widget.order.serviceType),
|
||||
_buildRow("Service", widget.order.service),
|
||||
_buildRow("Price", widget.order.price),
|
||||
_buildRow("Service Time", widget.order.time),
|
||||
_buildRow("Service Date", widget.order.date),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 12),
|
||||
Center(
|
||||
child: Text(
|
||||
widget.order.carName,
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
Divider(height: 28),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
widget.order.status,
|
||||
style: TextStyle(
|
||||
color: widget.order.status == "Confirmed" ? Colors.green : Colors.orange,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
assignedBoy == null
|
||||
? ElevatedButton(
|
||||
onPressed: () async {
|
||||
final selected = await showDialog<ServiceBoy>(
|
||||
context: context,
|
||||
builder: (_) => AssignServiceBoyDialog(serviceBoys: serviceBoys),
|
||||
);
|
||||
|
||||
if (selected != null) {
|
||||
setState(() {
|
||||
assignedBoy = selected;
|
||||
});
|
||||
}
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Color(0xFF1B1464),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(30)),
|
||||
),
|
||||
child: Text("Assign",style: GoogleFonts.inter(
|
||||
fontSize: 12,color: Colors.white
|
||||
,fontWeight: FontWeight.w500
|
||||
),),
|
||||
|
||||
)
|
||||
: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("Assigned to: ${assignedBoy!.name}",
|
||||
style: const TextStyle(fontWeight: FontWeight.bold)),
|
||||
Text("Phone: ${assignedBoy!.phone}"),
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildRow(String label, String value) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 3),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(flex: 2, child: Text(label, style: GoogleFonts.inter(
|
||||
fontSize: 10,color: Colors.black
|
||||
,fontWeight: FontWeight.w500
|
||||
))),
|
||||
Expanded(flex: 3, child: Text(value, style: GoogleFonts.inter(
|
||||
fontSize: 10,color: Colors.black
|
||||
,fontWeight: FontWeight.w500
|
||||
))),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
59
lib/widgets/profile_header.dart
Normal file
59
lib/widgets/profile_header.dart
Normal file
@@ -0,0 +1,59 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ProfileHeader extends StatelessWidget {
|
||||
const ProfileHeader({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Row(
|
||||
children: [
|
||||
// Circular Profile Image
|
||||
CircleAvatar(
|
||||
radius: 40,
|
||||
backgroundImage: AssetImage('assets/images/shop_image.jpg'), // Replace with your asset
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
// Details Column
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: const [
|
||||
Row(
|
||||
children: [
|
||||
ImageIcon(AssetImage("assets/icon/account_icon.png")),
|
||||
SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Omkara Car Wash Center',
|
||||
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
ImageIcon(AssetImage("assets/icon/contact_icon.png")),
|
||||
SizedBox(width: 8),
|
||||
Text('+91 9999988888'),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
ImageIcon(AssetImage("assets/icon/Message_icon.png")),
|
||||
SizedBox(width: 8),
|
||||
Expanded(child: Text('loremipsum@gmail.com')),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user