@@ -11,6 +11,7 @@ import 'package:widget_repository/widget_repository.dart';
11
11
12
12
import '../../../widgets/widgets_map.dart' ;
13
13
import '../category_end_drawer.dart' ;
14
+ import 'link_widget_buttons.dart' ;
14
15
import 'widget_detail_bar.dart' ;
15
16
import 'widget_detail_panel.dart' ;
16
17
import 'widget_node_panel.dart' ;
@@ -103,13 +104,15 @@ class _DeskWidgetDetailPageState extends State<DeskWidgetDetailPage> {
103
104
children: [
104
105
linkText,
105
106
if (state is DetailWithData )
106
- _buildLinkTo (context, state.links),
107
- // const Divider(),
107
+ LinkWidgetButtons (
108
+ links: state.links,
109
+ onSelect: _toLinkWidget,
110
+ )
108
111
],
109
112
))
110
113
],
111
114
),
112
- Divider ()
115
+ const Divider ()
113
116
],
114
117
),
115
118
),
@@ -134,44 +137,6 @@ class _DeskWidgetDetailPageState extends State<DeskWidgetDetailPage> {
134
137
}
135
138
}
136
139
137
- Color ? get chipColor => isDark
138
- ? Theme .of (context).floatingActionButtonTheme.backgroundColor
139
- : Theme .of (context).primaryColor;
140
-
141
- Widget _buildLinkTo (BuildContext context, List <WidgetModel > links) {
142
- if (links.isEmpty) {
143
- return Padding (
144
- padding: const EdgeInsets .only (left: 10 ),
145
- child: Chip (
146
- backgroundColor: Colors .grey.withAlpha (120 ),
147
- labelStyle: const TextStyle (fontSize: 12 , color: Colors .white),
148
- label: const Text ('暂无链接组件' ),
149
- ));
150
- } else {
151
- return Padding (
152
- padding: const EdgeInsets .only (left: 10.0 , top: 10 ),
153
- child: Wrap (
154
- spacing: 5 ,
155
- runSpacing: 5 ,
156
- children: links
157
- .map ((WidgetModel model) => ActionChip (
158
- labelPadding: EdgeInsets .zero,
159
- side: BorderSide .none,
160
- onPressed: () => _toLinkWidget (model),
161
- elevation: 1 ,
162
- // shadowColor: chipColor,
163
- backgroundColor: chipColor,
164
- labelStyle: model.deprecated
165
- ? UnitTextStyle .deprecatedChip
166
- : UnitTextStyle .commonChip,
167
- label: Text (model.name),
168
- ))
169
- .toList (),
170
- ),
171
- );
172
- }
173
- }
174
-
175
140
void _toLinkWidget (WidgetModel model) {
176
141
BlocProvider .of <WidgetDetailBloc >(context).add (FetchWidgetDetail (model));
177
142
_modelStack.add (model);
0 commit comments