Initial commit for complete UI

This commit is contained in:
2025-05-29 14:59:31 +05:30
commit 1f0ec17edc
170 changed files with 7211 additions and 0 deletions

View File

@@ -0,0 +1,204 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../provider/serviceboy_provider.dart';
import 'add_serviceboy_screen.dart';
import 'edit_serviceboy_screen.dart';
import 'package:google_fonts/google_fonts.dart';
class ServiceBoyScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
final provider = Provider.of<ServiceBoyProvider>(context);
return Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Color.fromRGBO(208, 235, 255, 1), Colors.white],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
child: Scaffold(
backgroundColor: Colors.transparent,
body: SafeArea(
child: Column(
children: [
SizedBox(height: 40),
Text(
'GLOWWHEELS',
style: GoogleFonts.inter(
fontSize: 32,color: Color.fromRGBO(25, 25, 112, 0.87)
,fontWeight: FontWeight.w700
)
),
Text(
'Service Center',
style: GoogleFonts.inter(
fontSize: 24,color: Color.fromRGBO(25, 25, 112, 0.87)
,fontWeight: FontWeight.w400
)
),
SizedBox(height: 20),
Text(
'Service Boy List',
style: GoogleFonts.inter(
fontSize: 16,color: Color.fromRGBO(33, 33, 33, 1)
,fontWeight: FontWeight.w500
)
),
SizedBox(height: 10),
Expanded(
child: provider.serviceBoys.isEmpty
? Center(child: Text("No service boys found"))
: ListView.builder(
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
itemCount: provider.serviceBoys.length,
itemBuilder: (context, index) {
final boy = provider.serviceBoys[index];
return Card(
color: Colors.white,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
elevation: 2,
child: ListTile(
contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
title: Text(
boy.name,
style: GoogleFonts.inter(
fontSize: 18,color: Color.fromRGBO(33, 33, 33, 0.78)
,fontWeight: FontWeight.w600
)
),
subtitle: Text(
boy.phone,
style: GoogleFonts.inter(
fontSize: 16,color: Color.fromRGBO(33, 33, 33, 0.78)
,fontWeight: FontWeight.w400
)
),
trailing: Row(
mainAxisSize: MainAxisSize.min,
children: [
_buildIconButton(
icon: Icons.edit,
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (_) => EditServiceBoyScreen(serviceBoy: boy),
),
);
},
),
SizedBox(width: 8),
_buildIconButton(
icon: Icons.delete,
onPressed: () {
_showDeleteDialog(context, '');
},
),
],
),
),
);
},
),
),
],
),
),
floatingActionButton: FloatingActionButton(
shape: CircleBorder(),
backgroundColor: Colors.white,
elevation: 4,
child: Icon(Icons.add, color: Color(0xFF1F1762),size: 25,),
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(builder: (_) => AddServiceBoyScreen()),
);
},
),
),
);
}
Widget _buildIconButton({required IconData icon, required VoidCallback onPressed}) {
return Container(
height: 40,
width: 40,
child: Center(
child: Ink(
decoration: ShapeDecoration(
color: Color(0xFF1F1762),
shape: CircleBorder(),
),
child: IconButton(
icon: Icon(icon, color: Colors.white, size: 23),
onPressed: onPressed,
splashRadius: 15,
),
),
),
);
}
void _showDeleteDialog(BuildContext context, String id) {
showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
isScrollControlled: true,
builder: (_) => Container(
padding: EdgeInsets.all(24),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.vertical(top: Radius.circular(24)),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Image.asset('assets/images/delete_serviceboy.png'),
SizedBox(height: 16),
Text(
'Delete Service boy?',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.black87,
),
),
SizedBox(height: 8),
Text(
'Are you sure you want to delete this service boy? You wont be able to undo this.',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14,
color: Colors.black54,
),
),
SizedBox(height: 24),
SizedBox(
width: double.infinity,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.red[700],
padding: EdgeInsets.symmetric(vertical: 14),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
),
onPressed: () {
// Provider.of<ServiceBoyProvider>(context, listen: false).deleteServiceBoy(id);
Navigator.pop(context);
},
child: Text(
'Confirm',
style: TextStyle(fontSize: 16, color: Colors.white),
),
),
),
SizedBox(height: 12),
],
),
),
);
}
}