File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -257,10 +257,45 @@ class _TorrentDownloadDialogState extends State<TorrentDownloadDialog> {
257257 border: OutlineInputBorder (),
258258 isDense: true ,
259259 ),
260+ selectedItemBuilder: (context) {
261+ return _clients.map ((client) {
262+ final screenWidth = MediaQuery .of (context).size.width;
263+ // 响应式宽度:手机上限制最大宽度,大屏上允许更宽
264+ final maxWidth = screenWidth > 600
265+ ? screenWidth * 0.6 // 大屏上使用60%宽度
266+ : 240.0 ; // 小屏上限制200px
267+
268+ return SizedBox (
269+ width: maxWidth,
270+ child: Text (
271+ '${client .name } (${client .host }:${client .port })' ,
272+ overflow: TextOverflow .ellipsis,
273+ maxLines: 1 ,
274+ ),
275+ );
276+ }).toList ();
277+ },
260278 items: _clients.map ((client) {
261279 return DropdownMenuItem (
262280 value: client,
263- child: Text ('${client .name } (${client .host }:${client .port })' ),
281+ child: Builder (
282+ builder: (context) {
283+ final screenWidth = MediaQuery .of (context).size.width;
284+ // 响应式宽度:手机上限制最大宽度,大屏上允许更宽
285+ final maxWidth = screenWidth > 600
286+ ? screenWidth * 0.6 // 大屏上使用60%宽度
287+ : 240.0 ; // 小屏上限制200px
288+
289+ return SizedBox (
290+ width: maxWidth,
291+ child: Text (
292+ '${client .name } (${client .host }:${client .port })' ,
293+ overflow: TextOverflow .ellipsis,
294+ maxLines: 1 ,
295+ ),
296+ );
297+ },
298+ ),
264299 );
265300 }).toList (),
266301 onChanged: (client) {
You can’t perform that action at this time.
0 commit comments