如何在框装饰扑动中按钮图标飞溅颜色

时间:2019-09-05 02:44:28

标签: flutter

我的带有框装饰的容器中的iconbutton出现问题。问题是当我单击按钮时,在框装饰下显示了highlightColor。卡中的图标按钮。该卡包含图标按钮,图标按钮下方带有标签。

如何根据我制作的尺寸在盒子装饰上方突出显示颜色?

import 'package:flutter/material.dart';

class Home extends StatefulWidget {
  @override
  _HomeState createState() => _HomeState();
}

class _HomeState extends State<Home> {
  @override
  void initState() {
    // TODO: implement initState
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      body: SafeArea(
        child: Container(
          width: MediaQuery.of(context).size.width,
          height: MediaQuery.of(context).size.height,
          child: SingleChildScrollView(
            child: Stack(
              children: <Widget>[
                new MenuAtas(),
              ],
            ),
          ),
        ),
      ),
    );
  }
}

class MenuAtas extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: EdgeInsets.only(top: 140.0),
      child: Align(
        alignment: Alignment.bottomCenter,
        child: Container(
          child: Stack(
            children: <Widget>[
              Padding(
                padding: EdgeInsets.all(5.0),
                child: Card(
                  elevation: 4.0,
                  shape: RoundedRectangleBorder(
                      borderRadius: BorderRadius.circular(
                          15.0) 
                      ),
                  child: Container(
                      width: 300.0,
                      height: 120.0,
                      child: Padding(
                        padding: EdgeInsets.all(5.0),
                        child: Container(
                          child: Row(
                            children: <Widget>[
                              Material(
                                type: MaterialType.transparency,
                                child: Stack(
                                  children: <Widget>[
                                    Column(
                                      children: <Widget>[
                                        Container(
                                          padding: EdgeInsets.only(
                                              top: 1.0,
                                              bottom: 1.0,
                                              right: 5.0),
                                          height: 50.0,
                                          width: 50.0,
                                          decoration: BoxDecoration(
                                            borderRadius:
                                                BorderRadius.circular(15.0),
                                            color: Colors.green[50],
                                          ),
                                          child: IconButton(
                                            icon: Icon(Icons.person_add),
                                            color: Colors.green[500],
                                            highlightColor: Colors.green,
                                            onPressed: () {

                                            },

                                          ),
                                        ),

                                      ],
                                    ),
                                  ],
                                ),
                              ),
                            ],
                          ),
                        ),
                      )),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

0 个答案:

没有答案