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

picker numbers misaligned when not using AppBar #43

Closed
dvorapa opened this issue Jul 7, 2019 · 6 comments · Fixed by #93
Closed

picker numbers misaligned when not using AppBar #43

dvorapa opened this issue Jul 7, 2019 · 6 comments · Fixed by #93

Comments

@dvorapa
Copy link

dvorapa commented Jul 7, 2019

There is one extra number shown when AppBar is missing, the center is shifted above and it is not clear, which of the two middle options is the chosen one.

@MarcinusX
Copy link
Owner

Can you provide code and screenshot? :)

@dvorapa
Copy link
Author

dvorapa commented Aug 6, 2019

I'm out of my PC for the whole August, but it should be easily reproducible:

  $ flutter create test
  $ nano test/lib/main.dart
  now remove appBar and add some sample NumberPicker into body
  see misaligned numbers

@MarcinusX
Copy link
Owner

Cannot reproduce. Will reopen if someone can reproduce/

@sisierra
Copy link

sisierra commented Dec 23, 2020

We are currently facing the same issue.
As soon as we are setting extendBodyBehindAppBar=true. The Numberpicker are misaligned and onChangedMethod delivers wrong values.
Below the example code, you see two screenshots, the first shows correct behavior and the second screenshot shows the behavior when extendBodyBehindAppBar=true and the described issue.

`import 'package:flutter/material.dart';
import 'package:numberpicker/numberpicker.dart';

class TestNumberPickerScreen extends StatefulWidget {
TestNumberPickerScreen({Key key, this.title}) : super(key: key);
final String title;

@OverRide
_TestNumberPickerScreenState createState() => _TestNumberPickerScreenState();
}

class _TestNumberPickerScreenState extends State {

int _selectedValue;

@OverRide
void initState() {
_selectedValue = 0;
super.initState();
}
@OverRide
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.lightGreen,
//extendBodyBehindAppBar: true,
appBar: new AppBar(
title: new Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('NumberPickerTest'),
]),
),
body: Container(
child: Center(
child: new Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height:50),
new NumberPicker.integer(
initialValue: 30,
minValue: 0,
step: 1,
maxValue: 50,
onChanged: (value) {
setState(() {
_selectedValue = value;
});
}
),
SizedBox(height:50),
Text('Selected Value:'+_selectedValue.toString())
]))));
}
}`
WhatsApp Image 2020-12-23 at 12 42 45(1)
WhatsApp Image 2020-12-23 at 12 42 45

@sisierra
Copy link

sisierra commented Jan 16, 2021

Can someone take a look on the latest actions on my response, or otherwise I would create a new issue

@MarcinusX
Copy link
Owner

Crap, you're right. Super weird...

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

Successfully merging a pull request may close this issue.

3 participants