一统天下 flutter - widget 按钮类: ElevatedButton - 自带背景色按钮

源码 https://github.com/webabcd/flutter_demo
作者 webabcd

一统天下 flutter - widget 按钮类: ElevatedButton - 自带背景色按钮

示例如下:

lib\widget\button\elevated_button.dart

/*
 * ElevatedButton - 自带背景色按钮
 *
 * TextButton 是默认啥都没有的按钮,OutlinedButton 是默认有边框的按钮,ElevatedButton 是默认有背景色的按钮
 */

import 'package:flutter/material.dart';

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

  @override
  Widget build(BuildContext context) {
    return Center(
      child:  ElevatedButton(
        child: Text('button'),
        onPressed: () {},
        style: ElevatedButton.styleFrom(  /// 关于按钮样式请参见 lib/widget/button/text_button.dart 中的说明

        ),
      ),
    );
  }
}

源码 https://github.com/webabcd/flutter_demo
作者 webabcd

posted @ 2023-03-22 10:31  webabcd  阅读(335)  评论(0编辑  收藏  举报