IndexedStack(每日Flutter 小部件)


/**
 *  集成自Stack,用來顯示第index個child,
 *  IndexedStack({
    Key key,
    AlignmentGeometry alignment = AlignmentDirectional.topStart,
    TextDirection textDirection,
    StackFit sizing = StackFit.loose,
    this.index = 0,
    List<Widget> children = const <Widget>[],
    })
 */

例:

import 'package:flutter/material.dart';

class IndexedStackWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return IndexedStack(
      alignment: AlignmentDirectional.center,
      textDirection: TextDirection.ltr,
      sizing: StackFit.loose,
      index: 0,
      children: [
        Container(
          width: 100,
          height: 100,
          color: Colors.red,
        ),
        Container(
          width: 80,
          height: 80,
          color: Colors.blue,
        ),
        Container(
          width: 50,
          height: 50,
          color: Colors.green,
        ),
      ],
    );
  }
}

運行結果

 


免責聲明!

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



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