mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 15:24:35 +01:00
37 lines
1.0 KiB
Dart
37 lines
1.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
Widget buildPicker(List<Widget> items, Function(int idx) onSelected) {
|
|
return SizedBox(
|
|
height: 111,
|
|
child: Stack(
|
|
children: [
|
|
Positioned(
|
|
top: 36,
|
|
bottom: 36,
|
|
left: 0,
|
|
right: 0,
|
|
child: Container(
|
|
height: 37,
|
|
decoration: const BoxDecoration(
|
|
borderRadius: BorderRadius.all(Radius.circular(7)),
|
|
color: Colors.black12,
|
|
),
|
|
),
|
|
),
|
|
ListWheelScrollView.useDelegate(
|
|
itemExtent: 37,
|
|
diameterRatio: 1.2,
|
|
controller: FixedExtentScrollController(initialItem: 0),
|
|
onSelectedItemChanged: (idx) => onSelected(idx),
|
|
physics: const FixedExtentScrollPhysics(),
|
|
childDelegate: ListWheelChildBuilderDelegate(
|
|
builder: (context, index) => Center(
|
|
child: items[index],
|
|
),
|
|
childCount: items.length),
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|