|
|
|
|
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/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';
|
|
|
|
|
|
|
|
|
|
class DepartmentButton extends StatelessWidget {
|
|
|
|
|
final Function(Department) onDepartmentPick;
|
|
|
|
|
final Department department;
|
|
|
|
|
|
|
|
|
|
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(
|
|
|
|
|
elevation: 0,
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8),
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(AppStyle.borderRadius * AppStyle.getScaleFactor(context)),
|
|
|
|
|
),
|
|
|
|
|
foregroundColor: AColors.primaryColor,
|
|
|
|
|
backgroundColor: AColors.inputFieldBackgroundColor,
|
|
|
|
|
),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
|
|
|
child: Text(
|
|
|
|
|
department?.name ?? _subtitle.pickUnite,
|
|
|
|
|
style: Theme.of(context).textTheme.bodyText1,
|
|
|
|
|
textScaleFactor: AppStyle.getScaleFactor(context),
|
|
|
|
|
textDirection: TextDirection.rtl,
|
|
|
|
|
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);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|