Flutter 3.7中Windows桌面端CupertinoPicker存在选项无法选中问题
Flutter 3.7 Windows桌面端CupertinoPicker部分选项无法选中问题
升级至Flutter 3.7版本后,在Windows桌面环境下使用CupertinoPicker组件时,会出现部分选项无法被选中的异常问题。
以下是可复现该问题的Dart代码:
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, ), home: const MyHomePage(title: 'Flutter Demo Home Page'), ); } } class MyHomePage extends StatefulWidget { const MyHomePage({super.key, required this.title}); final String title; @override State<MyHomePage> createState() => _MyHomePageState(); } class _MyHomePageState extends State<MyHomePage> { int _index = 0; List<String> team = <String>["Olaf","Victor","Rita"] ; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(widget.title), ), body: Center( child: CupertinoPicker( itemExtent: 50, onSelectedItemChanged: (selectedIndex) { _index = selectedIndex; }, children: List.generate(team.length, (index) { return Text(team[index]); }), ), ), ); } }
该问题已在Flutter官方GitHub仓库提交相关Issue。
内容的提问来源于stack exchange,提问作者deczaloth
相关产品推荐
相关产品推荐

