forked from toly1994328/FlutterUnit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete_category_dialog.dart
110 lines (100 loc) · 2.87 KB
/
delete_category_dialog.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import 'package:flutter/material.dart';
import 'package:flutter_unit/components/permanent/feedback_widget.dart';
/// create by 张风捷特烈 on 2020-04-21
/// contact me by email 1981462002@qq.com
/// 说明:
class DeleteCategoryDialog extends StatelessWidget {
final String title;
final String content;
final Function() onSubmit;
DeleteCategoryDialog({
this.title='', this.content ='',this.onSubmit
});
@override
Widget build(BuildContext context) {
return Container(
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
_buildBar(context),
_buildTitle(context),
_buildContent(),
_buildFooter(context),
],
),
);
}
Widget _buildTitle(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
title,
style: TextStyle(color: Colors.red, fontSize: 20),
),
],
);
}
Widget _buildContent() {
return Padding(
padding: const EdgeInsets.all(15.0),
child: Text(content,
style: TextStyle(color: Colors.grey, fontSize: 16),
textAlign: TextAlign.justify,
),
);
}
Widget _buildFooter(context) {
return Padding(
padding: const EdgeInsets.only(bottom: 15.0, top: 10,left: 10,right: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
FeedbackWidget(
onPressed: onSubmit,
child: Container(
alignment: Alignment.center,
height: 40,
width: 100,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(30)),
color: Theme.of(context).primaryColor),
child: Text('确 定',
style: TextStyle(color: Colors.white, fontSize: 16)),
),
),
FeedbackWidget(
onPressed: ()=>Navigator.of(context).pop(),
child: Container(
alignment: Alignment.center,
height: 40,
width: 100,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(30)),
color: Colors.orangeAccent),
child: Text('取 消',
style: TextStyle(color: Colors.white, fontSize: 16)),
),
)
],
),
);
}
_buildBar(context) => Row(
children: <Widget>[
Spacer(),
GestureDetector(
onTap: () => Navigator.of(context).pop(),
child: Container(
height: 30,
alignment: Alignment.centerRight,
padding: EdgeInsets.only(right: 10, top: 5),
child: Icon(
Icons.close,
color:Theme.of(context).primaryColor,
),
),
),
],
);
}