app_bar.dart 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import 'package:flutter/material.dart';
  2. import 'package:get/get.dart';
  3. import '../../generated/assets.dart';
  4. import 'home_controller.dart';
  5. class HomeAppBar extends GetView<HomeController>
  6. implements PreferredSizeWidget {
  7. const HomeAppBar({super.key, required this.tab});
  8. final Widget tab;
  9. @override
  10. Widget build(BuildContext context) {
  11. final statusBarHeight = MediaQuery.of(context).viewPadding.top;
  12. return SizedBox.expand(
  13. child: Container(
  14. padding: EdgeInsets.only(top: statusBarHeight),
  15. decoration: const BoxDecoration(
  16. image: DecorationImage(
  17. image: AssetImage(Assets.imagesBkCommonPage),
  18. fit: BoxFit.fitWidth),
  19. boxShadow: [
  20. BoxShadow(color: Color(0x33000000), spreadRadius: 4, blurRadius: 4)
  21. ]),
  22. child: Row(
  23. mainAxisSize: MainAxisSize.max,
  24. crossAxisAlignment: CrossAxisAlignment.center,
  25. children: [
  26. SizedBox(width: 660, height: double.infinity, child: tab),
  27. Expanded(
  28. child: Obx(() => controller.selectMapName.value.isEmpty
  29. ? const SizedBox()
  30. : Row(children: [
  31. Container(
  32. width: 10,
  33. height: 34,
  34. margin: const EdgeInsets.only(right: 12),
  35. decoration: BoxDecoration(
  36. color: Colors.blue,
  37. borderRadius: BorderRadius.circular(5)),
  38. ),
  39. Text(controller.selectMapName.value,
  40. style: const TextStyle(
  41. color: Colors.white, fontSize: 22))
  42. ]))),
  43. TextButton(
  44. onPressed: () {},
  45. child: const Row(
  46. crossAxisAlignment: CrossAxisAlignment.center,
  47. children: [
  48. Icon(Icons.radio, color: Colors.white),
  49. Text(' 广播',
  50. style: TextStyle(color: Colors.white, fontSize: 20))
  51. ],
  52. ))
  53. ],
  54. ),
  55. ));
  56. }
  57. @override
  58. Size get preferredSize => const Size.fromHeight(kToolbarHeight);
  59. }