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.

59 lines
1.8KB

  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. ? Row(
  17. mainAxisSize: MainAxisSize.min,
  18. children: [
  19. InkWell(
  20. onTap: () {
  21. if (Get.isSnackbarOpen) Get.back();
  22. Get.back();
  23. },
  24. child: Row(
  25. children: [
  26. Icon(
  27. Icons.keyboard_arrow_left,
  28. color: AppColors.YELLOW,
  29. size: 35,
  30. ),
  31. Text(
  32. 'Quay lại',
  33. maxLines: 1,
  34. style: TextStyle(
  35. color: AppColors.YELLOW,
  36. fontWeight: FontWeight.normal),
  37. ),
  38. ],
  39. ),
  40. ),
  41. Expanded(child: Container()),
  42. Align(
  43. alignment: Alignment.centerRight,
  44. child: action ?? SizedBox(),
  45. )
  46. ],
  47. )
  48. : SizedBox(),
  49. automaticallyImplyLeading: false,
  50. actions: [SizedBox()],
  51. ),
  52. );
  53. }
  54. @override
  55. Size get preferredSize => AppBar().preferredSize;
  56. }