|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|
|
|
|
import 'package:test_sa/controllers/localization/localization.dart';
|
|
|
|
|
import 'package:test_sa/models/hospital.dart';
|
|
|
|
|
import 'package:test_sa/models/subtitle.dart';
|
|
|
|
|
import 'package:test_sa/views/app_style/colors.dart';
|
|
|
|
|
import 'package:test_sa/views/app_style/sizing.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/hospitals/single_hospital_picker.dart';
|
|
|
|
|
class HospitalButton extends StatelessWidget {
|
|
|
|
|
final Function(Hospital) onHospitalPick;
|
|
|
|
|
final Hospital hospital;
|
|
|
|
|
|
|
|
|
|
const HospitalButton({
|
|
|
|
|
Key key,
|
|
|
|
|
this.hospital,
|
|
|
|
|
this.onHospitalPick
|
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
|
|
|
|
|
Subtitle _subtitle = AppLocalization.of(context).subtitle;
|
|
|
|
|
return ElevatedButton(
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
foregroundColor: AColors.primaryColor,
|
|
|
|
|
backgroundColor: AColors.white,
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 16,vertical: 12),
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
|
AppStyle.borderRadius * AppStyle.getScaleFactor(context)
|
|
|
|
|
),
|
|
|
|
|
side: const BorderSide(
|
|
|
|
|
color: AColors.black
|
|
|
|
|
)
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
const FaIcon(
|
|
|
|
|
FontAwesomeIcons.solidHospital,
|
|
|
|
|
size: 28,
|
|
|
|
|
color: AColors.black,
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 6),
|
|
|
|
|
child: Text(
|
|
|
|
|
hospital?.name ?? _subtitle.pickHospital,
|
|
|
|
|
style: Theme.of(context).textTheme.subtitle1,
|
|
|
|
|
textScaleFactor: AppStyle.getScaleFactor(context),
|
|
|
|
|
textDirection: TextDirection.rtl,
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
Hospital _hospital = await Navigator.of(context).pushNamed(SingleHospitalPicker.id) as Hospital;
|
|
|
|
|
onHospitalPick(_hospital);
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|