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.

57 lines
1.7KB

  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(color: AppColors.YELLOW, fontWeight: FontWeight.normal),
  35. ),
  36. ],
  37. ),
  38. ),
  39. Expanded(child: Container()),
  40. Align(
  41. alignment: Alignment.centerRight,
  42. child: action ?? SizedBox(),
  43. )
  44. ],
  45. )
  46. : SizedBox(),
  47. automaticallyImplyLeading: false,
  48. actions: [SizedBox()],
  49. ),
  50. );
  51. }
  52. @override
  53. Size get preferredSize => AppBar().preferredSize;
  54. }