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
| class _ListConditionState extends State<ListCondition> {
・・・・
int variableSet = 0;
ScrollController _scrollController;
double width;
double height;
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset : false,
appBar: TransAppBar(
title: Text(widget.category_title),
appBar: AppBar(),
widgets: <Widget>[
Padding(
padding: const EdgeInsets.only(right: 0.5),
child: IconButton(
icon: Icon(Icons.add),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => SelectIcon()),
);
},
),
)
],
),
body: DragAndDropGridView(
controller: _scrollController,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4,
childAspectRatio: 1 / 1,
),
padding: EdgeInsets.all(20),
itemBuilder: (context, index) => Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(100.0)),
elevation: 5,
color: widget.category_color,
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => EditCondition(
condition_key: '1',
condition_title: cateiconList[index].title,
condition_color: widget.category_color,
condition_icon: cateiconList[index].icon,
),
),
);
},
child: LayoutBuilder(
builder: (context, costrains) {
if (variableSet == 0) {
height = costrains.maxHeight;
width = costrains.maxWidth;
variableSet++;
}
return GridTile(
child: Padding(
padding: const EdgeInsets.all(10.0),
child: SizedBox(
height: height,
width: width,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Icon(
cateiconList[index].icon,
size: 30,
color: Colors.white70,
),
Text(
cateiconList[index].title,
style: TextStyle(
fontSize: 12,
color: Colors.white70,
),
), ],
),
),
),
);
},
),
),
),
itemCount: cateiconList.length,
onWillAccept: (oldIndex, newIndex) => true,
onReorder: (oldIndex, newIndex) {
final temp = cateiconList[oldIndex];
cateiconList[oldIndex] = cateiconList[newIndex];
cateiconList[newIndex] = temp;
setState(() {});
},
),
);
}
}
|