Flutter 畫圓環


Flutter 畫圓環,見代碼

import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'test',
      home: Stack(
        children: const [
          Align(
            alignment: AlignmentDirectional.center,
            child: CircleAvatar(
              radius: 300,
              backgroundColor: Colors.black,
            ),
          ),
          Align(
            alignment: AlignmentDirectional.center,
            child: CircleAvatar(
              radius: 250,
              backgroundColor: Colors.red,
            ),
          ),
           Align(
            alignment: AlignmentDirectional.center,
            child: CircleAvatar(
              radius: 200,
              backgroundColor: Colors.orange,
            ),
          ),
          Align(
            alignment: AlignmentDirectional.center,
            child: CircleAvatar(
              radius: 150,
              backgroundColor: Colors.blue,
            ),
          ),
          Align(
            alignment: AlignmentDirectional.center,
            child: CircleAvatar(
              radius: 100,
              backgroundColor: Colors.white,
            ),
          ),
        ],
      ),
    );
  }
}

運行效果

 

 

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM