flutter_picker icon indicating copy to clipboard operation
flutter_picker copied to clipboard

自定义添加selectionOverlay完全被挡住了

Open LiFuPeng opened this issue 1 year ago • 0 comments

selectionOverlay: Container( decoration: BoxDecoration(borderRadius: BorderRadiusDirectional.horizontal( start: Radius.circular(16), end: Radius.circular(16), ), ), margin: EdgeInsetsDirectional.only( start: 20, end: 20, ), height: 50, color: CupertinoDynamicColor.resolve(const Color.fromRGBO(245, 246, 248, 1), context),),

完整代码:

@override Widget build(BuildContext context) { return Picker( hideHeader: true, adapter: PickerDataAdapter( pickerData: ages.map((e) => '${e['label']}岁').toList(), isArray: false, ), height: widget.height, itemExtent: 50.w, textAlign: TextAlign.center, textStyle: TextStyle(color: const Color.fromRGBO(105, 115, 128, 1), fontSize: 15.sp, fontWeight: FontsUtils.R, fontFamily: FontsUtils.OPPOSansR, ),

  selectedTextStyle: TextStyle(color: const Color.fromRGBO(2, 17, 31, 1),
    fontSize: 15.sp, fontWeight: FontsUtils.R,
    fontFamily: FontsUtils.OPPOSansR,
  ),

  selectionOverlay: Container(
    decoration: BoxDecoration(borderRadius: BorderRadiusDirectional.horizontal(
      start: Radius.circular(16.w),
      end: Radius.circular(16.w),
    ),),

    margin: EdgeInsetsDirectional.only(
      start: 20.w,
      end: 20.w,
    ),
    height: 50.w,
    // color: const Color.fromRGBO(245, 246, 248, 1).withOpacity(0.5),
    color: CupertinoDynamicColor.resolve(const Color.fromRGBO(245, 246, 248, 1), context),
  ),
  // selectionOverlay: const CupertinoPickerDefaultSelectionOverlay(background: Color.fromRGBO(245, 246, 248, 1),),

  backgroundColor: Colors.transparent,
  selecteds: _defaultSelecteds,
  onSelect: (Picker picker, int index, List<int> selected) {
    print(selected);
    _selectAge(index);
  },
).makePicker();

}

LiFuPeng avatar May 09 '23 03:05 LiFuPeng