MENU

Fluter 实用组件

October 3, 2022 • 笔记,flutter

Fluter实用组件

FittedBox

Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Container(
              color: Colors.red,
              width: double.infinity,
              child: FittedBox(
                fit: BoxFit.scaleDown,
                child: Text(
                  'hello hell hel he h',
                  style: TextStyle(fontSize: 30),
                ),
              ),
            )
          ],
        ),
      ),

DefaultTextStyle

DefaultTextStyle(
          style: TextStyle(fontWeight: FontWeight.bold, color: Colors.amber),
          child: Column(
            children: [
              Text('2222'),
              Text('2222'),
              Text('2222'),
              Text('2222'),
              Text('2222'),
            ],
          ),
        ),

InteractiveViewer(放大缩小)

InteractiveViewer(
          constrained: false,
          child: SizedBox(
            width: 800,
            child: Column(
              children: [
                Text('flutter hello' * 999),
              ],
            ),
          ),
        ),