美文网首页
flutter 渐变色

flutter 渐变色

作者: 喜剧收尾_XWX | 来源:发表于2020-08-16 22:14 被阅读0次
import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return MaterialApp(
      title: "BoxDecoration渐变色线性",
      home: Scaffold(
          appBar: AppBar(
            title: Text('BoxDecoration渐变色线性'),
          ),
          body: Center(
            child: Container(
              width: 200,
              height: 200,
              decoration: BoxDecoration(
                  //渐变色
                  gradient: LinearGradient(
                      begin: FractionalOffset(0.0, 1.0),
                      end: FractionalOffset(1.0, 1.0),
                      colors: <Color>[
                    Colors.red,
                    Colors.green,
                    Colors.yellow,
                    Colors.grey,
                  ])),
            ),
          )),
    );
  }
}

相关文章

网友评论

      本文标题:flutter 渐变色

      本文链接:https://www.haomeiwen.com/subject/rmiydktx.html