1

我试图在操作列表中放置一个CircleAvatarAppBar但 CircleAvatar 会将其高度与 AppBar 的高度保持一致,从而无法调整它的大小并使其保持圆形。我已经尝试将它包装在 Container 或 SizedBox 中,但它不起作用。

例子:

import 'package:flutter/material.dart';

class HoursScreenEmployee extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.white10,
        brightness: Brightness.light,
        elevation: 0,
        centerTitle: false,
        actions: [
          CircleAvatar(
            backgroundImage: NetworkImage("https://picsum.photos/500/300"),
            maxRadius: 15,
            minRadius: 15,
          ),
        ],
        title: Text(
          "La Chance ",
          style: TextStyle(
            fontFamily: "Masiva",
            fontSize: 27,
            fontWeight: FontWeight.w800,
            color: Colors.black,
          ),
        ),
      ),
    );
  }
}

在此处输入图像描述

4

1 回答 1

1

您可以将其包装CircleAvatarRow

actions: [
          Row(
            children: <Widget>[
              Container(
                height: 60,
                width: 60,
                child: CircleAvatar(
                  backgroundImage:
                      NetworkImage("https://picsum.photos/500/300"),
                  maxRadius: 15,
                  minRadius: 15,
                ),
              ),
            ],
          ),
        ],

结果:

资源

于 2020-08-13T21:59:16.200 回答