home_menu_bar.dart 1.89 KB
import 'package:flutter/material.dart';

class HomeMenuHeader extends StatelessWidget {
  const HomeMenuHeader({
    Key? key,
    this.funcLeft,
    this.funcCenter,
    this.funcRight,
  }) : super(key: key);

  final Function? funcLeft;
  final Function? funcCenter;
  final Function? funcRight;

  @override
  Widget build(BuildContext context) {
    return Container(
        alignment: Alignment.center,
        margin: const EdgeInsets.symmetric(horizontal: 5.0),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          mainAxisSize: MainAxisSize.min,
          //交叉轴的布局方式,对于column来说就是水平方向的布局方式
          crossAxisAlignment: CrossAxisAlignment.center,
          children: <Widget>[
            SizedBox(
              width: 60.0,
              child: TextButton(
                onPressed: () => funcLeft!(),
                child: const Text(
                  "一言",
                  style: TextStyle(color: Colors.white),
                ),
              ),
            ),
            const VerticalDivider(
              color: Colors.white,
              width: 1.0,
              thickness: 1.0,
              indent: 15.0,
              endIndent: 15.0,
            ),
            TextButton(
              onPressed: () => funcCenter!(),
              child: const Text(
                "译解",
                style: TextStyle(color: Colors.white),
              ),
            ),
            const VerticalDivider(
              color: Colors.white,
              width: 1.0,
              thickness: 1.0,
              indent: 15.0,
              endIndent: 15.0,
            ),
            TextButton(
              onPressed: () => funcRight!(),
              child: const Text(
                "临境",
                style: TextStyle(color: Colors.white),
              ),
            ),
          ],
        ));
  }
}