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.

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