import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../provider/serviceboy_provider.dart'; import 'package:google_fonts/google_fonts.dart'; class AddServiceBoyScreen extends StatelessWidget { final _formKey = GlobalKey(); final TextEditingController nameController = TextEditingController(); final TextEditingController phoneController = TextEditingController(); @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Color(0xFFF9FAF4), // light background as per screenshot appBar: AppBar( backgroundColor: Colors.transparent, elevation: 0, leading: IconButton( icon: Icon(Icons.arrow_back_ios), onPressed: () => Navigator.pop(context), ), title: Text( 'Add Service boy', style: GoogleFonts.nunito( fontSize: 18,color: Color.fromRGBO(26, 26, 26, 1) ,fontWeight: FontWeight.w500 ) ), //centerTitle: true, ), body: Padding( padding: const EdgeInsets.all(16), child: Form( key: _formKey, child: Column( children: [ SizedBox(height: 30,), TextFormField( controller: nameController, decoration: InputDecoration( hintText: 'Name', hintStyle: GoogleFonts.nunito( fontSize: 14,color: Color.fromRGBO(26, 26, 26, 1) ,fontWeight: FontWeight.w400 ), border: OutlineInputBorder(), contentPadding: EdgeInsets.symmetric(horizontal: 12, vertical: 14), ), validator: (value) => value!.isEmpty ? 'Enter name' : null, ), SizedBox(height: 25), TextFormField( controller: phoneController, keyboardType: TextInputType.phone, decoration: InputDecoration( hintText: 'Mobile Number', hintStyle: GoogleFonts.nunito( fontSize: 14,color: Color.fromRGBO(26, 26, 26, 1) ,fontWeight: FontWeight.w400 ), border: OutlineInputBorder(), contentPadding: EdgeInsets.symmetric(horizontal: 12, vertical: 14), ), validator: (value) => value!.isEmpty ? 'Enter phone number' : null, ), Spacer(), SizedBox( width: double.infinity, child: ElevatedButton( onPressed: () { /* if (_formKey.currentState!.validate()) { Provider.of(context, listen: false).addServiceBoy( nameController.text, phoneController.text, ); Navigator.pop(context); }*/ }, style: ElevatedButton.styleFrom( backgroundColor: Color(0xFF000B8C), // dark blue padding: EdgeInsets.symmetric(vertical: 14), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(6), ), ), child: Text('Submit', style: GoogleFonts.inter( fontSize: 18,color: Colors.white ,fontWeight: FontWeight.w600 ) ), ), ), ], ), ), ), ); } }