[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CupertinoPicker example #118248

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
revert variable change
  • Loading branch information
TahaTesser committed Jan 10, 2023
commit 46aee576250624c9ce15938220e9aceb5c680fc5
8 changes: 4 additions & 4 deletions examples/api/lib/cupertino/picker/cupertino_picker.0.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class CupertinoPickerExample extends StatefulWidget {
}

class _CupertinoPickerExampleState extends State<CupertinoPickerExample> {
int selectedFruit = 0;
int _selectedFruit = 0;

// This shows a CupertinoModalPopup with a reasonable fixed height which hosts CupertinoPicker.
void _showDialog(Widget child) {
Expand Down Expand Up @@ -89,12 +89,12 @@ class _CupertinoPickerExampleState extends State<CupertinoPickerExample> {
itemExtent: _kItemExtent,
// This sets the initial item.
scrollController: FixedExtentScrollController(
initialItem: selectedFruit,
initialItem: _selectedFruit,
),
// This is called when selected item is changed.
onSelectedItemChanged: (int selectedItem) {
setState(() {
selectedFruit = selectedItem;
_selectedFruit = selectedItem;
});
},
children: List<Widget>.generate(_fruitNames.length, (int index) {
Expand All @@ -104,7 +104,7 @@ class _CupertinoPickerExampleState extends State<CupertinoPickerExample> {
),
// This displays the selected fruit name.
child: Text(
_fruitNames[selectedFruit],
_fruitNames[_selectedFruit],
style: const TextStyle(
fontSize: 22.0,
),
Expand Down