tab_button_group.dart 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import 'package:flutter/material.dart';
  2. class TabButtonGroup extends StatefulWidget {
  3. const TabButtonGroup(
  4. this.tabButtonList, {
  5. this.margin = const EdgeInsets.only(right: 8),
  6. Key? key,
  7. }) : super(key: key);
  8. final List<Widget>? tabButtonList;
  9. final EdgeInsetsGeometry? margin;
  10. @override
  11. State<TabButtonGroup> createState() => _TabButtonGroupState();
  12. }
  13. class _TabButtonGroupState extends State<TabButtonGroup> {
  14. @override
  15. Widget build(BuildContext context) {
  16. return Column(
  17. children: [
  18. Container(
  19. color: const Color.fromRGBO(238, 238, 238, 1),
  20. child: Flex(
  21. direction: Axis.horizontal,
  22. mainAxisAlignment: MainAxisAlignment.start,
  23. children: [
  24. Container(
  25. height: 40,
  26. alignment: Alignment.center,
  27. margin: widget.margin,
  28. child: MouseRegion(
  29. cursor: SystemMouseCursors.click,
  30. child: Row(
  31. children: widget.tabButtonList ?? [],
  32. ),
  33. ),
  34. ),
  35. ],
  36. ),
  37. ),
  38. SizedBox(
  39. height: 4,
  40. child: Container(
  41. height: 4,
  42. decoration: BoxDecoration(color: Theme.of(context).primaryColor),
  43. ),
  44. )
  45. ],
  46. );
  47. }
  48. }