You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cloudsolutions-atoms/lib/views/widgets/departments/department_button.dart

52 lines
2.0 KiB
Dart

import 'package:flutter/material.dart';
import 'package:test_sa/controllers/localization/localization.dart';
import 'package:test_sa/extensions/context_extension.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) {
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 ?? context.translation.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);
});
}
}