-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJcyDrawer.dart
80 lines (75 loc) · 2.12 KB
/
JcyDrawer.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import './tool/ColorTool.dart';
import './CreateLayer.dart';
class JcyDrawer {
static CreateLayer show (BuildContext context, {
@required Widget child,
String title = '默认标题'
}) {
CreateLayer ctr = new CreateLayer(true);
ctr.show(context: context, builder: (a, b) {
return Container(
decoration: BoxDecoration(
color: ColorTool.hex('#000', 0.5)
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Container(
decoration: BoxDecoration(
color: ColorTool.hex('#fff'),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Container(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: ColorTool.hex('#eee')
)
)
),
child: _Header(title, ctr.close),
),
child
],
),
)
],
),
);
});
return ctr;
}
}
class _Header extends StatelessWidget {
final Function onDelete;
final String title;
_Header(this.title, this.onDelete);
@override
Widget build (BuildContext context) {
return Container(
child: Padding(
padding: EdgeInsets.fromLTRB(20, 10, 20, 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(title, style: TextStyle(
fontSize: 16,
color: ColorTool.hex('#666'),
decoration: TextDecoration.none
)),
GestureDetector(
onTap: this.onDelete,
child: Icon(Icons.close),
),
// Icon(Icons.close)
],
),
),
);
}
}