You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.0 KiB
Dart
45 lines
1.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
//自定义图标按钮组件,顶部工具栏用
|
|
class MyIcontButton extends StatelessWidget {
|
|
var pressed;
|
|
double width;
|
|
double height;
|
|
double iconSize;
|
|
Color color;
|
|
Color iconColor;
|
|
double radius;
|
|
IconData icon;
|
|
MyIcontButton({
|
|
this.width = 30,
|
|
this.height = 30,
|
|
this.iconSize = 20,
|
|
this.color = Colors.blue,
|
|
this.iconColor = Colors.white,
|
|
this.radius = 0,
|
|
this.icon = Icons.message,
|
|
this.pressed = null,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
height: this.height,
|
|
width: this.width,
|
|
decoration: BoxDecoration(
|
|
color: this.color,
|
|
border: Border.all(color: Colors.blue, width: 1.0),
|
|
borderRadius: BorderRadius.all(
|
|
Radius.circular(radius),
|
|
)),
|
|
child: IconButton(
|
|
color: Colors.white,
|
|
padding: EdgeInsets.all(0),
|
|
iconSize: this.iconSize,
|
|
icon: Icon(this.icon),
|
|
onPressed: this.pressed,
|
|
),
|
|
);
|
|
}
|
|
}
|