You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.6KB

  1. import 'package:farm_tpf/utils/const_color.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:get/get.dart';
  4. class AppBarWidget extends StatelessWidget implements PreferredSizeWidget {
  5. final bool isBack;
  6. final Widget? action;
  7. AppBarWidget({this.isBack = true, this.action});
  8. @override
  9. Widget build(BuildContext context) {
  10. return Container(
  11. child: AppBar(
  12. backgroundColor: Colors.white,
  13. elevation: 0,
  14. centerTitle: false,
  15. title: isBack
  16. ? InkWell(
  17. child: Row(
  18. mainAxisSize: MainAxisSize.min,
  19. children: [
  20. Icon(
  21. Icons.keyboard_arrow_left,
  22. color: AppColors.YELLOW,
  23. size: 35,
  24. ),
  25. Text(
  26. 'Quay lại',
  27. maxLines: 1,
  28. style: TextStyle(color: AppColors.YELLOW, fontWeight: FontWeight.normal),
  29. ),
  30. const SizedBox(width: 4),
  31. Expanded(
  32. child: Align(
  33. alignment: Alignment.centerRight,
  34. child: action ?? const SizedBox(),
  35. ))
  36. ],
  37. ),
  38. onTap: () {
  39. if (Get.isSnackbarOpen) Get.back();
  40. Get.back();
  41. },
  42. )
  43. : const SizedBox(),
  44. automaticallyImplyLeading: false,
  45. actions: [const SizedBox()],
  46. ),
  47. );
  48. }
  49. @override
  50. Size get preferredSize => AppBar().preferredSize;
  51. }