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.

56 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(
  29. color: AppColors.YELLOW,
  30. fontWeight: FontWeight.normal),
  31. ),
  32. SizedBox(width: 4),
  33. Expanded(
  34. child: Align(
  35. alignment: Alignment.centerRight,
  36. child: action ?? SizedBox(),
  37. ))
  38. ],
  39. ),
  40. onTap: () {
  41. if (Get.isSnackbarOpen) Get.back();
  42. Get.back();
  43. },
  44. )
  45. : SizedBox(),
  46. automaticallyImplyLeading: false,
  47. actions: [SizedBox()],
  48. ),
  49. );
  50. }
  51. @override
  52. Size get preferredSize => AppBar().preferredSize;
  53. }