header_widget.dart 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. import 'package:fitness_dashboard_ui/const/constant.dart';
  2. import 'package:fitness_dashboard_ui/util/responsive.dart';
  3. import 'package:flutter/material.dart';
  4. class HeaderWidget extends StatelessWidget {
  5. const HeaderWidget({super.key});
  6. @override
  7. Widget build(BuildContext context) {
  8. return Row(
  9. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  10. children: [
  11. if (!Responsive.isDesktop(context))
  12. Padding(
  13. padding: const EdgeInsets.only(right: 20),
  14. child: InkWell(
  15. onTap: () => Scaffold.of(context).openDrawer(),
  16. child: Padding(
  17. padding: const EdgeInsets.all(4.0),
  18. child: Icon(
  19. Icons.menu,
  20. color: Colors.grey,
  21. size: 25,
  22. ),
  23. ),
  24. ),
  25. ),
  26. if (!Responsive.isMobile(context))
  27. Expanded(
  28. child: TextField(
  29. decoration: InputDecoration(
  30. filled: true,
  31. fillColor: cardBackgroundColor,
  32. enabledBorder: const OutlineInputBorder(
  33. borderSide: BorderSide(color: Colors.transparent),
  34. ),
  35. border: OutlineInputBorder(
  36. borderRadius: BorderRadius.circular(12.0),
  37. ),
  38. focusedBorder: OutlineInputBorder(
  39. borderRadius: BorderRadius.circular(12.0),
  40. borderSide: BorderSide(color: Theme.of(context).primaryColor),
  41. ),
  42. contentPadding: const EdgeInsets.symmetric(
  43. vertical: 5,
  44. ),
  45. hintText: 'Search',
  46. prefixIcon: const Icon(
  47. Icons.search,
  48. color: Colors.grey,
  49. size: 21,
  50. ),
  51. ),
  52. ),
  53. ),
  54. if (Responsive.isMobile(context))
  55. Row(
  56. children: [
  57. IconButton(
  58. icon: const Icon(
  59. Icons.search,
  60. color: Colors.grey,
  61. size: 25,
  62. ),
  63. onPressed: () {},
  64. ),
  65. InkWell(
  66. onTap: () => Scaffold.of(context).openEndDrawer(),
  67. child: CircleAvatar(
  68. backgroundColor: Colors.transparent,
  69. child: Image.asset(
  70. "assets/images/avatar.png",
  71. width: 32,
  72. ),
  73. ),
  74. ),
  75. ],
  76. ),
  77. ],
  78. );
  79. }
  80. }