-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathgradient_button.dart
46 lines (42 loc) · 1.23 KB
/
gradient_button.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import 'package:flutter/material.dart';
import 'package:flutter_app/utils/flutter_screenutil.dart';
///
/// <pre>
/// author : Wp
/// e-mail : [email protected]
/// time : 2019/8/5 6:00 PM
/// desc : 渐变按钮
/// version: 1.0
/// </pre>
///
class GradientButton extends StatelessWidget {
final _name;
double _width;
double _height;
GradientButton(this._name,this._width,this._height) : super();
@override
Widget build(BuildContext context) {
return DecoratedBox(
decoration: BoxDecoration(
gradient: LinearGradient(colors: [Colors.red, Colors.orange[700]]),
//背景渐变
borderRadius: BorderRadius.circular(3.0),
//3像素圆角
boxShadow: [
//阴影
BoxShadow(
color: Colors.black54,
offset: Offset(2.0, 2.0),
blurRadius: 4.0)
]),
child: Container(
width: ScreenUtil.getInstance().setWidth(_width),
height: ScreenUtil.getInstance().setWidth(_height),
alignment: Alignment.center,
child: Text(
_name,
style: TextStyle(color: Colors.white),
),
));
}
}