cupertino_height_picker library
A library for displaying Cupertino-style height pickers.
This library provides widgets and utilities for selecting height values in either centimeters or inches. It includes a modal popup for height selection and an enumeration for height units.
Terminology:
- HeightUnit: An enumeration representing the units of height (centimeters or inches).
- HeightPicker: A widget that allows users to pick a height value.
Example usage:
import 'package:cupertino_height_picker/cupertino_height_picker.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return CupertinoApp(
home: CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar(
middle: Text('Height Picker Example'),
),
child: Center(
child: CupertinoButton(
child: Text('Select Height'),
onPressed: () {
showCupertinoHeightPicker(
context: context,
onHeightChanged: (double height) {
print('Selected height: $height');
},
initialHeight: 170.0,
initialSelectedHeightUnit: HeightUnit.centimeters,
);
},
),
),
),
);
}
}
Links:
Enums
- HeightUnit
- An enumeration representing units of height.
Functions
-
showCupertinoHeightPicker(
{Key? key, required BuildContext context, required dynamic onHeightChanged(double), double initialHeight = 150.0, HeightUnit initialSelectedHeightUnit = HeightUnit.inches, bool canConvertUnit = true, bool showSeparationText = true, double modalHeight = 216.0, double? maxModalWidth, Color? modalBackgroundColor, Color barrierColor = kCupertinoModalBarrierColor}) → Future< void> - Displays a Cupertino-style modal sheet that allows the user to pick a height.