UI complete for patient registration Co-authored-by: Benoy Bose <benoybose@gmail.com> Reviewed-on: cosqnet/telemednet#2 Reviewed-by: Benoy Bose <benoybose@cosq.net> Co-authored-by: DhanshCOSQ <dhanshas@cosq.net> Co-committed-by: DhanshCOSQ <dhanshas@cosq.net>
121 lines
3.6 KiB
Dart
121 lines
3.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../route_names.dart';
|
|
|
|
class UserSelection extends StatefulWidget {
|
|
const UserSelection({super.key});
|
|
|
|
@override
|
|
State<UserSelection> createState() => _UserSelectionState();
|
|
}
|
|
|
|
class _UserSelectionState extends State<UserSelection> {
|
|
String _selectedUserType = '';
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: Center(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(24),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
const Text(
|
|
'Register',
|
|
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
const SizedBox(height: 24),
|
|
const Text(
|
|
'Select User Type',
|
|
style: TextStyle(fontSize: 16),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
const SizedBox(height: 16),
|
|
_buildSelectionOption(
|
|
icon: Icons.medical_services,
|
|
label: 'Doctor',
|
|
description: 'Can organise and approve appointments',
|
|
onTap: () => _selectUserType('Doctor'),
|
|
),
|
|
const SizedBox(height: 12),
|
|
_buildSelectionOption(
|
|
icon: Icons.person,
|
|
label: 'Patient',
|
|
description: 'Can book appointments',
|
|
onTap: () => _selectUserType('Patient'),
|
|
),
|
|
const SizedBox(height: 24),
|
|
ElevatedButton(
|
|
onPressed: () {
|
|
if (_selectedUserType == 'Patient') {
|
|
Navigator.of(context)
|
|
.pushNamed(RouteNames.patientLandingScreen);
|
|
} else {}
|
|
},
|
|
child: const Text('Next'),
|
|
style: ElevatedButton.styleFrom(
|
|
padding: const EdgeInsets.symmetric(vertical: 12),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildSelectionOption({
|
|
required IconData icon,
|
|
required String label,
|
|
required String description,
|
|
required VoidCallback onTap,
|
|
}) {
|
|
final isSelected = _selectedUserType == label;
|
|
return GestureDetector(
|
|
onTap: onTap,
|
|
child: Container(
|
|
padding: const EdgeInsets.all(12),
|
|
decoration: BoxDecoration(
|
|
border: Border.all(
|
|
color: isSelected ? Colors.blue : Colors.grey[300]!,
|
|
width: 2,
|
|
),
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Icon(icon, size: 40, color: Colors.blue),
|
|
const SizedBox(width: 16),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
label,
|
|
style: const TextStyle(
|
|
fontSize: 16, fontWeight: FontWeight.bold),
|
|
),
|
|
Text(
|
|
description,
|
|
style: TextStyle(fontSize: 12, color: Colors.grey[600]),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
if (isSelected) const Icon(Icons.check_circle, color: Colors.blue),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
void _selectUserType(String userType) {
|
|
setState(() {
|
|
_selectedUserType = userType;
|
|
});
|
|
}
|
|
}
|