Changes for Phase-1
parent
c713184c78
commit
9ce90c745f
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,13 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:test_sa/views/app_style/colors.dart';
|
||||
|
||||
extension IntExtensions on int {
|
||||
Widget get height => SizedBox(height: toDouble());
|
||||
|
||||
Widget get width => SizedBox(width: toDouble());
|
||||
|
||||
Widget get divider => Divider(height: toDouble(), thickness: toDouble(), color: AColors.greyEF);
|
||||
|
||||
Widget get makeItSquare => SizedBox(width: toDouble(), height: toDouble());
|
||||
}
|
||||
@ -0,0 +1,245 @@
|
||||
//
|
||||
// import 'package:flutter/cupertino.dart';
|
||||
// import 'package:intl/intl.dart';
|
||||
//
|
||||
// extension CapExtension on String {
|
||||
// String get toCamelCase => "${this[0].toUpperCase()}${this.substring(1)}";
|
||||
//
|
||||
// String get inCaps => '${this[0].toUpperCase()}${this.substring(1)}';
|
||||
//
|
||||
// String get allInCaps => this.toUpperCase();
|
||||
//
|
||||
// String get capitalizeFirstofEach => this.trim().length > 0 ? this.trim().toLowerCase().split(" ").map((str) => str.inCaps).join(" ") : "";
|
||||
// }
|
||||
//
|
||||
// extension EmailValidator on String {
|
||||
// Widget get toWidget => Text(this);
|
||||
//
|
||||
// Widget toText10({Color? color, bool isBold = false, int? maxlines, FontStyle? fontStyle}) => Text(
|
||||
// this,
|
||||
// maxLines: maxlines,
|
||||
// style: TextStyle(fontSize: 10, fontStyle: fontStyle ?? FontStyle.normal, fontWeight: isBold ? FontWeight.bold : FontWeight.w600, color: color ?? MyColors.darkTextColor, letterSpacing: -0.4),
|
||||
// );
|
||||
//
|
||||
// Widget toText11({Color? color, FontWeight? weight, bool isUnderLine = false, bool isBold = false, int maxLine = 0}) => Text(
|
||||
// this,
|
||||
// maxLines: (maxLine > 0) ? maxLine : null,
|
||||
// style: TextStyle(
|
||||
// fontSize: 11,
|
||||
// fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.w600),
|
||||
// color: color ?? MyColors.darkTextColor,
|
||||
// letterSpacing: -0.33,
|
||||
// decoration: isUnderLine ? TextDecoration.underline : null,
|
||||
// ),
|
||||
// );
|
||||
//
|
||||
// Widget toText12({Color? color, bool isUnderLine = false, bool isBold = false, bool isCenter = false, int maxLine = 0}) => Text(
|
||||
// this,
|
||||
// textAlign: isCenter ? TextAlign.center : null,
|
||||
// maxLines: (maxLine > 0) ? maxLine : null,
|
||||
// style: TextStyle(
|
||||
// fontSize: 12,
|
||||
// fontWeight: isBold ? FontWeight.bold : FontWeight.w600,
|
||||
// color: color ?? MyColors.darkTextColor,
|
||||
// letterSpacing: -0.72,
|
||||
// decoration: isUnderLine ? TextDecoration.underline : null,
|
||||
// ),
|
||||
// );
|
||||
//
|
||||
// Widget toText12Auto({Color? color, bool isUnderLine = false, bool isBold = false, bool isCenter = false, int maxLine = 0}) => AutoSizeText(
|
||||
// this,
|
||||
// textAlign: isCenter ? TextAlign.center : null,
|
||||
// maxLines: (maxLine > 0) ? maxLine : null,
|
||||
// minFontSize: 8,
|
||||
// style: TextStyle(
|
||||
// fontSize: 12,
|
||||
// fontWeight: isBold ? FontWeight.bold : FontWeight.w600,
|
||||
// color: color ?? MyColors.darkTextColor,
|
||||
// letterSpacing: -0.72,
|
||||
// decoration: isUnderLine ? TextDecoration.underline : null,
|
||||
// ),
|
||||
// );
|
||||
//
|
||||
// Widget toTextAuto({
|
||||
// Color? color,
|
||||
// bool isUnderLine = false,
|
||||
// bool isBold = false,
|
||||
// bool isCenter = false,
|
||||
// int maxLine = 0,
|
||||
// double fontSize = 12,
|
||||
// double letterSpacing = -0.72,
|
||||
// double height = 1,
|
||||
// }) =>
|
||||
// AutoSizeText(
|
||||
// this,
|
||||
// textAlign: isCenter ? TextAlign.center : null,
|
||||
// maxLines: (maxLine > 0) ? maxLine : null,
|
||||
// minFontSize: 5,
|
||||
// style: TextStyle(
|
||||
// fontSize: fontSize,
|
||||
// fontWeight: isBold ? FontWeight.bold : FontWeight.w600,
|
||||
// color: color ?? MyColors.darkTextColor,
|
||||
// letterSpacing: letterSpacing,
|
||||
// decoration: isUnderLine ? TextDecoration.underline : null,
|
||||
// ),
|
||||
// );
|
||||
//
|
||||
// Widget toText13({Color? color, bool isUnderLine = false}) => Text(
|
||||
// this,
|
||||
// style: TextStyle(fontSize: 13, fontWeight: FontWeight.w600, color: color ?? MyColors.darkTextColor, letterSpacing: -0.52, decoration: isUnderLine ? TextDecoration.underline : null),
|
||||
// );
|
||||
//
|
||||
// Widget toText14({Color? color, bool isUnderLine = false, bool isBold = false, FontWeight? weight, int? maxlines, TextAlign? textAlign, bool isCenter = false}) => Text(
|
||||
// this,
|
||||
// textAlign: isCenter ? TextAlign.center : (textAlign ?? TextAlign.left),
|
||||
// maxLines: maxlines,
|
||||
// style: TextStyle(
|
||||
// color: color ?? MyColors.darkTextColor,
|
||||
// fontSize: 14,
|
||||
// letterSpacing: -0.48,
|
||||
// fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.w600),
|
||||
// decoration: isUnderLine ? TextDecoration.underline : null),
|
||||
// );
|
||||
//
|
||||
// Widget toText16({Color? color, bool isUnderLine = false, bool isBold = false, int? maxlines, double? height}) => Text(
|
||||
// this,
|
||||
// maxLines: maxlines,
|
||||
// style: TextStyle(
|
||||
// color: color ?? MyColors.darkTextColor,
|
||||
// fontSize: 16,
|
||||
// letterSpacing: -0.64,
|
||||
// height: height,
|
||||
// fontWeight: isBold ? FontWeight.bold : FontWeight.w600,
|
||||
// decoration: isUnderLine ? TextDecoration.underline : null,
|
||||
// ),
|
||||
// );
|
||||
//
|
||||
// Widget toText17({Color? color, bool isBold = false}) => Text(
|
||||
// this,
|
||||
// style: TextStyle(color: color ?? MyColors.darkTextColor, fontSize: 17, letterSpacing: -0.68, fontWeight: isBold ? FontWeight.bold : FontWeight.w600),
|
||||
// );
|
||||
//
|
||||
// Widget toText18({Color? color, bool isBold = false, bool isCentered = false}) => Text(
|
||||
// this,
|
||||
// textAlign: isCentered ? TextAlign.center : null,
|
||||
// style: TextStyle(fontSize: 18, fontWeight: isBold ? FontWeight.bold : FontWeight.w600, color: color ?? MyColors.darkTextColor, letterSpacing: -1.08),
|
||||
// );
|
||||
//
|
||||
// Widget toText19({Color? color, bool isBold = false}) => Text(
|
||||
// this,
|
||||
// style: TextStyle(fontSize: 19, fontWeight: isBold ? FontWeight.bold : FontWeight.w600, color: color ?? MyColors.darkTextColor, letterSpacing: -1.14),
|
||||
// );
|
||||
//
|
||||
// Widget toText20({Color? color, bool isBold = false, bool isCentered = false}) => Text(
|
||||
// this,
|
||||
// textAlign: isCentered ? TextAlign.center : null,
|
||||
// style: TextStyle(fontSize: 20, fontWeight: isBold ? FontWeight.bold : FontWeight.w600, color: color ?? MyColors.darkTextColor, letterSpacing: -0.4),
|
||||
// );
|
||||
//
|
||||
// Widget toText21({Color? color, bool isBold = false, FontWeight? weight, int? maxlines}) => Text(
|
||||
// this,
|
||||
// maxLines: maxlines,
|
||||
// style: TextStyle(color: color ?? MyColors.grey3AColor, fontSize: 21, letterSpacing: -0.84, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.w600)),
|
||||
// );
|
||||
//
|
||||
// Widget toText22({Color? color, bool isBold = false, bool isCentered = false}) => Text(
|
||||
// this,
|
||||
// textAlign: isCentered ? TextAlign.center : null,
|
||||
// style: TextStyle(height: 1, color: color ?? MyColors.darkTextColor, fontSize: 22, letterSpacing: -1.44, fontWeight: isBold ? FontWeight.bold : FontWeight.w600),
|
||||
// );
|
||||
//
|
||||
// Widget toText24({Color? color, bool isBold = false}) => Text(
|
||||
// this,
|
||||
// style: TextStyle(height: 23 / 24, color: color ?? MyColors.darkTextColor, fontSize: 24, letterSpacing: -1.44, fontWeight: isBold ? FontWeight.bold : FontWeight.w600),
|
||||
// );
|
||||
//
|
||||
// Widget toText30({Color? color, bool isBold = false}) => Text(
|
||||
// this,
|
||||
// style: TextStyle(height: 20 / 32, color: color ?? MyColors.darkTextColor, fontSize: 32, letterSpacing: -1.2, fontWeight: isBold ? FontWeight.bold : FontWeight.w600),
|
||||
// );
|
||||
//
|
||||
// Widget toText32({Color? color, bool isBold = false, bool isCentered = false}) => Text(
|
||||
// this,
|
||||
// textAlign: isCentered ? TextAlign.center : null,
|
||||
// style: TextStyle(height: 32 / 32, color: color ?? MyColors.darkTextColor, fontSize: 32, letterSpacing: -1.92, fontWeight: isBold ? FontWeight.bold : FontWeight.w600),
|
||||
// );
|
||||
//
|
||||
// Widget toText44({Color? color, bool isBold = false}) => Text(
|
||||
// this,
|
||||
// style: TextStyle(height: 32 / 32, color: color ?? MyColors.darkTextColor, fontSize: 44, letterSpacing: -2.64, fontWeight: isBold ? FontWeight.bold : FontWeight.w600),
|
||||
// );
|
||||
//
|
||||
// Widget toSectionHeading({String upperHeading = "", String lowerHeading = ""}) {
|
||||
// String upper = "";
|
||||
// String lower = "";
|
||||
// String heading = this;
|
||||
// if (heading.isNotEmpty) {
|
||||
// List<String> data = heading.split(" ");
|
||||
//
|
||||
// if (data.length > 1) {
|
||||
// upper = data[0];
|
||||
// data.removeAt(0);
|
||||
// lower = data.join(" ");
|
||||
// } else {
|
||||
// lower = data[0];
|
||||
// }
|
||||
// }
|
||||
// if (upperHeading.isNotEmpty) {
|
||||
// upper = upperHeading;
|
||||
// }
|
||||
// if (lowerHeading.isNotEmpty) {
|
||||
// lower = lowerHeading;
|
||||
// }
|
||||
//
|
||||
// return Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
// children: [
|
||||
// if (upper.isNotEmpty) upper.toText12(),
|
||||
// lower.toText24(isBold: true),
|
||||
// ],
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// bool isValidEmail() {
|
||||
// return RegExp(r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$').hasMatch(this);
|
||||
// }
|
||||
//
|
||||
// String toFormattedDate() {
|
||||
// String date = this.split("T")[0];
|
||||
// String time = this.split("T")[1];
|
||||
// var dates = date.split("-");
|
||||
// return "${dates[2]} ${getMonth(int.parse(dates[1]))} ${dates[0]} ${DateFormat('hh:mm a').format(DateFormat('hh:mm:ss').parse(time))}";
|
||||
// }
|
||||
//
|
||||
// String getMonth(int month) {
|
||||
// switch (month) {
|
||||
// case 1:
|
||||
// return "January";
|
||||
// case 2:
|
||||
// return "February";
|
||||
// case 3:
|
||||
// return "March";
|
||||
// case 4:
|
||||
// return "April";
|
||||
// case 5:
|
||||
// return "May";
|
||||
// case 6:
|
||||
// return "June";
|
||||
// case 7:
|
||||
// return "July";
|
||||
// case 8:
|
||||
// return "August";
|
||||
// case 9:
|
||||
// return "September";
|
||||
// case 10:
|
||||
// return "October";
|
||||
// case 11:
|
||||
// return "November";
|
||||
// case 12:
|
||||
// return "December";
|
||||
// default:
|
||||
// return "";
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
@ -0,0 +1,20 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:test_sa/views/app_style/colors.dart';
|
||||
|
||||
extension WidgetExtensions on Widget {
|
||||
Widget onPress(VoidCallback onTap) => InkWell(onTap: onTap, child: this);
|
||||
|
||||
Widget get expanded => Expanded(child: this);
|
||||
|
||||
Widget get center => Center(child: this);
|
||||
|
||||
Widget circle(double _value) => ClipRRect(borderRadius: BorderRadius.circular(_value), child: this);
|
||||
|
||||
Widget paddingAll(double _value) => Padding(padding: EdgeInsets.all(_value), child: this);
|
||||
|
||||
Widget paddingOnly({double left = 0.0, double right = 0.0, double top = 0.0, double bottom = 0.0}) =>
|
||||
Padding(padding: EdgeInsets.only(left: left, right: right, top: top, bottom: bottom), child: this);
|
||||
|
||||
Widget toExpanded({int flex = 1}) => Expanded(flex: flex, child: this);
|
||||
}
|
||||
@ -1,64 +1,50 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:test_sa/controllers/localization/localization.dart';
|
||||
import 'package:test_sa/models/department.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/departments/single_department_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
class DepartmentButton extends StatelessWidget {
|
||||
final Function(Department) onDepartmentPick;
|
||||
final Department department;
|
||||
|
||||
const DepartmentButton({
|
||||
Key key,
|
||||
this.department,
|
||||
this.onDepartmentPick
|
||||
}) : super(key: key);
|
||||
const DepartmentButton({Key key, this.department, this.onDepartmentPick}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Subtitle _subtitle = AppLocalization.of(context).subtitle;
|
||||
return ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16,vertical: 12),
|
||||
elevation: 0,
|
||||
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppStyle.borderRadius * AppStyle.getScaleFactor(context)
|
||||
),
|
||||
side: BorderSide(
|
||||
color: AColors.black
|
||||
)
|
||||
borderRadius: BorderRadius.circular(AppStyle.borderRadius * AppStyle.getScaleFactor(context)),
|
||||
),
|
||||
foregroundColor: AColors.primaryColor,
|
||||
backgroundColor: AColors.white,
|
||||
backgroundColor: AColors.inputFieldBackgroundColor,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
FaIcon(
|
||||
FontAwesomeIcons.hospitalUser,
|
||||
size: 28,
|
||||
color: AColors.black,
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 6),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Text(
|
||||
department?.name ?? _subtitle.pickUnite,
|
||||
style: Theme.of(context).textTheme.subtitle1,
|
||||
style: Theme.of(context).textTheme.bodyText1,
|
||||
textScaleFactor: AppStyle.getScaleFactor(context),
|
||||
textDirection: TextDirection.rtl,
|
||||
textAlign: TextAlign.center,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const Icon(Icons.keyboard_arrow_down, size: 28, color: AColors.grey3A),
|
||||
],
|
||||
),
|
||||
onPressed: () async {
|
||||
Department _department = await Navigator.of(context).pushNamed(SingleDepartmentPicker.id) as Department;
|
||||
onDepartmentPick(_department);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,86 +1,78 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:test_sa/controllers/localization/localization.dart';
|
||||
import 'package:test_sa/models/device/device.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/equipment/single_device_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
class DeviceButton extends StatelessWidget {
|
||||
final Function(Device) onDevicePick;
|
||||
final Device device;
|
||||
|
||||
const DeviceButton({
|
||||
Key key,
|
||||
this.device,
|
||||
this.onDevicePick
|
||||
}) : super(key: key);
|
||||
const DeviceButton({Key key, this.device, this.onDevicePick}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Subtitle _subtitle = AppLocalization.of(context).subtitle;
|
||||
return ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16,vertical: device == null ? 12 : 8),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppStyle.borderRadius * AppStyle.getScaleFactor(context)
|
||||
),
|
||||
side: BorderSide(
|
||||
color: AColors.black
|
||||
)
|
||||
style: ElevatedButton.styleFrom(
|
||||
elevation: 0,
|
||||
padding: EdgeInsets.symmetric(horizontal: 16, vertical: device == null ? 12 : 8),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(AppStyle.borderRadius * AppStyle.getScaleFactor(context)),
|
||||
),
|
||||
foregroundColor: AColors.primaryColor,
|
||||
backgroundColor: AColors.inputFieldBackgroundColor,
|
||||
),
|
||||
onPrimary: AColors.primaryColor,
|
||||
primary: AColors.white,
|
||||
),
|
||||
|
||||
child: Row(
|
||||
children: [
|
||||
FaIcon(
|
||||
FontAwesomeIcons.hardDrive,
|
||||
size: 28,
|
||||
color: AColors.black,
|
||||
),
|
||||
device == null ?
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 6),
|
||||
child: Text(
|
||||
_subtitle.pickDevice,
|
||||
style: Theme.of(context).textTheme.subtitle1,
|
||||
textScaleFactor: AppStyle.getScaleFactor(context),
|
||||
textDirection: TextDirection.rtl,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
):
|
||||
Expanded(
|
||||
child: ListTile(
|
||||
title: Text("${_subtitle.sn} : " + device.serialNumber,
|
||||
style: Theme.of(context).textTheme.subtitle1,
|
||||
),
|
||||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Divider(color: Theme.of(context).textTheme.subtitle1.color,),
|
||||
Text("${_subtitle.brand} : " + device.brand,
|
||||
style: Theme.of(context).textTheme.subtitle2,
|
||||
device == null
|
||||
? Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 6),
|
||||
child: Text(
|
||||
_subtitle.pickDevice,
|
||||
style: Theme.of(context).textTheme.subtitle1,
|
||||
textScaleFactor: AppStyle.getScaleFactor(context),
|
||||
textDirection: TextDirection.rtl,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
),
|
||||
Divider(color: Theme.of(context).textTheme.subtitle1.color,),
|
||||
Text("${_subtitle.model} : " + device.model,
|
||||
style: Theme.of(context).textTheme.subtitle2,
|
||||
)
|
||||
: Expanded(
|
||||
child: ListTile(
|
||||
contentPadding: EdgeInsets.all(0),
|
||||
title: Text(
|
||||
"${_subtitle.sn} : " + device.serialNumber,
|
||||
style: Theme.of(context).textTheme.subtitle1,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Divider(
|
||||
color: Theme.of(context).textTheme.subtitle1.color,
|
||||
),
|
||||
Text(
|
||||
"${_subtitle.brand} : " + device.brand,
|
||||
style: Theme.of(context).textTheme.subtitle2,
|
||||
),
|
||||
Divider(
|
||||
color: Theme.of(context).textTheme.subtitle1.color,
|
||||
),
|
||||
Text(
|
||||
"${_subtitle.model} : " + device.model,
|
||||
style: Theme.of(context).textTheme.subtitle2,
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
const Icon(Icons.keyboard_arrow_down, size: 28, color: AColors.grey3A),
|
||||
],
|
||||
),
|
||||
onPressed: () async {
|
||||
Device _device = await Navigator.of(context).pushNamed(SingleDevicePicker.id) as Device;
|
||||
onDevicePick(_device);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,65 +1,48 @@
|
||||
import 'package:flutter/material.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';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
class HospitalButton extends StatelessWidget {
|
||||
final Function(Hospital) onHospitalPick;
|
||||
final Hospital hospital;
|
||||
|
||||
const HospitalButton({
|
||||
Key key,
|
||||
this.hospital,
|
||||
this.onHospitalPick
|
||||
}) : super(key: key);
|
||||
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
|
||||
)
|
||||
style: ElevatedButton.styleFrom(
|
||||
elevation: 0,
|
||||
foregroundColor: AColors.primaryColor,
|
||||
backgroundColor: AColors.inputFieldBackgroundColor,
|
||||
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(AppStyle.borderRadius * AppStyle.getScaleFactor(context))),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
const FaIcon(
|
||||
FontAwesomeIcons.solidHospital,
|
||||
size: 28,
|
||||
color: AColors.black,
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 6),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Text(
|
||||
hospital?.name ?? _subtitle.pickHospital,
|
||||
style: Theme.of(context).textTheme.subtitle1,
|
||||
textScaleFactor: AppStyle.getScaleFactor(context),
|
||||
style: Theme.of(context).textTheme.bodyText1.copyWith(fontSize: 14, color: AColors.grey3A),
|
||||
// textScaleFactor: AppStyle.getScaleFactor(context),
|
||||
textDirection: TextDirection.rtl,
|
||||
textAlign: TextAlign.center,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const Icon(Icons.keyboard_arrow_down, size: 28, color: AColors.grey3A),
|
||||
],
|
||||
),
|
||||
onPressed: () async {
|
||||
Hospital _hospital = await Navigator.of(context).pushNamed(SingleHospitalPicker.id) as Hospital;
|
||||
onHospitalPick(_hospital);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue