yiweiyihang

效果如上:

import \'package:flutter/material.dart\';

class testPage extends StatefulWidget {
  testPage({Key key}) : super(key: key);

  _testPageState createState() => _testPageState();
}

class _testPageState extends State<testPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: Text(\'测试页面\')),
        body: Column(
          children: <Widget>[
            //头像居中处理:
            Stack(
              alignment: Alignment.center,
              children: <Widget>[
                Container(height: 200, color: Colors.red),
                Positioned(
                  top: 40.0,
                  child: CircleAvatar(
                    radius: 60,
                    backgroundImage: NetworkImage(
                        "https://pic2.zhimg.com/v2-639b49f2f6578eabddc458b84eb3c6a1.jpg"),
                  ),
                ),
              ],
            ),
            Container(
              height: 200,
              color: Colors.blue
            )
          ],
        ));
  }
}

 

分类:

技术点:

相关文章:

  • 2021-12-09
  • 2021-09-09
  • 2021-04-20
  • 2021-11-29
  • 2021-12-23
  • 2021-10-24
  • 2021-09-01
  • 2021-06-01
猜你喜欢
  • 2021-06-09
  • 2021-10-25
  • 2022-12-23
  • 2022-01-09
  • 2021-11-29
  • 2021-06-24
  • 2022-12-23
相关资源
相似解决方案