app_bar.dart 2.6 KB

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