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

NumberPickerDialog #106

Open
sabinabialic opened this issue Apr 20, 2021 · 3 comments
Open

NumberPickerDialog #106

sabinabialic opened this issue Apr 20, 2021 · 3 comments

Comments

@sabinabialic
Copy link

In the latest version the NumberPickerDialog is no longer implemented. I'm wondering how to implement this?

@cupid-gracer
Copy link

I have the same problem while use Number Picker Dialog.
please hip in

@rawquesh
Copy link

rawquesh commented Jul 16, 2021

Future<int> showMyNumberPicker() async { return showCupertinoDialog<int>( barrierDismissible: true, context: context, builder: (context) { final borderRadius = BorderRadius.circular(3); final style = ptSans(40); final borderRadius2 = BorderRadius.circular(10); final black26 = Colors.black26; int _currentValue = 1; return StatefulBuilder(builder: (context, setState) { return AlertDialog( content: NumberPicker( minValue: 1, maxValue: 10, value: _currentValue, onChanged: (value) { setState(() { _currentValue = value; }); }, selectedTextStyle: ptSans(68).copyWith(color: themeColor), textStyle: ptSans(50), ), actions: <Widget>[ InkWell( onTap: () => Navigator.of(context).pop(), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 13, vertical: 8), child: Text("Cancel", style: style), ), ), InkWell( onTap: () => Navigator.of(context).pop(_currentValue), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 13, vertical: 8), child: Text("Ok", style: style), ), ), ], ); }); }, ); }
try this its same as the old one
@sabinabialic @cupid-gracer

@potemkini
Copy link

You can create your custom dialog as below. You can update the selection by onChanged method under DecimalNumberPicker() but even so I've added an elavated button in order to close the custom dialog.

bool selectedWeight = 0.0

Future openModal() async {
await showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text('Select Weight', textAlign: TextAlign.center),
content: StatefulBuilder(builder: (context, setState) {
return Container(
height: 350,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
DecimalNumberPicker(
itemCount: 3,
minValue: 0,
maxValue: 100,
decimalPlaces: 1,
value: selectedWeight,
onChanged: (value) => setState(() {
selectedWeight = value
}),
),
ElevatedButton(
child: Text(
'Approve',
),
onPressed: () {
Navigator.of(context).pop();
},
),
],
),
);
}),
);
},
)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants